[PATCH] D151052: [LoopUnroll] Peel iterations based on select conditions

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 05:33:07 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/LoopPeel.cpp:352
+    MaxPeelCount =
+        std::min((unsigned)SC->getAPInt().getZExtValue() - 1, MaxPeelCount);
+
----------------
The getZExtValue() here can assert if we the BECount is larger than 64 bits. You can use getLimitedValue() instead.

> When peeling only branch instructions, we avoid this by ignoring the branch condition of the latch block. But with this patch, we don't ignore and/or's that are used by the latch branch.

FWIW, I think that's a problem in your and/or handling: You shouldn't pick up random and/ors, but only those rooted at a br or select.

But anyway, I don't mind adding the check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151052



More information about the llvm-commits mailing list