[PATCH] D49754: Add -m(no-)spe, and e500 CPU definitions and support to clang
jhibbits updated this revision to Diff 207214. jhibbits added a comment. Made '8548' CPU designation just a stub, to be filled out later. I added it just for parity with GCC. The 8548 CPU, for GCC, also sets the __NO_LWSYNC__ macro, which doesn't belong with the SPE change, so will have to be revisited later. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D49754/new/ https://reviews.llvm.org/D49754 Files: include/clang/Driver/Options.td lib/Basic/Targets/PPC.cpp lib/Basic/Targets/PPC.h lib/CodeGen/TargetInfo.cpp lib/Driver/ToolChains/Arch/PPC.cpp test/Driver/ppc-features.cpp test/Misc/target-invalid-cpu-note.c test/Preprocessor/init.c Index: test/Preprocessor/init.c === --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -7580,6 +7580,11 @@ // // PPC32-LINUX-NOT: _CALL_LINUX // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-linux-gnu -target-feature +spe < /dev/null | FileCheck -match-full-lines -check-prefix PPC32-SPE %s +// +// PPC32-SPE:#define __NO_FPRS__ 1 +// PPC32-SPE:#define __SPE__ 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-apple-darwin8 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-DARWIN %s // // PPC-DARWIN:#define _ARCH_PPC 1 Index: test/Misc/target-invalid-cpu-note.c === --- test/Misc/target-invalid-cpu-note.c +++ test/Misc/target-invalid-cpu-note.c @@ -79,7 +79,7 @@ // PPC: error: unknown target CPU 'not-a-cpu' // PPC: note: valid target CPU values are: generic, 440, 450, 601, 602, 603, // PPC-SAME: 603e, 603ev, 604, 604e, 620, 630, g3, 7400, g4, 7450, g4+, 750, -// PPC-SAME: 970, g5, a2, a2q, e500mc, e5500, power3, pwr3, power4, pwr4, +// PPC-SAME: 8548, 970, g5, a2, a2q, e500mc, e5500, power3, pwr3, power4, pwr4, // PPC-SAME: power5, pwr5, power5x, pwr5x, power6, pwr6, power6x, pwr6x, power7, // PPC-SAME: pwr7, power8, pwr8, power9, pwr9, powerpc, ppc, powerpc64, ppc64, // PPC-SAME: powerpc64le, ppc64le Index: test/Driver/ppc-features.cpp === --- test/Driver/ppc-features.cpp +++ test/Driver/ppc-features.cpp @@ -168,6 +168,9 @@ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-invariant-function-descriptors -minvariant-function-descriptors -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-INVFUNCDESC %s // CHECK-INVFUNCDESC: "-target-feature" "+invariant-function-descriptors" +// RUN: %clang -target powerpc-unknown-linux-gnu %s -mno-spe -mspe -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-SPE %s +// CHECK-SPE: "-target-feature" "+spe" + // Assembler features // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o -no-integrated-as 2>&1 | FileCheck -check-prefix=CHECK_BE_AS_ARGS %s // CHECK_BE_AS_ARGS: "-mppc64" Index: lib/Driver/ToolChains/Arch/PPC.cpp === --- lib/Driver/ToolChains/Arch/PPC.cpp +++ lib/Driver/ToolChains/Arch/PPC.cpp @@ -115,7 +115,8 @@ const ArgList ) { if (Args.getLastArg(options::OPT_msecure_plt)) return ppc::ReadGOTPtrMode::SecurePlt; - if (Triple.isOSNetBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) + if ((Triple.isOSFreeBSD() && Triple.getOSMajorVersion() >= 13) || + Triple.isOSNetBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) return ppc::ReadGOTPtrMode::SecurePlt; else return ppc::ReadGOTPtrMode::Bss; Index: lib/CodeGen/TargetInfo.cpp === --- lib/CodeGen/TargetInfo.cpp +++ lib/CodeGen/TargetInfo.cpp @@ -9458,7 +9458,8 @@ case llvm::Triple::ppc: return SetCGInfo( -new PPC32TargetCodeGenInfo(Types, CodeGenOpts.FloatABI == "soft")); +new PPC32TargetCodeGenInfo(Types, CodeGenOpts.FloatABI == "soft" || + getTarget().hasFeature("spe"))); case llvm::Triple::ppc64: if (Triple.isOSBinFormatELF()) { PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv1; Index: lib/Basic/Targets/PPC.h === --- lib/Basic/Targets/PPC.h +++ lib/Basic/Targets/PPC.h @@ -66,6 +66,7 @@ bool HasBPERMD = false; bool HasExtDiv = false; bool HasP9Vector = false; + bool HasSPE = false; protected: std::string ABI; Index: lib/Basic/Targets/PPC.cpp === --- lib/Basic/Targets/PPC.cpp +++ lib/Basic/Targets/PPC.cpp @@ -54,6 +54,10 @@ HasFloat128 = true; } else if (Feature == "+power9-vector") { HasP9Vector = true; +} else if (Feature == "+spe") { + HasSPE = true; + LongDoubleWidth = LongDoubleAlign = 64; + LongDoubleFormat = ::APFloat::IEEEdouble(); } else if (Feature == "-hard-float") { FloatABI
[PATCH] D63976: Allow clang -Os and -Oz to work with -flto and lld
tejohnson added inline comments. Comment at: llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp:395 + if(OOpt == "s" || OOpt == "z") +OOpt = "3"; +} Os/Oz are closer to O2 than O3 (which allows much more aggressive code size increasing optimizations). Better though to add a size level to the LTO::Config, teach lld to pass it through properly, then using the LTO Config to set the SizeLevel in the old PM and the PassBuilder::OptimizationLevel in the new PM when setting up the LTO backend pipelines, similar to how CodeGenLevel.OptimizeSize is handled in clang (BackendUtil.cpp). My concern is that silently mapping Os/Oz to do something different than in the non-LTO pipeline is going to end up more confusing than the current error (which isn't good either, but at least makes it clear that it isn't supported). Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63976/new/ https://reviews.llvm.org/D63976 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D63976: Allow clang -Os and -Oz to work with -flto and lld
> On Jun 29, 2019, at 15:38, Bernhard Rosenkränzer via Phabricator via > llvm-commits wrote: > > bero created this revision. > bero added a reviewer: llvm-commits. > bero added a project: clang. > Herald added subscribers: cfe-commits, dexonsmith, inglorion, mehdi_amini. > > Fix clang -Os/-Oz with LTO > > $ clang -Os -fuse-ld=lld -flto test.c > ld.lld: error: -plugin-opt=Os: number expected, but got 's' > clang-9: error: linker command failed with exit code 1 (use -v to see > invocation) > $ clang -Oz -fuse-ld=lld -flto test.c > ld.lld: error: -plugin-opt=Oz: number expected, but got 'z' > clang-9: error: linker command failed with exit code 1 (use -v to see > invocation) > > https://bugs.llvm.org/show_bug.cgi?id=42445 > > > Repository: > rC Clang > > https://reviews.llvm.org/D63976 > > Files: > llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp > > > Index: llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp > === > --- llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp > +++ llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp > @@ -389,8 +389,11 @@ > if (A->getOption().matches(options::OPT_O4) || > A->getOption().matches(options::OPT_Ofast)) > OOpt = "3"; > -else if (A->getOption().matches(options::OPT_O)) > +else if (A->getOption().matches(options::OPT_O)) { > OOpt = A->getValue(); > + if(OOpt == "s" || OOpt == "z") > +OOpt = "3"; > +} Is this going to enable inlining? A user might be quite surprised to find multiple inlined versions of a function when compiled with -Os and especially with -Oz. > else if (A->getOption().matches(options::OPT_O0)) > OOpt = "0"; > if (!OOpt.empty()) > > > ___ > llvm-commits mailing list > llvm-comm...@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits -- Stephen Checkoway ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41569: [Concepts] Constraint enforcement and diagnostics
saar.raz updated this revision to Diff 207209. saar.raz added a comment. Herald added subscribers: erik.pilkington, mgorny. Create ASTConstraintSatisfaction for correctly storing constraint satisfaction data in AST nodes. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D41569/new/ https://reviews.llvm.org/D41569 Files: include/clang/AST/ASTConcept.h include/clang/AST/ExprCXX.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/Sema.h include/clang/Sema/SemaConcept.h include/clang/Sema/TemplateDeduction.h lib/AST/ASTConcept.cpp lib/AST/CMakeLists.txt lib/AST/Decl.cpp lib/AST/ExprCXX.cpp lib/AST/ItaniumMangle.cpp lib/Sema/SemaConcept.cpp lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaOverload.cpp lib/Sema/SemaTemplate.cpp lib/Sema/SemaTemplateDeduction.cpp lib/Sema/SemaTemplateInstantiate.cpp lib/Sema/SemaTemplateInstantiateDecl.cpp lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp test/CXX/concepts-ts/temp/temp.constr/temp.constr.constr/function-templates.cpp test/CXX/concepts-ts/temp/temp.constr/temp.constr.constr/non-function-templates.cpp test/CXX/concepts-ts/temp/temp.constr/temp.constr.constr/partial-specializations.cpp test/CodeGenCXX/mangle-concept.cpp Index: test/CodeGenCXX/mangle-concept.cpp === --- /dev/null +++ test/CodeGenCXX/mangle-concept.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -verify -Wno-return-type -Wno-main -std=c++2a -fconcepts-ts -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s +// expected-no-diagnostics + +namespace test1 { +template struct S {}; +template concept C = true; +template S> f0() { return S>{}; } +template S> f0<>(); +// CHECK: void @_ZN5test12f0IiEENS_1SIXL_ZNS_1CIT_EEv() +} + +template struct S {}; +template concept C = true; +template S> f0() { return S>{}; } +template S> f0<>(); +// CHECK: void @_Z2f0IiE1SIXL_Z1CIT_v() \ No newline at end of file Index: test/CXX/concepts-ts/temp/temp.constr/temp.constr.constr/partial-specializations.cpp === --- /dev/null +++ test/CXX/concepts-ts/temp/temp.constr/temp.constr.constr/partial-specializations.cpp @@ -0,0 +1,67 @@ +// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -x c++ -verify %s + +namespace class_templates +{ + template requires sizeof(T) >= 4 // expected-note {{because 'sizeof(char) >= 4' (1 >= 4) evaluated to false}} + struct is_same { static constexpr bool value = false; }; + + template requires sizeof(T*) >= 4 && sizeof(T) >= 4 + struct is_same { static constexpr bool value = true; }; + + static_assert(!is_same::value); + static_assert(!is_same::value); + static_assert(is_same::value); + static_assert(is_same::value); // expected-error {{constraints not satisfied for class template 'is_same' [with T = char, U = char]}} + + template + struct A { using type = typename T::type; }; // expected-error{{type 'int *' cannot be used prior to '::' because it has no members}} + + template + struct B {}; + + template requires A::type // expected-note{{in instantiation of template class 'class_templates::A' requested here}} + // expected-note@-1{{while substituting template arguments into constraint expression here}} + struct B {}; + + template requires T{} // expected-error{{atomic constraint must be of type 'bool' (found 'int')}} + struct B {}; + + static_assert((B{}, true)); // expected-note{{while checking constraint satisfaction for class template partial specialization 'B' required here}} + // expected-note@-1{{while checking constraint satisfaction for class template partial specialization 'B' required here}} + // expected-note@-2{{during template argument deduction for class template partial specialization 'B' [with T = int *]}} + // expected-note@-3{{during template argument deduction for class template partial specialization 'B' [with T = int]}} + // expected-note@-4 2{{in instantiation of template class 'class_templates::B' requested here}} +} + +namespace variable_templates +{ + template requires sizeof(T) >= 4 + constexpr bool is_same_v = false; + + template requires sizeof(T*) >= 4 && sizeof(T) >= 4 + constexpr bool is_same_v = true; + + static_assert(!is_same_v); + static_assert(!is_same_v); + static_assert(is_same_v); + + template + struct A { using type = typename T::type; }; // expected-error{{type 'int *' cannot be used prior to '::' because it has no members}} + + template + constexpr bool v1 = false; + + template requires A::type // expected-note{{in instantiation of template class 'variable_templates::A' requested here}} + // expected-note@-1{{while substituting template arguments into constraint expression here}} + constexpr bool v1 = true; + + template requires T{} //
[PATCH] D63976: Allow clang -Os and -Oz to work with -flto and lld
xbolva00 added a comment. Good idea, I found this issue a few days ago too. Please upload the patch with a full context. Plesse try to add a testcase. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63976/new/ https://reviews.llvm.org/D63976 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D63976: Allow clang -Os and -Oz to work with -flto and lld
bero created this revision. bero added a reviewer: llvm-commits. bero added a project: clang. Herald added subscribers: cfe-commits, dexonsmith, inglorion, mehdi_amini. Fix clang -Os/-Oz with LTO $ clang -Os -fuse-ld=lld -flto test.c ld.lld: error: -plugin-opt=Os: number expected, but got 's' clang-9: error: linker command failed with exit code 1 (use -v to see invocation) $ clang -Oz -fuse-ld=lld -flto test.c ld.lld: error: -plugin-opt=Oz: number expected, but got 'z' clang-9: error: linker command failed with exit code 1 (use -v to see invocation) https://bugs.llvm.org/show_bug.cgi?id=42445 Repository: rC Clang https://reviews.llvm.org/D63976 Files: llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp Index: llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp === --- llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -389,8 +389,11 @@ if (A->getOption().matches(options::OPT_O4) || A->getOption().matches(options::OPT_Ofast)) OOpt = "3"; -else if (A->getOption().matches(options::OPT_O)) +else if (A->getOption().matches(options::OPT_O)) { OOpt = A->getValue(); + if(OOpt == "s" || OOpt == "z") +OOpt = "3"; +} else if (A->getOption().matches(options::OPT_O0)) OOpt = "0"; if (!OOpt.empty()) Index: llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp === --- llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -389,8 +389,11 @@ if (A->getOption().matches(options::OPT_O4) || A->getOption().matches(options::OPT_Ofast)) OOpt = "3"; -else if (A->getOption().matches(options::OPT_O)) +else if (A->getOption().matches(options::OPT_O)) { OOpt = A->getValue(); + if(OOpt == "s" || OOpt == "z") +OOpt = "3"; +} else if (A->getOption().matches(options::OPT_O0)) OOpt = "0"; if (!OOpt.empty()) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D59415: Do not resolve directory junctions for `-fdiagnostics-absolute-paths` on Windows.
johan-boule added a comment. Is this going to break symlinks on Windows? Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59415/new/ https://reviews.llvm.org/D59415 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D63975: Warn when ScopeDepthOrObjCQuals overflows
Mordante created this revision. Mordante added a reviewer: rsmith. Mordante added a project: clang. Herald added a subscriber: cfe-commits. Before when the overflow occurred an assertion as triggered. Now check whether the maximum has been reached and warn properly. This patch fixes the original submission of bug 19607. The part mentioned in its 'duplicate' bug 33162 has not been fixed. I want to look at that after this patch has been accepted. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D63975 Files: clang/include/clang/AST/Decl.h clang/include/clang/Basic/DiagnosticParseKinds.td clang/lib/Parse/ParseDecl.cpp clang/test/Parser/nested_function_prototype_overflow.cpp Index: clang/test/Parser/nested_function_prototype_overflow.cpp === --- /dev/null +++ clang/test/Parser/nested_function_prototype_overflow.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -fsyntax-only +// RUN: not %clang_cc1 %s -fsyntax-only -DFAIL 2>&1 | FileCheck %s + +void foo(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)(void (*f)( +#ifdef FAIL +void (*f)() +#endif +; + +// CHECK: fatal error: function scope depth exceeded maximum of 127 Index: clang/lib/Parse/ParseDecl.cpp === --- clang/lib/Parse/ParseDecl.cpp +++ clang/lib/Parse/ParseDecl.cpp @@ -6576,6 +6576,16 @@ Actions.containsUnexpandedParameterPacks(ParmDeclarator)) DiagnoseMisplacedEllipsisInDeclarator(ConsumeToken(), ParmDeclarator); + // Avoid exceeding the maximum function scope depth. + // https://bugs.llvm.org/show_bug.cgi?id=19607 + if (getCurScope()->getFunctionPrototypeDepth() - 1 >= + ParmVarDecl::getMaxFunctionScopeDepth()) { +Diag(DSStart, diag::err_function_scope_depth_exceeded) +<< ParmVarDecl::getMaxFunctionScopeDepth(); +cutOffParsing(); +return; + } + // Inform the actions module about the parameter declarator, so it gets // added to the current scope. Decl *Param = Actions.ActOnParamDeclarator(getCurScope(), ParmDeclarator); Index: clang/include/clang/Basic/DiagnosticParseKinds.td === --- clang/include/clang/Basic/DiagnosticParseKinds.td +++ clang/include/clang/Basic/DiagnosticParseKinds.td @@ -326,6 +326,8 @@ def err_argument_required_after_attribute : Error< "argument required after attribute">; def err_missing_param : Error<"expected parameter declarator">; +def err_function_scope_depth_exceeded : Error< + "function scope depth exceeded maximum of %0">, DefaultFatal; def err_missing_comma_before_ellipsis : Error< "C requires a comma prior to the ellipsis in a variadic function type">; def err_unexpected_typedef_ident : Error< Index: clang/include/clang/AST/Decl.h === --- clang/include/clang/AST/Decl.h +++ clang/include/clang/AST/Decl.h @@ -905,11 +905,13 @@ /// Whether this parameter is an ObjC method parameter or not. unsigned IsObjCMethodParam : 1; + enum { NumScopeDepthOrObjCQualsBits = 7 }; + /// If IsObjCMethodParam, a Decl::ObjCDeclQualifier. /// Otherwise, the number of function parameter scopes enclosing /// the function parameter scope in which this parameter was /// declared. -unsigned ScopeDepthOrObjCQuals : 7; +unsigned ScopeDepthOrObjCQuals : NumScopeDepthOrObjCQualsBits; /// The number of parameters preceding this parameter in the /// function parameter
[PATCH] D49754: Add -m(no-)spe, and e500 CPU definitions and support to clang
vit9696 added a comment. Not sure whether I understood you, do not you already have the common switch by feature, named spe, in Features["spe"] line for that? Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D49754/new/ https://reviews.llvm.org/D49754 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits