[PATCH] D28241: [LICM] Untangle some of the logic in LICM canSinkOrHoistInst

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 10:58:03 PST 2017


danielcdh added inline comments.


================
Comment at: lib/Transforms/Scalar/LICM.cpp:366
     if (isNotUsedInLoop(I, CurLoop, SafetyInfo) &&
-        canSinkOrHoistInst(I, AA, DT, CurLoop, CurAST, SafetyInfo)) {
+        canSinkOrHoistInst(I, AA, DT, CurLoop, CurAST)) {
       ++II;
----------------
isSafeToExecuteUnconditionally will not be called in this function, is it safe?


================
Comment at: lib/Transforms/Scalar/LICM.cpp:422
               I, DT, CurLoop, SafetyInfo,
               CurLoop->getLoopPreheader()->getTerminator()))
         Changed |= hoist(I, DT, CurLoop, SafetyInfo);
----------------
isSafeToExecuteUnconditionally was called twice (without the patch):

* once in canSinkOrHoistInst, with CtxI=nullptr
* once here, with Ctxl=CurLoop->getLoopPreheader()->getTerminator()

I'm not quite familiar with isSafeToExecuteUnconditionally, but looks to me different CtxI may have different meaning to check? Or am I missing something?


https://reviews.llvm.org/D28241





More information about the llvm-commits mailing list