diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2017-09-01 19:20:18 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@dberlin.org> | 2017-09-01 19:20:18 +0000 |
commit | 86932104db64d3a9d9790744707b786bd2dbfee0 (patch) | |
tree | e6c7c2e8010e2f0d5070ad003cd3d0d3c0259dcf /llvm/lib/Transforms | |
parent | 75557fa0247f121e9c4070ba78f5dc907504cc3f (diff) | |
download | bcm5719-llvm-86932104db64d3a9d9790744707b786bd2dbfee0.tar.gz bcm5719-llvm-86932104db64d3a9d9790744707b786bd2dbfee0.zip |
NewGVN: Make sure we don't incorrectly use PredicateInfo when doing PHI of ops
Summary: When we backtranslate expressions, we can't use the predicateinfo, since we are evaluating them in a different context.
Reviewers: davide, mcrosier
Subscribers: sanjoy, Prazek, llvm-commits
Differential Revision: https://reviews.llvm.org/D37174
llvm-svn: 312352
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/NewGVN.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index e9bd696d6df..b946350d264 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -1782,10 +1782,15 @@ const Expression *NewGVN::performSymbolicCmpEvaluation(Instruction *I) const { if (PI == LastPredInfo) continue; LastPredInfo = PI; - - // TODO: Along the false edge, we may know more things too, like icmp of + // In phi of ops cases, we may have predicate info that we are evaluating + // in a different context. + if (!DT->dominates(PBranch->To, getBlockForValue(I))) + continue; + // TODO: Along the false edge, we may know more things too, like + // icmp of // same operands is false. - // TODO: We only handle actual comparison conditions below, not and/or. + // TODO: We only handle actual comparison conditions below, not + // and/or. auto *BranchCond = dyn_cast<CmpInst>(PBranch->Condition); if (!BranchCond) continue; @@ -2533,11 +2538,13 @@ NewGVN::makePossiblePhiOfOps(Instruction *I, // and make sure anything that tries to add it's DFS number is // redirected to the instruction we are making a phi of ops // for. + TempToBlock.insert({ValueOp, PredBB}); InstrDFS.insert({ValueOp, IDFSNum}); const Expression *E = performSymbolicEvaluation(ValueOp, Visited); InstrDFS.erase(ValueOp); AllTempInstructions.erase(ValueOp); ValueOp->deleteValue(); + TempToBlock.erase(ValueOp); if (MemAccess) TempToMemory.erase(ValueOp); if (!E) |