]> granicus.if.org Git - llvm/commitdiff
[mips] do not use FastISel when -mxgot is present
authorPetar Jovanovic <petar.jovanovic@imgtec.com>
Wed, 7 Jun 2017 12:59:53 +0000 (12:59 +0000)
committerPetar Jovanovic <petar.jovanovic@imgtec.com>
Wed, 7 Jun 2017 12:59:53 +0000 (12:59 +0000)
The clang compiler by default uses FastISel when invoked with -O0, which
is also the default. In that case, passing of -mxgot does not get honored,
i.e. the code path that is to deal with large got is not taken.
Clang produces same output regardless of -mxgot being present or not.
This change checks whether -mxgot is passed as an option, and turns off
FastISel if it is.

Patch by Stefan Maksimovic.

Differential Revision: https://reviews.llvm.org/D33593

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

lib/Target/Mips/MipsISelLowering.cpp
test/CodeGen/Mips/biggot.ll

index 87778434299732a08b0107f957107ec806a6e3d1..ce7dd09f429c739caa9782400a32b60a1ac70d62 100644 (file)
@@ -470,8 +470,9 @@ MipsTargetLowering::createFastISel(FunctionLoweringInfo &funcInfo,
                      !Subtarget.hasMips32r6() && !Subtarget.inMips16Mode() &&
                      !Subtarget.inMicroMipsMode();
 
-  // Disable if we don't generate PIC or the ABI isn't O32.
-  if (!TM.isPositionIndependent() || !TM.getABI().IsO32())
+  // Disable if either of the following is true:
+  // We do not generate PIC, the ABI is not O32, LargeGOT is being used.
+  if (!TM.isPositionIndependent() || !TM.getABI().IsO32() || LargeGOT)
     UseFastISel = false;
 
   return UseFastISel ? Mips::createFastISel(funcInfo, libInfo) : nullptr;
index 3acfa372a905be05726e68826c2e66eb7ddde901..b266b5e05e21490aeb9dce587035cb85a18567a6 100644 (file)
@@ -1,6 +1,9 @@
 ; RUN: llc -march=mipsel -mxgot -relocation-model=pic < %s | FileCheck %s -check-prefix=O32
 ; RUN: llc -march=mips64el -mcpu=mips64r2 -mxgot -relocation-model=pic < %s | \
 ; RUN: FileCheck %s -check-prefix=N64
+; RUN: llc -march=mipsel -mxgot -relocation-model=pic -fast-isel < %s | FileCheck %s -check-prefix=O32
+; RUN: llc -march=mips64el -mcpu=mips64r2 -mxgot -relocation-model=pic -fast-isel < %s | \
+; RUN: FileCheck %s -check-prefix=N64
 
 @v0 = external global i32