Skip to content

Commit 609f3f0

Browse files
committed
merge main into amd-staging
2 parents ff544d9 + ee1ecf3 commit 609f3f0

File tree

107 files changed

+8809
-578
lines changed

Some content is hidden

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

107 files changed

+8809
-578
lines changed

clang/cmake/caches/Release.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ if (LLVM_RELEASE_ENABLE_LTO)
102102
# FIXME: We can't use LLVM_ENABLE_LTO=Thin here, because it causes the CMake
103103
# step for the libcxx build to fail. CMAKE_INTERPROCEDURAL_OPTIMIZATION does
104104
# enable ThinLTO, though.
105-
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DLLVM_ENABLE_LLD=ON" CACHE STRING "")
105+
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DLLVM_ENABLE_LLD=ON -DLLVM_ENABLE_FATLTO=ON" CACHE STRING "")
106106
endif()
107107

108108
# Stage 1 Common Config
@@ -144,3 +144,7 @@ set_final_stage_var(CPACK_GENERATOR "TXZ" STRING)
144144
set_final_stage_var(CPACK_ARCHIVE_THREADS "0" STRING)
145145

146146
set_final_stage_var(LLVM_USE_STATIC_ZSTD "ON" BOOL)
147+
if (LLVM_RELEASE_ENABLE_LTO)
148+
set_final_stage_var(LLVM_ENABLE_FATLTO "ON" BOOL)
149+
set_final_stage_var(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/release_cpack_pre_build_strip_lto.cmake" STRING)
150+
endif()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
file(GLOB files ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/lib/*.a)
2+
3+
foreach(file ${files})
4+
execute_process(COMMAND ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/bin/llvm-strip --no-strip-all -R .llvm.lto ${file})
5+
endforeach()

clang/lib/Basic/Targets/WebAssembly.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const {
5959
.Case("exception-handling", HasExceptionHandling)
6060
.Case("extended-const", HasExtendedConst)
6161
.Case("fp16", HasFP16)
62+
.Case("gc", HasGC)
6263
.Case("multimemory", HasMultiMemory)
6364
.Case("multivalue", HasMultivalue)
6465
.Case("mutable-globals", HasMutableGlobals)
6566
.Case("nontrapping-fptoint", HasNontrappingFPToInt)
6667
.Case("reference-types", HasReferenceTypes)
67-
.Case("gc", HasGC)
6868
.Case("relaxed-simd", SIMDLevel >= RelaxedSIMD)
6969
.Case("sign-ext", HasSignExt)
7070
.Case("simd128", SIMDLevel >= SIMD128)
@@ -99,6 +99,8 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
9999
Builder.defineMacro("__wasm_multimemory__");
100100
if (HasFP16)
101101
Builder.defineMacro("__wasm_fp16__");
102+
if (HasGC)
103+
Builder.defineMacro("__wasm_gc__");
102104
if (HasMultivalue)
103105
Builder.defineMacro("__wasm_multivalue__");
104106
if (HasMutableGlobals)
@@ -107,8 +109,6 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
107109
Builder.defineMacro("__wasm_nontrapping_fptoint__");
108110
if (HasReferenceTypes)
109111
Builder.defineMacro("__wasm_reference_types__");
110-
if (HasGC)
111-
Builder.defineMacro("__wasm_gc__");
112112
if (SIMDLevel >= RelaxedSIMD)
113113
Builder.defineMacro("__wasm_relaxed_simd__");
114114
if (HasSignExt)
@@ -194,6 +194,7 @@ bool WebAssemblyTargetInfo::initFeatureMap(
194194
Features["exception-handling"] = true;
195195
Features["extended-const"] = true;
196196
Features["fp16"] = true;
197+
Features["gc"] = true;
197198
Features["multimemory"] = true;
198199
Features["tail-call"] = true;
199200
Features["wide-arithmetic"] = true;
@@ -270,6 +271,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
270271
HasFP16 = false;
271272
continue;
272273
}
274+
if (Feature == "+gc") {
275+
HasGC = true;
276+
continue;
277+
}
278+
if (Feature == "-gc") {
279+
HasGC = false;
280+
continue;
281+
}
273282
if (Feature == "+multimemory") {
274283
HasMultiMemory = true;
275284
continue;
@@ -310,14 +319,6 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
310319
HasReferenceTypes = false;
311320
continue;
312321
}
313-
if (Feature == "+gc") {
314-
HasGC = true;
315-
continue;
316-
}
317-
if (Feature == "-gc") {
318-
HasGC = false;
319-
continue;
320-
}
321322
if (Feature == "+relaxed-simd") {
322323
SIMDLevel = std::max(SIMDLevel, RelaxedSIMD);
323324
continue;

clang/lib/Basic/Targets/WebAssembly.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
6464
bool HasExceptionHandling = false;
6565
bool HasExtendedConst = false;
6666
bool HasFP16 = false;
67+
bool HasGC = false;
6768
bool HasMultiMemory = false;
6869
bool HasMultivalue = false;
6970
bool HasMutableGlobals = false;
7071
bool HasNontrappingFPToInt = false;
7172
bool HasReferenceTypes = false;
72-
bool HasGC = false;
7373
bool HasSignExt = false;
7474
bool HasTailCall = false;
7575
bool HasWideArithmetic = false;

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,7 @@ void CIRGenModule::emitTopLevelDecl(Decl *decl) {
12981298
decl->getDeclKindName());
12991299
break;
13001300

1301+
case Decl::CXXConversion:
13011302
case Decl::CXXMethod:
13021303
case Decl::Function: {
13031304
auto *fd = cast<FunctionDecl>(decl);
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// RUN: %clang_cc1 -std=c++11 -triple aarch64-none-linux-android21 -fclangir -emit-cir %s -o %t.cir
2+
// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
3+
// RUN: %clang_cc1 -std=c++11 -triple aarch64-none-linux-android21 -fclangir -emit-llvm %s -o %t-cir.ll
4+
// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
5+
// RUN: %clang_cc1 -std=c++11 -triple aarch64-none-linux-android21 -emit-llvm %s -o %t.ll
6+
// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
7+
8+
struct inline_operator {
9+
operator int() const { return 987; }
10+
11+
int operator+(inline_operator) { return 666; }
12+
};
13+
14+
struct out_of_line_operator {
15+
operator int();
16+
};
17+
18+
out_of_line_operator::operator int() { return 123; }
19+
20+
void test() {
21+
int x = 42;
22+
23+
inline_operator i;
24+
x = i;
25+
26+
out_of_line_operator o;
27+
x = o;
28+
}
29+
30+
// CIR: cir.func dso_local @_ZN20out_of_line_operatorcviEv(%[[THIS_ARG:.+]]: !cir.ptr<!rec_out_of_line_operator>{{.*}}) -> !s32i
31+
// CIR: %[[THIS_ALLOCA:.+]] = cir.alloca !cir.ptr<!rec_out_of_line_operator>, !cir.ptr<!cir.ptr<!rec_out_of_line_operator>>, ["this", init]
32+
// CIR: %[[RETVAL:.+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"]
33+
// CIR: cir.store %[[THIS_ARG]], %[[THIS_ALLOCA]] : !cir.ptr<!rec_out_of_line_operator>, !cir.ptr<!cir.ptr<!rec_out_of_line_operator>>
34+
// CIR: %[[THIS_LOAD:.+]] = cir.load %[[THIS_ALLOCA]] : !cir.ptr<!cir.ptr<!rec_out_of_line_operator>>, !cir.ptr<!rec_out_of_line_operator>
35+
// CIR: %[[CONST_123:.+]] = cir.const #cir.int<123> : !s32i
36+
// CIR: cir.store %[[CONST_123]], %[[RETVAL]] : !s32i, !cir.ptr<!s32i>
37+
// CIR: %[[RET_LOAD:.+]] = cir.load %[[RETVAL]] : !cir.ptr<!s32i>, !s32i
38+
// CIR: cir.return %[[RET_LOAD]] : !s32i
39+
// CIR: }
40+
41+
// CIR: cir.func comdat linkonce_odr @_ZNK15inline_operatorcviEv(%[[INLINE_THIS_ARG:.+]]: !cir.ptr<!rec_inline_operator>{{.*}}) -> !s32i
42+
// CIR: %[[INLINE_THIS_ALLOCA:.+]] = cir.alloca !cir.ptr<!rec_inline_operator>, !cir.ptr<!cir.ptr<!rec_inline_operator>>, ["this", init]
43+
// CIR: %[[INLINE_RETVAL:.+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["__retval"]
44+
// CIR: cir.store %[[INLINE_THIS_ARG]], %[[INLINE_THIS_ALLOCA]] : !cir.ptr<!rec_inline_operator>, !cir.ptr<!cir.ptr<!rec_inline_operator>>
45+
// CIR: %[[INLINE_THIS_LOAD:.+]] = cir.load %[[INLINE_THIS_ALLOCA]] : !cir.ptr<!cir.ptr<!rec_inline_operator>>, !cir.ptr<!rec_inline_operator>
46+
// CIR: %[[CONST_987:.+]] = cir.const #cir.int<987> : !s32i
47+
// CIR: cir.store %[[CONST_987]], %[[INLINE_RETVAL]] : !s32i, !cir.ptr<!s32i>
48+
// CIR: %[[INLINE_RET_LOAD:.+]] = cir.load %[[INLINE_RETVAL]] : !cir.ptr<!s32i>, !s32i
49+
// CIR: cir.return %[[INLINE_RET_LOAD]] : !s32i
50+
// CIR: }
51+
52+
// CIR: cir.func dso_local @_Z4testv()
53+
// CIR: %[[X_ALLOCA:.+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", init]
54+
// CIR: %[[I_ALLOCA:.+]] = cir.alloca {{.*}}, {{.*}}, ["i"]
55+
// CIR: %[[O_ALLOCA:.+]] = cir.alloca {{.*}}, {{.*}}, ["o"]
56+
// CIR: %[[CONST_42:.+]] = cir.const #cir.int<42> : !s32i
57+
// CIR: cir.store align(4) %[[CONST_42]], %[[X_ALLOCA]] : !s32i, !cir.ptr<!s32i>
58+
// CIR: %[[INLINE_CALL:.+]] = cir.call @_ZNK15inline_operatorcviEv(%[[I_ALLOCA]]) : ({{.*}}) -> !s32i
59+
// CIR: cir.store align(4) %[[INLINE_CALL]], %[[X_ALLOCA]] : !s32i, !cir.ptr<!s32i>
60+
// CIR: %[[OUTLINE_CALL:.+]] = cir.call @_ZN20out_of_line_operatorcviEv(%[[O_ALLOCA]]) : ({{.*}}) -> !s32i
61+
// CIR: cir.store align(4) %[[OUTLINE_CALL]], %[[X_ALLOCA]] : !s32i, !cir.ptr<!s32i>
62+
// CIR: cir.return
63+
// CIR: }
64+
65+
// LLVM: define dso_local i32 @_ZN20out_of_line_operatorcviEv(ptr %[[PARAM0:.+]])
66+
// LLVM: %[[THIS_ALLOCA:.+]] = alloca ptr, i64 1
67+
// LLVM: %[[RETVAL:.+]] = alloca i32, i64 1
68+
// LLVM: store ptr %[[PARAM0]], ptr %[[THIS_ALLOCA]]
69+
// LLVM: %[[THIS_LOAD:.+]] = load ptr, ptr %[[THIS_ALLOCA]]
70+
// LLVM: store i32 123, ptr %[[RETVAL]]
71+
// LLVM: %[[RET_LOAD:.+]] = load i32, ptr %[[RETVAL]]
72+
// LLVM: ret i32 %[[RET_LOAD]]
73+
// LLVM: }
74+
75+
// LLVM: define linkonce_odr i32 @_ZNK15inline_operatorcviEv(ptr %[[INLINE_PARAM0:.+]])
76+
// LLVM: %[[INLINE_THIS_ALLOCA:.+]] = alloca ptr, i64 1
77+
// LLVM: %[[INLINE_RETVAL:.+]] = alloca i32, i64 1
78+
// LLVM: store ptr %[[INLINE_PARAM0]], ptr %[[INLINE_THIS_ALLOCA]]
79+
// LLVM: %[[INLINE_THIS_LOAD:.+]] = load ptr, ptr %[[INLINE_THIS_ALLOCA]]
80+
// LLVM: store i32 987, ptr %[[INLINE_RETVAL]]
81+
// LLVM: %[[INLINE_RET_LOAD:.+]] = load i32, ptr %[[INLINE_RETVAL]]
82+
// LLVM: ret i32 %[[INLINE_RET_LOAD]]
83+
// LLVM: }
84+
85+
// LLVM: define dso_local void @_Z4testv()
86+
// LLVM: %[[X_ALLOCA:.+]] = alloca i32, i64 1
87+
// LLVM: %[[I_ALLOCA:.+]] = alloca {{.*}}, i64 1
88+
// LLVM: %[[O_ALLOCA:.+]] = alloca {{.*}}, i64 1
89+
// LLVM: store i32 42, ptr %[[X_ALLOCA]]
90+
// LLVM: %[[INLINE_CALL:.+]] = call i32 @_ZNK15inline_operatorcviEv(ptr %[[I_ALLOCA]])
91+
// LLVM: store i32 %[[INLINE_CALL]], ptr %[[X_ALLOCA]]
92+
// LLVM: %[[OUTLINE_CALL:.+]] = call i32 @_ZN20out_of_line_operatorcviEv(ptr %[[O_ALLOCA]])
93+
// LLVM: store i32 %[[OUTLINE_CALL]], ptr %[[X_ALLOCA]]
94+
// LLVM: ret void
95+
// LLVM: }
96+
97+
// OGCG: define dso_local noundef i32 @_ZN20out_of_line_operatorcviEv(ptr {{.*}} %[[THIS_PARAM:.+]])
98+
// OGCG: entry:
99+
// OGCG: %[[THIS_ADDR:.+]] = alloca ptr
100+
// OGCG: store ptr %[[THIS_PARAM]], ptr %[[THIS_ADDR]]
101+
// OGCG: %[[THIS_LOAD:.+]] = load ptr, ptr %[[THIS_ADDR]]
102+
// OGCG: ret i32 123
103+
// OGCG: }
104+
105+
// OGCG: define dso_local void @_Z4testv()
106+
// OGCG: entry:
107+
// OGCG: %[[X_VAR:.+]] = alloca i32
108+
// OGCG: %[[I_VAR:.+]] = alloca {{.*}}
109+
// OGCG: %[[O_VAR:.+]] = alloca {{.*}}
110+
// OGCG: store i32 42, ptr %[[X_VAR]]
111+
// OGCG: %[[INLINE_CALL:.+]] = call noundef i32 @_ZNK15inline_operatorcviEv(ptr {{.*}} %[[I_VAR]])
112+
// OGCG: store i32 %[[INLINE_CALL]], ptr %[[X_VAR]]
113+
// OGCG: %[[OUTLINE_CALL:.+]] = call noundef i32 @_ZN20out_of_line_operatorcviEv(ptr {{.*}} %[[O_VAR]])
114+
// OGCG: store i32 %[[OUTLINE_CALL]], ptr %[[X_VAR]]
115+
// OGCG: ret void
116+
// OGCG: }
117+
118+
// OGCG: define linkonce_odr noundef i32 @_ZNK15inline_operatorcviEv(ptr {{.*}} %[[INLINE_THIS_PARAM:.+]])
119+
// OGCG: entry:
120+
// OGCG: %[[INLINE_THIS_ADDR:.+]] = alloca ptr
121+
// OGCG: store ptr %[[INLINE_THIS_PARAM]], ptr %[[INLINE_THIS_ADDR]]
122+
// OGCG: %[[INLINE_THIS_LOAD:.+]] = load ptr, ptr %[[INLINE_THIS_ADDR]]
123+
// OGCG: ret i32 987
124+
// OGCG: }

clang/test/Driver/wasm-features.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
// HALF-PRECISION: "-target-feature" "+fp16"
4242
// NO-HALF-PRECISION: "-target-feature" "-fp16"
4343

44+
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mgc 2>&1 | FileCheck %s -check-prefix=GC
45+
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-gc 2>&1 | FileCheck %s -check-prefix=NO-GC
46+
47+
// GC: "-target-feature" "+gc"
48+
// NO-GC: "-target-feature" "-gc"
49+
4450
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mmultimemory 2>&1 | FileCheck %s -check-prefix=MULTIMEMORY
4551
// RUN: %clang --target=wasm32-unknown-unknown -### %s -mno-multimemory 2>&1 | FileCheck %s -check-prefix=NO-MULTIMEMORY
4652

clang/test/Preprocessor/wasm-target-features.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@
5252
//
5353
// FP16: #define __wasm_fp16__ 1{{$}}
5454

55+
// RUN: %clang -E -dM %s -o - 2>&1 \
56+
// RUN: -target wasm32-unknown-unknown -mgc \
57+
// RUN: | FileCheck %s -check-prefix=GC
58+
// RUN: %clang -E -dM %s -o - 2>&1 \
59+
// RUN: -target wasm64-unknown-unknown -mgc \
60+
// RUN: | FileCheck %s -check-prefix=GC
61+
//
62+
// GC: #define __wasm_gc__ 1{{$}}
63+
5564
// RUN: %clang -E -dM %s -o - 2>&1 \
5665
// RUN: -target wasm32-unknown-unknown -mmultimemory \
5766
// RUN: | FileCheck %s -check-prefix=MULTIMEMORY
@@ -145,6 +154,7 @@
145154
// MVP-NOT: #define __wasm_exception_handling__ 1{{$}}
146155
// MVP-NOT: #define __wasm_extended_const__ 1{{$}}
147156
// MVP-NOT: #define __wasm_fp16__ 1{{$}}
157+
// MVP-NOT: #define __wasm_gc__ 1{{$}}
148158
// MVP-NOT: #define __wasm_multimemory__ 1{{$}}
149159
// MVP-NOT: #define __wasm_multivalue__ 1{{$}}
150160
// MVP-NOT: #define __wasm_mutable_globals__ 1{{$}}
@@ -181,6 +191,7 @@
181191
// GENERIC-NOT: #define __wasm_exception_handling__ 1{{$}}
182192
// GENERIC-NOT: #define __wasm_extended_const__ 1{{$}}
183193
// GENERIC-NOT: #define __wasm__fp16__ 1{{$}}
194+
// GENERIC-NOT: #define __wasm_gc__ 1{{$}}
184195
// GENERIC-NOT: #define __wasm_multimemory__ 1{{$}}
185196
// GENERIC-NOT: #define __wasm_relaxed_simd__ 1{{$}}
186197
// GENERIC-NOT: #define __wasm_simd128__ 1{{$}}
@@ -199,6 +210,7 @@
199210
// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_exception_handling__ 1{{$}}
200211
// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_extended_const__ 1{{$}}
201212
// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_fp16__ 1{{$}}
213+
// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_gc__ 1{{$}}
202214
// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_multimemory__ 1{{$}}
203215
// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_multivalue__ 1{{$}}
204216
// BLEEDING-EDGE-INCLUDE-DAG: #define __wasm_mutable_globals__ 1{{$}}

compiler-rt/test/asan/TestCases/Linux/long-object-path.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// RUN: mkdir -p %T/a-long-directory-name-to-test-allocations-for-exceptions-in-_dl_lookup_symbol_x-since-glibc-2.27
2-
// RUN: %clangxx_asan -g %s -o %T/long-object-path
3-
// RUN: %run %T/a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../long-object-path
1+
// RUN: mkdir -p %t.a-long-directory-name-to-test-allocations-for-exceptions-in-_dl_lookup_symbol_x-since-glibc-2.27
2+
// RUN: %clangxx_asan -g %s -o %t.long-object-path
3+
// RUN: %run %t.a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../long-object-path
44

55
int main(void) {
66
return 0;

compiler-rt/test/fuzzer/afl-driver-stderr.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ RUN: %no_fuzzer_cpp_compiler %S/AFLDriverTest.cpp %libfuzzer_src/afl/afl_driver.
77
RUN: env -u AFL_DRIVER_STDERR_DUPLICATE_FILENAME %run %t-AFLDriverTest
88

99
; Test that specifying an invalid file causes a crash.
10-
RUN: env ASAN_OPTIONS= AFL_DRIVER_STDERR_DUPLICATE_FILENAME="%T" not --crash %run %t-AFLDriverTest
10+
RUN: mkdir -p %t.dir
11+
RUN: env ASAN_OPTIONS= AFL_DRIVER_STDERR_DUPLICATE_FILENAME="%t.dir" not --crash %run %t-AFLDriverTest
1112

1213
; Test that a file is created when specified as the duplicate stderr.
1314
RUN: env AFL_DRIVER_STDERR_DUPLICATE_FILENAME=%t %run %t-AFLDriverTest

0 commit comments

Comments
 (0)