[llvm] [MachineOutliner] Avoid ranges that cross bundle boundary (PR #148977)
Simon Tatham via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 16 04:15:27 PDT 2025
================
@@ -40,3 +40,52 @@ body: |
$x9 = ADDXri $x9, 16, 0
$x16 = ADDXri killed $x16, 16, 0
RET undef $x9
+...
+---
+name: unsafe_range_bundle
+tracksRegLiveness: true
+machineFunctionInfo:
+ hasRedZone: false
+body: |
+ bb.0:
+ liveins: $x0
+ ; Begin safe range of 3 instructions
----------------
statham-arm wrote:
I'm confused by the "safe range" comments. This "Begin safe range of 3 instructions" comment seems to go with an "End safe range" comment on line 74 (in this version of the patch) _four_ instructions later, not three. Then there's another "End safe range" further down (line 86) without any "Begin" comment. Finally, it's confusing that the CHECK comments are after the "Begin safe range"; putting them the other way round would surely have been clearer?
It looks to me as if the real point of this test is that the four ADDXri to x0,x1,x2,x3 are duplicated in this function (lines 69-72 and 81-85), but in the second copy two of them are inside a bundle, and therefore they mustn't be outlined. If I've understood that correctly, perhaps describing them as something like an "outlining candidate" instead of a safe range might be less confusing – especially since the whole point of this example is that this range of instructions _isn't_ safe to outline :-)
https://github.com/llvm/llvm-project/pull/148977
More information about the llvm-commits
mailing list