[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 DebugLocs 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.