[llvm] r285305 - [mips] Do not allow -opt-bisect-limit to skip the PIC call optimization pass.

Vasileios Kalintiris via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 08:50:37 PDT 2016


Author: vkalintiris
Date: Thu Oct 27 10:50:36 2016
New Revision: 285305

URL: http://llvm.org/viewvc/llvm-project?rev=285305&view=rev
Log:
[mips] Do not allow -opt-bisect-limit to skip the PIC call optimization pass.

r282428 added the MipsOptimizePICCall as an opt-in pass that can be
skipped when using the -opt-bisect-limit option. However, this pass is
needed because it generates code that conforms to the o32 ABI
specification by using the $t9 register for PIC calls with JALR
instructions.

This bug was exposed by the fact that skipFunction() also checks for
the "optnone" attribute. This caused functions with that attribute to
break the requirements of the o32 ABI.

Modified:
    llvm/trunk/lib/Target/Mips/MipsOptimizePICCall.cpp
    llvm/trunk/test/CodeGen/Mips/call-optimization.ll

Modified: llvm/trunk/lib/Target/Mips/MipsOptimizePICCall.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsOptimizePICCall.cpp?rev=285305&r1=285304&r2=285305&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsOptimizePICCall.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsOptimizePICCall.cpp Thu Oct 27 10:50:36 2016
@@ -174,9 +174,6 @@ void MBBInfo::postVisit() {
 
 // OptimizePICCall methods.
 bool OptimizePICCall::runOnMachineFunction(MachineFunction &F) {
-  if (skipFunction(*F.getFunction()))
-    return false;
-
   if (static_cast<const MipsSubtarget &>(F.getSubtarget()).inMips16Mode())
     return false;
 

Modified: llvm/trunk/test/CodeGen/Mips/call-optimization.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/call-optimization.ll?rev=285305&r1=285304&r2=285305&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/call-optimization.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/call-optimization.ll Thu Oct 27 10:50:36 2016
@@ -89,3 +89,17 @@ entry:
 }
 
 declare double @ceil(double)
+
+; Make sure that the MipsOptimizePICCall pass is run even for optnone functions,
+; as we have to make sure that jalr uses $t9 for PIC code in order to adhere to
+; the MIPS o32 ABI.
+define hidden double @foo(double %dbl) #0 {
+entry:
+  ; O32:      jalr $25
+  %res = call double @sqrt(double %dbl)
+  ret double %res
+}
+
+declare double @sqrt(double)
+
+attributes #0 = { noinline optnone }




More information about the llvm-commits mailing list