[llvm] r251852 - [SimplifyLibCalls] Remove variables that are not used. NFC.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 15:07:14 PST 2015


Author: davide
Date: Mon Nov  2 17:07:14 2015
New Revision: 251852

URL: http://llvm.org/viewvc/llvm-project?rev=251852&view=rev
Log:
[SimplifyLibCalls] Remove variables that are not used. NFC.

Modified:
    llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp

Modified: llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=251852&r1=251851&r2=251852&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp Mon Nov  2 17:07:14 2015
@@ -485,9 +485,6 @@ Value *LibCallSimplifier::optimizeStrCpy
 
 Value *LibCallSimplifier::optimizeStpCpy(CallInst *CI, IRBuilder<> &B) {
   Function *Callee = CI->getCalledFunction();
-  // Verify the "stpcpy" function prototype.
-  FunctionType *FT = Callee->getFunctionType();
-
   if (!checkStringCopyLibFuncSignature(Callee, LibFunc::stpcpy))
     return nullptr;
 
@@ -502,7 +499,7 @@ Value *LibCallSimplifier::optimizeStpCpy
   if (Len == 0)
     return nullptr;
 
-  Type *PT = FT->getParamType(0);
+  Type *PT = Callee->getFunctionType()->getParamType(0);
   Value *LenV = ConstantInt::get(DL.getIntPtrType(PT), Len);
   Value *DstEnd =
       B.CreateGEP(B.getInt8Ty(), Dst, ConstantInt::get(DL.getIntPtrType(PT), Len - 1));
@@ -515,8 +512,6 @@ Value *LibCallSimplifier::optimizeStpCpy
 
 Value *LibCallSimplifier::optimizeStrNCpy(CallInst *CI, IRBuilder<> &B) {
   Function *Callee = CI->getCalledFunction();
-  FunctionType *FT = Callee->getFunctionType();
-
   if (!checkStringCopyLibFuncSignature(Callee, LibFunc::strncpy))
     return nullptr;
 
@@ -549,7 +544,7 @@ Value *LibCallSimplifier::optimizeStrNCp
   if (Len > SrcLen + 1)
     return nullptr;
 
-  Type *PT = FT->getParamType(0);
+  Type *PT = Callee->getFunctionType()->getParamType(0);
   // strncpy(x, s, c) -> memcpy(x, s, c, 1) [s and c are constant]
   B.CreateMemCpy(Dst, Src, ConstantInt::get(DL.getIntPtrType(PT), Len), 1);
 




More information about the llvm-commits mailing list