summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-11 18:21:29 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-11 18:21:29 +0000
commit4fe16d607d11e29d742208894909733f5ad01f8f (patch)
treea669ba57373e87d31c3af6f301fe4a61f773f4b3 /lib/Transforms/Scalar
parent34dceb47573b0aedd188b5e72bb848ba29a4960f (diff)
downloadllvm-4fe16d607d11e29d742208894909733f5ad01f8f.tar.gz
llvm-4fe16d607d11e29d742208894909733f5ad01f8f.tar.bz2
llvm-4fe16d607d11e29d742208894909733f5ad01f8f.tar.xz
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/Scalar')
-rw-r--r--lib/Transforms/Scalar/CondPropagate.cpp2
-rw-r--r--lib/Transforms/Scalar/CorrelatedExprs.cpp2
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp30
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp12
-rw-r--r--lib/Transforms/Scalar/PredicateSimplifier.cpp6
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp6
6 files changed, 29 insertions, 29 deletions
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()));