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

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 02:59:12 PDT 2019


SjoerdMeijer added a comment.

Just a first look, some questions inline.



================
Comment at: include/llvm/IR/Intrinsics.td:1195
+// will execute. Also test that the given count is not zero.
+def int_test_set_loop_iterations :
+  Intrinsic<[llvm_i1_ty], [llvm_anyint_ty], [IntrNoDuplicate]>;
----------------
Perhaps it's blindingly obvious, but maybe a comment that this is useful for while-do hardware kind of loops?


================
Comment at: lib/CodeGen/HardwareLoops.cpp:269
+    BasicBlock *Preheader = L->getLoopPreheader();
+    if (!Preheader->getSinglePredecessor())
+      return false;
----------------
Is there always a preheader? Can we dereference a nullptr here?


================
Comment at: lib/CodeGen/HardwareLoops.cpp:276
+
+    return cast<BranchInst>(Pred->getTerminator())->isConditional();
+  };
----------------
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?


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