We skip debug instructions in RDA so we cannot attempt to look them up in our instruction map without causing a crash. But some of the methods select the last instruction in the block and this instruction may be a debug instruction... So, use getLastNonDebugInstr instead of calling back on a MachineBasicBlock.
MachineBasicBlock iterators have also been updated to use instructionsWithoutDebug so we can avoid the manual checks for debug instructions.
There's no test attached here... trying to make a sensible reproducer has been a real pain...
Details
Details
- Reviewers
dmgreen SjoerdMeijer nikic - Commits
- rG8f92f3c2eab0: [RDA] Fix DBG_VALUE issues
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
This LGTM, with some thoughts on how this could be improved in a followup.
llvm/lib/CodeGen/ReachingDefAnalysis.cpp | ||
---|---|---|
501 | The general approach in this function looks a bit dubious to me. Instead of passing in the last instruction to getReachingDef(), we should add a function that gets the reaching def at the end of the block. This can be found by inspecting the last element in the reaching def vector, rather than scanning the whole vector, and has the advantage that it will automatically include reaching defs from the last instruction. From a cursory look, I suspect that the current implementation has a discrepancy in handling of aliased registers for the last instruction, because reg units are not inspected for it. |
llvm/lib/CodeGen/ReachingDefAnalysis.cpp | ||
---|---|---|
501 | Thanks, sounds good. |
The general approach in this function looks a bit dubious to me. Instead of passing in the last instruction to getReachingDef(), we should add a function that gets the reaching def at the end of the block. This can be found by inspecting the last element in the reaching def vector, rather than scanning the whole vector, and has the advantage that it will automatically include reaching defs from the last instruction. From a cursory look, I suspect that the current implementation has a discrepancy in handling of aliased registers for the last instruction, because reg units are not inspected for it.