[llvm] [BOLT][AArch64] Transform cmpbr ~> cmp + br when inversion not possible (PR #185731)
Paschalis Mpeis via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 1 08:09:21 PDT 2026
================
@@ -73,37 +79,73 @@ register_swap:
mov x0, #2
ret
-# CHECK: <register_swap>:
-# CHECK-NEXT: {{.*}} cbgt x1, x0, 0x[[ADDR2:[0-9a-f]+]] <{{.*}}>
-# CHECK-NEXT: {{.*}} mov x0, #0x2 // =2
-# CHECK-NEXT: {{.*}} ret
-# CHECK-NEXT: [[ADDR2]]: {{.*}} mov x0, #0x1 // =1
-# CHECK-NEXT: {{.*}} ret
+# COMMON: <register_swap>:
+# COMMON-NEXT: {{.*}} cbgt x1, x0, 0x[[ADDR2:[0-9a-f]+]] <{{.*}}>
+# COMMON-NEXT: {{.*}} mov x0, #0x2 // =2
+# COMMON-NEXT: {{.*}} ret
+# COMMON-NEXT: [[ADDR2]]: {{.*}} mov x0, #0x1 // =1
+# COMMON-NEXT: {{.*}} ret
- .globl irreversible
- .type irreversible, %function
-irreversible:
+ .globl immediate_overflow
+ .type immediate_overflow, %function
+immediate_overflow:
.entry3:
-# FDATA: 1 irreversible #.entry3# 10
+# FDATA: 1 immediate_overflow #.entry3# 10
cbgt x0, #63, .exit3
.cold3:
-# FDATA: 1 irreversible #.cold3# 1
+# FDATA: 1 immediate_overflow #.cold3# 1
mov x0, #1
ret
.exit3:
-# FDATA: 1 irreversible #.exit3# 10
+# FDATA: 1 immediate_overflow #.exit3# 10
+ mov x0, #2
+ ret
+
+# BOLT-INFO-NO-LIVENESS: unable to swap successors in immediate_overflow
+
+# NO-LIVENESS: <immediate_overflow>:
----------------
paschalis-mpeis wrote:
Can you add 1-2 lines explaining some of those cases?
ie, we emit cbgt just fine, but we have code layout limitations here.
https://github.com/llvm/llvm-project/pull/185731
More information about the llvm-commits
mailing list