[PATCH] D136247: [NFC][SelectionDAG][DebugInfo] Remove duplicate parameter from handleDebugValue
Orlando Cazalet-Hyams via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 19 04:53:08 PDT 2022
Orlando created this revision.
Orlando added reviewers: dblaikie, jmorse, jryans, aprantl, StephenTozer.
Orlando added a project: debug-info.
Herald added subscribers: ecnelises, hiraditya.
Herald added a project: All.
Orlando requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
[NFC][SelectionDAG][DebugInfo] Remove duplicate parameter from handleDebugValue
`handleDebugValue` has two `DebugLoc` parameters that appear to always take the
same value. Remove one of the duplicate parameters.
Now an attempt to disentangle the code and explain why I think they are always
the same value:
The call to `handleDebugValue` in `visitIntrinsicCall` uses `dl` and
`DI.getDebugLoc()` as the two `DebugLoc` arguments, where `DI` is the
current instruction being visited casted to a `DbgValueInst`.
At the start of `visitIntrinsicCall` we can see
DebugLoc dl = getCurDebugLoc();
Here's the definition for `getCurDebugLoc`:
DebugLoc getCurDebugLoc() const {
return CurInst ? CurInst->getDebugLoc() : DebugLoc();
}
Noting that `CurInst` is set to the instruction-being-visited in
`SelectionDAGBuilder::visit(const Instruction &I)` before calling `visit`
which results in the call to `visitIntrinsicCall`. This shows that `dl`
and `DI.getDebugLoc()` are the same.
The other two calls to `handleDebugValue` occur inside
`SelectionDAGBuilder::salvageUnresolvedDbgValue(DanglingDebugInfo &DDI)`. The
two `DebugLoc`s passed to `handleDebugValue` from here are:
DebugLoc DL = DDI.getdl();
DebugLoc InstDL = DDI.getDI()->getDebugLoc();
The `DanglingDebugInfo` parameter `DDI` is created by the call from
`visitIntrinsicCall` to `addDanglingDebugInfo`:
addDanglingDebugInfo(&DI, dl, SDNodeOrder);
So following the logic for the arguments to the call to `handleDebugValue` in
`visitIntrinsicCall`, `DDI.getdl()` and `DDI.getDI()->getDebugLoc()` used in
`salvageUnresolvedDbgValue` are also the same value.
To help test this I added an assert to check the arguments were equal and built
the CTMark test suite - the assert wasn't tripped. That's not conclusive, but
adds confidence.
---
I'll put up another NFC patch that removes unneeded `DebugLoc` field from
`DanglingDebugInfo` shortly.
As well as being a nice tidy-up, these changes is used by an upcoming assignment tracking patch.
https://reviews.llvm.org/D136247
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136247.468871.patch
Type: text/x-patch
Size: 5222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221019/874efa76/attachment.bin>
More information about the llvm-commits
mailing list