mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-19 09:57:42 +00:00
I found a better place for this optz'n.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54877 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1b344bc986
commit
cbe23e33ba
@ -5241,20 +5241,6 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
|
||||
return new ICmpInst(I.getPredicate(), A, B);
|
||||
}
|
||||
|
||||
ConstantInt *CI2;
|
||||
// (icmp u/s (xor A SignBit), C) -> (icmp s/u A, (xor C SignBit))
|
||||
if (!I.isEquality() &&
|
||||
match(Op0, m_Xor(m_Value(A), m_ConstantInt(CI2)))) {
|
||||
if (CI2->getValue().isSignBit()) {
|
||||
const APInt &SignBit = CI2->getValue();
|
||||
ICmpInst::Predicate Pred = I.isSignedPredicate()
|
||||
? I.getUnsignedPredicate()
|
||||
: I.getSignedPredicate();
|
||||
return new ICmpInst(Pred, A,
|
||||
ConstantInt::get(CI->getValue() ^ SignBit));
|
||||
}
|
||||
}
|
||||
|
||||
// If we have a icmp le or icmp ge instruction, turn it into the appropriate
|
||||
// icmp lt or icmp gt instruction. This allows us to rely on them being
|
||||
// folded in the code below.
|
||||
@ -5822,6 +5808,16 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI,
|
||||
else
|
||||
return new ICmpInst(ICmpInst::ICMP_SLT, CompareVal, AddOne(RHS));
|
||||
}
|
||||
|
||||
// (icmp u/s (xor A SignBit), C) -> (icmp s/u A, (xor C SignBit))
|
||||
if (!ICI.isEquality() && XorCST->getValue().isSignBit()) {
|
||||
const APInt &SignBit = XorCST->getValue();
|
||||
ICmpInst::Predicate Pred = ICI.isSignedPredicate()
|
||||
? ICI.getUnsignedPredicate()
|
||||
: ICI.getSignedPredicate();
|
||||
return new ICmpInst(Pred, LHSI->getOperand(0),
|
||||
ConstantInt::get(RHSV ^ SignBit));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Instruction::And: // (icmp pred (and X, AndCST), RHS)
|
||||
|
Loading…
Reference in New Issue
Block a user