[PATCH] D37076: [LICM] Allow sinking when foldable in loop

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 14:06:59 PDT 2017


junbuml added a comment.

Considering that LICM is a part of the canonicalization process, it totally make sense to handle all free instructions, instead of being limited in GEPs used by Loads. However, I still don't think free from getUserCost() guarantee nop.  It's possible that getUserCost() returns FREE for a GEP, but the GEP cannot be folded into its user. For example, if an user of the GEP is a call instruction taking the GEP as parameter, then the GEP may not be folded in isel. ISel may also not fold a free GEP into a load if the GEP is not in the same block. 
Is FREE from getUserCost() supposed to guarantee nop or expect it to be nop?

With my current implementation (check GEPs used by load in the same block), I didn't any clear performance gain in my test for spec2000/2006/2017. However, when this change applied together with my another LICM patch (https://reviews.llvm.org/D37163), observed +4% performance gain in spec2006/xalancbmk.


https://reviews.llvm.org/D37076





More information about the llvm-commits mailing list