[PATCH] D109821: [ScalarEvolution] Infer loop max trip count from array accesses

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 15 08:35:51 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:7192
+  // We can't infer from Array in Irregular Loop.
+  // FIXME: It's hard to infer if loop has multi-exiting blocks.
+  // FIXME: It's hard to infer loop bound from array operated in Nested Loop.
----------------
Why are multiple exits a problem? This is calculating an upper bound, so even if we exit before that should still be a valid max trip count. (If multiple exits were a problem, you would also have to guard against abnormal exits.)


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:12474
+
+  if (SE->getConstantMaxTripCountFromArray(L)) {
+    OS << "Loop ";
----------------
Shouldn't we be integrating this in the main SCEV trip count calculation, rather than having it as a separate facility?


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

https://reviews.llvm.org/D109821



More information about the llvm-commits mailing list