[llvm] [bolt][aarch64] simplify rodata/literal load for X86 & AArch64 (PR #165723)

YongKang Zhu via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 26 16:06:42 PST 2025


================
@@ -0,0 +1,133 @@
+// Test checks that load literal instructions changed to movk
+// 1) case for big function where CI moved to the end of the fucntion
+// 2) case for CI outside of the function
+
+# REQUIRES: system-linux
+
+# RUN: rm -rf %t && split-file %s %t
+
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
+# RUN:    %t/materialize-ci-big-func.s -o %t/materialize-ci-big-func.o
+# RUN: %clang %cflags %t/materialize-ci-big-func.o -Wl,-q \
+# RUN:    -o %t/materialize-ci-big-func.exe
+# RUN: llvm-bolt %t/materialize-ci-big-func.exe \
+# RUN:    -o %t/materialize-ci-big-func.bolt --lite=0 \
+# RUN:    --keep-nops --eliminate-unreachable=false \
+# RUN:    | FileCheck %s --check-prefix=CHECK-BIG-FUNC
+
+# CHECK-BIG-FUNC: simplified 2 out of 2 loads from a statically computed address
+
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
+# RUN:    %t/materialize-ci-outside-func.s -o %t/materialize-ci-outside-func.o
+# RUN:  %clang %cflags %t/materialize-ci-outside-func.o -Wl,-q \
+# RUN:    -o %t/materialize-ci-outside-func.exe
+# RUN: llvm-bolt %t/materialize-ci-outside-func.exe \
+# RUN:    -o %t/materialize-ci-outside-func.bolt --lite=0 \
+# RUN:    | FileCheck %s --check-prefix=CHECK-OUTSIDE-FUNC
+
+# CHECK-OUTSIDE-FUNC: simplified 2 out of 2 loads from a statically computed address
+
+#--- materialize-ci-big-func.s
+  .text
+  .align 4
+  .global foo
+  .type foo, %function
+foo:
+    stp x29, x30, [sp, #-32]!
+    stp x19, x20, [sp, #16]
+    mov x29, sp
+
+    mov w19, #0
+    mov w22, #0
+
+    ldr w23, .Llimit
+    ldr x24, .LStep
+    b .LStub
+
+// CI moved by emitCI function to the end of the function
+// without materialization CI is outside available range (+/-1MB)
+.LConstants:
+  .Llimit: .word 100
+  .LStep:  .xword 3
+
+.LStub:
+
+
+
+
----------------
yozhu wrote:

nit: remove the empty lines between the label and `.rep`

https://github.com/llvm/llvm-project/pull/165723


More information about the llvm-commits mailing list