[llvm] 71a7c24 - [Hexagon] Add MC lit test for dropped fixups after packet relaxation (#210157)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 16:11:44 PDT 2026


Author: Ikhlas Ajbar
Date: 2026-07-16T18:11:40-05:00
New Revision: 71a7c24dec4fe7ab5eda28650cf8d9138b9ca994

URL: https://github.com/llvm/llvm-project/commit/71a7c24dec4fe7ab5eda28650cf8d9138b9ca994
DIFF: https://github.com/llvm/llvm-project/commit/71a7c24dec4fe7ab5eda28650cf8d9138b9ca994.diff

LOG: [Hexagon] Add MC lit test for dropped fixups after packet relaxation (#210157)

Test that a branch fixup is preserved when MC relaxes a packet
containing a conditional compare-and-jump due to a following .p2align
directive. Regression test for issue #163851.

Added: 
    llvm/test/MC/Hexagon/relax-align.s

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/MC/Hexagon/relax-align.s b/llvm/test/MC/Hexagon/relax-align.s
new file mode 100644
index 0000000000000..845fd6a372a0e
--- /dev/null
+++ b/llvm/test/MC/Hexagon/relax-align.s
@@ -0,0 +1,29 @@
+# RUN: llvm-mc -triple=hexagon-unknown-linux-musl -filetype=obj %s \
+# RUN:   | llvm-objdump -d - | FileCheck %s
+
+# When a .p2align directive following a packet with a conditional
+# compare-and-jump forces MC relaxation of the packet (to add pad nops
+# so that the following code is aligned), the branch fixup must be
+# updated after re-encoding. Regression test for issue #163851: the
+# recomputed fixup was silently dropped, leaving an invalid packet
+# encoding (missing packet-end bit) and an incorrect branch target.
+
+    .text
+    .globl foo
+    .p2align 4
+    .type foo, at function
+foo:
+    { r0 = r1
+      if (cmp.eq(r0.new,#0)) jump:nt .Lend }
+    .p2align 5
+.Lloop:
+    { r0 = add(r0,#1) }
+    { jump .Lloop }
+.Lend:
+    { jumpr r31 }
+    .size foo, .-foo
+
+# CHECK-LABEL: <foo>:
+# CHECK:      r0 = r1
+# CHECK-NEXT: if (cmp.eq(r0.new,#0x0)) jump:nt {{0x[0-9a-f]+}} <foo+0x28>
+# CHECK-NOT:  <unknown>


        


More information about the llvm-commits mailing list