summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorAlexandros Lamprineas <alexandros.lamprineas@arm.com>2018-07-23 09:42:35 +0000
committerAlexandros Lamprineas <alexandros.lamprineas@arm.com>2018-07-23 09:42:35 +0000
commit592cc78dd8b1bef45b9b0495b815cb260a5dcd0e (patch)
treee8e69fbbc380cd2a8a0103b2e8b16726d6ad117e /llvm/lib/Transforms
parent1d926fb9f4a967c7d1ef7312e147933987c8cd7b (diff)
downloadbcm5719-llvm-592cc78dd8b1bef45b9b0495b815cb260a5dcd0e.tar.gz
bcm5719-llvm-592cc78dd8b1bef45b9b0495b815cb260a5dcd0e.zip
[GVNHoist] safeToHoistLdSt allows illegal hoisting
Bug fix for PR36787. When reasoning if it's safe to hoist a load we want to make sure that the defining memory access dominates the new insertion point of the hoisted instruction. safeToHoistLdSt calls firstInBB(InsertionPoint,DefiningAccess) which returns false if InsertionPoint == DefiningAccess, and therefore it falsely thinks it's safe to hoist. Differential Revision: https://reviews.llvm.org/D49555 llvm-svn: 337674
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/GVNHoist.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp
index bec0a565124..6d2b25cf601 100644
--- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp
@@ -534,7 +534,7 @@ private:
if (NewBB == DBB && !MSSA->isLiveOnEntryDef(D))
if (auto *UD = dyn_cast<MemoryUseOrDef>(D))
- if (firstInBB(NewPt, UD->getMemoryInst()))
+ if (!firstInBB(UD->getMemoryInst(), NewPt))
// Cannot move the load or store to NewPt above its definition in D.
return false;
OpenPOWER on IntegriCloud