[llvm] [LV] Add vplan folds for urem(X, PowerOf2) -> and(X, PowerOf2 - 1) (PR #212198)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 02:40:20 PDT 2026


================
@@ -1366,6 +1366,15 @@ static void simplifyRecipe(VPSingleDefRecipe *Def) {
   }
 
   const APInt *APC;
+  // TODO: Enable optimizations in the vector preheader in a follow-up PR.
+  // This check currently means we only simplify before region dissolution.
+  VPBasicBlock *Preheader = Plan->getVectorPreheader();
----------------
david-arm wrote:

Wow, then `getVectorPreheader` is really bad and needs improving as well it seems. :) Yes, I intended to follow-up with a PR that was more inclusive but it won't land immediately. The alternative would be to revert this PR and do this all in one go, changing over 300+ tests in this PR.

https://github.com/llvm/llvm-project/pull/212198


More information about the llvm-commits mailing list