aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LCSSA.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/LCSSA.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LCSSA.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp
index 76f2685..af79dc4 100644
--- a/llvm/lib/Transforms/Utils/LCSSA.cpp
+++ b/llvm/lib/Transforms/Utils/LCSSA.cpp
@@ -107,13 +107,15 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
if (ExitBlocks.empty())
continue;
- for (Use &U : I->uses()) {
+ for (Use &U : make_early_inc_range(I->uses())) {
Instruction *User = cast<Instruction>(U.getUser());
BasicBlock *UserBB = User->getParent();
// Skip uses in unreachable blocks.
- if (!DT.isReachableFromEntry(UserBB))
+ if (!DT.isReachableFromEntry(UserBB)) {
+ U.set(PoisonValue::get(I->getType()));
continue;
+ }
// For practical purposes, we consider that the use in a PHI
// occurs in the respective predecessor block. For more info,