diff options
author | Vasileios Kalintiris <Vasileios.Kalintiris@imgtec.com> | 2016-10-27 15:50:36 +0000 |
---|---|---|
committer | Vasileios Kalintiris <Vasileios.Kalintiris@imgtec.com> | 2016-10-27 15:50:36 +0000 |
commit | cfb005a0ee6ca75c79805324d377b32d1325774a (patch) | |
tree | 5a63a4089ef0d36c3b09597047ac87177f95bfe6 | |
parent | 820e1326d726f8219b0de369f8dc14c666197c17 (diff) | |
download | bcm5719-llvm-cfb005a0ee6ca75c79805324d377b32d1325774a.tar.gz bcm5719-llvm-cfb005a0ee6ca75c79805324d377b32d1325774a.zip |
[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.
llvm-svn: 285305
-rw-r--r-- | llvm/lib/Target/Mips/MipsOptimizePICCall.cpp | 3 | ||||
-rw-r--r-- | llvm/test/CodeGen/Mips/call-optimization.ll | 14 |
2 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/Target/Mips/MipsOptimizePICCall.cpp b/llvm/lib/Target/Mips/MipsOptimizePICCall.cpp index 441a2dbec9b..f33857fe628 100644 --- a/llvm/lib/Target/Mips/MipsOptimizePICCall.cpp +++ b/llvm/lib/Target/Mips/MipsOptimizePICCall.cpp @@ -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; diff --git a/llvm/test/CodeGen/Mips/call-optimization.ll b/llvm/test/CodeGen/Mips/call-optimization.ll index 762b00effc9..0be5ff2ef6e 100644 --- a/llvm/test/CodeGen/Mips/call-optimization.ll +++ b/llvm/test/CodeGen/Mips/call-optimization.ll @@ -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 } |