-
Notifications
You must be signed in to change notification settings - Fork 13.6k
DeadArgumentElimination creates invalid code with musttail calls returning structs #107569
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
Comments
Related case with a different assertion message: %struct.S = type { double }
define internal %struct.S @F38() {
ret %struct.S { double 0.0 }
}
define internal %struct.S @F36() {
%1 = alloca %struct.S, align 8
%3 = musttail call %struct.S @F38()
ret %struct.S %3
}
define double @foo() {
%3 = call %struct.S @F36()
%5 = extractvalue %struct.S %3, 0
ret double %5
}
|
we have the test for second case at musttail-invalid.ll
but first case is not. maybe we need to add this into testcase. first case
CallInst: %1 = musttail call i32 @f38() This is weird. but after change it to
is this normal? |
I found why it causes, maybe.
|
we create new return type in here
I tested disabling the code that creates the new return type to see if it would make a quick improvement
it seems to work
If this is a defect,
we can fix it by choosing one of above. IMO please let me know this issue need to fix or not~ @dtcxzyw Can you please review this issue? |
I'm not sure why we're trying to run DAE on functions where we can't change the signature; why doesn't the current check for musttail callers handle this? |
@efriedma-quic Don't think it needs to be fix? |
Not sure what you're saying. I'm asking about the structure of the existing code. There are already checks for musttail calls in DeadArgumentElimination, which at first glance should exclude transforming cases like this. Can those checks be extended to also exclude this case? |
…signature (llvm#127366) This commit is for llvm#107569 and llvm#126817. Stop changing musttail's caller and callee's function signature when calling convention is not swifttailcc nor tailcc. Verifier makes sure musttail's caller and callee shares exactly the same signature, see commit 9ff2eb1 and llvm#54964. Otherwise just make sure the return type is the same and then process musttail like usual calls. close llvm#107569, llvm#126817
The DeadArgumentElimination pass creates code which fails the IR verifier when run on this input:
Found using a fuzzer while testing #102896.
The text was updated successfully, but these errors were encountered: