From: Reid Spencer Date: Sun, 17 Dec 2006 06:07:30 +0000 (+0000) Subject: Fix problems in the CBE and InstructionCombining which use the isMaxValue X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=691458697c7e71e9b75319ef4b6b3067a525f7d9;p=oota-llvm.git Fix problems in the CBE and InstructionCombining which use the isMaxValue and isMinValue methods of ConstantInt. These have been broken since the isSigned parameter was added. It is necessary to use the signed version of the type in the call to isValueValidForType or else incorrect results are returned. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32637 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 079f156cca3..1940e5b831e 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -205,7 +205,7 @@ public: int64_t V = getSExtValue(); if (V < 0) return false; // Be careful about wrap-around on 'long's ++V; - return !isValueValidForType(getType(), V) || V < 0; + return !isValueValidForType(getType()->getSignedVersion(), V) || V < 0; } return isAllOnesValue(); } @@ -219,7 +219,7 @@ public: int64_t V = getSExtValue(); if (V > 0) return false; // Be careful about wrap-around on 'long's --V; - return !isValueValidForType(getType(), V) || V > 0; + return !isValueValidForType(getType()->getSignedVersion(), V) || V > 0; } return getZExtValue() == 0; }