Simplify code. No change in functionality.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 20 Nov 2010 18:43:35 +0000 (18:43 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 20 Nov 2010 18:43:35 +0000 (18:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119908 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp
lib/Transforms/Scalar/MemCpyOptimizer.cpp
lib/Transforms/Scalar/ScalarReplAggregates.cpp
lib/Transforms/Utils/InlineFunction.cpp
lib/VMCore/Constants.cpp

index 141cc9fa76d9a56ec4c65c1b98a0c290c38555b0..84dca47ef8b5674b1c2310eba92b13f7091d9f91 100644 (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;
 }
index c866659c6204dc0a00c46ed2a1c904784ff87d69..6f53c322ef5fc6fba9f87a0fdb17c766485d4b37 100644 (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() };
 
index a20d769ba3f1be76b46448caa7dd8d5282e64819..3d676b2b24655dbcf6028b0399ad39c19858efef 100644 (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();
index f57fec7d4c7cb8deb2e66185f9b62279ab458b7c..d60f9080502a572c7dfe5a41ff422fc558f40925 100644 (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);
index 16eaca81048bbf9d2ce7310808fc2a9ac88817dc..5bbf087e486de5f30661b7b85b713022561b616b 100644 (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;
 }