[PATCH] D48447: Fix invariant fdiv hoisting in LICM

vit9696 via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 22 19:38:00 PDT 2018


vit9696 accepted this revision.
vit9696 added a comment.
This revision is now accepted and ready to land.

Hello,

The proposed change seems right to me in both senses:

- moving the invariant out of the loop (obvious);
- not making a reciprocal here, as it may add an extra overhead for non-constant divisors.

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,
Vit


https://reviews.llvm.org/D48447





More information about the llvm-commits mailing list