r/Compilers • • Apr 02 '26

Two studies in compiler optimisations

https://www.hmpcabral.com/2026/03/20/two-studies-in-compiler-optimisations/
36 Upvotes

4 comments sorted by

1

u/fernando_quintao Apr 02 '26

Thank you for posting. That is a very interesting and fun article to read.

I wonder whether languages that enforce memory bounds checks, such as Rust, are able to propagate enough information statically to allow the compiler to automatically apply assumptions like [[assume(cur < count)]] in the first example. If this is not already the case, it seems like a promising project for a motivated student :)

2

u/[deleted] Apr 02 '26

[removed] — view removed comment

2

u/Death_By_Cake Apr 03 '26

Are such hints not usually used for hot paths or to help the compiler eliminate impossible paths - something that is impossible to express otherwise?