[llvm] r318991 - [SCEV] NFC : Removing unnecessary check on outgoing branches of a branch instr.

Jatin Bhateja via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 25 18:01:02 PST 2017


Author: jbhateja
Date: Sat Nov 25 18:01:01 2017
New Revision: 318991

URL: http://llvm.org/viewvc/llvm-project?rev=318991&view=rev
Log:
[SCEV] NFC : Removing unnecessary check on outgoing branches of a branch 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

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=318991&r1=318990&r2=318991&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat Nov 25 18:01:01 2017
@@ -4092,8 +4092,7 @@ public:
     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 {




More information about the llvm-commits mailing list