[PATCH] D33593: [mips] Don't use FastISel when -mxgot is present

Stefan Maksimovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 06:13:30 PDT 2017


smaksimovic created this revision.
Herald added a subscriber: arichardson.

The clang compiler by default uses FastISel when invoked with -O0, which is also the default.
In that case, passing of -mxgot doesn't 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.


https://reviews.llvm.org/D33593

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


Index: test/CodeGen/Mips/biggot.ll
===================================================================
--- test/CodeGen/Mips/biggot.ll
+++ test/CodeGen/Mips/biggot.ll
@@ -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
 
Index: lib/Target/Mips/MipsISelLowering.cpp
===================================================================
--- lib/Target/Mips/MipsISelLowering.cpp
+++ lib/Target/Mips/MipsISelLowering.cpp
@@ -472,7 +472,7 @@
                      !Subtarget.inMicroMipsMode();
 
   // Disable if we don't generate PIC or the ABI isn't O32.
-  if (!TM.isPositionIndependent() || !TM.getABI().IsO32())
+  if (!TM.isPositionIndependent() || !TM.getABI().IsO32() || LargeGOT)
     UseFastISel = false;
 
   return UseFastISel ? Mips::createFastISel(funcInfo, libInfo) : nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33593.100390.patch
Type: text/x-patch
Size: 1226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170526/6be2f9a9/attachment.bin>


More information about the llvm-commits mailing list