[PATCH] D50040: [GuardWidening] Widen very likely non-taken br instructions

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 12 22:06:49 PDT 2018


mkazantsev added inline comments.


================
Comment at: lib/Transforms/Scalar/GuardWidening.cpp:391
       auto Score =
           computeWideningScore(GuardInst, GuardInstLoop, Candidate, CurLoop);
       LLVM_DEBUG(dbgs() << "Score between " << *getCondition(GuardInst)
----------------
mkazantsev wrote:
> reames wrote:
> > It looks like you forgot to invert the condition when checking profit.  Should be an easy fix, but add a test case which shows the problem too.
> I'm not sure what do you mean. This function only checks if we are hoisting out of loop or not and availability of condition at candidate's point. How can inversion of condition affect that?
Just realized that `isWideningCondProfitable` does a really ugly thing inside and may end up creating instructions. I will propagate the inversion flag there, but it must be rework in the follow-up.


https://reviews.llvm.org/D50040





More information about the llvm-commits mailing list