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

Backport for rust#127286 and rust#127260 #175

Merged
merged 5 commits into from
Jul 5, 2024

Conversation

DianQK
Copy link
Member

@DianQK DianQK commented Jul 5, 2024

Fixes rust-lang/rust#127286 and rust-lang/rust#127260.

Backport llvm#97711 and llvm#97533.

The file llvm/test/CodeGen/X86/var-permute-128.ll contains conflicts, so I regenerated this test. Strangely, the test doesn't seem to have changed? The test case is in llvm/test/CodeGen/X86/addr-mode-matcher-3.ll.

RKSimon and others added 4 commits July 5, 2024 08:06
Expose the memory addressing to simplify checking stack spill/restore manipulation codegen

(cherry picked from commit 8270485)
…(x),c)) if the pattern has multiple uses

Fixes llvm#97533 crash where we hit a case where the root node had referenced the original zext node, which we then deleted - hopefully I can come up with a better solution, but the codegen changes don't look too bad atm (pulls out a shift from some complex LEA nodes that shared the scaled index).

(cherry picked from commit e975ff0)
…value (llvm#97711)

If there is a single store, then loads must either load the stored value
or uninitialized memory (undef). If the stored value may be poison, then
replacing an uninitialized memory load with it would be incorrect. Fall
back to the generic code in that case.

This PR only fixes the case where there is a literal poison store -- the
case where the value is non-trivially poison will still get miscompiled
by phi simplification later, see llvm#96631.

Fixes llvm#97702.

(cherry picked from commit f58930f)
@DianQK DianQK requested a review from a team July 5, 2024 00:12
@nikic
Copy link

nikic commented Jul 5, 2024

Please hold this for now.

@nikic
Copy link

nikic commented Jul 5, 2024

llvm@daaea12 addresses a compile-time regression from the mem2reg change.

In llvm#97711 the single-store optimization was disabled for the case
where the value is potentially poison, as this may produce incorrect
results for loads of uninitialized memory.

However, this resulted in compile-time regressions. Address these
by still allowing the single-store optimization to occur in cases
where the store dominates the load, as we know that such a load
will always read initialized memory.

(cherry picked from commit daaea12)
@DianQK
Copy link
Member Author

DianQK commented Jul 5, 2024

llvm@daaea12 addresses a compile-time regression from the mem2reg change.

Added. The new changes also look easier to understand.

@nikic nikic merged commit c54cff0 into rust-lang:rustc/18.1-2024-05-19 Jul 5, 2024
@DianQK DianQK deleted the backport branch July 5, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants