[LICM][NFC] Reorder checks to speed up things slightly

Side effect check is made faster than potentially heavy other checks.
This commit is contained in:
Max Kazantsev 2020-04-21 11:25:38 +07:00
parent 68b2e507e4
commit a116f0fa86
1 changed files with 3 additions and 3 deletions

View File

@ -497,10 +497,10 @@ bool llvm::sinkRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI,
// operands of the instruction are loop invariant.
//
bool FreeInLoop = false;
if (isNotUsedOrFreeInLoop(I, CurLoop, SafetyInfo, TTI, FreeInLoop) &&
if (!I.mayHaveSideEffects() &&
isNotUsedOrFreeInLoop(I, CurLoop, SafetyInfo, TTI, FreeInLoop) &&
canSinkOrHoistInst(I, AA, DT, CurLoop, CurAST, MSSAU, true, &Flags,
ORE) &&
!I.mayHaveSideEffects()) {
ORE)) {
if (sink(I, LI, DT, CurLoop, SafetyInfo, MSSAU, ORE)) {
if (!FreeInLoop) {
++II;