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

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 16 10:40:45 PDT 2017


junbuml added inline comments.


================
Comment at: lib/Transforms/Scalar/LICM.cpp:713
+  }
+  return TTI->getUserCost(&I, UsersInLoop) ==
+         TargetTransformInfo::TCC_Free;
----------------
As r314923 was reverted, we cannot simply use getUserCost for all instructions because it optimistically assume that a GEP will fold into addressing mode regardless of its users.  I don't think we can rely on this optimistic assumption in here.  To handle GEPs properly in this change, we can check  GEP's users here directly, or we can add a function in TTI to see if an instruction is really foldable.


https://reviews.llvm.org/D37076





More information about the llvm-commits mailing list