diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -9607,6 +9607,10 @@ const DataLayout &DL = DAG.getDataLayout(); SmallVector Ins; + // In Naked functions we aren't going to save any registers. + if (F.hasFnAttribute(Attribute::Naked)) + return; + if (!FuncInfo->CanLowerReturn) { // Put in an sret pointer parameter before all the other parameters. SmallVector ValueVTs; diff --git a/llvm/test/CodeGen/ARM/naked-no-prolog.ll b/llvm/test/CodeGen/ARM/naked-no-prolog.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/ARM/naked-no-prolog.ll @@ -0,0 +1,13 @@ +; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a7 -verify-machineinstrs %s -o - | FileCheck %s + +%struct.S = type { [65 x i8] } + +define void @naked_no_prologue(%struct.S* byval(%struct.S) align 4 %0) naked noinline nounwind optnone { +; CHECK-NOT: stm +; CHECK-NOT: str + +entry: + ret void + unreachable +} +