diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-11 18:21:29 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-11 18:21:29 +0000 |
commit | 4fe16d607d11e29d742208894909733f5ad01f8f (patch) | |
tree | a669ba57373e87d31c3af6f301fe4a61f773f4b3 /lib/Transforms | |
parent | 34dceb47573b0aedd188b5e72bb848ba29a4960f (diff) |
Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 10 | ||||
-rw-r--r-- | lib/Transforms/IPO/LowerSetJmp.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/SimplifyLibCalls.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/CondPropagate.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/CorrelatedExprs.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 30 | ||||
-rw-r--r-- | lib/Transforms/Scalar/LoopUnswitch.cpp | 12 | ||||
-rw-r--r-- | lib/Transforms/Scalar/PredicateSimplifier.cpp | 6 | ||||
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 6 | ||||
-rw-r--r-- | lib/Transforms/Utils/CodeExtractor.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 4 |
11 files changed, 39 insertions, 39 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index c1944dbe95..ce30477c87 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -710,7 +710,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV, // If there is a comparison against null, we will insert a global bool to // keep track of whether the global was initialized yet or not. GlobalVariable *InitBool = - new GlobalVariable(Type::BoolTy, false, GlobalValue::InternalLinkage, + new GlobalVariable(Type::Int1Ty, false, GlobalValue::InternalLinkage, ConstantInt::getFalse(), GV->getName()+".init"); bool InitBoolUsed = false; @@ -1139,13 +1139,13 @@ static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal, /// values ever stored into GV are its initializer and OtherVal. static void ShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) { // Create the new global, initializing it to false. - GlobalVariable *NewGV = new GlobalVariable(Type::BoolTy, false, + GlobalVariable *NewGV = new GlobalVariable(Type::Int1Ty, false, GlobalValue::InternalLinkage, ConstantInt::getFalse(), GV->getName()+".b"); GV->getParent()->getGlobalList().insert(GV, NewGV); Constant *InitVal = GV->getInitializer(); - assert(InitVal->getType() != Type::BoolTy && "No reason to shrink to bool!"); + assert(InitVal->getType() != Type::Int1Ty && "No reason to shrink to bool!"); // If initialized to zero and storing one into the global, we can use a cast // instead of a select to synthesize the desired value. @@ -1341,7 +1341,7 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV, // Otherwise, if the global was not a boolean, we can shrink it to be a // boolean. if (Constant *SOVConstant = dyn_cast<Constant>(GS.StoredOnceValue)) - if (GV->getType()->getElementType() != Type::BoolTy && + if (GV->getType()->getElementType() != Type::Int1Ty && !GV->getType()->getElementType()->isFloatingPoint() && !GS.HasPHIUser) { DOUT << " *** SHRINKING TO BOOL: " << *GV; @@ -1801,7 +1801,7 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal, dyn_cast<ConstantInt>(getVal(Values, BI->getCondition())); // Cannot determine. - if (!Cond || Cond->getType() != Type::BoolTy) + if (!Cond || Cond->getType() != Type::Int1Ty) return false; NewBB = BI->getSuccessor(!Cond->getBoolValue()); } diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index ab6ee23cbb..a7da282c6a 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -223,7 +223,7 @@ bool LowerSetJmp::doInitialization(Module& M) // bool __llvm_sjljeh_is_longjmp_exception() IsLJException = M.getOrInsertFunction("__llvm_sjljeh_is_longjmp_exception", - Type::BoolTy, (Type *)0); + Type::Int1Ty, (Type *)0); // int __llvm_sjljeh_get_longjmp_value() GetLJValue = M.getOrInsertFunction("__llvm_sjljeh_get_longjmp_value", diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp index 483c5702c7..d2ab638288 100644 --- a/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp @@ -940,7 +940,7 @@ static bool IsOnlyUsedInEqualsZeroComparison(Instruction *I) { cast<Constant>(IC->getOperand(1))->isNullValue()) continue; } else if (CastInst *CI = dyn_cast<CastInst>(User)) - if (CI->getType() == Type::BoolTy) + if (CI->getType() == Type::Int1Ty) continue; // Unknown instruction. return false; diff --git a/lib/Transforms/Scalar/CondPropagate.cpp b/lib/Transforms/Scalar/CondPropagate.cpp index 4ca5c5e7b7..65e8c8d1de 100644 --- a/lib/Transforms/Scalar/CondPropagate.cpp +++ b/lib/Transforms/Scalar/CondPropagate.cpp @@ -134,7 +134,7 @@ void CondProp::SimplifyPredecessors(BranchInst *BI) { // possible, and to avoid invalidating "i". for (unsigned i = PN->getNumIncomingValues(); i != 0; --i) if (ConstantInt *CB = dyn_cast<ConstantInt>(PN->getIncomingValue(i-1))) { - if (CB->getType() != Type::BoolTy) continue; + if (CB->getType() != Type::Int1Ty) continue; // If we have a constant, forward the edge from its current to its // ultimate destination. bool PHIGone = PN->getNumIncomingValues() == 2; diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp index 44d3ad5cc2..09d5c07060 100644 --- a/lib/Transforms/Scalar/CorrelatedExprs.cpp +++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp @@ -833,7 +833,7 @@ void CEE::PropagateEquality(Value *Op0, Value *Op1, RegionInfo &RI) { // it's a constant, then see if the other one is one of a setcc instruction, // an AND, OR, or XOR instruction. // - if (Op1->getType() == Type::BoolTy) + if (Op1->getType() == Type::Int1Ty) if (ConstantInt *CB = dyn_cast<ConstantInt>(Op1)) { if (Instruction *Inst = dyn_cast<Instruction>(Op0)) { diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index b06cffd24a..bf4f5f3e23 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1626,7 +1626,7 @@ static Instruction *FoldOpIntoSelect(Instruction &Op, SelectInst *SI, if (isa<Constant>(TV) || isa<Constant>(FV)) { // Bool selects with constant operands can be folded to logical ops. - if (SI->getType() == Type::BoolTy) return 0; + if (SI->getType() == Type::Int1Ty) return 0; Value *SelectTrueVal = FoldOperationIntoSelectOperand(Op, TV, IC); Value *SelectFalseVal = FoldOperationIntoSelectOperand(Op, FV, IC); @@ -2203,11 +2203,11 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { // formed. CastInst *BoolCast = 0; if (ZExtInst *CI = dyn_cast<ZExtInst>(I.getOperand(0))) - if (CI->getOperand(0)->getType() == Type::BoolTy) + if (CI->getOperand(0)->getType() == Type::Int1Ty) BoolCast = CI; if (!BoolCast) if (ZExtInst *CI = dyn_cast<ZExtInst>(I.getOperand(1))) - if (CI->getOperand(0)->getType() == Type::BoolTy) + if (CI->getOperand(0)->getType() == Type::Int1Ty) BoolCast = CI; if (BoolCast) { if (ICmpInst *SCI = dyn_cast<ICmpInst>(BoolCast->getOperand(0))) { @@ -4284,7 +4284,7 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { return ReplaceInstUsesWith(I, ConstantInt::get(isTrueWhenEqual(I))); if (isa<UndefValue>(Op1)) // fcmp pred X, undef -> undef - return ReplaceInstUsesWith(I, UndefValue::get(Type::BoolTy)); + return ReplaceInstUsesWith(I, UndefValue::get(Type::Int1Ty)); // Handle fcmp with constant RHS if (Constant *RHSC = dyn_cast<Constant>(Op1)) { @@ -4336,7 +4336,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { return ReplaceInstUsesWith(I, ConstantInt::get(isTrueWhenEqual(I))); if (isa<UndefValue>(Op1)) // X icmp undef -> undef - return ReplaceInstUsesWith(I, UndefValue::get(Type::BoolTy)); + return ReplaceInstUsesWith(I, UndefValue::get(Type::Int1Ty)); // icmp of GlobalValues can never equal each other as long as they aren't // external weak linkage type. @@ -4354,7 +4354,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { return ReplaceInstUsesWith(I, ConstantInt::get(!isTrueWhenEqual(I))); // icmp's with boolean values can always be turned into bitwise operations - if (Ty == Type::BoolTy) { + if (Ty == Type::Int1Ty) { switch (I.getPredicate()) { default: assert(0 && "Invalid icmp instruction!"); case ICmpInst::ICMP_EQ: { // icmp eq bool %A, %B -> ~(A^B) @@ -5282,7 +5282,7 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { // // However, it is OK if SrcTy is bool (See cast-set.ll testcase) // OR operation is EQ/NE. - if (isSignedExt == isSignedCmp || SrcTy == Type::BoolTy || ICI.isEquality()) + if (isSignedExt == isSignedCmp || SrcTy == Type::Int1Ty || ICI.isEquality()) return new ICmpInst(ICI.getPredicate(), LHSCIOp, Res1); else return 0; @@ -6250,7 +6250,7 @@ Instruction *InstCombiner::visitTrunc(CastInst &CI) { // Turn 'trunc (lshr X, Y) to bool' into '(X & (1 << Y)) != 0'. This is // more LLVM instructions, but allows '1 << Y' to be hoisted if // loop-invariant and CSE'd. - if (CI.getType() == Type::BoolTy && SrcI->hasOneUse()) { + if (CI.getType() == Type::Int1Ty && SrcI->hasOneUse()) { Value *One = ConstantInt::get(SrcI->getType(), 1); Value *V = InsertNewInstBefore(new ShiftInst(Instruction::Shl, One, @@ -6570,10 +6570,10 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { return ReplaceInstUsesWith(SI, FalseVal); } - if (SI.getType() == Type::BoolTy) { + if (SI.getType() == Type::Int1Ty) { ConstantInt *C; if ((C = dyn_cast<ConstantInt>(TrueVal)) && - C->getType() == Type::BoolTy) { + C->getType() == Type::Int1Ty) { if (C->getBoolValue()) { // Change: A = select B, true, C --> A = or B, C return BinaryOperator::createOr(CondVal, FalseVal); @@ -6585,7 +6585,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { return BinaryOperator::createAnd(NotCond, FalseVal); } } else if ((C = dyn_cast<ConstantInt>(FalseVal)) && - C->getType() == Type::BoolTy) { + C->getType() == Type::Int1Ty) { if (C->getBoolValue() == false) { // Change: A = select B, C, false --> A = and B, C return BinaryOperator::createAnd(CondVal, TrueVal); @@ -7132,7 +7132,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) { // If the call and callee calling conventions don't match, this call must // be unreachable, as the call is undefined. new StoreInst(ConstantInt::getTrue(), - UndefValue::get(PointerType::get(Type::BoolTy)), OldCall); + UndefValue::get(PointerType::get(Type::Int1Ty)), OldCall); if (!OldCall->use_empty()) OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType())); if (isa<CallInst>(OldCall)) // Not worth removing an invoke here. @@ -7145,7 +7145,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) { // undef so that we know that this code is not reachable, despite the fact // that we can't modify the CFG here. new StoreInst(ConstantInt::getTrue(), - UndefValue::get(PointerType::get(Type::BoolTy)), + UndefValue::get(PointerType::get(Type::Int1Ty)), CS.getInstruction()); if (!CS.getInstruction()->use_empty()) @@ -7937,7 +7937,7 @@ Instruction *InstCombiner::visitFreeInst(FreeInst &FI) { if (isa<UndefValue>(Op)) { // Insert a new store to null because we cannot modify the CFG here. new StoreInst(ConstantInt::getTrue(), - UndefValue::get(PointerType::get(Type::BoolTy)), &FI); + UndefValue::get(PointerType::get(Type::Int1Ty)), &FI); return EraseInstFromFunction(FI); } @@ -9048,7 +9048,7 @@ static void AddReachableCodeToWorklist(BasicBlock *BB, TerminatorInst *TI = BB->getTerminator(); if (BranchInst *BI = dyn_cast<BranchInst>(TI)) { if (BI->isConditional() && isa<ConstantInt>(BI->getCondition()) && - BI->getCondition()->getType() == Type::BoolTy) { + BI->getCondition()->getType() == Type::Int1Ty) { bool CondVal = cast<ConstantInt>(BI->getCondition())->getBoolValue(); AddReachableCodeToWorklist(BI->getSuccessor(!CondVal), Visited, WorkList, TD); diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 2f79f607fe..c97c9b5518 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -486,7 +486,7 @@ static void EmitPreheaderBranchOnCondition(Value *LIC, Constant *Val, // Insert a conditional branch on LIC to the two preheaders. The original // code is the true version and the new code is the false version. Value *BranchVal = LIC; - if (Val->getType() != Type::BoolTy) + if (Val->getType() != Type::Int1Ty) BranchVal = new ICmpInst(ICmpInst::ICMP_EQ, LIC, Val, "tmp", InsertPt); else if (Val != ConstantInt::getTrue()) // We want to enter the new loop when the condition is true. @@ -919,7 +919,7 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC, // If we know that LIC == Val, or that LIC == NotVal, just replace uses of LIC // in the loop with the appropriate one directly. - if (IsEqual || (isa<ConstantInt>(Val) && Val->getType() == Type::BoolTy)) { + if (IsEqual || (isa<ConstantInt>(Val) && Val->getType() == Type::Int1Ty)) { Value *Replacement; if (IsEqual) Replacement = Val; @@ -1032,10 +1032,10 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist) { break; case Instruction::And: if (isa<ConstantInt>(I->getOperand(0)) && - I->getOperand(0)->getType() == Type::BoolTy) // constant -> RHS + I->getOperand(0)->getType() == Type::Int1Ty) // constant -> RHS cast<BinaryOperator>(I)->swapOperands(); if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1))) - if (CB->getType() == Type::BoolTy) { + if (CB->getType() == Type::Int1Ty) { if (CB->getBoolValue()) // X & 1 -> X ReplaceUsesOfWith(I, I->getOperand(0), Worklist); else // X & 0 -> 0 @@ -1045,10 +1045,10 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist) { break; case Instruction::Or: if (isa<ConstantInt>(I->getOperand(0)) && - I->getOperand(0)->getType() == Type::BoolTy) // constant -> RHS + I->getOperand(0)->getType() == Type::Int1Ty) // constant -> RHS cast<BinaryOperator>(I)->swapOperands(); if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1))) - if (CB->getType() == Type::BoolTy) { + if (CB->getType() == Type::Int1Ty) { if (CB->getBoolValue()) // X | 1 -> 1 ReplaceUsesOfWith(I, I->getOperand(1), Worklist); else // X | 0 -> X diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp index 717b8da578..c577409f9a 100644 --- a/lib/Transforms/Scalar/PredicateSimplifier.cpp +++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp @@ -1129,9 +1129,9 @@ namespace { ConstantInt *CB, *A; if ((CB = dyn_cast<ConstantInt>(Canonical)) && - CB->getType() == Type::BoolTy) { + CB->getType() == Type::Int1Ty) { if ((A = dyn_cast<ConstantInt>(LHS)) && - A->getType() == Type::BoolTy) + A->getType() == Type::Int1Ty) add(RHS, ConstantInt::get(A->getBoolValue() ^ CB->getBoolValue()), ICmpInst::ICMP_EQ, NewContext); @@ -1249,7 +1249,7 @@ namespace { if (isa<ConstantInt>(Unknown)) One = ConstantInt::get(Ty, 1); else if (isa<ConstantInt>(Unknown) && - Unknown->getType() == Type::BoolTy) + Unknown->getType() == Type::Int1Ty) One = ConstantInt::getTrue(); if (One) add(Unknown, One, ICmpInst::ICMP_EQ, NewContext); diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index fad5358d59..daf21d43f7 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -417,7 +417,7 @@ void SCCPSolver::getFeasibleSuccessors(TerminatorInst &TI, LatticeVal &BCValue = getValueState(BI->getCondition()); if (BCValue.isOverdefined() || (BCValue.isConstant() && - BCValue.getConstant()->getType() != Type::BoolTy)) { + BCValue.getConstant()->getType() != Type::Int1Ty)) { // Overdefined condition variables, and branches on unfoldable constant // conditions, mean the branch could go either way. Succs[0] = Succs[1] = true; @@ -477,7 +477,7 @@ bool SCCPSolver::isEdgeFeasible(BasicBlock *From, BasicBlock *To) { return true; } else if (BCValue.isConstant()) { // Not branching on an evaluatable constant? - if (BCValue.getConstant()->getType() != Type::BoolTy) return true; + if (BCValue.getConstant()->getType() != Type::Int1Ty) return true; // Constant condition variables mean the branch can only go a single way return BI->getSuccessor(BCValue.getConstant() == @@ -648,7 +648,7 @@ void SCCPSolver::visitSelectInst(SelectInst &I) { if (CondValue.isUndefined()) return; if (CondValue.isConstant() && - CondValue.getConstant()->getType() == Type::BoolTy) { + CondValue.getConstant()->getType() == Type::Int1Ty) { if (ConstantInt *CondCB = dyn_cast<ConstantInt>(CondValue.getConstant())){ mergeInValue(&I, getValueState(CondCB->getBoolValue() ? I.getTrueValue() : I.getFalseValue())); diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index f922a984f3..4e8f3c0ec4 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -251,7 +251,7 @@ Function *CodeExtractor::constructFunction(const Values &inputs, switch (NumExitBlocks) { case 0: case 1: RetTy = Type::VoidTy; break; - case 2: RetTy = Type::BoolTy; break; + case 2: RetTy = Type::Int1Ty; break; default: RetTy = Type::Int16Ty; break; } diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 0304aa3ff5..964b47c4ef 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -971,7 +971,7 @@ static bool FoldCondBranchOnPHI(BranchInst *BI) { for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { ConstantInt *CB; if ((CB = dyn_cast<ConstantInt>(PN->getIncomingValue(i))) && - CB->getType() == Type::BoolTy) { + CB->getType() == Type::Int1Ty) { // Okay, we now know that all edges from PredBB should be revectored to // branch to RealDest. BasicBlock *PredBB = PN->getIncomingBlock(i); @@ -1516,7 +1516,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { // Otherwise, if there are multiple predecessors, insert a PHI that // merges in the constant and simplify the block result. if (BlockIsSimpleEnoughToThreadThrough(BB)) { - PHINode *NewPN = new PHINode(Type::BoolTy, + PHINode *NewPN = new PHINode(Type::Int1Ty, BI->getCondition()->getName()+".pr", BB->begin()); for (PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) |