diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-16 20:23:50 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-17 08:51:48 +0200 |
| commit | 248c2a6a726af7c2c6089c48e3a1da47611a9cb6 (patch) | |
| tree | 1f8d968d9636aecf953a990fd15b434ca2764207 | |
| parent | 82c3ee9ea9063bedbb7a35e09610bfbf45af8f86 (diff) | |
| download | sparse-dev-248c2a6a726af7c2c6089c48e3a1da47611a9cb6.tar.gz | |
simplify TRUNC(TRUNC(x))
The simplification of ZEXT(ZEXT(x)) was already added but
its dual, TRUNC(TRUNC(x)), was not.
Add it now.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | simplify.c | 3 | ||||
| -rw-r--r-- | validation/optim/trunc-trunc.c | 1 |
2 files changed, 3 insertions, 1 deletions
@@ -1293,6 +1293,9 @@ static int simplify_cast(struct instruction *insn) break; case OP_TRUNC: switch (insn->opcode) { + case OP_TRUNC: + insn->orig_type = def->orig_type; + return replace_pseudo(insn, &insn->src1, def->src); case OP_ZEXT: if (size != def->orig_type->bit_size) break; diff --git a/validation/optim/trunc-trunc.c b/validation/optim/trunc-trunc.c index c01d81f6..6dc50aee 100644 --- a/validation/optim/trunc-trunc.c +++ b/validation/optim/trunc-trunc.c @@ -6,7 +6,6 @@ char foo(int a) /* * check-name: trunc-trunc * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-pattern(1): trunc\\. |
