Skip to content

suppresses unused variable warning #99526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

assert(BlockLiveIn->Properties.DIExpr->getFragmentInfo() ==
Var.getFragment() &&
"Fragment info missing during value prop");
Expand Down
Loading