Don't use a potentially expensive shift if all we want is one set bit.
[oota-llvm.git] / lib / Support / ConstantRange.cpp
index d770381dcd5a3f784a4dadc8fdde3f5f4adffb71..bb38cd15e634144b987ba461e94e7c6338445fea 100644 (file)
@@ -433,7 +433,7 @@ ConstantRange ConstantRange::zeroExtend(uint32_t DstTySize) const {
     APInt LowerExt(DstTySize, 0);
     if (!Upper) // special case: [X, 0) -- not really wrapping around
       LowerExt = Lower.zext(DstTySize);
-    return ConstantRange(LowerExt, APInt(DstTySize, 1).shl(SrcTySize));
+    return ConstantRange(LowerExt, APInt::getOneBitSet(DstTySize, SrcTySize));
   }
 
   return ConstantRange(Lower.zext(DstTySize), Upper.zext(DstTySize));