[llvm] Add code to handle llvm.dbg.values in SROA. (PR #94068)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 09:22:46 PDT 2024


================
@@ -259,6 +259,13 @@ CallInst *changeToCall(InvokeInst *II, DomTreeUpdater *DTU = nullptr);
 ///  Dbg Intrinsic utilities
 ///
 
+/// Moves an llvm.dbg.value intrinsic before a store to an alloca'd value
----------------
SLTozer wrote:

How would you read "a store to an alloca"? I would interpret that as meaning that for some `%a = alloca i32...`, then `store i32 0, ptr %a` would be a store to an alloca. Therefore if this comment is changed to say "before a store to an alloca", the expectation would be that this function moves an llvm.dbg.value to be immediately behind that store instruction.

Also, the comment for the `DbgVariableRecord` version should refer to a "dbg_value record" rather than an "llvm.dbg.value intrinsic".

```suggestion
/// Moves a dbg_value record before a store to an alloca
```

More pressingly, the function and comment say "move", but this function looks like it's creating and inserting a new debug value?

https://github.com/llvm/llvm-project/pull/94068


More information about the llvm-commits mailing list