aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--memops.c5
-rw-r--r--validation/mem2reg/dead-phisrc.c17
2 files changed, 22 insertions, 0 deletions
diff --git a/memops.c b/memops.c
index 30316391..df2e4d6c 100644
--- a/memops.c
+++ b/memops.c
@@ -134,6 +134,11 @@ static void simplify_loads(struct basic_block *bb)
goto next_load;
}
rewrite_load_instruction(insn, dominators);
+ } else { // cleanup pending phi-sources
+ pseudo_t phi;
+ FOR_EACH_PTR(dominators, phi) {
+ kill_instruction(phi->def);
+ } END_FOR_EACH_PTR(phi);
}
}
next_load:
diff --git a/validation/mem2reg/dead-phisrc.c b/validation/mem2reg/dead-phisrc.c
new file mode 100644
index 00000000..4e4f6a8b
--- /dev/null
+++ b/validation/mem2reg/dead-phisrc.c
@@ -0,0 +1,17 @@
+static void foo(void)
+{
+ extern int *a;
+
+ if (a || *a)
+ ;
+ if (a[0] || a[1])
+ ;
+}
+
+/*
+ * check-name: dead-phisrc
+ * check-command: test-linearize $file
+ *
+ * check-output-ignore
+ * check-output-excludes: phisrc
+ */