[llvm-bugs] [Bug 36078] New: __attribute__((naked)) function loses parameter
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jan 24 09:08:56 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36078
Bug ID: 36078
Summary: __attribute__((naked)) function loses parameter
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Interprocedural Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: momchil.velikov at arm.com
CC: llvm-bugs at lists.llvm.org
Created attachment 19740
--> https://bugs.llvm.org/attachment.cgi?id=19740&action=edit
minimal testcase
LLVM discards a parameter of a function, declared with the "naked" attribute.
Compiling the attached test program for Arm with `clang -target arm-eabi -O3 -S
naked.c` output the following assembly for `bar`:
bar:
.fnstart
b foo
i.e. the parameter to `foo` is not passed at all.
This change occurs during "Deduce function attributes", which marks the
parameter with "readnone" and subsequently it's removed by "Promote 'by
reference' arguments to scalars" pass.
*** IR Dump After Function Integration/Inlining ***
; Function Attrs: naked noinline nounwind
define internal fastcc i32 @foo(i32*) unnamed_addr #1 {
entry:
call void asm sideeffect "ldr r0, [r0] \0Abx lr \0A", ""() #2,
!srcloc !3
unreachable
}
*** IR Dump After Deduce function attributes ***
; Function Attrs: naked noinline nounwind
define internal fastcc i32 @foo(i32* nocapture readnone) unnamed_addr #1 {
entry:
call void asm sideeffect "ldr r0, [r0] \0Abx lr \0A", ""() #2,
!srcloc !3
unreachable
}
*** IR Dump After Promote 'by reference' arguments to scalars ***
; Function Attrs: naked noinline nounwind
define internal fastcc i32 @foo() unnamed_addr #1 {
entry:
call void asm sideeffect "ldr r0, [r0] \0Abx lr \0A", ""() #2,
!srcloc !3
unreachable
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180124/af63cef5/attachment.html>
More information about the llvm-bugs
mailing list