[llvm-commits] [llvm] r85636 - /llvm/trunk/test/Transforms/SimplifyCFG/duplicate-phis.ll
Dan Gohman
gohman at apple.com
Fri Oct 30 16:16:10 PDT 2009
Author: djg
Date: Fri Oct 30 18:16:10 2009
New Revision: 85636
URL: http://llvm.org/viewvc/llvm-project?rev=85636&view=rev
Log:
Add a testcase for the recent duplicate PHI elimination changes.
Added:
llvm/trunk/test/Transforms/SimplifyCFG/duplicate-phis.ll
Added: llvm/trunk/test/Transforms/SimplifyCFG/duplicate-phis.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/duplicate-phis.ll?rev=85636&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/duplicate-phis.ll (added)
+++ llvm/trunk/test/Transforms/SimplifyCFG/duplicate-phis.ll Fri Oct 30 18:16:10 2009
@@ -0,0 +1,21 @@
+; RUN: opt < %s -instcombine -simplifycfg -S | grep { = phi } | count 1
+
+; instcombine should sort the PHI operands so that simplifycfg can see the
+; duplicate and remove it.
+
+define i32 @foo(i1 %t) {
+entry:
+ call void @bar()
+ br i1 %t, label %true, label %false,
+true:
+ call void @bar()
+ br label %false
+false:
+ %a = phi i32 [ 2, %true ], [ 5, %entry ]
+ %b = phi i32 [ 5, %entry ], [ 2, %true ]
+ call void @bar()
+ %c = add i32 %a, %b
+ ret i32 %c
+}
+
+declare void @bar()
More information about the llvm-commits
mailing list