diff options
| author | azwolski <antoni.zwolski@intel.com> | 2025-10-15 15:47:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-15 14:47:09 +0100 |
| commit | 316c0766942a1ed87e1a440efaa2fa4d0bad0418 (patch) | |
| tree | 2ddbecab05da42cdaffb4c1ee0491f30cba2e5f3 /clang/lib/Frontend/CompilerInvocation.cpp | |
| parent | deaf7b914b1ce91e0aada8b59d00587e7b0739c6 (diff) | |
| download | llvm-316c0766942a1ed87e1a440efaa2fa4d0bad0418.zip llvm-316c0766942a1ed87e1a440efaa2fa4d0bad0418.tar.gz llvm-316c0766942a1ed87e1a440efaa2fa4d0bad0418.tar.bz2 | |
[X86] Fix X86 conditional load/store optimization for non-constant operands (#163353)
This PR fixes a bug in combineX86CloadCstore where an optimization was
being applied too broadly, causing incorrect code generation.
Without any assumptions about `X` this transformation is only valid when
`Y` is a non zero power of two/single-bit mask.
```cpp
// res, flags2 = sub 0, (and (xor X, -1), Y)
// cload/cstore ..., cond_ne, flag2
// ->
// res, flags2 = sub 0, (and X, Y)
// cload/cstore ..., cond_e, flag2
```
We can restrict the optimization to most important case, so only apply
when `llvm::isOneConstant(Op1.getOperand(1))`. It might be not trivial
to find code that creates a SelectionDag with other values of `Y`.
Basline test: https://github.com/llvm/llvm-project/pull/163354
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions
