[PATCH] D21561: [IPRA] Set callee saved registers to none for local function when IPRA is enabled.
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 21 11:34:51 PDT 2016
MatzeB added inline comments.
================
Comment at: lib/CodeGen/TargetFrameLoweringImpl.cpp:27-28
@@ -26,2 +26,4 @@
+extern cl::opt<bool> UseIPRA;
+
TargetFrameLowering::~TargetFrameLowering() {
----------------
This should go into a header.
================
Comment at: lib/CodeGen/TargetFrameLoweringImpl.cpp:64-69
@@ -61,1 +63,8 @@
RegScavenger *RS) const {
+ Function *F = const_cast<Function *>(MF.getFunction());
+
+ // When interprocedural register allocation is enabled caller saved registers
+ // are preferred over callee saved registers.
+ if (UseIPRA && F->hasLocalLinkage() && !F->hasAddressTaken())
+ return;
+
----------------
I would first test for `if (UseIPRA)` and only then do the MF.getFunction(), hasLocalLnkage() && !hasAddressTaken().
================
Comment at: test/CodeGen/X86/ipra-local-linkage.ll:4-5
@@ +3,4 @@
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.12.0"
+
----------------
You can probably simplify this further by leaving out the datalayout and using `target triple = "x86_64--"`
================
Comment at: test/CodeGen/X86/ipra-local-linkage.ll:7
@@ +6,3 @@
+
+define void @bar() #0 {
+ call void @foo()
----------------
The metadata `#0` referenced here doesn't exist, I am surprised this even parses...
http://reviews.llvm.org/D21561
More information about the llvm-commits
mailing list