Re:Ask HN: Why Are Conditionals Important?
by 2_listerine_pls on Monday August 19, 2019 @09:23PM
(#20743113)
I don't need to understand that code to tell you there is a control flow mechanism somewhere using a condition.
A common technique inside compilers is to separate out which code gets run, and which result gets used. If everything is side-effect-free, then there's no harm in running the code whose result won't get used. In highly parallel systems, you can just run both versions and select at the end. So you can rewrite:
to: (the phi operator is taken from SSA notation. See https://llvm.org/docs/LangRef.html#phi-instruction if you're unfamiliar)