[llvm] r278636 - [InstCombine] add test for potentially missing vector icmp fold

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 14 15:30:07 PDT 2016


Author: spatel
Date: Sun Aug 14 17:30:07 2016
New Revision: 278636

URL: http://llvm.org/viewvc/llvm-project?rev=278636&view=rev
Log:
[InstCombine] add test for potentially missing vector icmp fold

Modified:
    llvm/trunk/test/Transforms/InstCombine/cast.ll

Modified: llvm/trunk/test/Transforms/InstCombine/cast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast.ll?rev=278636&r1=278635&r2=278636&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast.ll Sun Aug 14 17:30:07 2016
@@ -350,12 +350,27 @@ define i1 @test31(i64 %A) {
 ; CHECK-NEXT:    [[D:%.*]] = icmp eq i64 [[C]], 10
 ; CHECK-NEXT:    ret i1 [[D]]
 ;
-  %B = trunc i64 %A to i32                ; <i32> [#uses=1]
-  %C = and i32 %B, 42             ; <i32> [#uses=1]
-  %D = icmp eq i32 %C, 10         ; <i1> [#uses=1]
+  %B = trunc i64 %A to i32
+  %C = and i32 %B, 42
+  %D = icmp eq i32 %C, 10
   ret i1 %D
 }
 
+; FIXME: Vectors should fold too...or not? 
+; Does this depend on the whether the source/dest types of the trunc are legal in the data layout?
+define <2 x i1> @test31vec(<2 x i64> %A) {
+; CHECK-LABEL: @test31vec(
+; CHECK-NEXT:    [[B:%.*]] = trunc <2 x i64> %A to <2 x i32>
+; CHECK-NEXT:    [[C:%.*]] = and <2 x i32> [[B]], <i32 42, i32 42>
+; CHECK-NEXT:    [[D:%.*]] = icmp eq <2 x i32> [[C]], <i32 10, i32 10>
+; CHECK-NEXT:    ret <2 x i1> [[D]]
+;
+  %B = trunc <2 x i64> %A to <2 x i32>
+  %C = and <2 x i32> %B, <i32 42, i32 42>
+  %D = icmp eq <2 x i32> %C, <i32 10, i32 10>
+  ret <2 x i1> %D
+}
+
 define i32 @test33(i32 %c1) {
 ; CHECK-LABEL: @test33(
 ; CHECK-NEXT:    ret i32 %c1




More information about the llvm-commits mailing list