[PATCH] D24934: [LICM] Add support of a new optimization case to Loop Versioning for LICM + code clean up
Ashutosh Nema via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 4 01:14:28 PDT 2016
ashutosh.nema added inline comments.
> eastig wrote in LoopVersioningLICM.cpp:489
> The old cases work as before, nothing is changed.
> The behaviour is only changed for the new cases. Loads are very heavy operations it is too dangerous to move them from an inner loop to an upper loop because the upper loop might have 1000 iterations and the inner loop might have 10. If there are aliased pointers a operation loading a pointer will be executed 11000 times instead of 10000 times: 1000 times in the RT checking basic block + 10000 times in the original loop. To make a proper decision an execution profile should be used.
Agree it does not change the existing behavior, but for new cases why you enforcing such restriction.
In your example it can be other way around as well where the inner loop has 1000 iteration and outer loop has 10 iterations and its actually beneficial to hoist load from inner load to outer lop. LoopVersioning LICM does not make any hoisting decision, actual decision & hoisting will be done later by LICM.
Are you getting issues/degrades by allowing inner loops ?
https://reviews.llvm.org/D24934
More information about the llvm-commits
mailing list