diff options
author | Meador Inge <meadori@codesourcery.com> | 2012-11-11 06:49:03 +0000 |
---|---|---|
committer | Meador Inge <meadori@codesourcery.com> | 2012-11-11 06:49:03 +0000 |
commit | 26ebe398f2bddae5395b4ad8c7ffb5933b2230d1 (patch) | |
tree | 56510c6353092b9bbc76e8bafc74a028720e5000 /lib/Transforms/Scalar/SimplifyLibCalls.cpp | |
parent | d324c48e5595235996aa2ddb08a331913f2037fd (diff) | |
download | external_llvm-26ebe398f2bddae5395b4ad8c7ffb5933b2230d1.zip external_llvm-26ebe398f2bddae5395b4ad8c7ffb5933b2230d1.tar.gz external_llvm-26ebe398f2bddae5395b4ad8c7ffb5933b2230d1.tar.bz2 |
instcombine: Migrate memset optimizations
This patch migrates the memset optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SimplifyLibCalls.cpp')
-rw-r--r-- | lib/Transforms/Scalar/SimplifyLibCalls.cpp | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp index 40dce65..0f95e15 100644 --- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/lib/Transforms/Scalar/SimplifyLibCalls.cpp @@ -104,28 +104,6 @@ static bool CallHasFloatingPointArgument(const CallInst *CI) { //===----------------------------------------------------------------------===// namespace { -//===---------------------------------------===// -// 'memset' Optimizations - -struct MemSetOpt : public LibCallOptimization { - virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { - // These optimizations require DataLayout. - if (!TD) return 0; - - FunctionType *FT = Callee->getFunctionType(); - if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) || - !FT->getParamType(0)->isPointerTy() || - !FT->getParamType(1)->isIntegerTy() || - FT->getParamType(2) != TD->getIntPtrType(*Context)) - return 0; - - // memset(p, v, n) -> llvm.memset(p, v, n, 1) - Value *Val = B.CreateIntCast(CI->getArgOperand(1), B.getInt8Ty(), false); - B.CreateMemSet(CI->getArgOperand(0), Val, CI->getArgOperand(2), 1); - return CI->getArgOperand(0); - } -}; - //===----------------------------------------------------------------------===// // Math Library Optimizations //===----------------------------------------------------------------------===// @@ -794,8 +772,6 @@ namespace { TargetLibraryInfo *TLI; StringMap<LibCallOptimization*> Optimizations; - // Memory LibCall Optimizations - MemSetOpt MemSet; // Math Library Optimizations CosOpt Cos; PowOpt Pow; Exp2Opt Exp2; UnaryDoubleFPOpt UnaryDoubleFP, UnsafeUnaryDoubleFP; @@ -861,9 +837,6 @@ void SimplifyLibCalls::AddOpt(LibFunc::Func F1, LibFunc::Func F2, /// Optimizations - Populate the Optimizations map with all the optimizations /// we know. void SimplifyLibCalls::InitOptimizations() { - // Memory LibCall Optimizations - AddOpt(LibFunc::memset, &MemSet); - // Math Library Optimizations Optimizations["cosf"] = &Cos; Optimizations["cos"] = &Cos; |