forked from OSchip/llvm-project
[InstCombine] canonicalizeICmpPredicate(): use InstCombiner::replaceInstUsesWith() instead of RAUW
We really shouldn't use RAUW in InstCombine because we should consistently update Worklist to avoid extra iterations.
This commit is contained in:
parent
bd12113f57
commit
e65f213178
|
@ -5306,7 +5306,7 @@ static ICmpInst *canonicalizeCmpWithConstant(ICmpInst &I) {
|
|||
|
||||
/// If we have a comparison with a non-canonical predicate, if we can update
|
||||
/// all the users, invert the predicate and adjust all the users.
|
||||
static CmpInst *canonicalizeICmpPredicate(CmpInst &I) {
|
||||
CmpInst *InstCombinerImpl::canonicalizeICmpPredicate(CmpInst &I) {
|
||||
// Is the predicate already canonical?
|
||||
CmpInst::Predicate Pred = I.getPredicate();
|
||||
if (InstCombiner::isCanonicalPredicate(Pred))
|
||||
|
@ -5334,7 +5334,7 @@ static CmpInst *canonicalizeICmpPredicate(CmpInst &I) {
|
|||
cast<BranchInst>(U)->swapSuccessors(); // swaps prof metadata too
|
||||
break;
|
||||
case Instruction::Xor:
|
||||
U->replaceAllUsesWith(&I);
|
||||
replaceInstUsesWith(cast<Instruction>(*U), &I);
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("Got unexpected user - out of sync with "
|
||||
|
|
|
@ -120,6 +120,7 @@ public:
|
|||
Instruction *visitLShr(BinaryOperator &I);
|
||||
Instruction *commonShiftTransforms(BinaryOperator &I);
|
||||
Instruction *visitFCmpInst(FCmpInst &I);
|
||||
CmpInst *canonicalizeICmpPredicate(CmpInst &I);
|
||||
Instruction *visitICmpInst(ICmpInst &I);
|
||||
Instruction *FoldShiftByConstant(Value *Op0, Constant *Op1,
|
||||
BinaryOperator &I);
|
||||
|
|
Loading…
Reference in New Issue