summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <efriedma@codeaurora.org>2018-05-15 23:36:46 +0000
committerEli Friedman <efriedma@codeaurora.org>2018-05-15 23:36:46 +0000
commit25bef201c57fb8e68cb50c7d3c26fe5e0ebf98af (patch)
tree1e30372443b630e17e617186f1d70735ef9eed24
parentc3f240f7dc0387a6efabb75ee86cd5b453e0b196 (diff)
downloadbcm5719-llvm-25bef201c57fb8e68cb50c7d3c26fe5e0ebf98af.tar.gz
bcm5719-llvm-25bef201c57fb8e68cb50c7d3c26fe5e0ebf98af.zip
[MachineOutliner] Add optsize markings to outlined functions.
It doesn't matter much this late in the pipeline, but one place that does check for it is the function alignment code. Differential Revision: https://reviews.llvm.org/D46373 llvm-svn: 332415
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp8
-rw-r--r--llvm/test/CodeGen/AArch64/machine-outliner.ll4
2 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index a524fca972e..afee909eaa2 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -1253,6 +1253,14 @@ MachineOutliner::createOutlinedFunction(Module &M, const OutlinedFunction &OF,
F->setLinkage(GlobalValue::InternalLinkage);
F->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
+ // FIXME: Set nounwind, so we don't generate eh_frame? Haven't verified it's
+ // necessary.
+
+ // Set optsize/minsize, so we don't insert padding between outlined
+ // functions.
+ F->addFnAttr(Attribute::OptimizeForSize);
+ F->addFnAttr(Attribute::MinSize);
+
// Save F so that we can add debug info later if we need to.
CreatedIRFunctions.push_back(F);
diff --git a/llvm/test/CodeGen/AArch64/machine-outliner.ll b/llvm/test/CodeGen/AArch64/machine-outliner.ll
index d8d8ddeded9..7e0dc8c6d6f 100644
--- a/llvm/test/CodeGen/AArch64/machine-outliner.ll
+++ b/llvm/test/CodeGen/AArch64/machine-outliner.ll
@@ -1,4 +1,5 @@
; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64-apple-darwin < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64-apple-darwin -mcpu=cortex-a53 -enable-misched=false < %s | FileCheck %s
; RUN: llc -verify-machineinstrs -enable-machine-outliner -enable-linkonceodr-outlining -mtriple=aarch64-apple-darwin < %s | FileCheck %s -check-prefix=ODR
define linkonce_odr void @fish() #0 {
@@ -67,7 +68,8 @@ define void @dog() #0 {
}
; ODR: [[OUTLINED]]:
-; CHECK: [[OUTLINED]]:
+; CHECK: .p2align 2
+; CHECK-NEXT: [[OUTLINED]]:
; CHECK-DAG: orr w8, wzr, #0x1
; CHECK-NEXT: stp w8, wzr, [sp, #8]
; CHECK-NEXT: orr w8, wzr, #0x2
OpenPOWER on IntegriCloud