summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff options
context:
space:
mode:
authorLuke Cheeseman <luke.cheeseman@arm.com>2018-02-22 14:42:08 +0000
committerLuke Cheeseman <luke.cheeseman@arm.com>2018-02-22 14:42:08 +0000
commit6c1e6bbe0c609489ef49f9d64f1370a43e05c19c (patch)
tree42f8f4b2437344e153ec13ac4fcf82182d1f75ed /llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
parent92b73711138b3d37855fb527a538c85b293f37a7 (diff)
downloadbcm5719-llvm-6c1e6bbe0c609489ef49f9d64f1370a43e05c19c.tar.gz
bcm5719-llvm-6c1e6bbe0c609489ef49f9d64f1370a43e05c19c.zip
[FunctionAttrs][ArgumentPromotion][GlobalOpt] Disable some optimisations passes for naked functions
- Fix for bug 36078. - Prevent the functionattrs, function-attrs, globalopt and argpromotion passes from changing naked functions. - These passes can perform some alterations to the functions that should not be applied. An example is removing parameters that are seemingly not used because they are only referenced in the inline assembly. Another example is marking the function as fastcc. llvm-svn: 325788
Diffstat (limited to 'llvm/lib/Transforms/IPO/ArgumentPromotion.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/ArgumentPromotion.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index d3a7b0e76fe..461c4e12cbd 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -817,6 +817,12 @@ promoteArguments(Function *F, function_ref<AAResults &(Function &F)> AARGetter,
unsigned MaxElements,
Optional<function_ref<void(CallSite OldCS, CallSite NewCS)>>
ReplaceCallSite) {
+ // Don't perform argument promotion for naked functions; otherwise we can end
+ // up removing parameters that are seemingly 'not used' as they are referred
+ // to in the assembly.
+ if(F->hasFnAttribute(Attribute::Naked))
+ return nullptr;
+
// Make sure that it is local to this module.
if (!F->hasLocalLinkage())
return nullptr;
OpenPOWER on IntegriCloud