Yeah, this optimization is called common subexpression elimination and is one of the basic optimizations you can expect in most optimizers!
-
-
-
Be careful relying on this though: in c/c++ it's easy for a function to be impure (won't behave the same way each call). llvm tries to check for this but it's not perfect and may miss things especially in complex cases. In rust it's easier but llvm doesn't know that.
- 1 more reply
New conversation -
-
-
very cool!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.