[PATCH] D110492: [LoopInfo] Return conditional branch of preheader's predecessor if loop's exit has exactly two predecessors which are latch and guard

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 27 07:28:46 PDT 2021


Whitney added a comment.

Why is the input to DSE not in simplified form? By running `-loop-simplify` after the IR you provided resolves this problem.



================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:396
+      return GuardBI;
+    }
+    return nullptr;
----------------
no need braces for single statement block.


================
Comment at: llvm/unittests/Analysis/LoopInfoTest.cpp:1587
+    EXPECT_EQ(L->isGuarded(), true);
+    EXPECT_NE(L->getLoopGuardBranch(), nullptr);
+  });
----------------
isn't it better to make sure is `FI->getTerminator()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110492/new/

https://reviews.llvm.org/D110492



More information about the llvm-commits mailing list