summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/GVNHoist.cpp
diff options
context:
space:
mode:
authorAditya Kumar <hiraditya@msn.com>2017-12-13 19:40:07 +0000
committerAditya Kumar <hiraditya@msn.com>2017-12-13 19:40:07 +0000
commit49c03b11df5a6e0ddc065b706a0959361cf2e0de (patch)
tree4fc1c95dfc29f2abb80743c6790ec22d37b177e5 /llvm/lib/Transforms/Scalar/GVNHoist.cpp
parent46af7316ea1d584e3e17604a7720300b9569d257 (diff)
downloadbcm5719-llvm-49c03b11df5a6e0ddc065b706a0959361cf2e0de.tar.gz
bcm5719-llvm-49c03b11df5a6e0ddc065b706a0959361cf2e0de.zip
[GVNHoist] Fix: PR35222 gvn-hoist incorrectly erases load
w.r.t. the paper "A Practical Improvement to the Partial Redundancy Elimination in SSA Form" (https://sites.google.com/site/jongsoopark/home/ssapre.pdf) Proper dominance check was missing here, so having a loopinfo should not be required. Committing this diff as this fixes the bug, if there are further concerns, I'll be happy to work on them. Differential Revision: https://reviews.llvm.org/D39781 llvm-svn: 320607
Diffstat (limited to 'llvm/lib/Transforms/Scalar/GVNHoist.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/GVNHoist.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp
index 3b551844dc2..c0cd1ea74a7 100644
--- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp
@@ -795,8 +795,8 @@ private:
for (auto IDFB : IDFBlocks) { // TODO: Prune out useless CHI insertions.
for (unsigned i = 0; i < V.size(); ++i) {
CHIArg C = {VN, nullptr, nullptr};
- if (DT->dominates(IDFB, V[i]->getParent())) { // Ignore spurious PDFs.
- // InValue[V[i]->getParent()].push_back(std::make_pair(VN, V[i]));
+ // Ignore spurious PDFs.
+ if (DT->properlyDominates(IDFB, V[i]->getParent())) {
OutValue[IDFB].push_back(C);
DEBUG(dbgs() << "\nInsertion a CHI for BB: " << IDFB->getName()
<< ", for Insn: " << *V[i]);
OpenPOWER on IntegriCloud