Skip to content
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

llc crash when exec 'llc -mtriple=sparcel' #89569

Closed
cpython-java opened this issue Apr 22, 2024 · 7 comments · Fixed by #107223
Closed

llc crash when exec 'llc -mtriple=sparcel' #89569

cpython-java opened this issue Apr 22, 2024 · 7 comments · Fixed by #107223
Assignees
Labels
backend:Sparc bug Indicates an unexpected problem or unintended behavior

Comments

@cpython-java
Copy link

description

when i use 'llc' to translate an IR, crash happened. I don't know whether it's a bug of 'llc' and want to be sure about it.

thank you for your help!

bug ir

define i32 @main() {
  
  br label %2

2: 
  %A = alloca i64, align 16
  ret i32 0
}

cmd

llc -mtriple=sparcel test.ll

crash info

https://godbolt.org/z/hEafj9887

@asl
Copy link
Collaborator

asl commented Apr 22, 2024

The error is:

LLVM ERROR: Function "main": over-aligned dynamic alloca not supported.

So, this is simply not something supported by old Sparc backend.

@asl asl added bug Indicates an unexpected problem or unintended behavior backend:Sparc and removed new issue labels Apr 22, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 22, 2024

@llvm/issue-subscribers-bug

Author: None (cpython-java)

# description when i use 'llc' to translate an IR, crash happened. I don't know whether it's a bug of 'llc' and want to be sure about it.

thank you for your help!

bug ir

define i32 @<!-- -->main() {
  
  br label %2

2: 
  %A = alloca i64, align 16
  ret i32 0
}

cmd

llc -mtriple=sparcel test.ll

crash info

https://godbolt.org/z/hEafj9887

@cpython-java
Copy link
Author

The error is:

LLVM ERROR: Function "main": over-aligned dynamic alloca not supported.

So, this is simply not something supported by old Sparc backend.

So it's a problem about align. But why the following code has no problem??? Thank you for your help!!!!!

define i32 @main() {
  %A = alloca i64, align 16
  ret i32 0
}

the difference between two IR is only whether instruction 'br' exists.

@asl
Copy link
Collaborator

asl commented Apr 22, 2024

First one is a dynamic alloca requiring stack realignment.

@cpython-java
Copy link
Author

First one is a dynamic alloca requiring stack realignment.

If the syntax is not supported, should the llc alert the user with an error instead of crashing?

@brad0
Copy link
Contributor

brad0 commented Jul 14, 2024

@koachan

@koachan
Copy link
Contributor

koachan commented Jul 16, 2024

From a quick look it seems that this also affects all the other 32-bit targets...
But yeah lemme see what I can do here.

@koachan koachan self-assigned this Aug 14, 2024
koachan added a commit that referenced this issue Nov 3, 2024
SPARC ABI doesn't use stack realignment, so let LLVM know about it in
`SparcFrameLowering`. This has the side effect of making all overaligned
allocations go through `LowerDYNAMIC_STACKALLOC`, so implement the
missing logic there too for overaligned allocations.
This makes the SPARC backend not crash on overaligned `alloca`s and fix
#89569.
PhilippRados pushed a commit to PhilippRados/llvm-project that referenced this issue Nov 6, 2024
SPARC ABI doesn't use stack realignment, so let LLVM know about it in
`SparcFrameLowering`. This has the side effect of making all overaligned
allocations go through `LowerDYNAMIC_STACKALLOC`, so implement the
missing logic there too for overaligned allocations.
This makes the SPARC backend not crash on overaligned `alloca`s and fix
llvm#89569.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:Sparc bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants