[PATCH] D63809: [HardwareLoops] Loop counter guard Loop intrinsic

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 23:49:05 PDT 2019


samparker marked 2 inline comments as done.
samparker added inline comments.


================
Comment at: lib/CodeGen/HardwareLoops.cpp:269
+    BasicBlock *Preheader = L->getLoopPreheader();
+    if (!Preheader->getSinglePredecessor())
+      return false;
----------------
SjoerdMeijer wrote:
> Is there always a preheader? Can we dereference a nullptr here?
Just before landing here we create a preheader if one doesn't exist.


================
Comment at: lib/CodeGen/HardwareLoops.cpp:276
+
+    return cast<BranchInst>(Pred->getTerminator())->isConditional();
+  };
----------------
SjoerdMeijer wrote:
> perhaps silly question, I guess the assumption here is that is if this is a conditional then it must be the loop check, but is that always true?
Well it certainly is controlling whether the loop is entered or not... I had the same thought tbh but I reasoned that any other condition of entering a loop would be handled before the iteration condition - i will add some tests along these lines though.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63809





More information about the llvm-commits mailing list