Skip to content

[AArch64][test] Fix test failing on unknown options #139696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025

Conversation

yasuna-oribe
Copy link
Contributor

Fixes buildbot failure https://lab.llvm.org/buildbot/#/builders/16/builds/18873 originating from #138448. Normally ignored silently but fails on higher error levels.

Buildbot errors:

/b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/llc < /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/AArch64/reserveXreg.ll -mtriple=aarch64-unknown-linux-gnu | /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/AArch64/reserveXreg.ll # RUN: at line 6
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/AArch64/reserveXreg.ll
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/llc -mtriple=aarch64-unknown-linux-gnu
'+reserve-x8' is not a recognized feature for this target (ignoring feature)
'+reserve-x8' is not a recognized feature for this target (ignoring feature)
'+reserve-x16' is not a recognized feature for this target (ignoring feature)
'+reserve-x16' is not a recognized feature for this target (ignoring feature)
'+reserve-x17' is not a recognized feature for this target (ignoring feature)
'+reserve-x17' is not a recognized feature for this target (ignoring feature)

Fixes buildbot failure https://lab.llvm.org/buildbot/#/builders/16/builds/18873
originating from llvm#138448. Normally ignored silently but fails on higher
error levels.

Buildbot errors:
```
/b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/llc < /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/AArch64/reserveXreg.ll -mtriple=aarch64-unknown-linux-gnu | /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/AArch64/reserveXreg.ll # RUN: at line 6
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/AArch64/reserveXreg.ll
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/llc -mtriple=aarch64-unknown-linux-gnu
'+reserve-x8' is not a recognized feature for this target (ignoring feature)
'+reserve-x8' is not a recognized feature for this target (ignoring feature)
'+reserve-x16' is not a recognized feature for this target (ignoring feature)
'+reserve-x16' is not a recognized feature for this target (ignoring feature)
'+reserve-x17' is not a recognized feature for this target (ignoring feature)
'+reserve-x17' is not a recognized feature for this target (ignoring feature)
```
@llvmbot
Copy link
Member

llvmbot commented May 13, 2025

@llvm/pr-subscribers-backend-aarch64

Author: Nuko Y. (yasuna-oribe)

Changes

Fixes buildbot failure https://lab.llvm.org/buildbot/#/builders/16/builds/18873 originating from #138448. Normally ignored silently but fails on higher error levels.

Buildbot errors:

/b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/llc &lt; /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/AArch64/reserveXreg.ll -mtriple=aarch64-unknown-linux-gnu | /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/AArch64/reserveXreg.ll # RUN: at line 6
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/AArch64/reserveXreg.ll
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/llc -mtriple=aarch64-unknown-linux-gnu
'+reserve-x8' is not a recognized feature for this target (ignoring feature)
'+reserve-x8' is not a recognized feature for this target (ignoring feature)
'+reserve-x16' is not a recognized feature for this target (ignoring feature)
'+reserve-x16' is not a recognized feature for this target (ignoring feature)
'+reserve-x17' is not a recognized feature for this target (ignoring feature)
'+reserve-x17' is not a recognized feature for this target (ignoring feature)

Full diff: https://github.com/llvm/llvm-project/pull/139696.diff

1 Files Affected:

  • (modified) llvm/test/CodeGen/AArch64/reserveXreg.ll (+1-35)
diff --git a/llvm/test/CodeGen/AArch64/reserveXreg.ll b/llvm/test/CodeGen/AArch64/reserveXreg.ll
index 86ed536049a35..037ccab1525d1 100644
--- a/llvm/test/CodeGen/AArch64/reserveXreg.ll
+++ b/llvm/test/CodeGen/AArch64/reserveXreg.ll
@@ -1,7 +1,6 @@
 ;; Check if manually reserved registers are always excluded from being saved by
 ;; the function prolog/epilog, even for callee-saved ones, as per GCC behavior.
