about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-08 12:52:50 +1000
committerGitHub <noreply@github.com>2025-08-08 12:52:50 +1000
commit44ffe1023c8aa9766de65c110f1e6e8f9d72e094 (patch)
tree6c0d6260ec3173f749f6a94515af3d5dbb855960 /compiler/rustc_codegen_llvm/src
parentcb271d055e6134c23b7cca5351353a7feb46458b (diff)
parentc396521fd38228945baf3437acdb27bf00d14919 (diff)
downloadrust-44ffe1023c8aa9766de65c110f1e6e8f9d72e094.tar.gz
rust-44ffe1023c8aa9766de65c110f1e6e8f9d72e094.zip
Rollup merge of #144764 - scottmcm:tweak-impossible-discriminant-assume, r=WaffleLapkin
[codegen] assume the tag, not the relative discriminant

Address the issue mentioned in <https://github.com/llvm/llvm-project/issues/134024#issuecomment-3131782555> by changing discriminant calculation to `assume` on the originally-loaded `tag`, rather than on `cast(tag)-OFFSET`.

The previous way does make the *purpose* of the assume clearer, IMHO, since you see `assume(x != 4); if p { x } else { 4 }`, but doing it this way instead means that the `add`s optimize away in LLVM21, which is more important.  And this new way is still easily thought of as being like metadata on the load saying specifically which value is impossible.

Demo of the LLVM20 vs LLVM21 difference: <https://llvm.godbolt.org/z/n54x5Mq1T>

r? ``@nikic``
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions