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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 13:21:17 PDT 2023


nikic added a comment.

Please restrict this patch to handle select only. Let's handle and/or in a followup.



================
Comment at: llvm/lib/Transforms/Utils/LoopPeel.cpp:352
+    MaxPeelCount =
+        std::min((unsigned)SC->getAPInt().getZExtValue() - 1, MaxPeelCount);
+
----------------
Why is this code needed now?


================
Comment at: llvm/lib/Transforms/Utils/LoopPeel.cpp:452
+      if (match(&I, m_CombineAnd(m_Value(LHS), m_Value(RHS))) ||
+          match(&I, m_CombineOr(m_Value(LHS), m_Value(RHS)))) {
+        ComputePeelCount(LHS);
----------------
You probably meant `m_And`/`m_Or` here. `m_CombineAnd`/`m_CombineOr` will put `&I` into both LHS and RHS, which is certainly not what you intended.


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