FDiv is replaced with multiplication by reciprocal and invariant
reciprocal is hoisted out of the loop, while multiplication remains
even if invariant.
Switch checks for all invariant operands and only invariant
denominator to fix the issue.
Differential D48447
Fix invariant fdiv hoisting in LICM rampitec on Jun 21 2018, 11:07 AM. Authored by
Details FDiv is replaced with multiplication by reciprocal and invariant Switch checks for all invariant operands and only invariant
Diff Detail
Event TimelineComment Actions Hello, The proposed change seems right to me in both senses:
The only case I could see this behaving worse is when the loop is not supposed to be executed, but the operations will still get speculatively hoisted. To my view this is uncommon and kind of contradicts the assumption of the LICM pass that loops do get executed more than once. It could have been nice to see some benchmarks on real projects, but I expect the inner arithmetics to be normally collapsed by other passes and defeat any change effects except in some special code, which this change supposedly optimises for, so it is not worth it. Accepted. Best regards, |