OSDN Git Service

Merging r369426 and r369443:
authorHans Wennborg <hans@hanshq.net>
Thu, 22 Aug 2019 14:28:05 +0000 (14:28 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 22 Aug 2019 14:28:05 +0000 (14:28 +0000)
------------------------------------------------------------------------
r369426 | mstorsjo | 2019-08-20 20:58:05 +0200 (Tue, 20 Aug 2019) | 5 lines

[TargetMachine] Don't try to create COFFSTUB references on windows on non-COFF

This avoids spurious relocation types for windows/elf targets.

Differential Revision: https://reviews.llvm.org/D66401
------------------------------------------------------------------------

------------------------------------------------------------------------
r369443 | mstorsjo | 2019-08-20 22:58:02 +0200 (Tue, 20 Aug 2019) | 11 lines

[test] Fix tests when run on windows after SVN r369426. NFC.

When running tests on windows, invoking "llc -march=<arch>" will
implicitly use windows as the target os, making these tests misbehave
after this change.

Fix the issue by using more specific -mtriple values instead of plain
-march in these tests.

This should hopefully fix buildbot failures like
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/9816.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_90@369654 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetMachine.cpp
lib/Target/X86/X86Subtarget.cpp
test/CodeGen/AMDGPU/propagate-attributes-bitcast-function.ll
test/CodeGen/AMDGPU/propagate-attributes-clone.ll
test/CodeGen/AMDGPU/propagate-attributes-single-set.ll
test/CodeGen/Hexagon/pic-jt-big.ll
test/CodeGen/Hexagon/pic-sdata.ll
test/CodeGen/SPARC/tls.ll
test/CodeGen/X86/mingw-refptr.ll

index 634866d..28d783a 100644 (file)
@@ -140,8 +140,8 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
   // don't assume the variables to be DSO local unless we actually know
   // that for sure. This only has to be done for variables; for functions
   // the linker can insert thunks for calling functions from another DLL.
-  if (TT.isWindowsGNUEnvironment() && GV && GV->isDeclarationForLinker() &&
-      isa<GlobalVariable>(GV))
+  if (TT.isWindowsGNUEnvironment() && TT.isOSBinFormatCOFF() && GV &&
+      GV->isDeclarationForLinker() && isa<GlobalVariable>(GV))
     return false;
 
   // On COFF, don't mark 'extern_weak' symbols as DSO local. If these symbols
@@ -154,7 +154,9 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
   // Make an exception for windows OS in the triple: Some firmware builds use
   // *-win32-macho triples. This (accidentally?) produced windows relocations
   // without GOT tables in older clang versions; Keep this behaviour.
-  if (TT.isOSBinFormatCOFF() || (TT.isOSWindows() && TT.isOSBinFormatMachO()))
+  // Some JIT users use *-win32-elf triples; these shouldn't use GOT tables
+  // either.
+  if (TT.isOSBinFormatCOFF() || TT.isOSWindows())
     return true;
 
   // Most PIC code sequences that assume that a symbol is local cannot
index d5bb566..61fc3d0 100644 (file)
@@ -146,6 +146,9 @@ unsigned char X86Subtarget::classifyGlobalReference(const GlobalValue *GV,
       return X86II::MO_DLLIMPORT;
     return X86II::MO_COFFSTUB;
   }
+  // Some JIT users use *-win32-elf triples; these shouldn't use GOT tables.
+  if (isOSWindows())
+    return X86II::MO_NO_FLAG;
 
   if (is64Bit()) {
     // ELF supports a large, truly PIC code model with non-PC relative GOT
index c1d8009..173bc72 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
 
 ; GCN: foo1:
 ; v_cndmask_b32_e64 v0, 0, 1, vcc_lo{{$}}
index b9c3621..cb0406c 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 < %s | FileCheck -check-prefix=OPT %s
-; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
 
 ; OPT: declare void @foo4() local_unnamed_addr #0
 ; OPT: define internal fastcc void @foo3.2() unnamed_addr #1
index 3488258..cb4283c 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 < %s | FileCheck -check-prefix=OPT %s
-; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s
 
 ; OPT: declare void @foo4() local_unnamed_addr #0
 ; OPT: define void @foo3() local_unnamed_addr #1
index f5b4c2d..25ee045 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc -march=hexagon -relocation-model=pic < %s | FileCheck %s
+; RUN: llc -mtriple=hexagon-unknown-elf -relocation-model=pic < %s | FileCheck %s
 
 ; CHECK: r{{[0-9]+}} = add({{pc|PC}},##.LJTI{{[0-9_]+}}@PCREL)
 ; CHECK: r{{[0-9]+}} = memw(r{{[0-9]}}+##g0@GOT
index 3e4dc2d..446734b 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: llc -march=hexagon -hexagon-small-data-threshold=8 -relocation-model=static < %s | FileCheck --check-prefixes=CHECK,STATIC %s
-; RUN: llc -march=hexagon -hexagon-small-data-threshold=8 -relocation-model=pic < %s | FileCheck --check-prefixes=CHECK,PIC %s
+; RUN: llc -mtriple=hexagon-unknown-elf -hexagon-small-data-threshold=8 -relocation-model=static < %s | FileCheck --check-prefixes=CHECK,STATIC %s
+; RUN: llc -mtriple=hexagon-unknown-elf -hexagon-small-data-threshold=8 -relocation-model=pic < %s | FileCheck --check-prefixes=CHECK,PIC %s
 
 ; If a global has a specified section, it should probably be placed in that
 ; section, but with PIC any accesses to globals in small data should still
index 1b1af2e..843769d 100644 (file)
@@ -1,12 +1,12 @@
-; RUN: llc <%s -march=sparc   -relocation-model=static | FileCheck %s --check-prefix=v8abs
-; RUN: llc <%s -march=sparcv9 -relocation-model=static | FileCheck %s --check-prefix=v9abs
-; RUN: llc <%s -march=sparc   -relocation-model=pic    | FileCheck %s --check-prefix=pic
-; RUN: llc <%s -march=sparcv9 -relocation-model=pic    | FileCheck %s --check-prefix=pic
-
-; RUN: llc <%s -march=sparc   -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v8abs-obj
-; RUN: llc <%s -march=sparcv9 -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v9abs-obj
-; RUN: llc <%s -march=sparc   -relocation-model=pic    -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
-; RUN: llc <%s -march=sparcv9 -relocation-model=pic    -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
+; RUN: llc <%s -mtriple=sparc-unknown-linux   -relocation-model=static | FileCheck %s --check-prefix=v8abs
+; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=static | FileCheck %s --check-prefix=v9abs
+; RUN: llc <%s -mtriple=sparc-unknown-linux   -relocation-model=pic    | FileCheck %s --check-prefix=pic
+; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=pic    | FileCheck %s --check-prefix=pic
+
+; RUN: llc <%s -mtriple=sparc-unknown-linux   -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v8abs-obj
+; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v9abs-obj
+; RUN: llc <%s -mtriple=sparc-unknown-linux   -relocation-model=pic    -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
+; RUN: llc <%s -mtriple=sparcv9-unknown-linux -relocation-model=pic    -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
 
 @local_symbol = internal thread_local global i32 0
 @extern_symbol = external thread_local global i32
index 158462d..8d5712b 100644 (file)
@@ -1,5 +1,6 @@
 ; RUN: llc < %s -mtriple=x86_64-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X64
 ; RUN: llc < %s -mtriple=i686-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X86
+; RUN: llc < %s -mtriple=i686-w64-mingw32-none-elf | FileCheck %s -check-prefix=CHECK-X86-ELF
 
 @var = external local_unnamed_addr global i32, align 4
 @dsolocalvar = external dso_local local_unnamed_addr global i32, align 4
@@ -16,6 +17,9 @@ define dso_local i32 @getVar() {
 ; CHECK-X86:    movl .refptr._var, %eax
 ; CHECK-X86:    movl (%eax), %eax
 ; CHECK-X86:    retl
+; CHECK-X86-ELF-LABEL: getVar:
+; CHECK-X86-ELF:    movl var, %eax
+; CHECK-X86-ELF:    retl
 entry:
   %0 = load i32, i32* @var, align 4
   ret i32 %0
@@ -66,6 +70,9 @@ define dso_local i32 @getExtVar() {
 ; CHECK-X86:    movl __imp__extvar, %eax
 ; CHECK-X86:    movl (%eax), %eax
 ; CHECK-X86:    retl
+; CHECK-X86-ELF-LABEL: getExtVar:
+; CHECK-X86-ELF:    movl extvar, %eax
+; CHECK-X86-ELF:    retl
 entry:
   %0 = load i32, i32* @extvar, align 4
   ret i32 %0