From b3056faa5554ded7ac1ac5865d10ef5839fb77d3 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Tue, 21 Jul 2009 18:03:38 +0000 Subject: [PATCH] Rename getConstantInt{True|False} to get{True|False} at Chris' behest. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76598 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/LLVMContext.h | 4 +- lib/Analysis/SparsePropagation.cpp | 2 +- lib/AsmParser/LLParser.cpp | 4 +- .../SelectionDAG/SelectionDAGBuild.cpp | 8 +- lib/Transforms/IPO/GlobalOpt.cpp | 8 +- lib/Transforms/Scalar/GVN.cpp | 4 +- .../Scalar/InstructionCombining.cpp | 156 +++++++++--------- lib/Transforms/Scalar/JumpThreading.cpp | 4 +- lib/Transforms/Scalar/LoopUnswitch.cpp | 12 +- lib/Transforms/Scalar/PredicateSimplifier.cpp | 24 +-- lib/Transforms/Scalar/SCCP.cpp | 6 +- lib/VMCore/ConstantFold.cpp | 12 +- lib/VMCore/LLVMContext.cpp | 8 +- lib/VMCore/LLVMContextImpl.h | 4 +- 14 files changed, 128 insertions(+), 128 deletions(-) diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h index d4cd891d8a9..5ec33453db6 100644 --- a/include/llvm/LLVMContext.h +++ b/include/llvm/LLVMContext.h @@ -68,8 +68,8 @@ public: UndefValue* getUndef(const Type* Ty); // ConstantInt accessors - ConstantInt* getConstantIntTrue(); - ConstantInt* getConstantIntFalse(); + ConstantInt* getTrue(); + ConstantInt* getFalse(); /// If Ty is a vector type, return a Constant with a splat of the given /// value. Otherwise return a ConstantInt for the given value. diff --git a/lib/Analysis/SparsePropagation.cpp b/lib/Analysis/SparsePropagation.cpp index 527299918bd..c1b39fe7d75 100644 --- a/lib/Analysis/SparsePropagation.cpp +++ b/lib/Analysis/SparsePropagation.cpp @@ -154,7 +154,7 @@ void SparseSolver::getFeasibleSuccessors(TerminatorInst &TI, } // Constant condition variables mean the branch can only go a single way - Succs[C == Context->getConstantIntFalse()] = true; + Succs[C == Context->getFalse()] = true; return; } diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index cbed8695bf1..d461a8dcffd 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -1706,11 +1706,11 @@ bool LLParser::ParseValID(ValID &ID) { ID.Kind = ValID::t_APFloat; break; case lltok::kw_true: - ID.ConstantVal = Context.getConstantIntTrue(); + ID.ConstantVal = Context.getTrue(); ID.Kind = ValID::t_Constant; break; case lltok::kw_false: - ID.ConstantVal = Context.getConstantIntFalse(); + ID.ConstantVal = Context.getFalse(); ID.Kind = ValID::t_Constant; break; case lltok::kw_null: ID.Kind = ValID::t_Null; break; diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index 0a7b1051bcb..30236e36f3f 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -1149,7 +1149,7 @@ SelectionDAGLowering::EmitBranchForMergedCondition(Value *Cond, } // Create a CaseBlock record representing this branch. - CaseBlock CB(ISD::SETEQ, Cond, DAG.getContext()->getConstantIntTrue(), + CaseBlock CB(ISD::SETEQ, Cond, DAG.getContext()->getTrue(), NULL, TBB, FBB, CurBB); SwitchCases.push_back(CB); } @@ -1304,7 +1304,7 @@ void SelectionDAGLowering::visitBr(BranchInst &I) { } // Create a CaseBlock record representing this branch. - CaseBlock CB(ISD::SETEQ, CondVal, DAG.getContext()->getConstantIntTrue(), + CaseBlock CB(ISD::SETEQ, CondVal, DAG.getContext()->getTrue(), NULL, Succ0MBB, Succ1MBB, CurMBB); // Use visitSwitchCase to actually insert the fast branch sequence for this // cond branch. @@ -1322,10 +1322,10 @@ void SelectionDAGLowering::visitSwitchCase(CaseBlock &CB) { if (CB.CmpMHS == NULL) { // Fold "(X == true)" to X and "(X == false)" to !X to // handle common cases produced by branch lowering. - if (CB.CmpRHS == DAG.getContext()->getConstantIntTrue() && + if (CB.CmpRHS == DAG.getContext()->getTrue() && CB.CC == ISD::SETEQ) Cond = CondLHS; - else if (CB.CmpRHS == DAG.getContext()->getConstantIntFalse() && + else if (CB.CmpRHS == DAG.getContext()->getFalse() && CB.CC == ISD::SETEQ) { SDValue True = DAG.getConstant(1, CondLHS.getValueType()); Cond = DAG.getNode(ISD::XOR, dl, CondLHS.getValueType(), CondLHS, True); diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 8b3cf48ceed..9d048b53001 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -865,7 +865,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV, GlobalVariable *InitBool = new GlobalVariable(*Context, Type::Int1Ty, false, GlobalValue::InternalLinkage, - Context->getConstantIntFalse(), GV->getName()+".init", + Context->getFalse(), GV->getName()+".init", GV->isThreadLocal()); bool InitBoolUsed = false; @@ -886,7 +886,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV, default: llvm_unreachable("Unknown ICmp Predicate!"); case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_SLT: - LV = Context->getConstantIntFalse(); // X < null -> always false + LV = Context->getFalse(); // X < null -> always false break; case ICmpInst::ICMP_ULE: case ICmpInst::ICMP_SLE: @@ -908,7 +908,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV, } else { StoreInst *SI = cast(GV->use_back()); // The global is initialized when the store to it occurs. - new StoreInst(Context->getConstantIntTrue(), InitBool, SI); + new StoreInst(Context->getTrue(), InitBool, SI); SI->eraseFromParent(); } @@ -1583,7 +1583,7 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal, // Create the new global, initializing it to false. GlobalVariable *NewGV = new GlobalVariable(*Context, Type::Int1Ty, false, - GlobalValue::InternalLinkage, Context->getConstantIntFalse(), + GlobalValue::InternalLinkage, Context->getFalse(), GV->getName()+".b", GV->isThreadLocal()); GV->getParent()->getGlobalList().insert(GV, NewGV); diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index e7be98506b9..bdb571dddbe 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -1384,9 +1384,9 @@ bool GVN::processInstruction(Instruction *I, BasicBlock* falseSucc = BI->getSuccessor(1); if (trueSucc->getSinglePredecessor()) - localAvail[trueSucc]->table[condVN] = Context->getConstantIntTrue(); + localAvail[trueSucc]->table[condVN] = Context->getTrue(); if (falseSucc->getSinglePredecessor()) - localAvail[falseSucc]->table[condVN] = Context->getConstantIntFalse(); + localAvail[falseSucc]->table[condVN] = Context->getFalse(); return false; diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index d2ed1e14e3f..17e372505a8 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2876,8 +2876,8 @@ bool InstCombiner::SimplifyDivRemOfSelect(BinaryOperator &I) { *I = SI->getOperand(NonNullOperand); AddToWorkList(BBI); } else if (*I == SelectCond) { - *I = NonNullOperand == 1 ? Context->getConstantIntTrue() : - Context->getConstantIntFalse(); + *I = NonNullOperand == 1 ? Context->getTrue() : + Context->getFalse(); AddToWorkList(BBI); } } @@ -3371,7 +3371,7 @@ static Value *getICmpValue(bool sign, unsigned code, Value *LHS, Value *RHS, LLVMContext *Context) { switch (code) { default: llvm_unreachable("Illegal ICmp code!"); - case 0: return Context->getConstantIntFalse(); + case 0: return Context->getFalse(); case 1: if (sign) return new ICmpInst(*Context, ICmpInst::ICMP_SGT, LHS, RHS); @@ -3394,7 +3394,7 @@ static Value *getICmpValue(bool sign, unsigned code, Value *LHS, Value *RHS, return new ICmpInst(*Context, ICmpInst::ICMP_SLE, LHS, RHS); else return new ICmpInst(*Context, ICmpInst::ICMP_ULE, LHS, RHS); - case 7: return Context->getConstantIntTrue(); + case 7: return Context->getTrue(); } } @@ -3440,7 +3440,7 @@ static Value *getFCmpValue(bool isordered, unsigned code, return new FCmpInst(*Context, FCmpInst::FCMP_OLE, LHS, RHS); else return new FCmpInst(*Context, FCmpInst::FCMP_ULE, LHS, RHS); - case 7: return Context->getConstantIntTrue(); + case 7: return Context->getTrue(); } } @@ -3825,7 +3825,7 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I, case ICmpInst::ICMP_EQ: // (X == 13 & X == 15) -> false case ICmpInst::ICMP_UGT: // (X == 13 & X > 15) -> false case ICmpInst::ICMP_SGT: // (X == 13 & X > 15) -> false - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); case ICmpInst::ICMP_NE: // (X == 13 & X != 15) -> X == 13 case ICmpInst::ICMP_ULT: // (X == 13 & X < 15) -> X == 13 case ICmpInst::ICMP_SLT: // (X == 13 & X < 15) -> X == 13 @@ -3863,7 +3863,7 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I, default: llvm_unreachable("Unknown integer condition code!"); case ICmpInst::ICMP_EQ: // (X u< 13 & X == 15) -> false case ICmpInst::ICMP_UGT: // (X u< 13 & X u> 15) -> false - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); case ICmpInst::ICMP_SGT: // (X u< 13 & X s> 15) -> no change break; case ICmpInst::ICMP_NE: // (X u< 13 & X != 15) -> X u< 13 @@ -3878,7 +3878,7 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I, default: llvm_unreachable("Unknown integer condition code!"); case ICmpInst::ICMP_EQ: // (X s< 13 & X == 15) -> false case ICmpInst::ICMP_SGT: // (X s< 13 & X s> 15) -> false - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); case ICmpInst::ICMP_UGT: // (X s< 13 & X u> 15) -> no change break; case ICmpInst::ICMP_NE: // (X s< 13 & X != 15) -> X < 13 @@ -4211,7 +4211,7 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { // If either of the constants are nans, then the whole thing returns // false. if (LHSC->getValueAPF().isNaN() || RHSC->getValueAPF().isNaN()) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); return new FCmpInst(*Context, FCmpInst::FCMP_ORD, LHS->getOperand(0), RHS->getOperand(0)); } @@ -4234,7 +4234,7 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { Op0LHS, Op0RHS); else if (Op0CC == FCmpInst::FCMP_FALSE || Op1CC == FCmpInst::FCMP_FALSE) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); else if (Op0CC == FCmpInst::FCMP_TRUE) return ReplaceInstUsesWith(I, Op1); else if (Op1CC == FCmpInst::FCMP_TRUE) @@ -4256,7 +4256,7 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { // uno && oeq -> uno && (ord && eq) -> false // uno && ord -> false if (!Op0Ordered) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); // ord && ueq -> ord && (uno || eq) -> oeq return cast(getFCmpValue(true, Op1Pred, Op0LHS, Op0RHS, Context)); @@ -4541,7 +4541,7 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I, case ICmpInst::ICMP_NE: // (X != 13 | X != 15) -> true case ICmpInst::ICMP_ULT: // (X != 13 | X u< 15) -> true case ICmpInst::ICMP_SLT: // (X != 13 | X s< 15) -> true - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); } break; case ICmpInst::ICMP_ULT: @@ -4596,7 +4596,7 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I, break; case ICmpInst::ICMP_NE: // (X u> 13 | X != 15) -> true case ICmpInst::ICMP_ULT: // (X u> 13 | X u< 15) -> true - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); case ICmpInst::ICMP_SLT: // (X u> 13 | X s< 15) -> no change break; } @@ -4611,7 +4611,7 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I, break; case ICmpInst::ICMP_NE: // (X s> 13 | X != 15) -> true case ICmpInst::ICMP_SLT: // (X s> 13 | X s< 15) -> true - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); case ICmpInst::ICMP_ULT: // (X s> 13 | X u< 15) -> no change break; } @@ -4919,7 +4919,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { // If either of the constants are nans, then the whole thing returns // true. if (LHSC->getValueAPF().isNaN() || RHSC->getValueAPF().isNaN()) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); // Otherwise, no need to compare the two constants, compare the // rest. @@ -4945,7 +4945,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { Op0LHS, Op0RHS); else if (Op0CC == FCmpInst::FCMP_TRUE || Op1CC == FCmpInst::FCMP_TRUE) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); else if (Op0CC == FCmpInst::FCMP_FALSE) return ReplaceInstUsesWith(I, Op1); else if (Op1CC == FCmpInst::FCMP_FALSE) @@ -5037,7 +5037,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { if (ConstantInt *RHS = dyn_cast(Op1)) { - if (RHS == Context->getConstantIntTrue() && Op0->hasOneUse()) { + if (RHS == Context->getTrue() && Op0->hasOneUse()) { // xor (cmp A, B), true = not (cmp A, B) = !cmp A, B if (ICmpInst *ICI = dyn_cast(Op0)) return new ICmpInst(*Context, ICI->getInversePredicate(), @@ -5055,7 +5055,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { Instruction::CastOps Opcode = Op0C->getOpcode(); if (Opcode == Instruction::ZExt || Opcode == Instruction::SExt) { if (RHS == Context->getConstantExprCast(Opcode, - Context->getConstantIntTrue(), + Context->getTrue(), Op0C->getDestTy())) { Instruction *NewCI = InsertNewInstBefore(CmpInst::Create( *Context, @@ -5706,9 +5706,9 @@ Instruction *InstCombiner::FoldFCmp_IntToFP_Cst(FCmpInst &I, Pred = ICmpInst::ICMP_NE; break; case FCmpInst::FCMP_ORD: - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); case FCmpInst::FCMP_UNO: - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); } const IntegerType *IntTy = cast(LHSI->getOperand(0)->getType()); @@ -5728,8 +5728,8 @@ Instruction *InstCombiner::FoldFCmp_IntToFP_Cst(FCmpInst &I, if (SMax.compare(RHS) == APFloat::cmpLessThan) { // smax < 13123.0 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SLE) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getTrue()); + return ReplaceInstUsesWith(I, Context->getFalse()); } } else { // If the RHS value is > UnsignedMax, fold the comparison. This handles @@ -5740,8 +5740,8 @@ Instruction *InstCombiner::FoldFCmp_IntToFP_Cst(FCmpInst &I, if (UMax.compare(RHS) == APFloat::cmpLessThan) { // umax < 13123.0 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_ULT || Pred == ICmpInst::ICMP_ULE) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getTrue()); + return ReplaceInstUsesWith(I, Context->getFalse()); } } @@ -5753,8 +5753,8 @@ Instruction *InstCombiner::FoldFCmp_IntToFP_Cst(FCmpInst &I, if (SMin.compare(RHS) == APFloat::cmpGreaterThan) { // smin > 12312.0 if (Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getTrue()); + return ReplaceInstUsesWith(I, Context->getFalse()); } } @@ -5776,14 +5776,14 @@ Instruction *InstCombiner::FoldFCmp_IntToFP_Cst(FCmpInst &I, switch (Pred) { default: llvm_unreachable("Unexpected integer comparison!"); case ICmpInst::ICMP_NE: // (float)int != 4.4 --> true - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); case ICmpInst::ICMP_EQ: // (float)int == 4.4 --> false - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); case ICmpInst::ICMP_ULE: // (float)int <= 4.4 --> int <= 4 // (float)int <= -4.4 --> false if (RHS.isNegative()) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); break; case ICmpInst::ICMP_SLE: // (float)int <= 4.4 --> int <= 4 @@ -5795,7 +5795,7 @@ Instruction *InstCombiner::FoldFCmp_IntToFP_Cst(FCmpInst &I, // (float)int < -4.4 --> false // (float)int < 4.4 --> int <= 4 if (RHS.isNegative()) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); Pred = ICmpInst::ICMP_ULE; break; case ICmpInst::ICMP_SLT: @@ -5808,7 +5808,7 @@ Instruction *InstCombiner::FoldFCmp_IntToFP_Cst(FCmpInst &I, // (float)int > 4.4 --> int > 4 // (float)int > -4.4 --> true if (RHS.isNegative()) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); break; case ICmpInst::ICMP_SGT: // (float)int > 4.4 --> int > 4 @@ -5820,7 +5820,7 @@ Instruction *InstCombiner::FoldFCmp_IntToFP_Cst(FCmpInst &I, // (float)int >= -4.4 --> true // (float)int >= 4.4 --> int > 4 if (!RHS.isNegative()) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); Pred = ICmpInst::ICMP_UGT; break; case ICmpInst::ICMP_SGE: @@ -5844,9 +5844,9 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { // Fold trivial predicates. if (I.getPredicate() == FCmpInst::FCMP_FALSE) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); if (I.getPredicate() == FCmpInst::FCMP_TRUE) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); // Simplify 'fcmp pred X, X' if (Op0 == Op1) { @@ -5855,11 +5855,11 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { case FCmpInst::FCMP_UEQ: // True if unordered or equal case FCmpInst::FCMP_UGE: // True if unordered, greater than, or equal case FCmpInst::FCMP_ULE: // True if unordered, less than, or equal - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); case FCmpInst::FCMP_OGT: // True if ordered and greater than case FCmpInst::FCMP_OLT: // True if ordered and less than case FCmpInst::FCMP_ONE: // True if ordered and operands are unequal - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); case FCmpInst::FCMP_UNO: // True if unordered: isnan(X) | isnan(Y) case FCmpInst::FCMP_ULT: // True if unordered or less than @@ -5890,11 +5890,11 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { if (ConstantFP *CFP = dyn_cast(RHSC)) { if (CFP->getValueAPF().isNaN()) { if (FCmpInst::isOrdered(I.getPredicate())) // True if ordered and... - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); assert(FCmpInst::isUnordered(I.getPredicate()) && "Comparison must be either ordered or unordered!"); // True if unordered. - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); } } @@ -6044,22 +6044,22 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { default: break; case ICmpInst::ICMP_ULE: if (CI->isMaxValue(false)) // A <=u MAX -> TRUE - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); return new ICmpInst(*Context, ICmpInst::ICMP_ULT, Op0, AddOne(CI, Context)); case ICmpInst::ICMP_SLE: if (CI->isMaxValue(true)) // A <=s MAX -> TRUE - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); return new ICmpInst(*Context, ICmpInst::ICMP_SLT, Op0, AddOne(CI, Context)); case ICmpInst::ICMP_UGE: if (CI->isMinValue(false)) // A >=u MIN -> TRUE - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); return new ICmpInst(*Context, ICmpInst::ICMP_UGT, Op0, SubOne(CI, Context)); case ICmpInst::ICMP_SGE: if (CI->isMinValue(true)) // A >=s MIN -> TRUE - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); return new ICmpInst(*Context, ICmpInst::ICMP_SGT, Op0, SubOne(CI, Context)); } @@ -6119,17 +6119,17 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { default: llvm_unreachable("Unknown icmp opcode!"); case ICmpInst::ICMP_EQ: if (Op0Max.ult(Op1Min) || Op0Min.ugt(Op1Max)) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); break; case ICmpInst::ICMP_NE: if (Op0Max.ult(Op1Min) || Op0Min.ugt(Op1Max)) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); break; case ICmpInst::ICMP_ULT: if (Op0Max.ult(Op1Min)) // A true if max(A) < min(B) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); if (Op0Min.uge(Op1Max)) // A false if min(A) >= max(B) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); if (Op1Min == Op0Max) // A A != B if max(A) == min(B) return new ICmpInst(*Context, ICmpInst::ICMP_NE, Op0, Op1); if (ConstantInt *CI = dyn_cast(Op1)) { @@ -6145,9 +6145,9 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { break; case ICmpInst::ICMP_UGT: if (Op0Min.ugt(Op1Max)) // A >u B -> true if min(A) > max(B) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); if (Op0Max.ule(Op1Min)) // A >u B -> false if max(A) <= max(B) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); if (Op1Max == Op0Min) // A >u B -> A != B if min(A) == max(B) return new ICmpInst(*Context, ICmpInst::ICMP_NE, Op0, Op1); @@ -6164,9 +6164,9 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { break; case ICmpInst::ICMP_SLT: if (Op0Max.slt(Op1Min)) // A true if max(A) < min(C) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); if (Op0Min.sge(Op1Max)) // A false if min(A) >= max(C) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); if (Op1Min == Op0Max) // A A != B if max(A) == min(B) return new ICmpInst(*Context, ICmpInst::ICMP_NE, Op0, Op1); if (ConstantInt *CI = dyn_cast(Op1)) { @@ -6177,9 +6177,9 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { break; case ICmpInst::ICMP_SGT: if (Op0Min.sgt(Op1Max)) // A >s B -> true if min(A) > max(B) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); if (Op0Max.sle(Op1Min)) // A >s B -> false if max(A) <= min(B) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); if (Op1Max == Op0Min) // A >s B -> A != B if min(A) == max(B) return new ICmpInst(*Context, ICmpInst::ICMP_NE, Op0, Op1); @@ -6192,30 +6192,30 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { case ICmpInst::ICMP_SGE: assert(!isa(Op1) && "ICMP_SGE with ConstantInt not folded!"); if (Op0Min.sge(Op1Max)) // A >=s B -> true if min(A) >= max(B) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); if (Op0Max.slt(Op1Min)) // A >=s B -> false if max(A) < min(B) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); break; case ICmpInst::ICMP_SLE: assert(!isa(Op1) && "ICMP_SLE with ConstantInt not folded!"); if (Op0Max.sle(Op1Min)) // A <=s B -> true if max(A) <= min(B) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); if (Op0Min.sgt(Op1Max)) // A <=s B -> false if min(A) > max(B) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); break; case ICmpInst::ICMP_UGE: assert(!isa(Op1) && "ICMP_UGE with ConstantInt not folded!"); if (Op0Min.uge(Op1Max)) // A >=u B -> true if min(A) >= max(B) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); if (Op0Max.ult(Op1Min)) // A >=u B -> false if max(A) < min(B) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); break; case ICmpInst::ICMP_ULE: assert(!isa(Op1) && "ICMP_ULE with ConstantInt not folded!"); if (Op0Max.ule(Op1Min)) // A <=u B -> true if max(A) <= min(B) - return ReplaceInstUsesWith(I, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(I, Context->getTrue()); if (Op0Min.ugt(Op1Max)) // A <=u B -> false if min(A) > max(B) - return ReplaceInstUsesWith(I, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(I, Context->getFalse()); break; } @@ -6628,7 +6628,7 @@ Instruction *InstCombiner::FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI, default: llvm_unreachable("Unhandled icmp opcode!"); case ICmpInst::ICMP_EQ: if (LoOverflow && HiOverflow) - return ReplaceInstUsesWith(ICI, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(ICI, Context->getFalse()); else if (HiOverflow) return new ICmpInst(*Context, DivIsSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE, X, LoBound); @@ -6639,7 +6639,7 @@ Instruction *InstCombiner::FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI, return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, true, ICI); case ICmpInst::ICMP_NE: if (LoOverflow && HiOverflow) - return ReplaceInstUsesWith(ICI, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(ICI, Context->getTrue()); else if (HiOverflow) return new ICmpInst(*Context, DivIsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT, X, LoBound); @@ -6651,16 +6651,16 @@ Instruction *InstCombiner::FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI, case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_SLT: if (LoOverflow == +1) // Low bound is greater than input range. - return ReplaceInstUsesWith(ICI, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(ICI, Context->getTrue()); if (LoOverflow == -1) // Low bound is less than input range. - return ReplaceInstUsesWith(ICI, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(ICI, Context->getFalse()); return new ICmpInst(*Context, Pred, X, LoBound); case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_SGT: if (HiOverflow == +1) // High bound greater than input range. - return ReplaceInstUsesWith(ICI, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(ICI, Context->getFalse()); else if (HiOverflow == -1) // High bound less than input range. - return ReplaceInstUsesWith(ICI, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(ICI, Context->getTrue()); if (Pred == ICmpInst::ICMP_UGT) return new ICmpInst(*Context, ICmpInst::ICMP_UGE, X, HiBound); else @@ -6829,9 +6829,9 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, // As a special case, check to see if this means that the // result is always true or false now. if (ICI.getPredicate() == ICmpInst::ICMP_EQ) - return ReplaceInstUsesWith(ICI, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(ICI, Context->getFalse()); if (ICI.getPredicate() == ICmpInst::ICMP_NE) - return ReplaceInstUsesWith(ICI, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(ICI, Context->getTrue()); } else { ICI.setOperand(1, NewCst); Constant *NewAndCST; @@ -7252,9 +7252,9 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { // First, handle some easy cases. We know the result cannot be equal at this // point so handle the ICI.isEquality() cases if (ICI.getPredicate() == ICmpInst::ICMP_EQ) - return ReplaceInstUsesWith(ICI, Context->getConstantIntFalse()); + return ReplaceInstUsesWith(ICI, Context->getFalse()); if (ICI.getPredicate() == ICmpInst::ICMP_NE) - return ReplaceInstUsesWith(ICI, Context->getConstantIntTrue()); + return ReplaceInstUsesWith(ICI, Context->getTrue()); // Evaluate the comparison for LT (we invert for GT below). LE and GE cases // should have been folded away previously and not enter in here. @@ -7262,9 +7262,9 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { if (isSignedCmp) { // We're performing a signed comparison. if (cast(CI)->getValue().isNegative()) - Result = Context->getConstantIntFalse(); // X < (small) --> false + Result = Context->getFalse(); // X < (small) --> false else - Result = Context->getConstantIntTrue(); // X < (large) --> true + Result = Context->getTrue(); // X < (large) --> true } else { // We're performing an unsigned comparison. if (isSignedExt) { @@ -7275,7 +7275,7 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { LHSCIOp, NegOne, ICI.getName()), ICI); } else { // Unsigned extend & unsigned compare -> always true. - Result = Context->getConstantIntTrue(); + Result = Context->getTrue(); } } @@ -8406,7 +8406,7 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) { // cast (xor bool X, true) to int --> xor (cast bool X to int), 1 if (isa(CI) && SrcBitSize == 1 && SrcI->getOpcode() == Instruction::Xor && - Op1 == Context->getConstantIntTrue() && + Op1 == Context->getTrue() && (!Op0->hasOneUse() || !isa(Op0))) { Value *New = InsertCastBefore(Instruction::ZExt, Op0, DestTy, CI); return BinaryOperator::CreateXor(New, @@ -10021,7 +10021,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) { Instruction *OldCall = CS.getInstruction(); // If the call and callee calling conventions don't match, this call must // be unreachable, as the call is undefined. - new StoreInst(Context->getConstantIntTrue(), + new StoreInst(Context->getTrue(), Context->getUndef(Context->getPointerTypeUnqual(Type::Int1Ty)), OldCall); if (!OldCall->use_empty()) @@ -10035,7 +10035,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) { // This instruction is not reachable, just remove it. We insert a store to // undef so that we know that this code is not reachable, despite the fact // that we can't modify the CFG here. - new StoreInst(Context->getConstantIntTrue(), + new StoreInst(Context->getTrue(), Context->getUndef(Context->getPointerTypeUnqual(Type::Int1Ty)), CS.getInstruction()); @@ -10046,7 +10046,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) { if (InvokeInst *II = dyn_cast(CS.getInstruction())) { // Don't break the CFG, insert a dummy cond branch. BranchInst::Create(II->getNormalDest(), II->getUnwindDest(), - Context->getConstantIntTrue(), II); + Context->getTrue(), II); } return EraseInstFromFunction(*CS.getInstruction()); } @@ -11354,7 +11354,7 @@ Instruction *InstCombiner::visitFreeInst(FreeInst &FI) { // free undef -> unreachable. if (isa(Op)) { // Insert a new store to null because we cannot modify the CFG here. - new StoreInst(Context->getConstantIntTrue(), + new StoreInst(Context->getTrue(), Context->getUndef(Context->getPointerTypeUnqual(Type::Int1Ty)), &FI); return EraseInstFromFunction(FI); } diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp index f3536c10c57..1ce823aa5e4 100644 --- a/lib/Transforms/Scalar/JumpThreading.cpp +++ b/lib/Transforms/Scalar/JumpThreading.cpp @@ -718,7 +718,7 @@ bool JumpThreading::ProcessJumpOnPHI(PHINode *PN) { // Next, figure out which successor we are threading to. BasicBlock *SuccBB; if (BranchInst *BI = dyn_cast(BB->getTerminator())) - SuccBB = BI->getSuccessor(PredCst == Context->getConstantIntFalse()); + SuccBB = BI->getSuccessor(PredCst == Context->getFalse()); else { SwitchInst *SI = cast(BB->getTerminator()); SuccBB = SI->getSuccessor(SI->findCaseValue(PredCst)); @@ -803,7 +803,7 @@ static Constant *GetResultOfComparison(CmpInst::Predicate pred, if (LHS == RHS) if (isa(LHS->getType()) || isa(LHS->getType())) return ICmpInst::isTrueWhenEqual(pred) ? - Context->getConstantIntTrue() : Context->getConstantIntFalse(); + Context->getTrue() : Context->getFalse(); return 0; } diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index daf1841a91c..16e04b39c16 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -233,7 +233,7 @@ bool LoopUnswitch::processCurrentLoop() { Value *LoopCond = FindLIVLoopCondition(BI->getCondition(), currentLoop, Changed); if (LoopCond && UnswitchIfProfitable(LoopCond, - Context->getConstantIntTrue())) { + Context->getTrue())) { ++NumBranches; return true; } @@ -263,7 +263,7 @@ bool LoopUnswitch::processCurrentLoop() { Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), currentLoop, Changed); if (LoopCond && UnswitchIfProfitable(LoopCond, - Context->getConstantIntTrue())) { + Context->getTrue())) { ++NumSelects; return true; } @@ -351,10 +351,10 @@ bool LoopUnswitch::IsTrivialUnswitchCondition(Value *Cond, Constant **Val, // this. if ((LoopExitBB = isTrivialLoopExitBlock(currentLoop, BI->getSuccessor(0)))) { - if (Val) *Val = Context->getConstantIntTrue(); + if (Val) *Val = Context->getTrue(); } else if ((LoopExitBB = isTrivialLoopExitBlock(currentLoop, BI->getSuccessor(1)))) { - if (Val) *Val = Context->getConstantIntFalse(); + if (Val) *Val = Context->getFalse(); } } else if (SwitchInst *SI = dyn_cast(HeaderTerm)) { // If this isn't a switch on Cond, we can't handle it. @@ -510,7 +510,7 @@ void LoopUnswitch::EmitPreheaderBranchOnCondition(Value *LIC, Constant *Val, Value *BranchVal = LIC; if (!isa(Val) || Val->getType() != Type::Int1Ty) BranchVal = new ICmpInst(InsertPt, ICmpInst::ICMP_EQ, LIC, Val, "tmp"); - else if (Val != Context->getConstantIntTrue()) + else if (Val != Context->getTrue()) // We want to enter the new loop when the condition is true. std::swap(TrueDest, FalseDest); @@ -947,7 +947,7 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC, Instruction* OldTerm = Old->getTerminator(); BranchInst::Create(Split, SISucc, - Context->getConstantIntTrue(), OldTerm); + Context->getTrue(), OldTerm); LPM->deleteSimpleAnalysisValue(Old->getTerminator(), L); Old->getTerminator()->eraseFromParent(); diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp index df397cea0a4..9928c688c4f 100644 --- a/lib/Transforms/Scalar/PredicateSimplifier.cpp +++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp @@ -1691,7 +1691,7 @@ namespace { if (Constant *C1 = dyn_cast(V1)) if (Constant *C2 = dyn_cast(V2)) return Context->getConstantExprCompare(Pred, C1, C2) == - Context->getConstantIntTrue(); + Context->getTrue(); unsigned n1 = VN.valueNumber(V1, Top); unsigned n2 = VN.valueNumber(V2, Top); @@ -1803,10 +1803,10 @@ namespace { // "icmp ult i32 %a, %y" EQ true then %a u< y // etc. - if (Canonical == Context->getConstantIntTrue()) { + if (Canonical == Context->getTrue()) { add(IC->getOperand(0), IC->getOperand(1), IC->getPredicate(), NewContext); - } else if (Canonical == Context->getConstantIntFalse()) { + } else if (Canonical == Context->getFalse()) { add(IC->getOperand(0), IC->getOperand(1), ICmpInst::getInversePredicate(IC->getPredicate()), NewContext); } @@ -1822,11 +1822,11 @@ namespace { if (isRelatedBy(True, False, ICmpInst::ICMP_NE)) { if (Canonical == VN.canonicalize(True, Top) || isRelatedBy(Canonical, False, ICmpInst::ICMP_NE)) - add(SI->getCondition(), Context->getConstantIntTrue(), + add(SI->getCondition(), Context->getTrue(), ICmpInst::ICMP_EQ, NewContext); else if (Canonical == VN.canonicalize(False, Top) || isRelatedBy(Canonical, True, ICmpInst::ICMP_NE)) - add(SI->getCondition(), Context->getConstantIntFalse(), + add(SI->getCondition(), Context->getFalse(), ICmpInst::ICMP_EQ, NewContext); } } else if (GetElementPtrInst *GEPI = dyn_cast(I)) { @@ -2050,9 +2050,9 @@ namespace { ICmpInst::Predicate Pred = IC->getPredicate(); if (isRelatedBy(Op0, Op1, Pred)) - add(IC, Context->getConstantIntTrue(), ICmpInst::ICMP_EQ, NewContext); + add(IC, Context->getTrue(), ICmpInst::ICMP_EQ, NewContext); else if (isRelatedBy(Op0, Op1, ICmpInst::getInversePredicate(Pred))) - add(IC, Context->getConstantIntFalse(), + add(IC, Context->getFalse(), ICmpInst::ICMP_EQ, NewContext); } else if (SelectInst *SI = dyn_cast(I)) { @@ -2064,9 +2064,9 @@ namespace { // %b EQ %c then %a EQ %b Value *Canonical = VN.canonicalize(SI->getCondition(), Top); - if (Canonical == Context->getConstantIntTrue()) { + if (Canonical == Context->getTrue()) { add(SI, SI->getTrueValue(), ICmpInst::ICMP_EQ, NewContext); - } else if (Canonical == Context->getConstantIntFalse()) { + } else if (Canonical == Context->getFalse()) { add(SI, SI->getFalseValue(), ICmpInst::ICMP_EQ, NewContext); } else if (VN.canonicalize(SI->getTrueValue(), Top) == VN.canonicalize(SI->getFalseValue(), Top)) { @@ -2156,7 +2156,7 @@ namespace { if (Constant *CI_L = dyn_cast(O.LHS)) { if (Constant *CI_R = dyn_cast(O.RHS)) { if (Context->getConstantExprCompare(O.Op, CI_L, CI_R) == - Context->getConstantIntFalse()) + Context->getFalse()) UB.mark(TopBB); WorkList.pop_front(); @@ -2458,7 +2458,7 @@ namespace { if (Dest == TrueDest) { DOUT << "(" << DTNode->getBlock()->getName() << ") true set:\n"; VRPSolver VRP(VN, IG, UB, VR, PS->DTDFS, PS->modified, Dest); - VRP.add(Context->getConstantIntTrue(), Condition, ICmpInst::ICMP_EQ); + VRP.add(Context->getTrue(), Condition, ICmpInst::ICMP_EQ); VRP.solve(); DEBUG(VN.dump()); DEBUG(IG.dump()); @@ -2466,7 +2466,7 @@ namespace { } else if (Dest == FalseDest) { DOUT << "(" << DTNode->getBlock()->getName() << ") false set:\n"; VRPSolver VRP(VN, IG, UB, VR, PS->DTDFS, PS->modified, Dest); - VRP.add(Context->getConstantIntFalse(), Condition, ICmpInst::ICMP_EQ); + VRP.add(Context->getFalse(), Condition, ICmpInst::ICMP_EQ); VRP.solve(); DEBUG(VN.dump()); DEBUG(IG.dump()); diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 7fa1a08f8ad..5952e972c0e 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -441,7 +441,7 @@ void SCCPSolver::getFeasibleSuccessors(TerminatorInst &TI, Succs[0] = Succs[1] = true; } else if (BCValue.isConstant()) { // Constant condition variables mean the branch can only go a single way - Succs[BCValue.getConstant() == Context->getConstantIntFalse()] = true; + Succs[BCValue.getConstant() == Context->getFalse()] = true; } } } else if (isa(&TI)) { @@ -486,7 +486,7 @@ bool SCCPSolver::isEdgeFeasible(BasicBlock *From, BasicBlock *To) { // Constant condition variables mean the branch can only go a single way return BI->getSuccessor(BCValue.getConstant() == - Context->getConstantIntFalse()) == To; + Context->getFalse()) == To; } return false; } @@ -1487,7 +1487,7 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) { // as undef, then further analysis could think the undef went another way // leading to an inconsistent set of conclusions. if (BranchInst *BI = dyn_cast(TI)) { - BI->setCondition(Context->getConstantIntFalse()); + BI->setCondition(Context->getFalse()); } else { SwitchInst *SI = cast(TI); SI->setCondition(SI->getCaseValue(1)); diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 7b10f444913..0e4bf6c7bfb 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -1398,9 +1398,9 @@ Constant *llvm::ConstantFoldCompareInstruction(LLVMContext &Context, // Don't try to evaluate aliases. External weak GV can be null. if (!isa(GV) && !GV->hasExternalWeakLinkage()) { if (pred == ICmpInst::ICMP_EQ) - return Context.getConstantIntFalse(); + return Context.getFalse(); else if (pred == ICmpInst::ICMP_NE) - return Context.getConstantIntTrue(); + return Context.getTrue(); } // icmp eq/ne(GV,null) -> false/true } else if (C2->isNullValue()) { @@ -1408,9 +1408,9 @@ Constant *llvm::ConstantFoldCompareInstruction(LLVMContext &Context, // Don't try to evaluate aliases. External weak GV can be null. if (!isa(GV) && !GV->hasExternalWeakLinkage()) { if (pred == ICmpInst::ICMP_EQ) - return Context.getConstantIntFalse(); + return Context.getFalse(); else if (pred == ICmpInst::ICMP_NE) - return Context.getConstantIntTrue(); + return Context.getTrue(); } } @@ -1446,8 +1446,8 @@ Constant *llvm::ConstantFoldCompareInstruction(LLVMContext &Context, APFloat::cmpResult R = C1V.compare(C2V); switch (pred) { default: llvm_unreachable("Invalid FCmp Predicate"); return 0; - case FCmpInst::FCMP_FALSE: return Context.getConstantIntFalse(); - case FCmpInst::FCMP_TRUE: return Context.getConstantIntTrue(); + case FCmpInst::FCMP_FALSE: return Context.getFalse(); + case FCmpInst::FCMP_TRUE: return Context.getTrue(); case FCmpInst::FCMP_UNO: return Context.getConstantInt(Type::Int1Ty, R==APFloat::cmpUnordered); case FCmpInst::FCMP_ORD: diff --git a/lib/VMCore/LLVMContext.cpp b/lib/VMCore/LLVMContext.cpp index bb3762bd813..5e009ea6dff 100644 --- a/lib/VMCore/LLVMContext.cpp +++ b/lib/VMCore/LLVMContext.cpp @@ -80,16 +80,16 @@ UndefValue* LLVMContext::getUndef(const Type* Ty) { } // ConstantInt accessors. -ConstantInt* LLVMContext::getConstantIntTrue() { +ConstantInt* LLVMContext::getTrue() { assert(this && "Context not initialized!"); assert(pImpl && "Context not initialized!"); - return pImpl->getConstantIntTrue(); + return pImpl->getTrue(); } -ConstantInt* LLVMContext::getConstantIntFalse() { +ConstantInt* LLVMContext::getFalse() { assert(this && "Context not initialized!"); assert(pImpl && "Context not initialized!"); - return pImpl->getConstantIntFalse(); + return pImpl->getFalse(); } Constant* LLVMContext::getConstantInt(const Type* Ty, uint64_t V, diff --git a/lib/VMCore/LLVMContextImpl.h b/lib/VMCore/LLVMContextImpl.h index 5571995c7e5..02df15c81f1 100644 --- a/lib/VMCore/LLVMContextImpl.h +++ b/lib/VMCore/LLVMContextImpl.h @@ -120,14 +120,14 @@ public: MDNode *getMDNode(Value*const* Vals, unsigned NumVals); - ConstantInt *getConstantIntTrue() { + ConstantInt *getTrue() { if (TheTrueVal) return TheTrueVal; else return (TheTrueVal = Context.getConstantInt(IntegerType::get(1), 1)); } - ConstantInt *getConstantIntFalse() { + ConstantInt *getFalse() { if (TheFalseVal) return TheFalseVal; else