[llvm] r299665 - [InstSimplify] Teach SimplifyMulInst to recognize vectors of i1 as And. Not just scalar i1.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 6 10:33:38 PDT 2017
Author: ctopper
Date: Thu Apr 6 12:33:37 2017
New Revision: 299665
URL: http://llvm.org/viewvc/llvm-project?rev=299665&view=rev
Log:
[InstSimplify] Teach SimplifyMulInst to recognize vectors of i1 as And. Not just scalar i1.
Added:
llvm/trunk/test/Transforms/InstSimplify/mul.ll
Modified:
llvm/trunk/lib/Analysis/InstructionSimplify.cpp
Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=299665&r1=299664&r2=299665&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Thu Apr 6 12:33:37 2017
@@ -930,7 +930,7 @@ static Value *SimplifyMulInst(Value *Op0
return X;
// i1 mul -> and.
- if (MaxRecurse && Op0->getType()->isIntegerTy(1))
+ if (MaxRecurse && Op0->getType()->getScalarType()->isIntegerTy(1))
if (Value *V = SimplifyAndInst(Op0, Op1, Q, MaxRecurse-1))
return V;
Added: llvm/trunk/test/Transforms/InstSimplify/mul.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/mul.ll?rev=299665&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/mul.ll (added)
+++ llvm/trunk/test/Transforms/InstSimplify/mul.ll Thu Apr 6 12:33:37 2017
@@ -0,0 +1,11 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -instsimplify -S | FileCheck %s
+
+define <2 x i1> @test1(<2 x i1> %a) {
+; CHECK-LABEL: @test1(
+; CHECK-NEXT: ret <2 x i1> zeroinitializer
+;
+ %b = and <2 x i1> %a, <i1 true, i1 false>
+ %res = mul <2 x i1> %b, <i1 false, i1 true>
+ ret <2 x i1> %res
+}
More information about the llvm-commits
mailing list