Index: llvm/lib/IR/ConstantRange.cpp =================================================================== --- llvm/lib/IR/ConstantRange.cpp +++ llvm/lib/IR/ConstantRange.cpp @@ -1479,7 +1479,7 @@ APInt OtherMax = Other.getUnsignedMax(); // There's overflow! - if (OtherMax.ugt(Max.countl_zero())) + if (OtherMax.ugt(Max.abs().countl_zero())) return getFull(); // FIXME: implement the other tricky cases @@ -1487,6 +1487,10 @@ Min <<= Other.getUnsignedMin(); Max <<= OtherMax; + // For negitive value c, its shifted range is [c<