diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-10-07 17:38:31 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-10-07 17:38:31 +0000 |
commit | 0015e5a088b851dfd2405f05eb4c512f8089fc20 (patch) | |
tree | 7bff8bc54fa5687139a4ffd0795d67bc757dc349 /llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | |
parent | 4493b4000237688fb32225450ee4d400fba2d643 (diff) | |
download | llvm-0015e5a088b851dfd2405f05eb4c512f8089fc20.zip llvm-0015e5a088b851dfd2405f05eb4c512f8089fc20.tar.gz llvm-0015e5a088b851dfd2405f05eb4c512f8089fc20.tar.bz2 |
[IndVars] Preserve LCSSA in `eliminateIdentitySCEV`
Summary:
After r249211, SCEV can see through some LCSSA phis. Add a
`replacementPreservesLCSSAForm` check before replacing uses of these phi
nodes with a simplified use of the induction variable to avoid breaking
LCSSA.
Fixes 25047.
Depends on D13460.
Reviewers: atrick, hfinkel
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13461
llvm-svn: 249575
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyIndVar.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp index c7ec1bc..58715fa 100644 --- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -333,6 +333,9 @@ bool SimplifyIndvar::eliminateIdentitySCEV(Instruction *UseInst, if (!DT || !DT->dominates(IVOperand, UseInst)) return false; + if (!LI->replacementPreservesLCSSAForm(UseInst, IVOperand)) + return false; + DEBUG(dbgs() << "INDVARS: Eliminated identity: " << *UseInst << '\n'); UseInst->replaceAllUsesWith(IVOperand); |