[llvm-commits] [llvm] r59757 - /llvm/trunk/lib/Transforms/IPO/Inliner.cpp

Bill Wendling isanbard at gmail.com
Thu Nov 20 16:06:33 PST 2008


Author: void
Date: Thu Nov 20 18:06:32 2008
New Revision: 59757

URL: http://llvm.org/viewvc/llvm-project?rev=59757&view=rev
Log:
If the function being inlined has a higher stack protection level than the
inlining function, then increase the stack protection level on the inlining
function.

Modified:
    llvm/trunk/lib/Transforms/IPO/Inliner.cpp

Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=59757&r1=59756&r2=59757&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Thu Nov 20 18:06:32 2008
@@ -56,6 +56,15 @@
   Function *Callee = CS.getCalledFunction();
   if (!InlineFunction(CS, &CG, &TD)) return false;
 
+  // If the inlined function had a higher stack protection level than the
+  // calling function, then bump up the caller's stack protection level.
+  Function *Caller = CS.getCaller();
+  if (Callee->hasFnAttr(Attribute::StackProtectReq))
+    Caller->addFnAttr(Attribute::StackProtectReq);
+  else if (Callee->hasFnAttr(Attribute::StackProtect) &&
+           !Caller->hasFnAttr(Attribute::StackProtectReq))
+    Caller->addFnAttr(Attribute::StackProtect);
+
   // If we inlined the last possible call site to the function, delete the
   // function body now.
   if (Callee->use_empty() && Callee->hasInternalLinkage() &&





More information about the llvm-commits mailing list