[PATCH] D28501: Add an assert for hasLoopInvariantOperands

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 16:50:42 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL291516: Add an assert for hasLoopInvariantOperands (authored by trentxintong).

Changed prior to commit:
  https://reviews.llvm.org/D28501?vs=83744&id=83745#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28501

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


Index: llvm/trunk/lib/Transforms/Scalar/LoopSink.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopSink.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LoopSink.cpp
@@ -283,6 +283,9 @@
   // sinked.
   for (auto II = Preheader->rbegin(), E = Preheader->rend(); II != E;) {
     Instruction *I = &*II++;
+    // No need to check for instruction's operands are loop invariant.
+    assert(L.hasLoopInvariantOperands(I) &&
+           "Insts in a loop's preheader should have loop invariant operands!");
     if (!canSinkOrHoistInst(*I, &AA, &DT, &L, &CurAST, nullptr))
       continue;
     if (sinkInstruction(L, *I, ColdLoopBBs, LoopBlockNumber, LI, DT, BFI))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28501.83745.patch
Type: text/x-patch
Size: 716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170110/b46bfe45/attachment.bin>


More information about the llvm-commits mailing list