diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-06-24 19:34:46 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-06-24 19:34:46 +0000 |
commit | 3b3e954ea2a48d0d466dec383f6bfa40a90dd0e1 (patch) | |
tree | 1aa8c2d5969c527ac4bafc5c71fe4dfd39fa9ae2 /llvm/lib/Transforms/Scalar/LoopRotation.cpp | |
parent | f15064871ad933370532f068eca70fb5134ba69f (diff) | |
download | llvm-3b3e954ea2a48d0d466dec383f6bfa40a90dd0e1.zip llvm-3b3e954ea2a48d0d466dec383f6bfa40a90dd0e1.tar.gz llvm-3b3e954ea2a48d0d466dec383f6bfa40a90dd0e1.tar.bz2 |
SimplifyInstruction does not imply DCE
We cannot remove an instruction with no uses just because
SimplifyInstruction succeeds. It may have side effects.
llvm-svn: 273711
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopRotation.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopRotation.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp index c6709d5..46db8f1 100644 --- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp +++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp @@ -312,13 +312,18 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { if (V && LI->replacementPreservesLCSSAForm(C, V)) { // If so, then delete the temporary instruction and stick the folded value // in the map. - delete C; ValueMap[Inst] = V; + if (!C->mayHaveSideEffects()) { + delete C; + C = nullptr; + } } else { + ValueMap[Inst] = C; + } + if (C) { // Otherwise, stick the new instruction into the new block! C->setName(Inst->getName()); C->insertBefore(LoopEntryBranch); - ValueMap[Inst] = C; } } |