[llvm] 2e1a737 - [PowerPC][PCRelative] Turn on TLS support for PCRel by default

Victor Huang via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 11:59:09 PDT 2020


Author: Victor Huang
Date: 2020-10-27T13:58:44-05:00
New Revision: 2e1a737f46460ddc15733f78acb42e27bc18a5ee

URL: https://github.com/llvm/llvm-project/commit/2e1a737f46460ddc15733f78acb42e27bc18a5ee
DIFF: https://github.com/llvm/llvm-project/commit/2e1a737f46460ddc15733f78acb42e27bc18a5ee.diff

LOG: [PowerPC][PCRelative] Turn on TLS support for PCRel by default

Turn on TLS support for PCRel by default and update the test cases.

Differential Revision: https://reviews.llvm.org/D88738
Reviewed by: stefanp, kamaub

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCISelLowering.cpp
    llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll
    llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll
    llvm/test/CodeGen/PowerPC/pcrel-tls-local-dynamic.ll
    llvm/test/CodeGen/PowerPC/pcrel-tls-local-exec.ll

Removed: 
    llvm/test/CodeGen/PowerPC/pcrel-tls.ll


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index ac184fff1388..662442f1643b 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -121,11 +121,6 @@ cl::desc("don't always align innermost loop to 32 bytes on ppc"), cl::Hidden);
 static cl::opt<bool> UseAbsoluteJumpTables("ppc-use-absolute-jumptables",
 cl::desc("use absolute jump tables on ppc"), cl::Hidden);
 
-static cl::opt<bool> EnablePPCPCRelTLS(
-    "enable-ppc-pcrel-tls",
-    cl::desc("enable the use of PC relative memops in TLS instructions on PPC"),
-    cl::Hidden);
-
 STATISTIC(NumTailCalls, "Number of tail calls");
 STATISTIC(NumSiblingCalls, "Number of sibling calls");
 STATISTIC(ShufflesHandledWithVPERM, "Number of shuffles lowered to a VPERM");
