diff options
| author | Max Kazantsev <max.kazantsev@azul.com> | 2018-06-28 08:20:03 +0000 |
|---|---|---|
| committer | Max Kazantsev <max.kazantsev@azul.com> | 2018-06-28 08:20:03 +0000 |
| commit | f5ba37182e8259c4de184177027203f303965c5a (patch) | |
| tree | 18ed79c653596db5244fa3807ccf905ce7ca0fb7 /llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | |
| parent | 717c9768d3070050f8c20d7a5b4879e613f126ec (diff) | |
| download | bcm5719-llvm-f5ba37182e8259c4de184177027203f303965c5a.tar.gz bcm5719-llvm-f5ba37182e8259c4de184177027203f303965c5a.zip | |
[IndVarSimplify] Ignore unreachable users of truncs
If a trunc has a user in a block which is not reachable from entry,
we can safely perform trunc elimination as if this user didn't exist.
llvm-svn: 335816
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyIndVar.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp index ed227918055..7b07c9a3c4a 100644 --- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -535,6 +535,10 @@ bool SimplifyIndvar::eliminateTrunc(TruncInst *TI) { // Bail if we find something different. SmallVector<ICmpInst *, 4> ICmpUsers; for (auto *U : TI->users()) { + // We don't care about users in unreachable blocks. + if (isa<Instruction>(U) && + !DT->isReachableFromEntry(cast<Instruction>(U)->getParent())) + continue; if (ICmpInst *ICI = dyn_cast<ICmpInst>(U)) { if (ICI->getOperand(0) == TI && L->isLoopInvariant(ICI->getOperand(1))) { assert(L->contains(ICI->getParent()) && "LCSSA form broken?"); |

