From e6eef49f05dadd781a708e68c2fc91ff5aff64a1 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 26 Mar 2019 22:37:26 +0000 Subject: [ConstantRange] Exclude full set from isSignWrappedSet() Split off from D59749. This uses a simpler and more efficient implementation of isSignWrappedSet(), and considers full sets as non-wrapped, to be consistent with isWrappedSet(). Otherwise the behavior is unchanged. There are currently only two users of this function and both already check for isFullSet() || isSignWrappedSet(), so this is not going to cause a change in overall behavior. Differential Revision: https://reviews.llvm.org/D59848 llvm-svn: 357039 --- llvm/lib/IR/ConstantRange.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'llvm/lib/IR/ConstantRange.cpp') diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp index 732f5c03d4e..0c2a3a86597 100644 --- a/llvm/lib/IR/ConstantRange.cpp +++ b/llvm/lib/IR/ConstantRange.cpp @@ -349,8 +349,7 @@ bool ConstantRange::isWrappedSet() const { } bool ConstantRange::isSignWrappedSet() const { - return contains(APInt::getSignedMaxValue(getBitWidth())) && - contains(APInt::getSignedMinValue(getBitWidth())); + return Lower.sgt(Upper) && !Upper.isMinSignedValue(); } APInt ConstantRange::getSetSize() const { -- cgit v1.2.3