diff options
author | Eric Christopher <echristo@apple.com> | 2010-01-06 20:04:44 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2010-01-06 20:04:44 +0000 |
commit | 2cdb806fd88bccd7d4bf22fa358cc79609492f55 (patch) | |
tree | 77d88f5d2139186ea44b5c16b10209330be44d5a /llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp | |
parent | 746012a6c14e86d8a8314cd32e7651e0d51dac08 (diff) | |
download | bcm5719-llvm-2cdb806fd88bccd7d4bf22fa358cc79609492f55.tar.gz bcm5719-llvm-2cdb806fd88bccd7d4bf22fa358cc79609492f55.zip |
Move the object size intrinsic optimization to inst-combine and make
it work for any integer size return type.
llvm-svn: 92853
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp index c67c9cf03f2..9183f3aac1f 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp @@ -1095,27 +1095,6 @@ struct MemSetOpt : public LibCallOptimization { //===----------------------------------------------------------------------===// //===---------------------------------------===// -// 'object size' -namespace { -struct SizeOpt : public LibCallOptimization { - virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) { - // TODO: We can do more with this, but delaying to here should be no change - // in behavior. - ConstantInt *Const = dyn_cast<ConstantInt>(CI->getOperand(2)); - - if (!Const) return 0; - - const Type *Ty = Callee->getFunctionType()->getReturnType(); - - if (Const->getZExtValue() == 0) - return Constant::getAllOnesValue(Ty); - else - return ConstantInt::get(Ty, 0); - } -}; -} - -//===---------------------------------------===// // 'memcpy_chk' Optimizations struct MemCpyChkOpt : public LibCallOptimization { @@ -1745,7 +1724,6 @@ namespace { FWriteOpt FWrite; FPutsOpt FPuts; FPrintFOpt FPrintF; // Object Size Checking - SizeOpt ObjectSize; MemCpyChkOpt MemCpyChk; MemSetChkOpt MemSetChk; MemMoveChkOpt MemMoveChk; bool Modified; // This is only used by doInitialization. @@ -1855,8 +1833,6 @@ void SimplifyLibCalls::InitOptimizations() { Optimizations["fprintf"] = &FPrintF; // Object Size Checking - Optimizations["llvm.objectsize.i32"] = &ObjectSize; - Optimizations["llvm.objectsize.i64"] = &ObjectSize; Optimizations["__memcpy_chk"] = &MemCpyChk; Optimizations["__memset_chk"] = &MemSetChk; Optimizations["__memmove_chk"] = &MemMoveChk; |