[PATCH] D95521: [SCEV] Apply loop guards to trailing zero bits

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 31 01:58:51 PST 2021


fhahn added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:13266
+      // zero %v's D low bits.
+      if (auto ZExt = dyn_cast<SCEVZeroExtendExpr>(LHS)) {
+        if (auto Trunc = dyn_cast<SCEVTruncateExpr>(ZExt->getOperand(0)))
----------------
Here we basically are matching a SCEV `URem` expression, right? There's a helper for that (`matchURem`), which should help to simplify the code a bit? 


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:13277
+              auto ClearLowBits = getMulExpr(
+                  getUDivExpr(LHSUnknown, Divisor), Divisor,
+                  (SCEV::NoWrapFlags)(SCEV::FlagNUW | SCEV::FlagNSW));
----------------
Here we could just re-use the existing `URem` expression?


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

https://reviews.llvm.org/D95521



More information about the llvm-commits mailing list