diff options
| author | Daniel Berlin <dberlin@dberlin.org> | 2017-08-30 19:53:23 +0000 |
|---|---|---|
| committer | Daniel Berlin <dberlin@dberlin.org> | 2017-08-30 19:53:23 +0000 |
| commit | 23fec57e6fd06127689a093d3106c052786360dd (patch) | |
| tree | 819ebd5a5e5157b6ec8f803dc416e8c3f6f417f2 /llvm/lib | |
| parent | 7ef26daba8bbf07934be6a49f0bf2c3338a48436 (diff) | |
| download | bcm5719-llvm-23fec57e6fd06127689a093d3106c052786360dd.tar.gz bcm5719-llvm-23fec57e6fd06127689a093d3106c052786360dd.zip | |
NewGVN: Make sure we add the correct user if we swapped the comparison operands
llvm-svn: 312162
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/NewGVN.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index ababf7f76e3..e9bd696d6df 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -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)); } } |

