[llvm-branch-commits] [llvm-branch] r99420 - /llvm/branches/Apple/Morbo/lib/Transforms/Scalar/SimplifyLibCalls.cpp

Evan Cheng evan.cheng at apple.com
Wed Mar 24 13:31:07 PDT 2010


Author: evancheng
Date: Wed Mar 24 15:31:07 2010
New Revision: 99420

URL: http://llvm.org/viewvc/llvm-project?rev=99420&view=rev
Log:
Merge 99418.

Modified:
    llvm/branches/Apple/Morbo/lib/Transforms/Scalar/SimplifyLibCalls.cpp

Modified: llvm/branches/Apple/Morbo/lib/Transforms/Scalar/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=99420&r1=99419&r2=99420&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Transforms/Scalar/SimplifyLibCalls.cpp Wed Mar 24 15:31:07 2010
@@ -49,13 +49,10 @@
   Function *Caller;
   const TargetData *TD;
   LLVMContext* Context;
-  bool OptChkCall;  // True if it's optimizing a *_chk libcall.
 public:
-  LibCallOptimization() : OptChkCall(false) { }
+  LibCallOptimization() { }
   virtual ~LibCallOptimization() {}
 
-  void setOptChkCall(bool c) { OptChkCall = c; }
-
   /// CallOptimizer - This pure virtual method is implemented by base classes to
   /// do various optimizations.  If this returns null then no transformation was
   /// performed.  If it returns CI, then it transformed the call and CI is to be
@@ -353,6 +350,10 @@
 // 'strcpy' Optimizations
 
 struct StrCpyOpt : public LibCallOptimization {
+  bool OptChkCall;  // True if it's optimizing a __strcpy_chk libcall.
+
+  StrCpyOpt(bool c) : OptChkCall(c) {}
+
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     // Verify the "strcpy" function prototype.
     unsigned NumParams = OptChkCall ? 3 : 2;
@@ -1188,8 +1189,7 @@
     bool Modified;  // This is only used by doInitialization.
   public:
     static char ID; // Pass identification
-    SimplifyLibCalls() : FunctionPass(&ID) {}
-
+    SimplifyLibCalls() : FunctionPass(&ID), StrCpy(false), StrCpyChk(true) {}
     void InitOptimizations();
     bool runOnFunction(Function &F);
 
@@ -1240,7 +1240,6 @@
   Optimizations["memset"] = &MemSet;
 
   // _chk variants of String and Memory LibCall Optimizations.
-  StrCpyChk.setOptChkCall(true);
   Optimizations["__strcpy_chk"] = &StrCpyChk;
 
   // Math Library Optimizations





More information about the llvm-branch-commits mailing list