[PATCH] D28501: Add an assert for hasLoopInvariantOperands

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


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

Add an assert for hasLoopInvariantOperands


https://reviews.llvm.org/D28501

Files:
  lib/Transforms/Scalar/LoopSink.cpp


Index: lib/Transforms/Scalar/LoopSink.cpp
===================================================================
--- lib/Transforms/Scalar/LoopSink.cpp
+++ 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) &&
+           "Inst's operands should always be invariant to this loop");
     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.83741.patch
Type: text/x-patch
Size: 674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170110/908abcf7/attachment.bin>


More information about the llvm-commits mailing list