Skip to content

Commit a116f0f

Browse files
committed
[LICM][NFC] Reorder checks to speed up things slightly
Side effect check is made faster than potentially heavy other checks.
1 parent 68b2e50 commit a116f0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Transforms/Scalar/LICM.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,10 @@ bool llvm::sinkRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI,
497497
// operands of the instruction are loop invariant.
498498
//
499499
bool FreeInLoop = false;
500-
if (isNotUsedOrFreeInLoop(I, CurLoop, SafetyInfo, TTI, FreeInLoop) &&
500+
if (!I.mayHaveSideEffects() &&
501+
isNotUsedOrFreeInLoop(I, CurLoop, SafetyInfo, TTI, FreeInLoop) &&
501502
canSinkOrHoistInst(I, AA, DT, CurLoop, CurAST, MSSAU, true, &Flags,
502-
ORE) &&
503-
!I.mayHaveSideEffects()) {
503+
ORE)) {
504504
if (sink(I, LI, DT, CurLoop, SafetyInfo, MSSAU, ORE)) {
505505
if (!FreeInLoop) {
506506
++II;

0 commit comments

Comments
 (0)