[llvm-commits] [llvm] r112611 - /llvm/trunk/test/Transforms/JumpThreading/basic.ll

Owen Anderson resistor at mac.com
Tue Aug 31 10:59:07 PDT 2010


Author: resistor
Date: Tue Aug 31 12:59:07 2010
New Revision: 112611

URL: http://llvm.org/viewvc/llvm-project?rev=112611&view=rev
Log:
Add a micro-test for the transforms I added to JumpThreading.

I have not been able to find a way to test each in isolation, for a few reasons:
1) The ability to look-through non-i1 BinaryOperator's requires the ability to look through non-constant
   ICmps in order for it to ever trigger.
2) The ability to do LVI-powered PHI value determination only matters in cases that ProcessBranchOnPHI
   can't handle.  Since it already handles all the cases without other instructions in the def-use chain
   between the PHI and the branch, it requires the ability to look through ICmps and/or BinaryOperators
   as well.

Modified:
    llvm/trunk/test/Transforms/JumpThreading/basic.ll

Modified: llvm/trunk/test/Transforms/JumpThreading/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/JumpThreading/basic.ll?rev=112611&r1=112610&r2=112611&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/JumpThreading/basic.ll (original)
+++ llvm/trunk/test/Transforms/JumpThreading/basic.ll Tue Aug 31 12:59:07 2010
@@ -421,4 +421,34 @@
 ; CHECK-NEXT:   br i1 %N, label %T2, label %F2
 }
 
+; CHECK: @test14
+define i32 @test14(i32 %in) {
+entry:
+	%A = icmp eq i32 %in, 0
+; CHECK: br i1 %A, label %right_ret, label %merge
+  br i1 %A, label %left, label %right
+
+; CHECK-NOT: left:
+left:
+	br label %merge
+
+; CHECK-NOT: right:
+right:
+  %B = call i32 @f1()
+	br label %merge
+
+merge:
+; CHECK-NOT: %C = phi i32 [%in, %left], [%B, %right]
+	%C = phi i32 [%in, %left], [%B, %right]
+	%D = add i32 %C, 1
+	%E = icmp eq i32 %D, 2
+	br i1 %E, label %left_ret, label %right_ret
+
+; CHECK: left_ret:
+left_ret:
+	ret i32 0
+
+right_ret:
+	ret i32 1
+}
 





More information about the llvm-commits mailing list