aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Transforms/SimplifyCFG/PhiNoEliminate.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyCFG/PhiNoEliminate.ll b/test/Transforms/SimplifyCFG/PhiNoEliminate.ll
new file mode 100644
index 0000000000..6e7c9f5e78
--- /dev/null
+++ b/test/Transforms/SimplifyCFG/PhiNoEliminate.ll
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep select
+
+;; The PHI node in this example should not be turned into a select, as we are
+;; not able to ifcvt the entire block. As such, converting to a select just
+;; introduces inefficiency without saving copies.
+
+int %bar(bool %C) {
+entry:
+ br bool %C, label %then, label %endif
+
+then:
+ %tmp.3 = call int %qux()
+ br label %endif
+
+endif:
+ %R = phi int [123, %entry], [12312, %then]
+ ;; stuff to disable tail duplication
+ call int %qux()
+ call int %qux()
+ call int %qux()
+ call int %qux()
+ call int %qux()
+ call int %qux()
+ call int %qux()
+ ret int %R
+}
+
+declare int %qux()
+