From 6703253d58c3fb04aa51653f3e81d8876971603a Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Fri, 8 Nov 2019 10:32:56 +0300 Subject: [PATCH] [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.. --- lib/IR/ConstantRange.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/IR/ConstantRange.cpp b/lib/IR/ConstantRange.cpp index 63a6494fc17..e9bdf419352 100644 --- a/lib/IR/ConstantRange.cpp +++ b/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)); }