Skip to content

Commit

Permalink
[LoopUnrollAndJam] Fixed null check after dereferencing warning. NFCI.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbolvansky committed Nov 3, 2019
1 parent 505a44a commit 60cb193
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
Expand Up @@ -177,6 +177,7 @@ LoopUnrollResult llvm::UnrollAndJamLoop(

// When we enter here we should have already checked that it is safe
BasicBlock *Header = L->getHeader();
assert(Header && "No header.");
assert(L->getSubLoops().size() == 1);
Loop *SubLoop = *L->begin();

Expand Down Expand Up @@ -247,8 +248,9 @@ LoopUnrollResult llvm::UnrollAndJamLoop(

BasicBlock *Preheader = L->getLoopPreheader();
BasicBlock *LatchBlock = L->getLoopLatch();
assert(Preheader && "No preheader");
assert(LatchBlock && "No latch block");
BranchInst *BI = dyn_cast<BranchInst>(LatchBlock->getTerminator());
assert(Preheader && LatchBlock && Header);
assert(BI && !BI->isUnconditional());
bool ContinueOnTrue = L->contains(BI->getSuccessor(0));
BasicBlock *LoopExit = BI->getSuccessor(ContinueOnTrue);
Expand Down

0 comments on commit 60cb193

Please sign in to comment.