Eliminate ConstantBool::True and ConstantBool::False. Instead, provide

ConstantBool::getTrue() and ConstantBool::getFalse().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30665 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2006-09-28 23:35:22 +00:00
parent 850ba99cb6
commit 47811b76ca
11 changed files with 2983 additions and 3981 deletions
+5 -4
View File
@@ -709,7 +709,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
// keep track of whether the global was initialized yet or not.
GlobalVariable *InitBool =
new GlobalVariable(Type::BoolTy, false, GlobalValue::InternalLinkage,
ConstantBool::False, GV->getName()+".init");
ConstantBool::getFalse(), GV->getName()+".init");
bool InitBoolUsed = false;
// Loop over all uses of GV, processing them in turn.
@@ -728,7 +728,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
switch (SCI->getOpcode()) {
default: assert(0 && "Unknown opcode!");
case Instruction::SetLT:
LV = ConstantBool::False; // X < null -> always false
LV = ConstantBool::getFalse(); // X < null -> always false
break;
case Instruction::SetEQ:
case Instruction::SetLE:
@@ -747,7 +747,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
} else {
StoreInst *SI = cast<StoreInst>(GV->use_back());
// The global is initialized when the store to it occurs.
new StoreInst(ConstantBool::True, InitBool, SI);
new StoreInst(ConstantBool::getTrue(), InitBool, SI);
SI->eraseFromParent();
}
@@ -859,7 +859,8 @@ static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal,
static void ShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
// Create the new global, initializing it to false.
GlobalVariable *NewGV = new GlobalVariable(Type::BoolTy, false,
GlobalValue::InternalLinkage, ConstantBool::False, GV->getName()+".b");
GlobalValue::InternalLinkage, ConstantBool::getFalse(),
GV->getName()+".b");
GV->getParent()->getGlobalList().insert(GV, NewGV);
Constant *InitVal = GV->getInitializer();