diff options
author | Meador Inge <meadori@codesourcery.com> | 2012-11-29 19:15:17 +0000 |
---|---|---|
committer | Meador Inge <meadori@codesourcery.com> | 2012-11-29 19:15:17 +0000 |
commit | 75798bb7fe4fa9d820a6a5df689a488430def2ea (patch) | |
tree | 74304e1d1cf5664ce8603c0280c1c7e60c6eacde /llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp | |
parent | 59aeece231d2ce6eb2552d140eec9a5b3642c24f (diff) | |
download | bcm5719-llvm-75798bb7fe4fa9d820a6a5df689a488430def2ea.tar.gz bcm5719-llvm-75798bb7fe4fa9d820a6a5df689a488430def2ea.zip |
instcombine: Migrate puts optimizations
This patch migrates the puts optimizations from the simplify-libcalls
pass into the instcombine library call simplifier.
All the simplifiers from simplify-libcalls have now been migrated to
instcombine. Yay! Just a few other bits to migrate (prototype attribute
inference and a few statistics) and simplify-libcalls can finally be put
to rest.
llvm-svn: 168925
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp index 7a224122d4b..43fff858a1e 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp @@ -81,41 +81,6 @@ public: } // End anonymous namespace. -namespace { -//===----------------------------------------------------------------------===// -// Formatting and IO Optimizations -//===----------------------------------------------------------------------===// - -//===---------------------------------------===// -// 'puts' Optimizations - -struct PutsOpt : public LibCallOptimization { - virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { - // Require one fixed pointer argument and an integer/void result. - FunctionType *FT = Callee->getFunctionType(); - if (FT->getNumParams() < 1 || !FT->getParamType(0)->isPointerTy() || - !(FT->getReturnType()->isIntegerTy() || - FT->getReturnType()->isVoidTy())) - return 0; - - // Check for a constant string. - StringRef Str; - if (!getConstantStringInfo(CI->getArgOperand(0), Str)) - return 0; - - if (Str.empty() && CI->use_empty()) { - // puts("") -> putchar('\n') - Value *Res = EmitPutChar(B.getInt32('\n'), B, TD, TLI); - if (CI->use_empty() || !Res) return Res; - return B.CreateIntCast(Res, CI->getType(), true); - } - - return 0; - } -}; - -} // end anonymous namespace. - //===----------------------------------------------------------------------===// // SimplifyLibCalls Pass Implementation //===----------------------------------------------------------------------===// @@ -127,8 +92,6 @@ namespace { TargetLibraryInfo *TLI; StringMap<LibCallOptimization*> Optimizations; - // Formatting and IO Optimizations - PutsOpt Puts; bool Modified; // This is only used by doInitialization. public: @@ -183,8 +146,6 @@ void SimplifyLibCalls::AddOpt(LibFunc::Func F1, LibFunc::Func F2, /// Optimizations - Populate the Optimizations map with all the optimizations /// we know. void SimplifyLibCalls::InitOptimizations() { - // Formatting and IO Optimizations - Optimizations["puts"] = &Puts; } |