[PATCH] D70043: [ConstantRange] Add `mulWithNoWrap()` method

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 03:21:35 PST 2019


nikic added inline comments.


================
Comment at: llvm/lib/IR/ConstantRange.cpp:1003
+    for (const APInt &L : {getUnsignedMin(), getUnsignedMax()}) {
+      for (const APInt &R : {Other.getUnsignedMin(), Other.getUnsignedMax()}) {
+        bool Overflow;
----------------
Why do these fetch the unsigned min/max for the signed multiplication case?


================
Comment at: llvm/lib/IR/ConstantRange.cpp:1022
+
+    if (NoWrapKind & OBO::NoSignedWrap) {
+      (void)getUnsignedMin().smul_ov(Other.getUnsignedMin(), Overflow);
----------------
Why do we need to specially handle the nuw+nsw combination here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70043





More information about the llvm-commits mailing list