aheejin updated this revision to Diff 185700. aheejin added a comment. - Small fix
Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57874/new/ https://reviews.llvm.org/D57874 Files: lib/Frontend/CompilerInvocation.cpp test/Driver/wasm32-unknown-unknown.cpp test/Driver/wasm64-unknown-unknown.cpp Index: test/Driver/wasm64-unknown-unknown.cpp =================================================================== --- test/Driver/wasm64-unknown-unknown.cpp +++ test/Driver/wasm64-unknown-unknown.cpp @@ -120,3 +120,6 @@ // CHECK: SwitchILi8 Switch<sizeof(va_list)>(); } + +// -pthread turns on -matomics +// THREADS: attributes #{{[[0-9]+}} = {{{.*}}"target-features"="+atomics"{{.*}}} Index: test/Driver/wasm32-unknown-unknown.cpp =================================================================== --- test/Driver/wasm32-unknown-unknown.cpp +++ test/Driver/wasm32-unknown-unknown.cpp @@ -120,3 +120,6 @@ // CHECK: SwitchILi4 Switch<sizeof(va_list)>(); } + +// -pthread turns on -matomics +// THREADS: attributes #{{[[0-9]+}} = {{{.*}}"target-features"="+atomics"{{.*}}} Index: lib/Frontend/CompilerInvocation.cpp =================================================================== --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -3332,6 +3332,11 @@ Res.getDiagnosticOpts().Warnings.push_back("spir-compat"); } + if (Arch == llvm::Triple::wasm32 || Arch == llvm::Triple::wasm64) { + if (LangOpts.POSIXThreads) + Res.getTargetOpts().FeaturesAsWritten.emplace_back("+atomics"); + } + // If sanitizer is enabled, disable OPT_ffine_grained_bitfield_accesses. if (Res.getCodeGenOpts().FineGrainedBitfieldAccesses && !Res.getLangOpts()->Sanitize.empty()) {
Index: test/Driver/wasm64-unknown-unknown.cpp =================================================================== --- test/Driver/wasm64-unknown-unknown.cpp +++ test/Driver/wasm64-unknown-unknown.cpp @@ -120,3 +120,6 @@ // CHECK: SwitchILi8 Switch<sizeof(va_list)>(); } + +// -pthread turns on -matomics +// THREADS: attributes #{{[[0-9]+}} = {{{.*}}"target-features"="+atomics"{{.*}}} Index: test/Driver/wasm32-unknown-unknown.cpp =================================================================== --- test/Driver/wasm32-unknown-unknown.cpp +++ test/Driver/wasm32-unknown-unknown.cpp @@ -120,3 +120,6 @@ // CHECK: SwitchILi4 Switch<sizeof(va_list)>(); } + +// -pthread turns on -matomics +// THREADS: attributes #{{[[0-9]+}} = {{{.*}}"target-features"="+atomics"{{.*}}} Index: lib/Frontend/CompilerInvocation.cpp =================================================================== --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -3332,6 +3332,11 @@ Res.getDiagnosticOpts().Warnings.push_back("spir-compat"); } + if (Arch == llvm::Triple::wasm32 || Arch == llvm::Triple::wasm64) { + if (LangOpts.POSIXThreads) + Res.getTargetOpts().FeaturesAsWritten.emplace_back("+atomics"); + } + // If sanitizer is enabled, disable OPT_ffine_grained_bitfield_accesses. if (Res.getCodeGenOpts().FineGrainedBitfieldAccesses && !Res.getLangOpts()->Sanitize.empty()) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits