-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Clobber between alloca and stack arg #63430
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
@llvm/issue-subscribers-backend-x86 |
This should be a bug in the findArgumentCopyElisionCandidates() optimization. |
This is another of those issues where I wonder how we never hit this before. The copy elision optimization seems to completely fail to account for the possibility that a stack slot that an argument has been stored into can be clobbered with a different value later. |
Okay, this is less bad than I thought. Apparently the way this is supposed to work is that if such a store gets elided, the load chain becomes the new root, ensuring that these loads happen before any potential clobbers. However, it seems that the code assumes that the argument only has one part, and will only preserve the chain of that first part. So in this case we lose the chain from the second load. |
Candidate patch: https://reviews.llvm.org/D153432 |
…R63430) When eliding an argument copy, we need to update the chain to ensure the argument reads are performed before later writes. However, the code doing this only handled this for the first part of the argument. If the argument had multiple parts, the chains of the later parts were dropped. Make sure we preserve all chains. Fixes llvm/llvm-project#63430.
…R63430) When eliding an argument copy, we need to update the chain to ensure the argument reads are performed before later writes. However, the code doing this only handled this for the first part of the argument. If the argument had multiple parts, the chains of the later parts were dropped. Make sure we preserve all chains. Fixes llvm/llvm-project#63430.
Results in:
The final argument is passed in
8(%rsp)
and16(%rsp)
. The zero store writes 128 bits to8(%rsp)
, clobbering the argument before it is read.The text was updated successfully, but these errors were encountered: