forked from OSchip/llvm-project
NewGVN: Make sure we add the correct user if we swapped the comparison operands
llvm-svn: 312162
This commit is contained in:
parent
7ef26daba8
commit
23fec57e6f
|
@ -1476,7 +1476,8 @@ NewGVN::performSymbolicPredicateInfoEvaluation(Instruction *I) const {
|
|||
if ((PBranch->TrueEdge && Predicate == CmpInst::ICMP_EQ) ||
|
||||
(!PBranch->TrueEdge && Predicate == CmpInst::ICMP_NE)) {
|
||||
addPredicateUsers(PI, I);
|
||||
addAdditionalUsers(Cmp->getOperand(0), I);
|
||||
addAdditionalUsers(SwappedOps ? Cmp->getOperand(1) : Cmp->getOperand(0),
|
||||
I);
|
||||
return createVariableOrConstant(FirstOp);
|
||||
}
|
||||
// Handle the special case of floating point.
|
||||
|
@ -1484,7 +1485,8 @@ NewGVN::performSymbolicPredicateInfoEvaluation(Instruction *I) const {
|
|||
(!PBranch->TrueEdge && Predicate == CmpInst::FCMP_UNE)) &&
|
||||
isa<ConstantFP>(FirstOp) && !cast<ConstantFP>(FirstOp)->isZero()) {
|
||||
addPredicateUsers(PI, I);
|
||||
addAdditionalUsers(Cmp->getOperand(0), I);
|
||||
addAdditionalUsers(SwappedOps ? Cmp->getOperand(1) : Cmp->getOperand(0),
|
||||
I);
|
||||
return createConstantExpression(cast<Constant>(FirstOp));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue