[llvm] suppresses unused variable warning (PR #99526)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 21 11:00:23 PDT 2024
================
@@ -3361,7 +3361,7 @@ void InstrRefBasedLDV::buildVLocValueMap(
continue;
if (BlockLiveIn->Kind == DbgValue::VPHI)
BlockLiveIn->Kind = DbgValue::Def;
- auto &[Var, DILoc] = DVMap.lookupDVID(VarID);
+ [[maybe_unused]] auto &[Var, DILoc] = DVMap.lookupDVID(VarID);
----------------
dwblaikie wrote:
FWIW/next time, I'd consider rolling this into the assert, maybe?
```
assert(BlockLiveIn->Properties.DIExpr->getFragmentInfo() ==
DVMap.lookupDVID(VarID).first.getFragment() &&
...
```
(so the optimizer doesn't have to deal with the lookup code in nonasserts builds)
(and/or if the named variable helped with readability/was needed for other reasons, maybe using `auto &VarID = ...(VarID).first;` ? rather than needing to name an extra fully unused variable (DILoc))
https://github.com/llvm/llvm-project/pull/99526
More information about the llvm-commits
mailing list