[llvm] r291132 - Remove a unnecessary hasLoopInvariantOperands check in loop sink.

Xin Tong via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 08:52:37 PST 2017


Author: trentxintong
Date: Thu Jan  5 10:52:37 2017
New Revision: 291132

URL: http://llvm.org/viewvc/llvm-project?rev=291132&view=rev
Log:
Remove a unnecessary hasLoopInvariantOperands check in loop sink.

Summary:
Preheader instruction's operands will always be invariant w.r.t. the loop which its the preheader
for.

Memory aliases are handled in canSinkOrHoistInst.

Reviewers: danielcdh, davidxl

Subscribers: mzolotukhin, llvm-commits

Differential Revision: https://reviews.llvm.org/D28270

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopSink.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopSink.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopSink.cpp?rev=291132&r1=291131&r2=291132&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopSink.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopSink.cpp Thu Jan  5 10:52:37 2017
@@ -283,8 +283,7 @@ static bool sinkLoopInvariantInstruction
   // sinked.
   for (auto II = Preheader->rbegin(), E = Preheader->rend(); II != E;) {
     Instruction *I = &*II++;
-    if (!L.hasLoopInvariantOperands(I) ||
-        !canSinkOrHoistInst(*I, &AA, &DT, &L, &CurAST, nullptr))
+    if (!canSinkOrHoistInst(*I, &AA, &DT, &L, &CurAST, nullptr))
       continue;
     if (sinkInstruction(L, *I, ColdLoopBBs, LoopBlockNumber, LI, DT, BFI))
       Changed = true;




More information about the llvm-commits mailing list