diff options
author | Alina Sbirlea <asbirlea@google.com> | 2019-07-10 17:36:56 +0000 |
---|---|---|
committer | Alina Sbirlea <asbirlea@google.com> | 2019-07-10 17:36:56 +0000 |
commit | 58a37754bb107ee1bd2e7a94f1da39fcebe900d9 (patch) | |
tree | 69f7c671b3ca062c45d6ec1c70f7c1e6bb16c447 /llvm/lib/Transforms/Utils | |
parent | 843f198a83d8161dc580562cbe11643ed2b0e54f (diff) | |
download | bcm5719-llvm-58a37754bb107ee1bd2e7a94f1da39fcebe900d9.tar.gz bcm5719-llvm-58a37754bb107ee1bd2e7a94f1da39fcebe900d9.zip |
[LoopRotate + MemorySSA] Keep an <instruction-cloned instruction> map.
Summary:
The map kept in loop rotate is used for instruction remapping, in order
to simplify the clones of instructions. Thus, if an instruction can be
simplified, its simplified value is placed in the map, even when the
clone is added to the IR. MemorySSA in contrast needs to know about that
clone, so it can add an access for it.
To resolve this: keep a different map for MemorySSA.
Reviewers: george.burgess.iv
Subscribers: jlebar, Prazek, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63680
llvm-svn: 365672
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopRotationUtils.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp index 88c4937cfe1..37389a695b4 100644 --- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp @@ -295,7 +295,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { // Begin by walking OrigHeader and populating ValueMap with an entry for // each Instruction. BasicBlock::iterator I = OrigHeader->begin(), E = OrigHeader->end(); - ValueToValueMapTy ValueMap; + ValueToValueMapTy ValueMap, ValueMapMSSA; // For PHI nodes, the value available in OldPreHeader is just the // incoming value from OldPreHeader. @@ -374,6 +374,9 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { if (auto *II = dyn_cast<IntrinsicInst>(C)) if (II->getIntrinsicID() == Intrinsic::assume) AC->registerAssumption(II); + // MemorySSA cares whether the cloned instruction was inserted or not, and + // not whether it can be remapped to a simplified value. + ValueMapMSSA[Inst] = C; } } @@ -391,10 +394,11 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { LoopEntryBranch->eraseFromParent(); // Update MemorySSA before the rewrite call below changes the 1:1 - // instruction:cloned_instruction_or_value mapping in ValueMap. + // instruction:cloned_instruction_or_value mapping. if (MSSAU) { - ValueMap[OrigHeader] = OrigPreheader; - MSSAU->updateForClonedBlockIntoPred(OrigHeader, OrigPreheader, ValueMap); + ValueMapMSSA[OrigHeader] = OrigPreheader; + MSSAU->updateForClonedBlockIntoPred(OrigHeader, OrigPreheader, + ValueMapMSSA); } SmallVector<PHINode*, 2> InsertedPHIs; |