@@ -3015,9 +3010,6 @@ SDValue PPCTargetLowering::LowerGlobalTLSAddress(SDValue Op,
   // which is the most useful form.  Eventually support for small and
   // large models could be added if users need it, at the cost of
   // additional complexity.
-  if (Subtarget.isUsingPCRelativeCalls() && !EnablePPCPCRelTLS)
-    report_fatal_error("Thread local storage is not supported with pc-relative"
-                       " addressing - please compile with -mno-pcrel");
   GlobalAddressSDNode *GA = cast<GlobalAddressSDNode>(Op);
   if (DAG.getTarget().useEmulatedTLS())
     return LowerToTLSEmulatedModel(GA, DAG);

diff  --git a/llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll b/llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll
index dfbcbb3b338b..9fdcc6fff602 100644
--- a/llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll
+++ b/llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll
@@ -1,9 +1,7 @@
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
-; RUN:   --relocation-model=pic -mcpu=pwr10 -ppc-asm-full-reg-names \
-; RUN:   -enable-ppc-pcrel-tls < %s | FileCheck %s --check-prefix=CHECK-S
+; RUN:   --relocation-model=pic -mcpu=pwr10 -ppc-asm-full-reg-names < %s | FileCheck %s --check-prefix=CHECK-S
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
-; RUN:   --relocation-model=pic -mcpu=pwr10 -ppc-asm-full-reg-names \
-; RUN:   -enable-ppc-pcrel-tls --filetype=obj -o %t.o < %s
+; RUN:   --relocation-model=pic -mcpu=pwr10 -ppc-asm-full-reg-names --filetype=obj -o %t.o < %s
 ; RUN: llvm-objdump --mcpu=pwr10 -dr %t.o |FileCheck %s --check-prefix=CHECK-O
 ; RUN: llvm-readelf -s %t.o | FileCheck %s --check-prefix=CHECK-SYM
 

diff  --git a/llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll b/llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll
index f10ed538d092..dd7e1d1f98aa 100644
--- a/llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll
+++ b/llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll
@@ -1,9 +1,7 @@
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
-; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names -enable-ppc-pcrel-tls < %s | \
-; RUN:   FileCheck %s --check-prefix=CHECK-S
+; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names < %s | FileCheck %s --check-prefix=CHECK-S
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
-; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names --filetype=obj \
-; RUN:   -enable-ppc-pcrel-tls -o %t.o < %s
+; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names --filetype=obj -o %t.o < %s
 ; RUN: llvm-objdump --mcpu=pwr10 -dr %t.o | FileCheck %s --check-prefix=CHECK-O
 ; RUN: llvm-readelf -s %t.o | FileCheck %s --check-prefix=CHECK-SYM
 

diff  --git a/llvm/test/CodeGen/PowerPC/pcrel-tls-local-dynamic.ll b/llvm/test/CodeGen/PowerPC/pcrel-tls-local-dynamic.ll
index dbc4f345fab5..5dae2e87fcb8 100644
--- a/llvm/test/CodeGen/PowerPC/pcrel-tls-local-dynamic.ll
+++ b/llvm/test/CodeGen/PowerPC/pcrel-tls-local-dynamic.ll
@@ -1,7 +1,7 @@
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 \
-; RUN:   -ppc-asm-full-reg-names --relocation-model=pic -enable-ppc-pcrel-tls < %s | FileCheck %s --check-prefix=CHECK-S
+; RUN:   -ppc-asm-full-reg-names --relocation-model=pic < %s | FileCheck %s --check-prefix=CHECK-S
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 \
-; RUN:   -ppc-asm-full-reg-names --relocation-model=pic -enable-ppc-pcrel-tls --filetype=obj < %s | \
+; RUN:   -ppc-asm-full-reg-names --relocation-model=pic --filetype=obj < %s | \
 ; RUN:   llvm-objdump --mcpu=pwr10 --no-show-raw-insn -dr - | FileCheck %s --check-prefix=CHECK-O
 
 ; These test cases are to ensure that when using pc relative memory operations

diff  --git a/llvm/test/CodeGen/PowerPC/pcrel-tls-local-exec.ll b/llvm/test/CodeGen/PowerPC/pcrel-tls-local-exec.ll
index 002400d10656..32329458185d 100644
--- a/llvm/test/CodeGen/PowerPC/pcrel-tls-local-exec.ll
+++ b/llvm/test/CodeGen/PowerPC/pcrel-tls-local-exec.ll
@@ -1,8 +1,7 @@
-; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
-; RUN:   -enable-ppc-pcrel-tls -mcpu=pwr10 -ppc-asm-full-reg-names \
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 -ppc-asm-full-reg-names \
 ; RUN:   < %s | FileCheck %s --check-prefix=CHECK-S
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
-; RUN:   -enable-ppc-pcrel-tls -mcpu=pwr10 -ppc-asm-full-reg-names \
+; RUN:   -mcpu=pwr10 -ppc-asm-full-reg-names \
 ; RUN:   --filetype=obj < %s | llvm-objdump --no-show-raw-insn --mcpu=pwr10 -dr - \
 ; RUN:   | FileCheck %s --check-prefix=CHECK-O
 

diff  --git a/llvm/test/CodeGen/PowerPC/pcrel-tls.ll b/llvm/test/CodeGen/PowerPC/pcrel-tls.ll
deleted file mode 100644
index a40021c14e97..000000000000
--- a/llvm/test/CodeGen/PowerPC/pcrel-tls.ll
+++ /dev/null
@@ -1,16 +0,0 @@
-; RUN: not --crash llc -mcpu=pwr10 -mtriple=powerpc64le-unknown-linux-gnu \
-; RUN:   -verify-machineinstrs -mattr=+pcrelative-memops -o - < %s 2>&1 | \
-; RUN:   FileCheck %s --check-prefix=CHECK-PCREL
-; RUN: llc -mcpu=pwr10 -mtriple=powerpc64le-unknown-linux-gnu \
-; RUN:   -verify-machineinstrs -mattr=-pcrelative-memops -o - < %s 2>&1 | \
-; RUN:   FileCheck %s --check-prefix=CHECK-NOPCREL
-
-; CHECK-PCREL:     Thread local storage is not supported with pc-relative addressing
-; CHECK-NOPCREL:   blr
-
- at x = external thread_local global i32, align 4
-
-define i32* @testTLS() {
-entry:
-  ret i32* @x
-}


        


More information about the llvm-commits mailing list