Skip to content

Commit

Permalink
[SCEV] NFC : Removing unnecessary check on outgoing branches of a bra…
Browse files Browse the repository at this point in the history
…nch instr.

Summary:
For a given loop, getLoopLatch returns a non-null value
when a loop has only one latch block. In the modified
context a check on both the outgoing branches of a terminator instruction (of latch) to same header is redundant.

Reviewers: jbhateja

Reviewed By: jbhateja

Subscribers: sanjoy

Differential Revision: https://reviews.llvm.org/D40460

llvm-svn: 318991
  • Loading branch information
jbhateja committed Nov 26, 2017
1 parent c4eb505 commit a1da5e4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions llvm/lib/Analysis/ScalarEvolution.cpp
Expand Up @@ -4092,8 +4092,7 @@ class SCEVBackedgeConditionFolder
Value *BECond = nullptr;
if (BasicBlock *Latch = L->getLoopLatch()) {
BranchInst *BI = dyn_cast<BranchInst>(Latch->getTerminator());
if (BI && BI->isConditional() &&
BI->getSuccessor(0) != BI->getSuccessor(1)) {
if (BI && BI->isConditional()) {
BECond = BI->getCondition();
IsPosBECond = BI->getSuccessor(0) == L->getHeader();
} else {
Expand Down

0 comments on commit a1da5e4

Please sign in to comment.