[llvm-branch-commits] [clang] 219d00e - [test] Make ELF tests immune to dso_local/dso_preemptable/(none) differences

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 31 14:03:51 PST 2020


Author: Fangrui Song
Date: 2020-12-31T13:59:44-08:00
New Revision: 219d00e0d90941d3e54fc711ea1e7b5e4b5b4335

URL: https://github.com/llvm/llvm-project/commit/219d00e0d90941d3e54fc711ea1e7b5e4b5b4335
DIFF: https://github.com/llvm/llvm-project/commit/219d00e0d90941d3e54fc711ea1e7b5e4b5b4335.diff

LOG: [test] Make ELF tests immune to dso_local/dso_preemptable/(none) differences

ELF -cc1 -mrelocation-model pic will default to no semantic interposition plus
setting dso_local on default visibility external linkage definitions, so that
COFF, Mach-O and ELF output will be similar.

This patch makes tests immune to the differences.

Added: 
    

Modified: 
    clang/test/CodeGenCUDA/lambda-reference-var.cu
    clang/test/CodeGenCXX/default_calling_conv.cpp
    clang/test/Driver/hip-fpie-option.hip
    clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGenCUDA/lambda-reference-var.cu b/clang/test/CodeGenCUDA/lambda-reference-var.cu
index 44b012956507..2c62b0a94beb 100644
--- a/clang/test/CodeGenCUDA/lambda-reference-var.cu
+++ b/clang/test/CodeGenCUDA/lambda-reference-var.cu
@@ -47,7 +47,7 @@ __device__ void dev_capture_dev_ref_by_ref(int *out) {
   [&](){ ref++; *out = ref;}();
 }
 
-// DEV-LABEL: define void @_Z7dev_refPi(
+// DEV-LABEL: define{{.*}} void @_Z7dev_refPi(
 // DEV: %[[VAL:.*]] = load i32, i32* addrspacecast (i32 addrspace(1)* @global_device_var to i32*)
 // DEV: %[[VAL2:.*]] = add nsw i32 %[[VAL]], 1
 // DEV: store i32 %[[VAL2]], i32* addrspacecast (i32 addrspace(1)* @global_device_var to i32*)
@@ -94,7 +94,7 @@ void host_capture_host_ref_by_ref(int *out) {
   [&](){ ref++; *out = ref;}();
 }
 
-// HOST-LABEL: define void @_Z8host_refPi(
+// HOST-LABEL: define{{.*}} void @_Z8host_refPi(
 // HOST: %[[VAL:.*]] = load i32, i32* @global_host_var
 // HOST: %[[VAL2:.*]] = add nsw i32 %[[VAL]], 1
 // HOST: store i32 %[[VAL2]], i32* @global_host_var
@@ -120,7 +120,7 @@ void host_lambda_ref(int *out) {
   }();
 }
 
-// HOST-LABEL: define void @_Z28dev_capture_host_ref_by_copyPi(
+// HOST-LABEL: define{{.*}} void @_Z28dev_capture_host_ref_by_copyPi(
 // HOST: %[[CAP:.*]] = getelementptr inbounds %[[T3]], %[[T3]]* %{{.*}}, i32 0, i32 1
 // HOST: %[[VAL:.*]] = load i32, i32* @global_host_var
 // HOST: store i32 %[[VAL]], i32* %[[CAP]]

diff  --git a/clang/test/CodeGenCXX/default_calling_conv.cpp b/clang/test/CodeGenCXX/default_calling_conv.cpp
index d1f9571e0d56..e3d7ac429a60 100644
--- a/clang/test/CodeGenCXX/default_calling_conv.cpp
+++ b/clang/test/CodeGenCXX/default_calling_conv.cpp
@@ -29,7 +29,7 @@ void __attribute__((fastcall)) test3() {}
 // ALL: define{{.*}} x86_stdcallcc void @_Z5test4v
 void __attribute__((stdcall)) test4() {}
 
-// ALL: define  x86_vectorcallcc void @_Z5test5v
+// ALL: define{{.*}} x86_vectorcallcc void @_Z5test5v
 void __attribute__((vectorcall)) test5() {}
 
 // ALL: define{{.*}} x86_regcallcc void @_Z17__regcall3__test6v

diff  --git a/clang/test/Driver/hip-fpie-option.hip b/clang/test/Driver/hip-fpie-option.hip
index 2b433cd5a2c2..2e296a099dea 100644
--- a/clang/test/Driver/hip-fpie-option.hip
+++ b/clang/test/Driver/hip-fpie-option.hip
@@ -31,8 +31,9 @@
 // RUN:   -fPIE \
 // RUN:   2>&1 | FileCheck -check-prefixes=DEV,HOST-PIE %s
 
-// DEV-DAG: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* "-mrelocation-model" "pic" "-pic-level" "[1|2]" "-mframe-pointer=all"}}
+// DEV-DAG: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* "-mrelocation-model" "pic" "-pic-level" "[1|2]".* "-mframe-pointer=all"}}
 // HOST-STATIC-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* "-mrelocation-model" "static"}}
-// HOST-PIC-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=all"}}
+// HOST-PIC-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* "-mrelocation-model" "pic" "-pic-level" "2"}}
+// HOST-PIC-NOT: "-pic-is-pie"
 // HOST-PIE-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie"}}
 // DEV-NOT: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* "-pic-is-pie"}}

diff  --git a/clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp b/clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
index 91a9c2af73da..496ac07d9fa2 100644
--- a/clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
+++ b/clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
@@ -18,7 +18,7 @@
 // DEVICE-DAG: [[C_ADDR:.+]] = internal global i32 0,
 // DEVICE-DAG: [[CD_ADDR:@.+]] ={{ hidden | }}global %struct.S zeroinitializer,
 // HOST-DAG: @[[C_ADDR:.+]] = internal global i32 0,
-// HOST-DAG: @[[CD_ADDR:.+]] ={{ hidden | }}global %struct.S zeroinitializer,
+// HOST-DAG: @[[CD_ADDR:.+]] ={{( hidden | dso_local)?}} global %struct.S zeroinitializer,
 
 #pragma omp declare target
 int foo() { return 0; }


        


More information about the llvm-branch-commits mailing list