1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

[InstSimplify] Teach SimplifyMulInst to recognize vectors of i1 as And. Not just scalar i1.

llvm-svn: 299665
This commit is contained in:
Craig Topper 2017-04-06 17:33:37 +00:00
parent a3273168dc
commit 56898df231
2 changed files with 12 additions and 1 deletions

View File

@ -930,7 +930,7 @@ static Value *SimplifyMulInst(Value *Op0, Value *Op1, const Query &Q,
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;

View File

@ -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
}