-;; X19(BP, LLVM specific), X29(FP), X30(LP), X31(SP) are special so
-;; they are not checked.
+;; Look at AArch64Features.td for registers excluded from this test.
 
 ; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu | FileCheck %s
 
@@ -82,17 +81,6 @@ define preserve_mostcc void @t7() "target-features"="+reserve-x7" {
   ret void
 }
 
-define preserve_mostcc void @t8() "target-features"="+reserve-x8" {
-; CHECK-LABEL: t8:
-; CHECK: // %bb.0:
-; CHECK-NEXT:        mov     w8, #256
-; CHECK-NEXT:        //APP
-; CHECK-NEXT:        //NO_APP
-; CHECK-NEXT:        ret
-  call i64 asm sideeffect "", "={x8},{x8}"(i64 256)
-  ret void
-}
-
 define preserve_mostcc void @t9() "target-features"="+reserve-x9" {
 ; CHECK-LABEL: t9:
 ; CHECK: // %bb.0:
@@ -170,28 +158,6 @@ define preserve_mostcc void @t15() "target-features"="+reserve-x15" {
   ret void
 }
 
-define preserve_mostcc void @t16() "target-features"="+reserve-x16" {
-; CHECK-LABEL: t16:
-; CHECK: // %bb.0:
-; CHECK-NEXT:        mov     w16, #256
-; CHECK-NEXT:        //APP
-; CHECK-NEXT:        //NO_APP
-; CHECK-NEXT:        ret
-  call i64 asm sideeffect "", "={x16},{x16}"(i64 256)
-  ret void
-}
-
-define preserve_mostcc void @t17() "target-features"="+reserve-x17" {
-; CHECK-LABEL: t17:
-; CHECK: // %bb.0:
-; CHECK-NEXT:        mov     w17, #256
-; CHECK-NEXT:        //APP
-; CHECK-NEXT:        //NO_APP
-; CHECK-NEXT:        ret
-  call i64 asm sideeffect "", "={x17},{x17}"(i64 256)
-  ret void
-}
-
 define preserve_mostcc void @t18() "target-features"="+reserve-x18" {
 ; CHECK-LABEL: t18:
 ; CHECK: // %bb.0:

@yasuna-oribe
Copy link
Contributor Author

Ping @davemgreen @nasherm @efriedma-quic, sorry for this. Didn't show up in normal tests.

Copy link
Collaborator

@davemgreen davemgreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@davemgreen davemgreen merged commit 69f4e60 into llvm:main May 13, 2025
8 of 12 checks passed
@davemgreen
Copy link
Collaborator

@yasuna-oribe About the buildbot - it looks like if you add -verify-machineinstrs to the test it produces:

/work/clean/build/bin/llc < /work/clean/llvm/test/CodeGen/AArch64/reserveXreg.ll -mtriple=aarch64-unknown-linux-gnu -verify-machineinstrs | /work/
clean/build/bin/FileCheck /work/clean/llvm/test/CodeGen/AArch64/reserveXreg.ll # RUN: at line 5                                                   
+ /work/clean/build/bin/FileCheck /work/clean/llvm/test/CodeGen/AArch64/reserveXreg.ll                                                            
+ /work/clean/build/bin/llc -mtriple=aarch64-unknown-linux-gnu -verify-machineinstrs                                                              
                                                                                                                                                  
# After Register Coalescer                                                                                                                        
********** INTERVALS **********
W1 [16r,16d:1)[64r,64d:0) 0@64r 1@16r
W1_HI [16r,16d:1)[64r,64d:0) 0@64r 1@16r
RegMasks:
********** MACHINEINSTRS **********
# Machine code for function t1: NoPHIs, TracksLiveness, TiedOpsRewritten

0B      bb.0 (%ir-block.0):
16B       $w1 = MOVi32imm 256
64B       INLINEASM &"" [sideeffect] [attdialect], $0:[regdef], implicit-def $x1, $1:[reguse], $x1
80B       RET_ReallyLR

# End machine code for function t1.

*** Bad machine code: Defining instruction does not modify register ***
- function:    t1
- basic block: %bb.0  (0x55fd4e671680) [0B;96B)
- instruction: 16B      $w1 = MOVi32imm 256
- liverange:   [16r,16d:1)[64r,64d:0) 0@64r 1@16r
- regunit:     W1_HI
- ValNo:       1 (def 16r)
LLVM ERROR: Found 1 machine code errors.

I'm pretty sure it is meant to look like $w1 = MOVi32imm 256, implicit-def $x1. Any idea what might be going wrong?

@yasuna-oribe
Copy link
Contributor Author

@davemgreen, honestly I have no idea what "Defining instruction does not modify register" is trying to tell me, and the loop at MachineVerifier.cpp:3610 isn't really helpful either. I'll report back after checking with a reverted tree to see if it's failing because of my change or my test (I'm strongly assuming the latter).

@yasuna-oribe
Copy link
Contributor Author

yasuna-oribe commented May 14, 2025

I've just reverted and checked myself and it's not my changes to LLVM that makes it fail; it looks like either the test makes it fail, or it's a bug in LLVM (I don't really know how to read this). Take a look:


