1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

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
This commit is contained in:
Bill Wendling 2008-11-21 00:06:32 +00:00
parent d0bd6f6e73
commit f85b54db6c

View File

@ -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() &&