diff options
author | Luke Cheeseman <luke.cheeseman@arm.com> | 2018-02-22 14:42:08 +0000 |
---|---|---|
committer | Luke Cheeseman <luke.cheeseman@arm.com> | 2018-02-22 14:42:08 +0000 |
commit | 6c1e6bbe0c609489ef49f9d64f1370a43e05c19c (patch) | |
tree | 42f8f4b2437344e153ec13ac4fcf82182d1f75ed /llvm/test/Transforms/ArgumentPromotion | |
parent | 92b73711138b3d37855fb527a538c85b293f37a7 (diff) | |
download | bcm5719-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/test/Transforms/ArgumentPromotion')
-rw-r--r-- | llvm/test/Transforms/ArgumentPromotion/naked_functions.ll | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ArgumentPromotion/naked_functions.ll b/llvm/test/Transforms/ArgumentPromotion/naked_functions.ll new file mode 100644 index 00000000000..70a63f4d02e --- /dev/null +++ b/llvm/test/Transforms/ArgumentPromotion/naked_functions.ll @@ -0,0 +1,23 @@ +; RUN: opt < %s -argpromotion -S | FileCheck %s + +; Don't promote paramaters of/arguments to naked functions + +@g = common global i32 0, align 4 + +define i32 @bar() { +entry: + %call = call i32 @foo(i32* @g) +; CHECK: %call = call i32 @foo(i32* @g) + ret i32 %call +} + +define internal i32 @foo(i32*) #0 { +entry: + %retval = alloca i32, align 4 + call void asm sideeffect "ldr r0, [r0] \0Abx lr \0A", ""() + unreachable +} + +; CHECK: define internal i32 @foo(i32*) + +attributes #0 = { naked } |