Simplify code. No change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119908 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2010-11-20 18:43:35 +00:00
parent 1c3f050309
commit f601d6df6f
5 changed files with 11 additions and 15 deletions

View File

@ -5075,13 +5075,13 @@ bool ScalarEvolution::SimplifyICmpOperands(ICmpInst::Predicate &Pred,
trivially_true:
// Return 0 == 0.
LHS = RHS = getConstant(Type::getInt1Ty(getContext()), 0);
LHS = RHS = getConstant(ConstantInt::getFalse(getContext()));
Pred = ICmpInst::ICMP_EQ;
return true;
trivially_false:
// Return 0 != 0.
LHS = RHS = getConstant(Type::getInt1Ty(getContext()), 0);
LHS = RHS = getConstant(ConstantInt::getFalse(getContext()));
Pred = ICmpInst::ICMP_NE;
return true;
}

View File

@ -496,7 +496,7 @@ bool MemCpyOpt::processStore(StoreInst *SI, BasicBlock::iterator &BBI) {
// align
ConstantInt::get(Type::getInt32Ty(Context), Alignment),
// volatile
ConstantInt::get(Type::getInt1Ty(Context), 0),
ConstantInt::getFalse(Context),
};
const Type *Tys[] = { Ops[0]->getType(), Ops[2]->getType() };

View File

@ -1477,7 +1477,7 @@ void SROA::RewriteMemIntrinUserOfAlloca(MemIntrinsic *MI, Instruction *Inst,
EltPtr, MI->getArgOperand(1), // Dest, Value,
ConstantInt::get(MI->getArgOperand(2)->getType(), EltSize), // Size
Zero, // Align
ConstantInt::get(Type::getInt1Ty(MI->getContext()), 0) // isVolatile
ConstantInt::getFalse(MI->getContext()) // isVolatile
};
const Type *Tys[] = { Ops[0]->getType(), Ops[2]->getType() };
Module *M = MI->getParent()->getParent()->getParent();

View File

@ -338,7 +338,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI) {
Value *CallArgs[] = {
DestCast, SrcCast, Size,
ConstantInt::get(Type::getInt32Ty(Context), 1),
ConstantInt::get(Type::getInt1Ty(Context), 0)
ConstantInt::getFalse(Context) // isVolatile
};
CallInst *TheMemCpy =
CallInst::Create(MemCpyFn, CallArgs, CallArgs+5, "", TheCall);

View File

@ -265,20 +265,16 @@ ConstantInt::ConstantInt(const IntegerType *Ty, const APInt& V)
ConstantInt* ConstantInt::getTrue(LLVMContext &Context) {
LLVMContextImpl *pImpl = Context.pImpl;
if (pImpl->TheTrueVal)
return pImpl->TheTrueVal;
else
return (pImpl->TheTrueVal =
ConstantInt::get(IntegerType::get(Context, 1), 1));
if (!pImpl->TheTrueVal)
pImpl->TheTrueVal = ConstantInt::get(Type::getInt1Ty(Context), 1);
return pImpl->TheTrueVal;
}
ConstantInt* ConstantInt::getFalse(LLVMContext &Context) {
LLVMContextImpl *pImpl = Context.pImpl;
if (pImpl->TheFalseVal)
return pImpl->TheFalseVal;
else
return (pImpl->TheFalseVal =
ConstantInt::get(IntegerType::get(Context, 1), 0));
if (!pImpl->TheFalseVal)
pImpl->TheFalseVal = ConstantInt::get(Type::getInt1Ty(Context), 0);
return pImpl->TheFalseVal;
}