diff options
| -rw-r--r-- | simplify.c | 7 | ||||
| -rw-r--r-- | validation/optim/select-self-zero.c | 9 |
2 files changed, 11 insertions, 5 deletions
@@ -1776,11 +1776,8 @@ static int simplify_select(struct instruction *insn) return REPEAT_CSE; } } - if (cond == src2 && is_zero(src1)) { - kill_use(&insn->src1); - kill_use(&insn->src3); - return replace_with_value(insn, 0); - } + if (cond == src2 && is_zero(src1)) // SEL(x, 0, x) --> 0 + return replace_with_pseudo(insn, src1); switch (DEF_OPCODE(def, cond)) { case OP_SET_EQ: diff --git a/validation/optim/select-self-zero.c b/validation/optim/select-self-zero.c new file mode 100644 index 00000000..ea309894 --- /dev/null +++ b/validation/optim/select-self-zero.c @@ -0,0 +1,9 @@ +int sel_self0x(int x) { return (x ? 0 : x) == 0; } + +/* + * check-name: select-self-zero + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-returns: 1 + */ |
