From cf9e07dea8aad32c5e7e2631d135566b20e1763c Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Mon, 13 Jul 2009 02:49:08 +0000 Subject: Fix a bug summing two full sets. The overflow checking doesn't handle sets as large as the full set, only those one size smaller. Thanks to Daniel Dunbar who found this bug using Klee! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75443 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ConstantRange.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/Support/ConstantRange.cpp') diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index 04a1b68e07..8bab537795 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -533,6 +533,8 @@ ConstantRange ConstantRange::add(const ConstantRange &Other) const { if (isEmptySet() || Other.isEmptySet()) return ConstantRange(getBitWidth(), /*isFullSet=*/false); + if (isFullSet() || Other.isFullSet()) + return ConstantRange(getBitWidth(), /*isFullSet=*/true); APInt Spread_X = getSetSize(), Spread_Y = Other.getSetSize(); APInt NewLower = getLower() + Other.getLower(); -- cgit v1.2.3-18-g5258