diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2016-06-05 17:49:45 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2016-06-05 17:49:45 +0000 |
| commit | a6fbc82392160c7fc1a50851165cbcc27677d07f (patch) | |
| tree | 5fc8e84749ff4823714d45f517938993e4b000d5 /llvm | |
| parent | 54d7010627ca4b3a6f9ec1bb5311269388bf0442 (diff) | |
| download | bcm5719-llvm-a6fbc82392160c7fc1a50851165cbcc27677d07f.tar.gz bcm5719-llvm-a6fbc82392160c7fc1a50851165cbcc27677d07f.zip | |
[InstCombine] allow vector icmp bool transforms
llvm-svn: 271843
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/InstCombine/cast.ll | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/InstCombine/set.ll | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 3dc44d14342..cb9c7e5b893 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -3188,7 +3188,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { Type *Ty = Op0->getType(); // icmp's with boolean values can always be turned into bitwise operations - if (Ty->isIntegerTy(1)) { + if (Ty->getScalarType()->isIntegerTy(1)) { switch (I.getPredicate()) { default: llvm_unreachable("Invalid icmp instruction!"); case ICmpInst::ICMP_EQ: { // icmp eq i1 A, B -> ~(A^B) diff --git a/llvm/test/Transforms/InstCombine/cast.ll b/llvm/test/Transforms/InstCombine/cast.ll index e062896e43e..3bc79cef735 100644 --- a/llvm/test/Transforms/InstCombine/cast.ll +++ b/llvm/test/Transforms/InstCombine/cast.ll @@ -226,7 +226,7 @@ define <2 x i1> @test19vec(<2 x i32> %X) { define <3 x i1> @test19vec2(<3 x i1> %X) { ; CHECK-LABEL: @test19vec2( -; CHECK-NEXT: [[CMPEQ:%.*]] = icmp eq <3 x i1> %X, zeroinitializer +; CHECK-NEXT: [[CMPEQ:%.*]] = xor <3 x i1> %X, <i1 true, i1 true, i1 true> ; CHECK-NEXT: ret <3 x i1> [[CMPEQ]] ; %sext = sext <3 x i1> %X to <3 x i32> diff --git a/llvm/test/Transforms/InstCombine/set.ll b/llvm/test/Transforms/InstCombine/set.ll index 23d1a63e497..26614df1607 100644 --- a/llvm/test/Transforms/InstCombine/set.ll +++ b/llvm/test/Transforms/InstCombine/set.ll @@ -118,10 +118,10 @@ define i1 @test13(i1 %A, i1 %B) { ret i1 %C } -; FIXME: Vectors should fold the same as scalars. define <2 x i1> @test13vec(<2 x i1> %A, <2 x i1> %B) { ; CHECK-LABEL: @test13vec( -; CHECK-NEXT: [[C:%.*]] = icmp uge <2 x i1> %A, %B +; CHECK-NEXT: [[CTMP:%.*]] = xor <2 x i1> %B, <i1 true, i1 true> +; CHECK-NEXT: [[C:%.*]] = or <2 x i1> [[CTMP]], %A ; CHECK-NEXT: ret <2 x i1> [[C]] ; %C = icmp uge <2 x i1> %A, %B @@ -138,10 +138,10 @@ define i1 @test14(i1 %A, i1 %B) { ret i1 %C } -; FIXME: Vectors should fold the same as scalars. define <3 x i1> @test14vec(<3 x i1> %A, <3 x i1> %B) { ; CHECK-LABEL: @test14vec( -; CHECK-NEXT: [[C:%.*]] = icmp eq <3 x i1> %A, %B +; CHECK-NEXT: [[CTMP:%.*]] = xor <3 x i1> %A, %B +; CHECK-NEXT: [[C:%.*]] = xor <3 x i1> [[CTMP]], <i1 true, i1 true, i1 true> ; CHECK-NEXT: ret <3 x i1> [[C]] ; %C = icmp eq <3 x i1> %A, %B |

