diff options
| author | Bill Wendling <isanbard@gmail.com> | 2008-11-21 00:06:32 +0000 |
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2008-11-21 00:06:32 +0000 |
| commit | 26c6a3e736d3aa51c3e27789b381563c481d5ceb (patch) | |
| tree | 7b7c569d554fdb5a4837ece356aa30e67369fc90 /llvm/lib/Transforms/IPO/Inliner.cpp | |
| parent | 3d9cdd44840407641f25b88dc5c859c5f18516f6 (diff) | |
| download | bcm5719-llvm-26c6a3e736d3aa51c3e27789b381563c481d5ceb.tar.gz bcm5719-llvm-26c6a3e736d3aa51c3e27789b381563c481d5ceb.zip | |
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.
llvm-svn: 59757
Diffstat (limited to 'llvm/lib/Transforms/IPO/Inliner.cpp')
| -rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index 418b2b70cb6..bf0925c2e2f 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -56,6 +56,15 @@ static bool InlineCallIfPossible(CallSite CS, CallGraph &CG, 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() && |

