[llvm] Handle #dbg_values in SROA. (PR #94070)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 10:45:53 PDT 2024


================
@@ -4977,8 +4977,6 @@ const Value *getAddress(const DbgVariableIntrinsic *DVI) {
 }
 
 const Value *getAddress(const DbgVariableRecord *DVR) {
-  assert(DVR->getType() == DbgVariableRecord::LocationType::Declare ||
-         DVR->getType() == DbgVariableRecord::LocationType::Assign);
----------------
SLTozer wrote:

Hm, well I said that removing the assert was questionable, but the problem is really calling `DVR->getAddress()` for a dbg_value; at some point, we intend to refactor the classes s.t. `getAddress()` is not available for dbg_values. I think the future-proof code would look more like:
```
  if (DVR->isDbgValue())
    return DVR->getValue();
  return DVR->getAddress();
```
But since there's no error with just using `DVR->getAddress()` right now, I think this can be left for us to fix when we refactor this.

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


More information about the llvm-commits mailing list