diff options
| author | Max Kazantsev <max.kazantsev@azul.com> | 2018-11-09 05:39:04 +0000 |
|---|---|---|
| committer | Max Kazantsev <max.kazantsev@azul.com> | 2018-11-09 05:39:04 +0000 |
| commit | 9883d1e1a72bb22e9a3a58f707726455c62ce5b4 (patch) | |
| tree | cf29bdef0394b215493580245571dc39907fd4b5 /llvm/lib/Transforms/Scalar | |
| parent | 71c35e13c3dc4cb267b4a5d1c736342cfc0402bf (diff) | |
| download | bcm5719-llvm-9883d1e1a72bb22e9a3a58f707726455c62ce5b4.tar.gz bcm5719-llvm-9883d1e1a72bb22e9a3a58f707726455c62ce5b4.zip | |
[NFC] Add utility function for SafetyInfo updates for moveBefore
llvm-svn: 346472
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 7789cb92345..e7402ea579b 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -126,6 +126,9 @@ CloneInstructionInExitBlock(Instruction &I, BasicBlock &ExitBlock, PHINode &PN, static void eraseInstruction(Instruction &I, ICFLoopSafetyInfo &SafetyInfo, AliasSetTracker *AST); +static void moveInstructionBefore(Instruction &I, Instruction &Dest, + ICFLoopSafetyInfo &SafetyInfo); + namespace { struct LoopInvariantCodeMotion { using ASTrackerMapTy = DenseMap<Loop *, std::unique_ptr<AliasSetTracker>>; @@ -890,6 +893,13 @@ static void eraseInstruction(Instruction &I, ICFLoopSafetyInfo &SafetyInfo, I.eraseFromParent(); } +static void moveInstructionBefore(Instruction &I, Instruction &Dest, + ICFLoopSafetyInfo &SafetyInfo) { + SafetyInfo.removeInstruction(&I); + SafetyInfo.insertInstructionTo(Dest.getParent()); + I.moveBefore(&Dest); +} + static Instruction *sinkThroughTriviallyReplaceablePHI( PHINode *TPN, Instruction *I, LoopInfo *LI, SmallDenseMap<BasicBlock *, Instruction *, 32> &SunkCopies, @@ -1118,10 +1128,8 @@ static void hoist(Instruction &I, const DominatorTree *DT, const Loop *CurLoop, !SafetyInfo->isGuaranteedToExecute(I, DT, CurLoop)) I.dropUnknownNonDebugMetadata(); - SafetyInfo->removeInstruction(&I); - SafetyInfo->insertInstructionTo(Preheader); // Move the new node to the Preheader, before its terminator. - I.moveBefore(Preheader->getTerminator()); + moveInstructionBefore(I, *Preheader->getTerminator(), *SafetyInfo); // Do not retain debug locations when we are moving instructions to different // basic blocks, because we want to avoid jumpy line tables. Calls, however, |

