aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorTozer <stephen.tozer@sony.com>2019-12-04 18:47:08 +0000
committerTozer <stephen.tozer@sony.com>2019-12-04 18:47:08 +0000
commit8b0780f795eb58fca0a2456e308adaaa1a0b5013 (patch)
tree251e77b6be8ffd4ab0ed36bb512d0310b4a18afb /llvm/lib/Transforms/Utils/Local.cpp
parent02760b750b2ffcc0e2f5d78ecb137c80930c42c3 (diff)
downloadllvm-8b0780f795eb58fca0a2456e308adaaa1a0b5013.zip
llvm-8b0780f795eb58fca0a2456e308adaaa1a0b5013.tar.gz
llvm-8b0780f795eb58fca0a2456e308adaaa1a0b5013.tar.bz2
Revert "[DebugInfo] Recover debug intrinsics when killing duplicated/empty basic blocks"
This reverts commit 72ce759928e6dfee6a9efa310b966c19722352ba. Reverted due to build failure.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp27
1 files changed, 5 insertions, 22 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 94edf8c..eaccaa1 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -485,19 +485,15 @@ void llvm::RecursivelyDeleteTriviallyDeadInstructions(
I.eraseFromParent();
}
}
-void llvm::setDbgVariableUndef(DbgVariableIntrinsic *DVI) {
- Value *DbgValue = DVI->getVariableLocation(false);
- Value *Undef = UndefValue::get(DbgValue ? DbgValue->getType()
- : Type::getInt1Ty(DVI->getContext()));
- DVI->setOperand(
- 0, MetadataAsValue::get(DVI->getContext(), ValueAsMetadata::get(Undef)));
-}
bool llvm::replaceDbgUsesWithUndef(Instruction *I) {
SmallVector<DbgVariableIntrinsic *, 1> DbgUsers;
findDbgUsers(DbgUsers, I);
- for (auto *DII : DbgUsers)
- setDbgVariableUndef(DII);
+ for (auto *DII : DbgUsers) {
+ Value *Undef = UndefValue::get(I->getType());
+ DII->setOperand(0, MetadataAsValue::get(DII->getContext(),
+ ValueAsMetadata::get(Undef)));
+ }
return !DbgUsers.empty();
}
@@ -1044,19 +1040,6 @@ bool llvm::TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB,
assert(PN->use_empty() && "There shouldn't be any uses here!");
PN->eraseFromParent();
}
- // If Succ has multiple predecessors, each debug intrinsic in BB may or may
- // not be valid when we reach Succ, so the debug variable should be set
- // undef since its value is unknown.
- Instruction *DbgInsertPoint = Succ->getFirstNonPHI();
- while (DbgInfoIntrinsic *DI = dyn_cast<DbgInfoIntrinsic>(&BB->front())) {
- if (auto DVI = cast<DbgVariableIntrinsic>(DI)) {
- if (!isa<DbgDeclareInst>(DVI))
- setDbgVariableUndef(DVI);
- DVI->moveBefore(DbgInsertPoint);
- } else {
- break;
- }
- }
}
// If the unconditional branch we replaced contains llvm.loop metadata, we