summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorXin Tong <trent.xin.tong@gmail.com>2017-01-10 00:39:49 +0000
committerXin Tong <trent.xin.tong@gmail.com>2017-01-10 00:39:49 +0000
commit12c8cb3745e4ba2025816b57b18acd72d6e6b891 (patch)
tree80da06fd2d7a6da1a65347919df8e8294102d0f7 /llvm/lib
parentff27fec26bee63626b8ff57373b5ad0b86371eca (diff)
downloadbcm5719-llvm-12c8cb3745e4ba2025816b57b18acd72d6e6b891.tar.gz
bcm5719-llvm-12c8cb3745e4ba2025816b57b18acd72d6e6b891.zip
Add an assert for hasLoopInvariantOperands
Summary: Add an assert for hasLoopInvariantOperands Reviewers: danielcdh, sanjoy Subscribers: mzolotukhin, llvm-commits Differential Revision: https://reviews.llvm.org/D28501 llvm-svn: 291516
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopSink.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopSink.cpp b/llvm/lib/Transforms/Scalar/LoopSink.cpp
index f6435449777..800a9b4c69c 100644
--- a/llvm/lib/Transforms/Scalar/LoopSink.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSink.cpp
@@ -283,6 +283,9 @@ static bool sinkLoopInvariantInstructions(Loop &L, AAResults &AA, LoopInfo &LI,
// 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))
OpenPOWER on IntegriCloud