1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

[InstCombine] allow icmp (shr exact X, C2), C fold for splat constant vectors

The enhancement to foldICmpDivConstant ( http://llvm.org/viewvc/llvm-project?view=revision&revision=280299 )
allows us to remove the ConstantInt check; no other changes needed.

llvm-svn: 280300
This commit is contained in:
Sanjay Patel 2016-08-31 22:18:43 +00:00
parent 002c7088e9
commit 2518f817be
2 changed files with 1 additions and 8 deletions

View File

@ -1876,11 +1876,6 @@ Instruction *InstCombiner::foldICmpShrConstant(ICmpInst &Cmp,
if (IsAShr && (!Shr->isExact() || ShAmtVal == TypeBits - 1))
return nullptr;
// FIXME: This check restricts this fold to scalar types.
ConstantInt *ShAmt = dyn_cast<ConstantInt>(Shr->getOperand(1));
if (!ShAmt)
return nullptr;
// Revisit the shift (to delete it).
Worklist.Add(Shr);

View File

@ -120,11 +120,9 @@ define i1 @ashr_icmp2(i64 %X) {
ret i1 %Z
}
; FIXME: Vectors should fold the same way.
define <2 x i1> @ashr_icmp2_vec(<2 x i64> %X) {
; CHECK-LABEL: @ashr_icmp2_vec(
; CHECK-NEXT: [[Y:%.*]] = ashr exact <2 x i64> %X, <i64 2, i64 2>
; CHECK-NEXT: [[Z:%.*]] = icmp slt <2 x i64> [[Y]], <i64 4, i64 4>
; CHECK-NEXT: [[Z:%.*]] = icmp slt <2 x i64> %X, <i64 16, i64 16>
; CHECK-NEXT: ret <2 x i1> [[Z]]
;
%Y = ashr exact <2 x i64> %X, <i64 2, i64 2>