diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2025-07-18 11:31:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-18 11:31:52 +0100 |
commit | c9d8b68676dbf51996a76475313088f750697343 (patch) | |
tree | b173298135c208fd7e1869ca6764b314085ed46f /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 4fbe88fc46989b5b4e3b8913a915c7a3cd188bdf (diff) | |
download | llvm-c9d8b68676dbf51996a76475313088f750697343.zip llvm-c9d8b68676dbf51996a76475313088f750697343.tar.gz llvm-c9d8b68676dbf51996a76475313088f750697343.tar.bz2 |
[DebugInfo] Suppress lots of users of DbgValueInst (#149476)
This is another prune of dead code -- we never generate debug intrinsics
nowadays, therefore there's no need for these codepaths to run.
---------
Co-authored-by: Nikita Popov <github@npopov.com>
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index ee3e56c..d481ad9 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1606,12 +1606,8 @@ static bool PhiHasDebugValue(DILocalVariable *DIVar, SmallVector<DbgValueInst *, 1> DbgValues; SmallVector<DbgVariableRecord *, 1> DbgVariableRecords; findDbgValues(DbgValues, APN, &DbgVariableRecords); - for (auto *DVI : DbgValues) { - assert(is_contained(DVI->getValues(), APN)); - if ((DVI->getVariable() == DIVar) && (DVI->getExpression() == DIExpr)) - return true; - } - for (auto *DVR : DbgVariableRecords) { + assert(DbgValues.empty()); + for (DbgVariableRecord *DVR : DbgVariableRecords) { assert(is_contained(DVR->location_ops(), APN)); if ((DVR->getVariable() == DIVar) && (DVR->getExpression() == DIExpr)) return true; @@ -1970,7 +1966,6 @@ bool llvm::replaceDbgDeclare(Value *Address, Value *NewAddress, static void updateOneDbgValueForAlloca(const DebugLoc &Loc, DILocalVariable *DIVar, DIExpression *DIExpr, Value *NewAddress, - DbgValueInst *DVI, DbgVariableRecord *DVR, DIBuilder &Builder, int Offset) { assert(DIVar && "Missing variable"); @@ -1986,14 +1981,8 @@ static void updateOneDbgValueForAlloca(const DebugLoc &Loc, if (Offset) DIExpr = DIExpression::prepend(DIExpr, 0, Offset); - if (DVI) { - DVI->setExpression(DIExpr); - DVI->replaceVariableLocationOp(0u, NewAddress); - } else { - assert(DVR); - DVR->setExpression(DIExpr); - DVR->replaceVariableLocationOp(0u, NewAddress); - } + DVR->setExpression(DIExpr); + DVR->replaceVariableLocationOp(0u, NewAddress); } void llvm::replaceDbgValueForAlloca(AllocaInst *AI, Value *NewAllocaAddress, @@ -2001,18 +1990,13 @@ void llvm::replaceDbgValueForAlloca(AllocaInst *AI, Value *NewAllocaAddress, SmallVector<DbgValueInst *, 1> DbgUsers; SmallVector<DbgVariableRecord *, 1> DPUsers; findDbgValues(DbgUsers, AI, &DPUsers); - - // Attempt to replace dbg.values that use this alloca. - for (auto *DVI : DbgUsers) - updateOneDbgValueForAlloca(DVI->getDebugLoc(), DVI->getVariable(), - DVI->getExpression(), NewAllocaAddress, DVI, - nullptr, Builder, Offset); + assert(DbgUsers.empty()); // Replace any DbgVariableRecords that use this alloca. for (DbgVariableRecord *DVR : DPUsers) updateOneDbgValueForAlloca(DVR->getDebugLoc(), DVR->getVariable(), - DVR->getExpression(), NewAllocaAddress, nullptr, - DVR, Builder, Offset); + DVR->getExpression(), NewAllocaAddress, DVR, + Builder, Offset); } /// Where possible to salvage debug information for \p I do so. |