[PATCH] D27940: [LICM] Report failing to hoist conditionally-executed loads

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 14:38:59 PST 2017


anemet added inline comments.


================
Comment at: lib/Transforms/Scalar/LICM.cpp:797
+    auto *LI = dyn_cast<LoadInst>(&Inst);
+    if (LI && CurLoop->isLoopInvariant(LI->getPointerOperand()))
+      ORE->emit(OptimizationRemarkMissed(
----------------
hfinkel wrote:
> I have the same question here as I did in D27939, is the `CurLoop->isLoopInvariant` check needed here? At least in the call on line 407, the call is guarded by `CurLoop->hasLoopInvariantOperands`.
Similarly to D27939, I think, here too we need the check.

When isSafeToExecuteUnconditionally is called from canSinkOrHoistInst and we're sinking then the address is not necessarily loop-invariant.


https://reviews.llvm.org/D27940





More information about the llvm-commits mailing list