This is a follow up to rL331182. A PHI node can be split up into
several MIR PHI nodes when being selected. When there is a
dbg.value intrinsic that uses the result of such a PHI node we
need to select several DBG_VALUE instructions, with fragment
expressions, in order to do a correct selection.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
5267 ↗ | (On Diff #144767) | Would it be more convenient to add a 'occupiesMultipleRegs()' predicate to RegsForValue? |
5273 ↗ | (On Diff #144767) | You might be able to simplify this by using zip_first(RegCount, RegVTs) (see STLExtras.h, or unittests/ADT/IteratorTest for example usage). |
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
5273 ↗ | (On Diff #144767) | I basically stole this code/loop from EmitFuncArgumentDbgValue (line ~4917). But your suggestion sounds like a really good idea. May I suggest a follow up commit to refactor this and the code in EmitFuncArgumentDbgValue at the same time? Or is it preferred to have this one nice-looking from the start? (I can totally but that...) |
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
5273 ↗ | (On Diff #144767) | I'd be fine with a follow-up commit to clean up both sites. Although now that you mention this, there may be a opportunity here to share code. It's conceivable that some common helper could take care of creating the fragment expressions, and then passing {fragmentExpr, Offset, Reg} to a lambda. |
test/DebugInfo/X86/sdag-dbgvalue-phi-use-3.ll | ||
123 ↗ | (On Diff #144767) | Consider stripping out these attributes, lifetime markers, and tbaa metadata to make the test more maintainable. |
Some updates suggested by vsk:
- Use zip_first.
- Add a RegsForValue::occupiesMultipleRegisters() helper.
- Cleanup in the test case (removing tbaa and lifetime stuff).
I'll create another patch to do a similar refactoring in EmitFuncArgumentDbgValue (or see if we can share code in some way).
Unfortunately, this broke things for me, see https://bugs.llvm.org/show_bug.cgi?id=37321 for details. I'll revert this one in the meantime.