[PATCH] D25287: [SCEVAffinator] Make precise modular math more correct.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 04:02:29 PDT 2016


Meinersbur added a comment.

Thank you for the explanation. I'll will look at it again after the update.



================
Comment at: lib/Support/SCEVAffinator.cpp:41
+// precisely.
+static unsigned const MaxSmallBitWidth = 7;
 
----------------
How is this magic number determined? Why is it constant and does not depend on the the type's width?


================
Comment at: lib/Support/SCEVAffinator.cpp:250
+      PWAC.first = addModuloSemantic(PWAC.first, Expr->getType());
     PWAC = checkForWrapping(Expr, PWAC);
   }
----------------
efriedma wrote:
> jdoerfert wrote:
> > Did you omit the `else` here on purpose? If we add modulo semantics there is no wrapping (by construction)
> I can.  checkForWrapping is essentially a no-op on the result of addModuloSemantic, since the value can't actually be out of range.
I don't understand why when the type's bitwidth is below a threshold, we always add modulo ie. ignore the nsw flag?


Repository:
  rL LLVM

https://reviews.llvm.org/D25287





More information about the llvm-commits mailing list