[PATCH] D28270: Remove a unnecessary hasLoopInvariantOperands check in loop sink.

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 17:26:28 PST 2017


trentxintong created this revision.
trentxintong added reviewers: danielcdh, davidxl.
trentxintong added a subscriber: llvm-commits.
Herald added a subscriber: mzolotukhin.

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

Memory aliases are handled in canSinkOrHoistInst.


https://reviews.llvm.org/D28270

Files:
  lib/Transforms/Scalar/LoopSink.cpp


Index: lib/Transforms/Scalar/LoopSink.cpp
===================================================================
--- lib/Transforms/Scalar/LoopSink.cpp
+++ lib/Transforms/Scalar/LoopSink.cpp
@@ -283,8 +283,7 @@
   // 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28270.82981.patch
Type: text/x-patch
Size: 617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170104/1e2000b0/attachment.bin>


More information about the llvm-commits mailing list