[PATCH] D65464: [LoopFusion] Add ability to fuse guarded loops

Ettore Tiotto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 07:24:31 PDT 2019


etiotto added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:166
+        Latch(L->getLoopLatch()), L(L), Valid(true), GuardBranch(nullptr),
+        DT(DT), PDT(PDT), ORE(ORE) {
+
----------------
I think it would be better to pass a const reference to the DominatorTree and PostDominatorTree given that they should never be nullptr ?


================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:172
+    if (isRotated())
+      GuardBranch = L->getLoopGuardBranch();
 
----------------
It would be better to initialize GuardBranch in the init. list: GuardBranch(L->getLoopGuardBranch()) and have getLoopGuardBranch() return nullptr if the loop guard cannot be identified for whatever reason.


================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:251
+  BasicBlock *getNonLoopBlock() const {
+    assert(GuardBranch && "Only valid on guarded loops.");
+    return (GuardBranch->getSuccessor(0) == Preheader)
----------------
assert GuarbBranch->isConditional()


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65464





More information about the llvm-commits mailing list