[llvm] a116f0f - [LICM][NFC] Reorder checks to speed up things slightly
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 20 21:50:31 PDT 2020
Author: Max Kazantsev
Date: 2020-04-21T11:34:44+07:00
New Revision: a116f0fa868424f88b9276911935d68ef1f3e714
URL: https://github.com/llvm/llvm-project/commit/a116f0fa868424f88b9276911935d68ef1f3e714
DIFF: https://github.com/llvm/llvm-project/commit/a116f0fa868424f88b9276911935d68ef1f3e714.diff
LOG: [LICM][NFC] Reorder checks to speed up things slightly
Side effect check is made faster than potentially heavy other checks.
Added:
Modified:
llvm/lib/Transforms/Scalar/LICM.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index ed9d70fb2e78..ee822763b349 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -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;
More information about the llvm-commits
mailing list