# After Register Coalescer
********** INTERVALS **********
W28 [16r,16d:1)[64r,64d:0) 0@64r 1@16r
W28_HI [16r,16d:1)[64r,64d:0) 0@64r 1@16r
RegMasks:
********** MACHINEINSTRS **********
# Machine code for function foo: NoPHIs, TracksLiveness, TiedOpsRewritten

0B      bb.0 (%ir-block.0):
16B       $w28 = MOVi32imm 238
64B       INLINEASM &"" [sideeffect] [attdialect], $0:[regdef], implicit-def $x28, $1:[reguse], $x28
80B       RET_ReallyLR

# End machine code for function foo.

*** Bad machine code: Defining instruction does not modify register ***
- function:    foo
- basic block: %bb.0  (0x5622b74a1120) [0B;96B)
- instruction: 16B      $w28 = MOVi32imm 238
- liverange:   [16r,16d:1)[64r,64d:0) 0@64r 1@16r
- regunit:     W28_HI
- ValNo:       1 (def 16r)
LLVM ERROR: Found 1 machine code errors.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: build/bin/llc -mtriple=aarch64-unknown-linux-gnu a.ll
1.      Running pass 'Function Pass Manager' on module 'a.ll'.
2.      Running pass 'Verify generated machine code' on function '@foo'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVMSupport.so.21.0git 0x00007fa316d335cc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 60
1  libLLVMSupport.so.21.0git 0x00007fa316d33cfc
2  libc.so.6                 0x00007fa316513cd0
3  libc.so.6                 0x00007fa31656d624
4  libc.so.6                 0x00007fa316513ba0 gsignal + 32
5  libc.so.6                 0x00007fa3164fb582 abort + 38
6  libLLVMSupport.so.21.0git 0x00007fa316c49ff4 llvm::report_fatal_error(llvm::Twine const&, bool) + 452
7  libLLVMCodeGen.so.21.0git 0x00007fa3194038d5
8  libLLVMCodeGen.so.21.0git 0x00007fa319404c32
9  libLLVMCodeGen.so.21.0git 0x00007fa3192bdec8 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 952
10 libLLVMCore.so.21.0git    0x00007fa31733c54f llvm::FPPassManager::runOnFunction(llvm::Function&) + 575
11 libLLVMCore.so.21.0git    0x00007fa317342572 llvm::FPPassManager::runOnModule(llvm::Module&) + 50
12 libLLVMCore.so.21.0git    0x00007fa31733ccf7 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1111
13 llc                       0x00005622a7e87c18
14 llc                       0x00005622a7e8529d main + 1245
15 libc.so.6                 0x00007fa3164fd488
16 libc.so.6                 0x00007fa3164fd54c __libc_start_main + 140
17 llc                       0x00005622a7e84c75 _start + 37
Aborted (core dumped)

I'll write a test that doesn't make it error for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants