aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2025-07-21 17:49:25 +0100
committerGitHub <noreply@github.com>2025-07-21 17:49:25 +0100
commitc9ceb9b75fd547c7d2e79837075370f4c8db8faa (patch)
tree8a82e4f1dce77a1b714633e7f7cd26b75127b743 /llvm/lib/Transforms/Utils/Local.cpp
parent0823f4ff086e5352f7543b68ce6e7823498cf44b (diff)
downloadllvm-c9ceb9b75fd547c7d2e79837075370f4c8db8faa.zip
llvm-c9ceb9b75fd547c7d2e79837075370f4c8db8faa.tar.gz
llvm-c9ceb9b75fd547c7d2e79837075370f4c8db8faa.tar.bz2
[DebugInfo] Remove intrinsic-flavours of findDbgUsers (#149816)
This is one of the final remaining debug-intrinsic specific codepaths out there, and pieces of cross-LLVM infrastructure to do with debug intrinsics.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp39
1 files changed, 10 insertions, 29 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 7f0c23b..1e3ef68 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -610,10 +610,8 @@ void llvm::RecursivelyDeleteTriviallyDeadInstructions(
}
bool llvm::replaceDbgUsesWithUndef(Instruction *I) {
- SmallVector<DbgVariableIntrinsic *, 1> DbgUsers;
SmallVector<DbgVariableRecord *, 1> DPUsers;
- findDbgUsers(DbgUsers, I, &DPUsers);
- assert(DbgUsers.empty());
+ findDbgUsers(I, DPUsers);
for (auto *DVR : DPUsers)
DVR->setKillLocation();
return !DPUsers.empty();
@@ -1603,10 +1601,8 @@ static bool PhiHasDebugValue(DILocalVariable *DIVar,
// Since we can't guarantee that the original dbg.declare intrinsic
// is removed by LowerDbgDeclare(), we need to make sure that we are
// not inserting the same dbg.value intrinsic over and over.
- SmallVector<DbgValueInst *, 1> DbgValues;
SmallVector<DbgVariableRecord *, 1> DbgVariableRecords;
- findDbgValues(DbgValues, APN, &DbgVariableRecords);
- assert(DbgValues.empty());
+ findDbgValues(APN, DbgVariableRecords);
for (DbgVariableRecord *DVR : DbgVariableRecords) {
assert(is_contained(DVR->location_ops(), APN));
if ((DVR->getVariable() == DIVar) && (DVR->getExpression() == DIExpr))
@@ -1987,10 +1983,8 @@ static void updateOneDbgValueForAlloca(const DebugLoc &Loc,
void llvm::replaceDbgValueForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
DIBuilder &Builder, int Offset) {
- SmallVector<DbgValueInst *, 1> DbgUsers;
SmallVector<DbgVariableRecord *, 1> DPUsers;
- findDbgValues(DbgUsers, AI, &DPUsers);
- assert(DbgUsers.empty());
+ findDbgValues(AI, DPUsers);
// Replace any DbgVariableRecords that use this alloca.
for (DbgVariableRecord *DVR : DPUsers)
@@ -2002,11 +1996,9 @@ void llvm::replaceDbgValueForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
/// Where possible to salvage debug information for \p I do so.
/// If not possible mark undef.
void llvm::salvageDebugInfo(Instruction &I) {
- SmallVector<DbgVariableIntrinsic *, 1> DbgUsers;
SmallVector<DbgVariableRecord *, 1> DPUsers;
- findDbgUsers(DbgUsers, &I, &DPUsers);
- assert(DbgUsers.empty());
- salvageDebugInfoForDbgValues(I, DbgUsers, DPUsers);
+ findDbgUsers(&I, DPUsers);
+ salvageDebugInfoForDbgValues(I, DPUsers);
}
template <typename T> static void salvageDbgAssignAddress(T *Assign) {
@@ -2044,9 +2036,8 @@ template <typename T> static void salvageDbgAssignAddress(T *Assign) {
}
}
-void llvm::salvageDebugInfoForDbgValues(
- Instruction &I, ArrayRef<DbgVariableIntrinsic *> DbgUsers,
- ArrayRef<DbgVariableRecord *> DPUsers) {
+void llvm::salvageDebugInfoForDbgValues(Instruction &I,
+ ArrayRef<DbgVariableRecord *> DPUsers) {
// These are arbitrary chosen limits on the maximum number of values and the
// maximum size of a debug expression we can salvage up to, used for
// performance reasons.
@@ -2054,9 +2045,6 @@ void llvm::salvageDebugInfoForDbgValues(
const unsigned MaxExpressionSize = 128;
bool Salvaged = false;
- // We should never see debug intrinsics nowadays.
- assert(DbgUsers.empty());
-
for (auto *DVR : DPUsers) {
if (DVR->isDbgAssign()) {
if (DVR->getAddress() == &I) {
@@ -2343,16 +2331,11 @@ static bool rewriteDebugUsers(
Instruction &From, Value &To, Instruction &DomPoint, DominatorTree &DT,
function_ref<DbgValReplacement(DbgVariableRecord &DVR)> RewriteDVRExpr) {
// Find debug users of From.
- SmallVector<DbgVariableIntrinsic *, 1> Users;
SmallVector<DbgVariableRecord *, 1> DPUsers;
- findDbgUsers(Users, &From, &DPUsers);
- if (Users.empty() && DPUsers.empty())
+ findDbgUsers(&From, DPUsers);
+ if (DPUsers.empty())
return false;
- // Ignore intrinsic-users: they are no longer supported and should never
- // appear.
- assert(Users.empty());
-
// Prevent use-before-def of To.
bool Changed = false;
@@ -3356,10 +3339,8 @@ void llvm::copyRangeMetadata(const DataLayout &DL, const LoadInst &OldLI,
}
void llvm::dropDebugUsers(Instruction &I) {
- SmallVector<DbgVariableIntrinsic *, 1> DbgUsers;
SmallVector<DbgVariableRecord *, 1> DPUsers;
- findDbgUsers(DbgUsers, &I, &DPUsers);
- assert(DbgUsers.empty());
+ findDbgUsers(&I, DPUsers);
for (auto *DVR : DPUsers)
DVR->eraseFromParent();
}