From 72a21ad6c9cdbb41c8f17de2318fa469c013caef Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Fri, 8 Nov 2019 10:32:56 +0300 Subject: [CR] ConstantRange::sshl_sat(): check sigdness of the min/max, not ranges This was pointed out in review, but forgot to stage this change into the commit itself.. --- llvm/lib/IR/ConstantRange.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/IR/ConstantRange.cpp') diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp index 63a6494fc17..e9bdf419352 100644 --- a/llvm/lib/IR/ConstantRange.cpp +++ b/llvm/lib/IR/ConstantRange.cpp @@ -1348,8 +1348,8 @@ ConstantRange ConstantRange::sshl_sat(const ConstantRange &Other) const { APInt Min = getSignedMin(), Max = getSignedMax(); APInt ShAmtMin = Other.getUnsignedMin(), ShAmtMax = Other.getUnsignedMax(); - APInt NewL = Min.sshl_sat(isAllNonNegative() ? ShAmtMin : ShAmtMax); - APInt NewU = Max.sshl_sat(isAllNegative() ? ShAmtMin : ShAmtMax) + 1; + APInt NewL = Min.sshl_sat(Min.isNonNegative() ? ShAmtMin : ShAmtMax); + APInt NewU = Max.sshl_sat(Max.isNegative() ? ShAmtMin : ShAmtMax) + 1; return getNonEmpty(std::move(NewL), std::move(NewU)); } -- cgit v1.2.3