]> granicus.if.org Git - llvm/commitdiff
[ConstantRange] Delete redundnt {z,s}extOrSelf for multiplication
authorFangrui Song <maskray@google.com>
Mon, 8 Apr 2019 07:29:24 +0000 (07:29 +0000)
committerFangrui Song <maskray@google.com>
Mon, 8 Apr 2019 07:29:24 +0000 (07:29 +0000)
These calls are redundant because the quotients have the same BitWidth
as MinValue/MaxValue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357886 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/ConstantRange.cpp

index f48fe9f737d31d35326297aa47e058d16d7036f8..391d9653db5ca831c57e9bf225e9ddaf43ca46b8 100644 (file)
@@ -314,13 +314,6 @@ ConstantRange::makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp,
         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.