[llvm] r357886 - [ConstantRange] Delete redundnt {z, s}extOrSelf for multiplication

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 00:29:25 PDT 2019


Author: maskray
Date: Mon Apr  8 00:29:24 2019
New Revision: 357886

URL: http://llvm.org/viewvc/llvm-project?rev=357886&view=rev
Log:
[ConstantRange] Delete redundnt {z,s}extOrSelf for multiplication

These calls are redundant because the quotients have the same BitWidth
as MinValue/MaxValue.

Modified:
    llvm/trunk/lib/IR/ConstantRange.cpp

Modified: llvm/trunk/lib/IR/ConstantRange.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/ConstantRange.cpp?rev=357886&r1=357885&r2=357886&view=diff
==============================================================================
--- llvm/trunk/lib/IR/ConstantRange.cpp (original)
+++ llvm/trunk/lib/IR/ConstantRange.cpp Mon Apr  8 00:29:24 2019
@@ -314,13 +314,6 @@ ConstantRange::makeGuaranteedNoWrapRegio
         Lower = APIntOps::RoundingSDiv(MinValue, V, APInt::Rounding::UP);
         Upper = APIntOps::RoundingSDiv(MaxValue, V, APInt::Rounding::DOWN);
       }
-      if (Unsigned) {
-        Lower = Lower.zextOrSelf(BitWidth);
-        Upper = Upper.zextOrSelf(BitWidth);
-      } else {
-        Lower = Lower.sextOrSelf(BitWidth);
-        Upper = Upper.sextOrSelf(BitWidth);
-      }
       // ConstantRange ctor take a half inclusive interval [Lower, Upper + 1).
       // Upper + 1 is guanranteed not to overflow, because |divisor| > 1. 0, -1,
       // and 1 are already handled as special cases.




More information about the llvm-commits mailing list