summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/ConstantRange.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/ConstantRange.cpp')
-rw-r--r--llvm/lib/IR/ConstantRange.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp
index eda31f73473..f07ec9d5a3f 100644
--- a/llvm/lib/IR/ConstantRange.cpp
+++ b/llvm/lib/IR/ConstantRange.cpp
@@ -1006,8 +1006,12 @@ ConstantRange::shl(const ConstantRange &Other) const {
APInt max = getUnsignedMax();
APInt Other_umax = Other.getUnsignedMax();
+ // If we are shifting by maximum amount of
+ // zero return return the original range.
+ if (Other_umax.isNullValue())
+ return *this;
// there's overflow!
- if (Other_umax.uge(max.countLeadingZeros()))
+ if (Other_umax.ugt(max.countLeadingZeros()))
return getFull();
// FIXME: implement the other tricky cases
OpenPOWER on IntegriCloud