]> granicus.if.org Git - llvm/commitdiff
[mips] Do not allow -opt-bisect-limit to skip the PIC call optimization pass.
authorVasileios Kalintiris <Vasileios.Kalintiris@imgtec.com>
Thu, 27 Oct 2016 15:50:36 +0000 (15:50 +0000)
committerVasileios Kalintiris <Vasileios.Kalintiris@imgtec.com>
Thu, 27 Oct 2016 15:50:36 +0000 (15:50 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285305 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsOptimizePICCall.cpp
test/CodeGen/Mips/call-optimization.ll

index 441a2dbec9b15d7493b7da09015df2b2130a4de0..f33857fe628fcbbb00f6e8911d3c0e588666b33b 100644 (file)
@@ -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;
 
index 762b00effc97c28e9e47e1426532f07a1cb7eb19..0be5ff2ef6e323617cf251bc677624202a4e0477 100644 (file)
@@ -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 }