[PATCH] D37174: NewGVN: Make sure we don't incorrectly use PredicateInfo when doing PHI of ops
Daniel Berlin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 25 20:22:47 PDT 2017
dberlin created this revision.
Herald added subscribers: Prazek, sanjoy.
When we backtranslate expressions, we can't use the predicateinfo, since we are evaluating them in a different context.
https://reviews.llvm.org/D37174
Files:
lib/Transforms/Scalar/NewGVN.cpp
Index: lib/Transforms/Scalar/NewGVN.cpp
===================================================================
--- lib/Transforms/Scalar/NewGVN.cpp
+++ lib/Transforms/Scalar/NewGVN.cpp
@@ -1777,10 +1777,15 @@
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;
@@ -2528,11 +2533,13 @@
// 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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37174.112778.patch
Type: text/x-patch
Size: 1541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170826/8d49fcfe/attachment.bin>
More information about the llvm-commits
mailing list