You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make use of getelementptr nuw in pointer::add #137217
add() on pointers should generate getelementptr inbounds nuw on LLVM 20 and above, to let LLVM know that the offset cannot be negative. We'll need a new variant of intrinsic::offset to pass down this information.
If not I'll get to it eventually, just not sure when that'll be. I'm excited for it, since I tried doing it with assumes in #123598 but perf wasn't happy with me.
Activity
nikic commentedon Feb 18, 2025
cc @scottmcm as this seems like something up your alley :)
scottmcm commentedon Feb 18, 2025
Shouldn't need a new intrinsic -- we already lower
addto MIROffset(#110837) -- so it's just a matter of updatingrust/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
Lines 958 to 971 in 3b022d8
to check whether the RHS is unsigned, and add
nuwif it is.nikic commentedon Feb 18, 2025
Oh nice, that will make things a lot simpler. Maybe I can even implement this myself...
scottmcm commentedon Feb 18, 2025
If you're tempted, go for it! Should be pretty similar to https://github.com/rust-lang/rust/pull/136575/files#diff-76d7dff532dc6719661f41c02777d2b1f8888cd0b8113b9908ed0085ef49fff4 , just with less confusion along the way since you actually know the LLVM API (unlike me :P)
If not I'll get to it eventually, just not sure when that'll be. I'm excited for it, since I tried doing it with assumes in #123598 but perf wasn't happy with me.
Auto merge of rust-lang#137271 - nikic:gep-nuw-2, r=<try>
Auto merge of rust-lang#137271 - nikic:gep-nuw-2, r=<try>
Auto merge of rust-lang#137271 - nikic:gep-nuw-2, r=scottmcm
Auto merge of #137271 - nikic:gep-nuw-2, r=scottmcm
Auto merge of #137271 - nikic:gep-nuw-2, r=scottmcm
Auto merge of #137271 - nikic:gep-nuw-2, r=scottmcm
Auto merge of #137271 - nikic:gep-nuw-2, r=scottmcm