[PATCH] D21561: [IPRA] Set callee saved registers to none for local function when IPRA is enabled.

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 12:22:37 PDT 2016


mehdi_amini added inline comments.

================
Comment at: include/llvm/CodeGen/TargetPassConfig.h:23
@@ -21,1 +22,3 @@
+extern llvm::cl::opt<bool> UseIPRA;
+
 namespace llvm {
----------------
I'm not sure it is fine to have a cl::opt in such a global header? If we need the option available broadly we may have to make it a member of `TargetPassConfig` initialized from a private cl::opt. 
(I haven't look in detail where it is needed though).

================
Comment at: include/llvm/Target/TargetFrameLowering.h:350
@@ +349,3 @@
+              return false;
+        }
+
----------------
Why not looking at the users of F?

================
Comment at: lib/CodeGen/RegUsageInfoCollector.cpp:123
@@ +122,3 @@
+    const uint32_t *CallPreservedMask =
+        TRI->getCallPreservedMask(MF, MF.getFunction()->getCallingConv());
+    // Set callee saved register as preserved.
----------------
You created `F` but didn't update uses of `MF.getFunction()`

================
Comment at: lib/CodeGen/RegUsageInfoCollector.cpp:129
@@ +128,3 @@
+    ++NumCSROpt;
+    DEBUG(dbgs() << "Function optimized for not having CSR.\n");
+  }
----------------
Add the function name in the debug output.

================
Comment at: lib/CodeGen/TargetFrameLoweringImpl.cpp:76
@@ +75,3 @@
+      return;
+  }
+
----------------
```
if (UseIPRA && isSafeForNoCSROpt(MF.getFunction()))
  return;
```

================
Comment at: test/CodeGen/X86/ipra-local-linkage.ll:8
@@ +7,3 @@
+; When IPRA is not enabled R15 will be saved by foo as it is callee saved reg.
+; NOIPRA-LABEL: foo:
+; NOIPRA: pushq	%r15
----------------
Hasn't been fixed apparently.

================
Comment at: test/CodeGen/X86/ipra-local-linkage.ll:19
@@ +18,3 @@
+define void @bar() #0 {
+  %X = add i32 1, 3
+  call void asm sideeffect "movl  %r12d, $0", "{r15}~{r12}"(i32 %X) #0
----------------
Take %X by argument?

================
Comment at: test/CodeGen/X86/ipra-local-linkage.ll:22
@@ +21,3 @@
+  ; As R15 is clobbered by foo() when IPRA is enabled value of R15 should be
+  ; reloaded after foo()
+  call void @foo()
----------------
saved before and reloaded after?


http://reviews.llvm.org/D21561





More information about the llvm-commits mailing list