summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LoopInfo.cpp
diff options
context:
space:
mode:
authorAlina Sbirlea <asbirlea@google.com>2019-11-20 16:09:37 -0800
committerAlina Sbirlea <asbirlea@google.com>2019-11-20 17:11:00 -0800
commit5c5cf899ef2fda1d3306b1e5c384ae062b80b672 (patch)
treeae648e474f1a0b2b50c22f3c94f8f37d11323db5 /llvm/lib/Analysis/LoopInfo.cpp
parent27da569a7a54e9dcb3b2c09fbdfd6b70bd6fd912 (diff)
downloadbcm5719-llvm-5c5cf899ef2fda1d3306b1e5c384ae062b80b672.tar.gz
bcm5719-llvm-5c5cf899ef2fda1d3306b1e5c384ae062b80b672.zip
[MemorySSA] Moving at the end often means before terminator.
Moving accesses in MemorySSA at InsertionPlace::End, when an instruction is moved into a block, almost always means insert at the end of the block, but before the block terminator. This matters when the block terminator is a MemoryAccess itself (an invoke), and the insertion must be done before the terminator for the update to be correct. Insert an additional position: InsertionPlace:BeforeTerminator and update current usages where this applies. Resolves PR44027.
Diffstat (limited to 'llvm/lib/Analysis/LoopInfo.cpp')
-rw-r--r--llvm/lib/Analysis/LoopInfo.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index 663b42c55f1..3e3303cbb02 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -106,7 +106,8 @@ bool Loop::makeLoopInvariant(Instruction *I, bool &Changed,
I->moveBefore(InsertPt);
if (MSSAU)
if (auto *MUD = MSSAU->getMemorySSA()->getMemoryAccess(I))
- MSSAU->moveToPlace(MUD, InsertPt->getParent(), MemorySSA::End);
+ MSSAU->moveToPlace(MUD, InsertPt->getParent(),
+ MemorySSA::BeforeTerminator);
// There is possibility of hoisting this instruction above some arbitrary
// condition. Any metadata defined on it can be control dependent on this
OpenPOWER on IntegriCloud