Skip to content

Commit 3c61b39

Browse files
Merge branch 'main' into llvm_symbolizer_gsym_support
2 parents b1f6a05 + a83bb35 commit 3c61b39

File tree

100 files changed

+1572
-605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1572
-605
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6172,6 +6172,22 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD,
61726172
CodeGenFunction(*this).GenerateCode(GD, Fn, FI);
61736173

61746174
setNonAliasAttributes(GD, Fn);
6175+
6176+
bool ShouldAddOptNone = !CodeGenOpts.DisableO0ImplyOptNone &&
6177+
(CodeGenOpts.OptimizationLevel == 0) &&
6178+
!D->hasAttr<MinSizeAttr>();
6179+
6180+
if (D->hasAttr<OpenCLKernelAttr>()) {
6181+
if (GD.getKernelReferenceKind() == KernelReferenceKind::Stub &&
6182+
!D->hasAttr<NoInlineAttr>() &&
6183+
!Fn->hasFnAttribute(llvm::Attribute::NoInline) &&
6184+
!D->hasAttr<OptimizeNoneAttr>() &&
6185+
!Fn->hasFnAttribute(llvm::Attribute::OptimizeNone) &&
6186+
!ShouldAddOptNone) {
6187+
Fn->addFnAttr(llvm::Attribute::AlwaysInline);
6188+
}
6189+
}
6190+
61756191
SetLLVMFunctionAttributesForDefinition(D, Fn);
61766192

61776193
if (const ConstructorAttr *CA = D->getAttr<ConstructorAttr>())

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
934934
std::optional<StringRef> OptVal =
935935
llvm::StringSwitch<std::optional<StringRef>>(ArgVecLib->getValue())
936936
.Case("Accelerate", "Accelerate")
937-
.Case("libmvec", "LIBMVEC-X86")
937+
.Case("libmvec", "LIBMVEC")
938938
.Case("MASSV", "MASSV")
939939
.Case("SVML", "SVML")
940940
.Case("SLEEF", "sleefgnuabi")

clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ kernel void test_target_features_kernel(global int *i) {
492492
// GFX900-NEXT: ret void
493493
//
494494
//
495-
// GFX900: Function Attrs: convergent norecurse nounwind
495+
// GFX900: Function Attrs: alwaysinline convergent norecurse nounwind
496496
// GFX900-LABEL: define dso_local void @__clang_ocl_kern_imp_test(
497497
// GFX900-SAME: ptr addrspace(1) noundef align 1 [[A:%.*]], i8 noundef signext [[B:%.*]], ptr addrspace(1) noundef align 8 [[C:%.*]], i64 noundef [[D:%.*]]) #[[ATTR3:[0-9]+]] !kernel_arg_addr_space [[META10]] !kernel_arg_access_qual [[META11]] !kernel_arg_type [[META12]] !kernel_arg_base_type [[META12]] !kernel_arg_type_qual [[META13]] {
498498
// GFX900-NEXT: [[ENTRY:.*:]]
@@ -640,7 +640,7 @@ kernel void test_target_features_kernel(global int *i) {
640640
// GFX900-NEXT: ret void
641641
//
642642
//
643-
// GFX900: Function Attrs: convergent norecurse nounwind
643+
// GFX900: Function Attrs: alwaysinline convergent norecurse nounwind
644644
// GFX900-LABEL: define dso_local void @__clang_ocl_kern_imp_test_target_features_kernel(
645645
// GFX900-SAME: ptr addrspace(1) noundef align 4 [[I:%.*]]) #[[ATTR3]] !kernel_arg_addr_space [[META22]] !kernel_arg_access_qual [[META23]] !kernel_arg_type [[META24]] !kernel_arg_base_type [[META24]] !kernel_arg_type_qual [[META25]] {
646646
// GFX900-NEXT: [[ENTRY:.*:]]
@@ -832,7 +832,7 @@ kernel void test_target_features_kernel(global int *i) {
832832
// GFX900: attributes #[[ATTR0:[0-9]+]] = { "objc_arc_inert" }
833833
// GFX900: attributes #[[ATTR1]] = { convergent norecurse nounwind "denormal-fp-math-f32"="preserve-sign,preserve-sign" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64,-sram-ecc" }
834834
// GFX900: attributes #[[ATTR2]] = { convergent norecurse nounwind "amdgpu-flat-work-group-size"="1,256" "denormal-fp-math-f32"="preserve-sign,preserve-sign" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64,-sram-ecc" "uniform-work-group-size"="false" }
835-
// GFX900: attributes #[[ATTR3]] = { convergent norecurse nounwind "amdgpu-flat-work-group-size"="1,256" "denormal-fp-math-f32"="preserve-sign,preserve-sign" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64,-sram-ecc" }
835+
// GFX900: attributes #[[ATTR3]] = { alwaysinline convergent norecurse nounwind "amdgpu-flat-work-group-size"="1,256" "denormal-fp-math-f32"="preserve-sign,preserve-sign" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64,-sram-ecc" }
836836
// GFX900: attributes #[[ATTR4:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
837837
// GFX900: attributes #[[ATTR5:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
838838
// GFX900: attributes #[[ATTR6]] = { convergent nounwind "denormal-fp-math-f32"="preserve-sign,preserve-sign" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx900" "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64,-sram-ecc" }

clang/test/CodeGenOpenCL/cl-uniform-wg-size.cl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
kernel void ker() {};
77
// CHECK: define{{.*}}@ker() #[[ATTR0:[0-9]+]]
8-
// CHECK: call void @__clang_ocl_kern_imp_ker() #[[ATTR2:[0-9]+]]
98

109
// CHECK: define{{.*}}@__clang_ocl_kern_imp_ker() #[[ATTR1:[0-9]+]]
1110

@@ -18,6 +17,3 @@ void foo() {};
1817

1918
// CHECK: attributes #[[ATTR1]]
2019
// CHECK-NOT: uniform-work-group-size
21-
22-
// CHECK: attributes #[[ATTR2]]
23-
// CHECK-NOT: uniform-work-group-size

clang/test/CodeGenOpenCL/cl20-device-side-enqueue.cl

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir-unknown-unknown" | FileCheck %s --check-prefixes=COMMON,B32,SPIR,TRIPLESPIR
2-
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir64-unknown-unknown" | FileCheck %s --check-prefixes=COMMON,B64,SPIR,TRIPLESPIR
3-
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL2.0 -ffake-address-space-map -O1 -emit-llvm -o - -triple "spir64-unknown-unknown" | FileCheck %s --check-prefixes=CHECK-LIFETIMES,TRIPLESPIR
4-
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL3.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir-unknown-unknown" | FileCheck %s --check-prefixes=COMMON,B32,SPIR,TRIPLESPIR
5-
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL3.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir64-unknown-unknown" | FileCheck %s --check-prefixes=COMMON,B64,SPIR,TRIPLESPIR
6-
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL3.0 -ffake-address-space-map -O1 -emit-llvm -o - -triple "spir64-unknown-unknown" | FileCheck %s --check-prefixes=CHECK-LIFETIMES,TRIPLESPIR
7-
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "x86_64-unknown-linux-gnu" | FileCheck %s --check-prefixes=COMMON,B64,X86,TRIPLEX86
8-
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL3.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "x86_64-unknown-linux-gnu" | FileCheck %s --check-prefixes=COMMON,B64,X86,TRIPLEX86
9-
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL3.0 -ffake-address-space-map -O1 -emit-llvm -o - -triple "x86_64-unknown-linux-gnu" | FileCheck %s --check-prefixes=CHECK-LIFETIMES,TRIPLEX86
1+
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir-unknown-unknown" | FileCheck %s --check-prefixes=COMMON,B32,SPIR
2+
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir64-unknown-unknown" | FileCheck %s --check-prefixes=COMMON,B64,SPIR
3+
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL2.0 -ffake-address-space-map -O1 -emit-llvm -o - -triple "spir64-unknown-unknown" | FileCheck %s --check-prefix=CHECK-LIFETIMES
4+
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL3.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir-unknown-unknown" | FileCheck %s --check-prefixes=COMMON,B32,SPIR
5+
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL3.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "spir64-unknown-unknown" | FileCheck %s --check-prefixes=COMMON,B64,SPIR
6+
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL3.0 -ffake-address-space-map -O1 -emit-llvm -o - -triple "spir64-unknown-unknown" | FileCheck %s --check-prefix=CHECK-LIFETIMES
7+
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL2.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "x86_64-unknown-linux-gnu" | FileCheck %s --check-prefixes=COMMON,B64,X86
8+
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL3.0 -ffake-address-space-map -O0 -emit-llvm -o - -triple "x86_64-unknown-linux-gnu" | FileCheck %s --check-prefixes=COMMON,B64,X86
9+
// RUN: %clang_cc1 -no-enable-noundef-analysis %s -cl-std=CL3.0 -ffake-address-space-map -O1 -emit-llvm -o - -triple "x86_64-unknown-linux-gnu" | FileCheck %s --check-prefix=CHECK-LIFETIMES
1010

1111
#pragma OPENCL EXTENSION cl_khr_subgroups : enable
1212

@@ -39,12 +39,6 @@ void callee(int id, __global int *out) {
3939
out[id] = id;
4040
}
4141

42-
// TRIPLESPIR: define{{.*}} void @device_side_enqueue(ptr addrspace(1) align 4 %{{.*}}, ptr addrspace(1) align 4 %b, i32 %i)
43-
// TRIPLESPIR: call spir_func void @__clang_ocl_kern_imp_device_side_enqueue({{.*}})
44-
45-
// TRIPLEX86: define{{.*}} void @device_side_enqueue(ptr addrspace(1) align 4 %{{.*}}, ptr addrspace(1) align 4 %b, i32 %i)
46-
// TRIPLEX86: call void @__clang_ocl_kern_imp_device_side_enqueue({{.*}})
47-
4842
// COMMON-LABEL: define{{.*}} void @__clang_ocl_kern_imp_device_side_enqueue(ptr addrspace(1) align 4 %{{.*}}, ptr addrspace(1) align 4 %b, i32 %i)
4943
kernel void device_side_enqueue(global int *a, global int *b, int i) {
5044
// SPIR: %default_queue = alloca target("spirv.Queue")

clang/test/CodeGenOpenCL/convergent.cl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void test_not_unroll() {
127127
// CHECK: declare spir_func void @nodupfun(){{[^#]*}} #[[attr3:[0-9]+]]
128128

129129
// CHECK-LABEL: @assume_convergent_asm
130-
// CHECK: tail call void asm sideeffect "s_barrier", ""() #5
130+
// CHECK: tail call void asm sideeffect "s_barrier", ""() #6
131131
kernel void assume_convergent_asm()
132132
{
133133
__asm__ volatile("s_barrier");
@@ -138,6 +138,7 @@ kernel void assume_convergent_asm()
138138
// CHECK: attributes #2 = { {{[^}]*}}convergent{{[^}]*}} }
139139
// CHECK: attributes #3 = { {{[^}]*}}convergent noduplicate{{[^}]*}} }
140140
// CHECK: attributes #4 = { {{[^}]*}}convergent{{[^}]*}} }
141-
// CHECK: attributes #5 = { {{[^}]*}}convergent{{[^}]*}} }
142-
// CHECK: attributes #6 = { {{[^}]*}}nounwind{{[^}]*}} }
143-
// CHECK: attributes #7 = { {{[^}]*}}convergent noduplicate nounwind{{[^}]*}} }
141+
// CHECK: attributes #5 = { {{[^}]*}}alwaysinline convergent{{[^}]*}} }
142+
// CHECK: attributes #6 = { {{[^}]*}}convergent{{[^}]*}} }
143+
// CHECK: attributes #7 = { {{[^}]*}}nounwind{{[^}]*}} }
144+
// CHECK: attributes #8 = { {{[^}]*}}convergent noduplicate nounwind{{[^}]*}} }

clang/test/CodeGenOpenCL/enqueue-kernel-non-entry-block.cl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@
99
typedef struct {int a;} ndrange_t;
1010

1111
kernel void test(int i) {
12-
1312
// AMDGPU-LABEL: define {{.*}} amdgpu_kernel void @test
14-
// AMDGPU-LABEL: call void @__clang_ocl_kern_imp_test(i32 noundef %0)
15-
1613
// SPIR-LABEL: define {{.*}} spir_kernel void @test
17-
// SPIR-LABEL: call spir_func void @__clang_ocl_kern_imp_test(i32 noundef %0)
18-
19-
// AMDGPU-LABEL: define {{.*}} void @__clang_ocl_kern_imp_test
20-
// SPIR-LABEL: define {{.*}} spir_func void @__clang_ocl_kern_imp_test
2114

2215
// COMMON-LABEL: entry:
2316
// AMDGPU: %block_sizes = alloca [1 x i64]
@@ -44,5 +37,5 @@ kernel void test(int i) {
4437

4538
// CHECK-DEBUG: ![[TESTFILE:[0-9]+]] = !DIFile(filename: "<stdin>"
4639
// CHECK-DEBUG: ![[TESTSCOPE:[0-9]+]] = distinct !DISubprogram(name: "test", linkageName: "__clang_ocl_kern_imp_test", {{.*}} file: ![[TESTFILE]]
47-
// CHECK-DEBUG: ![[IFSCOPE:[0-9]+]] = distinct !DILexicalBlock(scope: ![[TESTSCOPE]], file: ![[TESTFILE]], line: 33)
48-
// CHECK-DEBUG: ![[TEMPLOCATION]] = !DILocation(line: 34, scope: ![[IFSCOPE]])
40+
// CHECK-DEBUG: ![[IFSCOPE:[0-9]+]] = distinct !DILexicalBlock(scope: ![[TESTSCOPE]], file: ![[TESTFILE]], line: 26)
41+
// CHECK-DEBUG: ![[TEMPLOCATION]] = !DILocation(line: 27, scope: ![[IFSCOPE]])

clang/test/Driver/fveclib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
/* Verify that the correct vector library is passed to LTO flags. */
3939

4040
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=libmvec -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-LIBMVEC %s
41-
// CHECK-LTO-LIBMVEC: "-plugin-opt=-vector-library=LIBMVEC-X86"
41+
// CHECK-LTO-LIBMVEC: "-plugin-opt=-vector-library=LIBMVEC"
4242

4343
// RUN: %clang -### --target=powerpc64-unknown-linux-gnu -fveclib=MASSV -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-MASSV %s
4444
// CHECK-LTO-MASSV: "-plugin-opt=-vector-library=MASSV"

flang/docs/OpenMPSupport.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ Note : No distinction is made between the support in Parser/Semantics, MLIR, Low
6464
| target teams distribute parallel loop simd construct | P | device, reduction, dist_schedule and linear clauses are not supported |
6565

6666
## OpenMP 3.1, OpenMP 2.5, OpenMP 1.1
67-
All features except a few corner cases in atomic (complex type, different but compatible types in lhs and rhs), threadprivate (character type) constructs/clauses are supported.
67+
All features except a few corner cases in atomic (complex type, different but compatible types in lhs and rhs) are supported.

flang/include/flang/Lower/ConvertVariable.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@ mlir::Value genInitialDataTarget(Fortran::lower::AbstractConverter &,
134134
const SomeExpr &initialTarget,
135135
bool couldBeInEquivalence = false);
136136

137-
/// Call \p genInit to generate code inside \p global initializer region.
138-
void createGlobalInitialization(
139-
fir::FirOpBuilder &builder, fir::GlobalOp global,
140-
std::function<void(fir::FirOpBuilder &)> genInit);
137+
/// Create the global op and its init if it has one
138+
fir::GlobalOp defineGlobal(Fortran::lower::AbstractConverter &converter,
139+
const Fortran::lower::pft::Variable &var,
140+
llvm::StringRef globalName, mlir::StringAttr linkage,
141+
cuf::DataAttributeAttr dataAttr = {});
141142

142143
/// Generate address \p addr inside an initializer.
143144
fir::ExtendedValue

0 commit comments

Comments
 (0)