aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorZhou Sheng <zhousheng00@gmail.com>2007-01-11 12:24:14 +0000
committerZhou Sheng <zhousheng00@gmail.com>2007-01-11 12:24:14 +0000
commit6b6b6ef1677fa71b1072c2911b4c1f9524a558c9 (patch)
tree480ecf010ac5facd1bc29ab57441253691bb42d6 /lib/Analysis/BasicAliasAnalysis.cpp
parent057809ac1c78c3456e8f1481330fa2bcd2b85029 (diff)
For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt. Remove ConstantIntegral and ConstantBool from LLVM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index caabc86f3f..179f069716 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -434,7 +434,8 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
if (cast<PointerType>(
BasePtr->getType())->getElementType()->isSized()) {
for (unsigned i = 0; i != GEPOperands.size(); ++i)
- if (!isa<ConstantInt>(GEPOperands[i]))
+ if (!isa<ConstantInt>(GEPOperands[i]) ||
+ GEPOperands[i]->getType() == Type::BoolTy)
GEPOperands[i] =
Constant::getNullValue(GEPOperands[i]->getType());
int64_t Offset =
@@ -584,8 +585,8 @@ BasicAliasAnalysis::CheckGEPInstructions(
if (G1OC) {
Constant *Compare = ConstantExpr::getICmp(ICmpInst::ICMP_SGT,
G1OC, G2OC);
- if (ConstantBool *CV = dyn_cast<ConstantBool>(Compare)) {
- if (CV->getValue()) // If they are comparable and G2 > G1
+ if (ConstantInt *CV = dyn_cast<ConstantInt>(Compare)) {
+ if (CV->getBoolValue()) // If they are comparable and G2 > G1
std::swap(GEP1Ops, GEP2Ops); // Make GEP1 < GEP2
break;
}
@@ -608,13 +609,15 @@ BasicAliasAnalysis::CheckGEPInstructions(
// Is there anything to check?
if (GEP1Ops.size() > MinOperands) {
for (unsigned i = FirstConstantOper; i != MaxOperands; ++i)
- if (isa<ConstantInt>(GEP1Ops[i]) &&
+ if (isa<ConstantInt>(GEP1Ops[i]) &&
+ GEP1Ops[i]->getType() != Type::BoolTy &&
!cast<Constant>(GEP1Ops[i])->isNullValue()) {
// Yup, there's a constant in the tail. Set all variables to
// constants in the GEP instruction to make it suiteable for
// TargetData::getIndexedOffset.
for (i = 0; i != MaxOperands; ++i)
- if (!isa<ConstantInt>(GEP1Ops[i]))
+ if (!isa<ConstantInt>(GEP1Ops[i]) ||
+ GEP1Ops[i]->getType() == Type::BoolTy)
GEP1Ops[i] = Constant::getNullValue(GEP1Ops[i]->getType());
// Okay, now get the offset. This is the relative offset for the full
// instruction.
@@ -667,7 +670,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
const Value *Op2 = i < GEP2Ops.size() ? GEP2Ops[i] : 0;
// If they are equal, use a zero index...
if (Op1 == Op2 && BasePtr1Ty == BasePtr2Ty) {
- if (!isa<ConstantInt>(Op1))
+ if (!isa<ConstantInt>(Op1) || Op1->getType() == Type::BoolTy)
GEP1Ops[i] = GEP2Ops[i] = Constant::getNullValue(Op1->getType());
// Otherwise, just keep the constants we have.
} else {