diff options
author | Alina Sbirlea <asbirlea@google.com> | 2019-10-01 18:34:39 +0000 |
---|---|---|
committer | Alina Sbirlea <asbirlea@google.com> | 2019-10-01 18:34:39 +0000 |
commit | ae40dfc1e3ce5f64be3234ed7958792f15800181 (patch) | |
tree | c4bad81a6b3f16187bcc101b7886012eebf055ee /llvm/lib/Analysis/MemorySSAUpdater.cpp | |
parent | 2cee0e2d97c4f6fcb6cfcadf0e449f5ed714a72c (diff) | |
download | bcm5719-llvm-ae40dfc1e3ce5f64be3234ed7958792f15800181.tar.gz bcm5719-llvm-ae40dfc1e3ce5f64be3234ed7958792f15800181.zip |
[MemorySSA] Update last_access_in_block check.
The check for "was there an access in this block" should be: is the last
access in this block and is it not a newly inserted phi.
Resolves new test in PR43438.
Also fix a typo when simplifying trivial Phis to match the comment.
llvm-svn: 373380
Diffstat (limited to 'llvm/lib/Analysis/MemorySSAUpdater.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemorySSAUpdater.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/MemorySSAUpdater.cpp b/llvm/lib/Analysis/MemorySSAUpdater.cpp index b62cf08eb4c..315037bcc04 100644 --- a/llvm/lib/Analysis/MemorySSAUpdater.cpp +++ b/llvm/lib/Analysis/MemorySSAUpdater.cpp @@ -303,7 +303,12 @@ void MemorySSAUpdater::insertDef(MemoryDef *MD, bool RenameUses) { // See if we had a local def, and if not, go hunting. MemoryAccess *DefBefore = getPreviousDef(MD); - bool DefBeforeSameBlock = DefBefore->getBlock() == MD->getBlock(); + bool DefBeforeSameBlock = false; + if (DefBefore->getBlock() == MD->getBlock() && + !(isa<MemoryPhi>(DefBefore) && + std::find(InsertedPHIs.begin(), InsertedPHIs.end(), DefBefore) != + InsertedPHIs.end())) + DefBeforeSameBlock = true; // There is a def before us, which means we can replace any store/phi uses // of that thing with us, since we are in the way of whatever was there @@ -628,7 +633,7 @@ void MemorySSAUpdater::updatePhisWhenInsertingUniqueBackedgeBlock( // If NewMPhi is a trivial phi, remove it. Its use in the header MPhi will be // replaced with the unique value. - tryRemoveTrivialPhi(MPhi); + tryRemoveTrivialPhi(NewMPhi); } void MemorySSAUpdater::updateForClonedLoop(const LoopBlocksRPO &LoopBlocks, |