Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33110 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index ebe4cec..d49898a 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -586,7 +586,7 @@
Constant *Compare = ConstantExpr::getICmp(ICmpInst::ICMP_SGT,
G1OC, G2OC);
if (ConstantInt *CV = dyn_cast<ConstantInt>(Compare)) {
- if (CV->getBoolValue()) // If they are comparable and G2 > G1
+ if (CV->getZExtValue()) // If they are comparable and G2 > G1
std::swap(GEP1Ops, GEP2Ops); // Make GEP1 < GEP2
break;
}
diff --git a/lib/Analysis/ConstantRange.cpp b/lib/Analysis/ConstantRange.cpp
index 6c2dce0..7a34420 100644
--- a/lib/Analysis/ConstantRange.cpp
+++ b/lib/Analysis/ConstantRange.cpp
@@ -64,7 +64,7 @@
}
static ConstantInt *Next(ConstantInt *CI) {
if (CI->getType() == Type::Int1Ty)
- return ConstantInt::get(!CI->getBoolValue());
+ return ConstantInt::get(Type::Int1Ty, !CI->getZExtValue());
Constant *Result = ConstantExpr::getAdd(CI,
ConstantInt::get(CI->getType(), 1));
@@ -75,14 +75,14 @@
Constant *C = ConstantExpr::getICmp(
(isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT), A, B);
assert(isa<ConstantInt>(C) && "Constant folding of integrals not impl??");
- return cast<ConstantInt>(C)->getBoolValue();
+ return cast<ConstantInt>(C)->getZExtValue();
}
static bool LTE(ConstantInt *A, ConstantInt *B, bool isSigned) {
Constant *C = ConstantExpr::getICmp(
(isSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE), A, B);
assert(isa<ConstantInt>(C) && "Constant folding of integrals not impl??");
- return cast<ConstantInt>(C)->getBoolValue();
+ return cast<ConstantInt>(C)->getZExtValue();
}
static bool GT(ConstantInt *A, ConstantInt *B, bool isSigned) {
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index ad16acc..27c9e62 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -1722,7 +1722,7 @@
// Evaluate the condition for this iteration.
Result = ConstantExpr::getICmp(predicate, Result, RHS);
if (!isa<ConstantInt>(Result)) break; // Couldn't decide for sure
- if (cast<ConstantInt>(Result)->getBoolValue() == false) {
+ if (cast<ConstantInt>(Result)->getZExtValue() == false) {
#if 0
cerr << "\n***\n*** Computed loop count " << *ItCst
<< "\n*** From global " << *GV << "*** BB: " << *L->getHeader()
@@ -1932,7 +1932,7 @@
// Couldn't symbolically evaluate.
if (!CondVal || CondVal->getType() != Type::Int1Ty) return UnknownValue;
- if (CondVal->getBoolValue() == ExitWhen) {
+ if (CondVal->getZExtValue() == ExitWhen) {
ConstantEvolutionLoopExitValue[PN] = PHIVal;
++NumBruteForceTripCountsComputed;
return SCEVConstant::get(ConstantInt::get(Type::Int32Ty, IterationNum));
@@ -2204,7 +2204,7 @@
if (ConstantInt *CB =
dyn_cast<ConstantInt>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT,
R1->getValue(), R2->getValue()))) {
- if (CB->getBoolValue() == false)
+ if (CB->getZExtValue() == false)
std::swap(R1, R2); // R1 is the minimum root now.
// We can only use this value if the chrec ends up with an exact zero
@@ -2429,7 +2429,7 @@
if (ConstantInt *CB =
dyn_cast<ConstantInt>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT,
R1->getValue(), R2->getValue()))) {
- if (CB->getBoolValue() == false)
+ if (CB->getZExtValue() == false)
std::swap(R1, R2); // R1 is the minimum root now.
// Make sure the root is not off by one. The returned iteration should