Fix PR3874 by restoring a condition I removed, but making it more
precise than it used to be. llvm-svn: 67662
This commit is contained in:
parent
a6e85a19c6
commit
c3b2111d97
|
@ -6582,7 +6582,8 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI,
|
|||
// preferable because it allows the C<<Y expression to be hoisted out
|
||||
// of a loop if Y is invariant and X is not.
|
||||
if (Shift && Shift->hasOneUse() && RHSV == 0 &&
|
||||
ICI.isEquality() && !Shift->isArithmeticShift()) {
|
||||
ICI.isEquality() && !Shift->isArithmeticShift() &&
|
||||
!isa<Constant>(Shift->getOperand(0))) {
|
||||
// Compute C << Y.
|
||||
Value *NS;
|
||||
if (Shift->getOpcode() == Instruction::LShr) {
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
; PR3874
|
||||
; RUN: llvm-as < %s | opt -instcombine | llvm-dis
|
||||
define i1 @test(i32 %x) {
|
||||
%A = lshr i32 3968, %x
|
||||
%B = and i32 %A, 1
|
||||
%C = icmp eq i32 %B, 0
|
||||
ret i1 %C
|
||||
}
|
||||
|
Loading…
Reference in New Issue