aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--cse.c7
-rw-r--r--validation/kill-cse.c21
2 files changed, 22 insertions, 6 deletions
diff --git a/cse.c b/cse.c
index 165b862a..048a3eb7 100644
--- a/cse.c
+++ b/cse.c
@@ -251,12 +251,7 @@ static struct instruction * cse_one_instruction(struct instruction *insn, struct
{
convert_instruction_target(insn, def->target);
- if (insn->opcode == OP_PHI) {
- kill_instruction(insn);
- }
-
- insn->opcode = OP_NOP;
- insn->bb = NULL;
+ kill_instruction(insn);
repeat_phase |= REPEAT_CSE;
return def;
}
diff --git a/validation/kill-cse.c b/validation/kill-cse.c
new file mode 100644
index 00000000..2e2b1024
--- /dev/null
+++ b/validation/kill-cse.c
@@ -0,0 +1,21 @@
+int foo(int a)
+{
+ return ((a == 0) + 1) != ((a == 0) + 1);
+}
+
+/*
+ * check-name: kill-cse
+ * check-description:
+ * Verify that instructions removed at CSE are
+ * properly adjust the usage of their operands.
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-start
+foo:
+.L0:
+ <entry-point>
+ ret.32 $0
+
+
+ * check-output-end
+ */