[llvm] [SROA] Fix debug locations for variables with non-zero offsets (PR #97750)
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 15 10:42:46 PDT 2024
================
@@ -4967,46 +4967,224 @@ AllocaInst *SROA::rewritePartition(AllocaInst &AI, AllocaSlices &AS,
return NewAI;
}
-static void insertNewDbgInst(DIBuilder &DIB, DbgDeclareInst *Orig,
- AllocaInst *NewAddr, DIExpression *NewFragmentExpr,
- Instruction *BeforeInst) {
- DIB.insertDeclare(NewAddr, Orig->getVariable(), NewFragmentExpr,
+// There isn't a shared interface to get the "address" parts out of a
+// dbg.declare and dbg.assign, so provide some wrappers now for
+// both debug intrinsics and records.
+const Value *getAddress(const DbgVariableIntrinsic *DVI) {
+ if (const auto *DAI = dyn_cast<DbgAssignIntrinsic>(DVI))
+ return DAI->getAddress();
+ return cast<DbgDeclareInst>(DVI)->getAddress();
+}
----------------
jmorse wrote:
I believe the style guide says you need a clear line between function definitions
https://github.com/llvm/llvm-project/pull/97750
More information about the llvm-commits
mailing list