[PATCH] D12405: [clang-format-vs] Format the whole document if nothing is selected
berenm created this revision. berenm added a reviewer: djasper. berenm added a subscriber: cfe-commits. By default, clang-format VS plugin only reformats the selected code. To reformat the whole document, the user has to select everything before calling the reformat shortcut. http://reviews.llvm.org/D12405 Files: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs Index: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs === --- tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs +++ tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs @@ -84,8 +84,13 @@ // We're not in a text view. return; string text = view.TextBuffer.CurrentSnapshot.GetText(); -int start = view.Selection.Start.Position.GetContainingLine().Start.Position; -int end = view.Selection.End.Position.GetContainingLine().End.Position; +int start = 0; +int end = text.Length; +if (!view.Selection.IsEmpty) +{ +start = view.Selection.Start.Position.GetContainingLine().Start.Position; +end = view.Selection.End.Position.GetContainingLine().End.Position; +} int length = end - start; // clang-format doesn't support formatting a range that starts at the end // of the file. Index: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs === --- tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs +++ tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs @@ -84,8 +84,13 @@ // We're not in a text view. return; string text = view.TextBuffer.CurrentSnapshot.GetText(); -int start = view.Selection.Start.Position.GetContainingLine().Start.Position; -int end = view.Selection.End.Position.GetContainingLine().End.Position; +int start = 0; +int end = text.Length; +if (!view.Selection.IsEmpty) +{ +start = view.Selection.Start.Position.GetContainingLine().Start.Position; +end = view.Selection.End.Position.GetContainingLine().End.Position; +} int length = end - start; // clang-format doesn't support formatting a range that starts at the end // of the file. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D12406: [Analyzer] Add -analyzer-config option for function size the inliner considers as large
seaneveson created this revision. seaneveson added a subscriber: cfe-commits. Dear All, I would like to propose a small patch to add an option (-analyzer-config min-blocks-for-inline-large=14) to control the function size the inliner considers as large, in relation to max-times-inline-large. In my patch the option defaults to the original hard coded behaviour, which I believe should be adjustable with the other inlining settings. The analyzer-config test has been modified so that the analyzer will reach the getMinBlocksForInlineLarge() method and store the result in the ConfigTable, to ensure it is dumped by the debug checker. Regards, Sean Eveson SN Systems - Sony Computer Entertainment Group http://reviews.llvm.org/D12406 Files: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h lib/StaticAnalyzer/Core/AnalyzerOptions.cpp lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp test/Analysis/analyzer-config.c test/Analysis/analyzer-config.cpp Index: test/Analysis/analyzer-config.cpp === --- test/Analysis/analyzer-config.cpp +++ test/Analysis/analyzer-config.cpp @@ -1,8 +1,14 @@ -// RUN: %clang -target x86_64-apple-darwin10 --analyze %s -o /dev/null -Xclang -analyzer-checker=debug.ConfigDumper %t 21 +// RUN: %clang -target x86_64-apple-darwin10 --analyze %s -o /dev/null -Xclang -analyzer-checker=debug.ConfigDumper -Xclang -analyzer-max-loop -Xclang 34 %t 21 // RUN: FileCheck --input-file=%t %s void bar() {} -void foo() { bar(); } +void foo() { + // Call bar 33 times so max-times-inline-large is met and + // min-blocks-for-inline-large is checked + for (int i = 0; i 34; ++i) { +bar(); + } +} class Foo { public: @@ -26,7 +32,8 @@ // CHECK-NEXT: max-inlinable-size = 50 // CHECK-NEXT: max-nodes = 15 // CHECK-NEXT: max-times-inline-large = 32 +// CHECK-NEXT: min-blocks-for-inline-large = 14 // CHECK-NEXT: mode = deep // CHECK-NEXT: region-store-small-struct-limit = 2 // CHECK-NEXT: [stats] -// CHECK-NEXT: num-entries = 17 +// CHECK-NEXT: num-entries = 18 Index: test/Analysis/analyzer-config.c === --- test/Analysis/analyzer-config.c +++ test/Analysis/analyzer-config.c @@ -1,8 +1,14 @@ -// RUN: %clang -target x86_64-apple-darwin10 --analyze %s -o /dev/null -Xclang -analyzer-checker=debug.ConfigDumper %t 21 +// RUN: %clang -target x86_64-apple-darwin10 --analyze %s -o /dev/null -Xclang -analyzer-checker=debug.ConfigDumper -Xclang -analyzer-max-loop -Xclang 34 %t 21 // RUN: FileCheck --input-file=%t %s void bar() {} -void foo() { bar(); } +void foo() { + // Call bar 33 times so max-times-inline-large is met and + // min-blocks-for-inline-large is checked + for (int i = 0; i 34; ++i) { +bar(); + } +} // CHECK: [config] // CHECK-NEXT: cfg-conditional-static-initializers = true @@ -15,8 +21,9 @@ // CHECK-NEXT: max-inlinable-size = 50 // CHECK-NEXT: max-nodes = 15 // CHECK-NEXT: max-times-inline-large = 32 +// CHECK-NEXT: min-blocks-for-inline-large = 14 // CHECK-NEXT: mode = deep // CHECK-NEXT: region-store-small-struct-limit = 2 // CHECK-NEXT: [stats] -// CHECK-NEXT: num-entries = 12 +// CHECK-NEXT: num-entries = 13 Index: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp === --- lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp +++ lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp @@ -870,7 +870,7 @@ // Do not inline large functions too many times. if ((Engine.FunctionSummaries-getNumTimesInlined(D) Opts.getMaxTimesInlineLarge()) - CalleeCFG-getNumBlockIDs() 13) { + CalleeCFG-getNumBlockIDs() = Opts.getMinBlocksForInlineLarge()) { NumReachedInlineCountMax++; return false; } Index: lib/StaticAnalyzer/Core/AnalyzerOptions.cpp === --- lib/StaticAnalyzer/Core/AnalyzerOptions.cpp +++ lib/StaticAnalyzer/Core/AnalyzerOptions.cpp @@ -295,6 +295,13 @@ return MaxTimesInlineLarge.getValue(); } +unsigned AnalyzerOptions::getMinBlocksForInlineLarge() { + if (!MinBlocksForInlineLarge.hasValue()) +MinBlocksForInlineLarge = getOptionAsInteger(min-blocks-for-inline-large, + 14); + return MinBlocksForInlineLarge.getValue(); +} + unsigned AnalyzerOptions::getMaxNodesPerTopLevelFunction() { if (!MaxNodesPerTopLevelFunction.hasValue()) { int DefaultValue = 0; Index: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h === --- include/clang/StaticAnalyzer/Core/AnalyzerOptions.h +++ include/clang/StaticAnalyzer/Core/AnalyzerOptions.h @@ -253,6 +253,9 @@ /// \sa getMaxTimesInlineLarge Optionalunsigned MaxTimesInlineLarge; + /// \sa getMinBlocksForInlineLarge + Optionalunsigned MinBlocksForInlineLarge; + /// \sa
Re: [PATCH] D11297: PR17829: Functions declared extern C with a name matching a mangled C++ function are allowed
andreybokhanko marked 3 inline comments as done. andreybokhanko added a comment. John, Thank you for the review! All your comments but one are fixed. See below for details on the single one I didn't manage to get fixed. Andrey Comment at: lib/CodeGen/CodeGenModule.h:354 @@ +353,3 @@ + /// call). + llvm::DenseSetGlobalDecl ExplicitDefinitions; + Checking that a GlobalDecl is not in ExplicitDefinitions yet is actually required to avoid printing multiple identical warnings. In my example: ``` 1: struct T { 2: ~T() {} 3: }; 4: 5: extern C void _ZN1TD1Ev(); 6: 7: int main() { 8: _ZN1TD1Ev(); 9: T t; 10: } ``` ~T() is added to the list of deferred decls twice. Judging from this comment in EmitDeferred method: // Check to see if we've already emitted this. This is necessary // for a couple of reasons: first, decls can end up in the // deferred-decls queue multiple times, and second, decls can end // up with definitions in unusual ways (e.g. by an extern inline // function acquiring a strong function redefinition). Just // ignore these cases. this is pretty normal (decls can end up in the deferred-decls queue multiple times). This means that we can call GetOrCreateLLVMFunction(..., /*IsForDefinition*/=true) for duplicated decls several times, which is fine in general, *but* will print the duplicated mangled names diagnostic multiple times as well -- unless we check that we already printed a warning on duplicated mangled names for given decl. As for not emitting diagnostics for different globals -- this won't happen, as we will call GetOrCreateLLVMFunction at least once for each global with a definition, and thus, will print a warning for everyone. I thought really hard (honestly!) on how to prevent duplicated diagnostics without usage of an additional set, but didn't found any solution. If you have any hints here, they would be much appreciated. http://reviews.llvm.org/D11297 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12405: [clang-format-vs] Format the whole document if nothing is selected
Alright, my bad. It does indeed. I was trying to add a Reformat all on save feature in the plugin, and after struggling with VSSDK I thought this would be an easy first step. -- Beren Minor On Thu, Aug 27, 2015 at 3:36 PM, Aaron Ballman aa...@aaronballman.com wrote: On Thu, Aug 27, 2015 at 9:34 AM, Daniel Jasper via cfe-commits cfe-commits@lists.llvm.org wrote: If nothing is selected, clang-format should format the current line.. At least that's the intended behavior. Doesn't it do that? It currently reformats the current line (possibly extended if the expression spans multiple lines) for me. ~Aaron On Aug 27, 2015 3:21 PM, Beren Minor beren.minor+git...@gmail.com wrote: berenm created this revision. berenm added a reviewer: djasper. berenm added a subscriber: cfe-commits. By default, clang-format VS plugin only reformats the selected code. To reformat the whole document, the user has to select everything before calling the reformat shortcut. http://reviews.llvm.org/D12405 Files: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs Index: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs === --- tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs +++ tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs @@ -84,8 +84,13 @@ // We're not in a text view. return; string text = view.TextBuffer.CurrentSnapshot.GetText(); -int start = view.Selection.Start.Position.GetContainingLine().Start.Position; -int end = view.Selection.End.Position.GetContainingLine().End.Position; +int start = 0; +int end = text.Length; +if (!view.Selection.IsEmpty) +{ +start = view.Selection.Start.Position.GetContainingLine().Start.Position; +end = view.Selection.End.Position.GetContainingLine().End.Position; +} int length = end - start; // clang-format doesn't support formatting a range that starts at the end // of the file. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12405: [clang-format-vs] Format the whole document if nothing is selected
On Thu, Aug 27, 2015 at 9:34 AM, Daniel Jasper via cfe-commits cfe-commits@lists.llvm.org wrote: If nothing is selected, clang-format should format the current line.. At least that's the intended behavior. Doesn't it do that? It currently reformats the current line (possibly extended if the expression spans multiple lines) for me. ~Aaron On Aug 27, 2015 3:21 PM, Beren Minor beren.minor+git...@gmail.com wrote: berenm created this revision. berenm added a reviewer: djasper. berenm added a subscriber: cfe-commits. By default, clang-format VS plugin only reformats the selected code. To reformat the whole document, the user has to select everything before calling the reformat shortcut. http://reviews.llvm.org/D12405 Files: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs Index: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs === --- tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs +++ tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs @@ -84,8 +84,13 @@ // We're not in a text view. return; string text = view.TextBuffer.CurrentSnapshot.GetText(); -int start = view.Selection.Start.Position.GetContainingLine().Start.Position; -int end = view.Selection.End.Position.GetContainingLine().End.Position; +int start = 0; +int end = text.Length; +if (!view.Selection.IsEmpty) +{ +start = view.Selection.Start.Position.GetContainingLine().Start.Position; +end = view.Selection.End.Position.GetContainingLine().End.Position; +} int length = end - start; // clang-format doesn't support formatting a range that starts at the end // of the file. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12405: [clang-format-vs] Format the whole document if nothing is selected
I see.. I think we'll want to keep the current behavior there.. On Aug 27, 2015 3:38 PM, Beren Minor beren.minor+git...@gmail.com wrote: Alright, my bad. It does indeed. I was trying to add a Reformat all on save feature in the plugin, and after struggling with VSSDK I thought this would be an easy first step. -- Beren Minor On Thu, Aug 27, 2015 at 3:36 PM, Aaron Ballman aa...@aaronballman.com wrote: On Thu, Aug 27, 2015 at 9:34 AM, Daniel Jasper via cfe-commits cfe-commits@lists.llvm.org wrote: If nothing is selected, clang-format should format the current line.. At least that's the intended behavior. Doesn't it do that? It currently reformats the current line (possibly extended if the expression spans multiple lines) for me. ~Aaron On Aug 27, 2015 3:21 PM, Beren Minor beren.minor+git...@gmail.com wrote: berenm created this revision. berenm added a reviewer: djasper. berenm added a subscriber: cfe-commits. By default, clang-format VS plugin only reformats the selected code. To reformat the whole document, the user has to select everything before calling the reformat shortcut. http://reviews.llvm.org/D12405 Files: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs Index: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs === --- tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs +++ tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs @@ -84,8 +84,13 @@ // We're not in a text view. return; string text = view.TextBuffer.CurrentSnapshot.GetText(); -int start = view.Selection.Start.Position.GetContainingLine().Start.Position; -int end = view.Selection.End.Position.GetContainingLine().End.Position; +int start = 0; +int end = text.Length; +if (!view.Selection.IsEmpty) +{ +start = view.Selection.Start.Position.GetContainingLine().Start.Position; +end = view.Selection.End.Position.GetContainingLine().End.Position; +} int length = end - start; // clang-format doesn't support formatting a range that starts at the end // of the file. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12368: Add a clang release note about raising the minimum Windows version for the next major release
gbedwell added a comment. In http://reviews.llvm.org/D12368#233680, @hans wrote: Committed in r246090. Thanks! Repository: rL LLVM http://reviews.llvm.org/D12368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12375: [PATCH] Relax parse ordering rules for attributes
aaron.ballman updated this revision to Diff 33318. aaron.ballman added a comment. I've updated the patch to disallow reordering of C++11 attributes with relation to other attribute syntaxes. Additionally, if there is a reordering issue found, we now warn the user. http://reviews.llvm.org/D12375 Files: include/clang/Basic/DiagnosticParseKinds.td include/clang/Parse/Parser.h lib/Parse/ParseDecl.cpp lib/Parse/ParseDeclCXX.cpp lib/Parse/ParseExprCXX.cpp lib/Parse/Parser.cpp test/Parser/attr-order.cpp Index: test/Parser/attr-order.cpp === --- test/Parser/attr-order.cpp +++ test/Parser/attr-order.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -fsyntax-only -fms-extensions -std=c++14 -verify %s + +struct [[]] __attribute__((lockable)) __declspec(dllexport) A {}; // ok +struct [[]] __declspec(dllexport) __attribute__((lockable)) B {}; // ok +struct [[]] [[]] __declspec(dllexport) __attribute__((lockable)) C {}; // ok +struct __declspec(dllexport) [[]] __attribute__((lockable)) D {}; // expected-warning {{C++11 attributes should precede all other attributes in an attribute list}} +struct __declspec(dllexport) __attribute__((lockable)) [[]] E {}; // expected-warning {{C++11 attributes should precede all other attributes in an attribute list}} +struct __attribute__((lockable)) __declspec(dllexport) [[]] F {}; // expected-warning {{C++11 attributes should precede all other attributes in an attribute list}} +struct __attribute__((lockable)) [[]] __declspec(dllexport) G {}; // expected-warning {{C++11 attributes should precede all other attributes in an attribute list}} +struct [[]] __attribute__((lockable)) [[]] __declspec(dllexport) H {}; // expected-warning {{C++11 attributes should precede all other attributes in an attribute list}} + +[[noreturn]] __attribute__((cdecl)) __declspec(dllexport) void a(); // ok +[[noreturn]] __declspec(dllexport) __attribute__((cdecl)) void b(); // ok +[[]] [[noreturn]] __attribute__((cdecl)) __declspec(dllexport) void c(); // ok + +// FIXME: The following cases should report the same warning diagnostic as +// above. However, that requires changing the way we parse decl specifiers vs +// top-level declarations. See PR24559 for more details. +__declspec(dllexport) [[noreturn]] __attribute__((cdecl)) void d(); // expected-error {{an attribute list cannot appear here}} +__declspec(dllexport) __attribute__((cdecl)) [[noreturn]] void e(); // expected-error {{an attribute list cannot appear here}} +__attribute__((cdecl)) __declspec(dllexport) [[noreturn]] void f(); // expected-error {{an attribute list cannot appear here}} +__attribute__((cdecl)) [[noreturn]] __declspec(dllexport) void g(); // expected-error {{an attribute list cannot appear here}} +[[noreturn]] __attribute__((cdecl)) [[]] __declspec(dllexport) void h(); // expected-error {{an attribute list cannot appear here}} Index: lib/Parse/Parser.cpp === --- lib/Parse/Parser.cpp +++ lib/Parse/Parser.cpp @@ -586,8 +586,7 @@ } ParsedAttributesWithRange attrs(AttrFactory); - MaybeParseCXX11Attributes(attrs); - MaybeParseMicrosoftAttributes(attrs); + MaybeParseAttributes(PAKM_CXX11 | PAKM_Microsoft, attrs); Result = ParseExternalDeclaration(attrs); return false; @@ -1962,8 +1961,7 @@ // FIXME: Support module import within __if_exists? while (Tok.isNot(tok::r_brace) !isEofOrEom()) { ParsedAttributesWithRange attrs(AttrFactory); -MaybeParseCXX11Attributes(attrs); -MaybeParseMicrosoftAttributes(attrs); +MaybeParseAttributes(PAKM_CXX11 | PAKM_Microsoft, attrs); DeclGroupPtrTy Result = ParseExternalDeclaration(attrs); if (Result !getCurScope()-getParent()) Actions.getASTConsumer().HandleTopLevelDecl(Result.get()); Index: lib/Parse/ParseExprCXX.cpp === --- lib/Parse/ParseExprCXX.cpp +++ lib/Parse/ParseExprCXX.cpp @@ -1090,14 +1090,10 @@ SourceLocation RParenLoc = T.getCloseLocation(); DeclEndLoc = RParenLoc; -// GNU-style attributes must be parsed before the mutable specifier to be -// compatible with GCC. -MaybeParseGNUAttributes(Attr, DeclEndLoc); +// GNU-style and __declspec attributes must be parsed before the mutable +// specifier to be compatible with GCC/MSVC. +MaybeParseAttributes(PAKM_GNU | PAKM_Declspec, Attr, DeclEndLoc); -// MSVC-style attributes must be parsed before the mutable specifier to be -// compatible with MSVC. -MaybeParseMicrosoftDeclSpecs(Attr, DeclEndLoc); - // Parse 'mutable'[opt]. SourceLocation MutableLoc; if (TryConsumeToken(tok::kw_mutable, MutableLoc)) Index: lib/Parse/ParseDeclCXX.cpp === --- lib/Parse/ParseDeclCXX.cpp +++ lib/Parse/ParseDeclCXX.cpp @@ -212,8 +212,7 @@ if (index == Ident.size()) { while
Re: [PATCH] D12405: [clang-format-vs] Format the whole document if nothing is selected
If nothing is selected, clang-format should format the current line.. At least that's the intended behavior. Doesn't it do that? On Aug 27, 2015 3:21 PM, Beren Minor beren.minor+git...@gmail.com wrote: berenm created this revision. berenm added a reviewer: djasper. berenm added a subscriber: cfe-commits. By default, clang-format VS plugin only reformats the selected code. To reformat the whole document, the user has to select everything before calling the reformat shortcut. http://reviews.llvm.org/D12405 Files: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs Index: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs === --- tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs +++ tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs @@ -84,8 +84,13 @@ // We're not in a text view. return; string text = view.TextBuffer.CurrentSnapshot.GetText(); -int start = view.Selection.Start.Position.GetContainingLine().Start.Position; -int end = view.Selection.End.Position.GetContainingLine().End.Position; +int start = 0; +int end = text.Length; +if (!view.Selection.IsEmpty) +{ +start = view.Selection.Start.Position.GetContainingLine().Start.Position; +end = view.Selection.End.Position.GetContainingLine().End.Position; +} int length = end - start; // clang-format doesn't support formatting a range that starts at the end // of the file. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D9639: Do not include pthread.h and sched.h when threads are disabled
jroelofs added a comment. Ah, usually the process is that you get your patch through review, and when someone accepts it, then you can commit it. If you do not have commit rights, then you can get someone else to commit it for you. Accepted = ok to commit Closed = I've committed it Do you need me to commit it for you? http://reviews.llvm.org/D9639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r246169 - [clang-tidy] Update docs for clang-tidy checks. NFC
Author: alexfh Date: Thu Aug 27 13:01:58 2015 New Revision: 246169 URL: http://llvm.org/viewvc/llvm-project?rev=246169view=rev Log: [clang-tidy] Update docs for clang-tidy checks. NFC Changes mostly address formatting and unification of the style. Use MarkDown style for inline code snippets and lists. Added some text for a few checks. The idea is to move most of the documentation out to separate rST files and have implementation files refer to the corresponding documentation files. Modified: clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.h clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.h clang-tools-extra/trunk/clang-tidy/google/ExplicitMakePairCheck.h clang-tools-extra/trunk/clang-tidy/google/IntegerTypesCheck.h clang-tools-extra/trunk/clang-tidy/google/MemsetZeroLengthCheck.h clang-tools-extra/trunk/clang-tidy/google/OverloadedUnaryAndCheck.h clang-tools-extra/trunk/clang-tidy/google/StringReferenceMemberCheck.h clang-tools-extra/trunk/clang-tidy/google/TodoCommentCheck.h clang-tools-extra/trunk/clang-tidy/google/UnnamedNamespaceInHeaderCheck.h clang-tools-extra/trunk/clang-tidy/google/UsingNamespaceDirectiveCheck.h clang-tools-extra/trunk/clang-tidy/llvm/IncludeOrderCheck.h clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.h clang-tools-extra/trunk/clang-tidy/misc/ArgumentCommentCheck.h clang-tools-extra/trunk/clang-tidy/misc/AssertSideEffectCheck.h clang-tools-extra/trunk/clang-tidy/misc/AssignOperatorSignatureCheck.h clang-tools-extra/trunk/clang-tidy/misc/BoolPointerImplicitConversionCheck.h clang-tools-extra/trunk/clang-tidy/misc/InaccurateEraseCheck.h clang-tools-extra/trunk/clang-tidy/misc/InefficientAlgorithmCheck.h clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.cpp clang-tools-extra/trunk/clang-tidy/misc/MacroParenthesesCheck.h clang-tools-extra/trunk/clang-tidy/misc/MacroRepeatedSideEffectsCheck.h clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.h clang-tools-extra/trunk/clang-tidy/misc/NoexceptMoveConstructorCheck.h clang-tools-extra/trunk/clang-tidy/misc/StaticAssertCheck.h clang-tools-extra/trunk/clang-tidy/misc/SwappedArgumentsCheck.h clang-tools-extra/trunk/clang-tidy/misc/UndelegatedConstructor.h clang-tools-extra/trunk/clang-tidy/misc/UniqueptrResetReleaseCheck.h clang-tools-extra/trunk/clang-tidy/misc/UnusedAliasDeclsCheck.h clang-tools-extra/trunk/clang-tidy/misc/UnusedParametersCheck.h clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.h clang-tools-extra/trunk/clang-tidy/misc/UseOverrideCheck.h clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.h clang-tools-extra/trunk/clang-tidy/readability/ContainerSizeEmptyCheck.h clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.h clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.h clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.h clang-tools-extra/trunk/clang-tidy/readability/NamedParameterCheck.h clang-tools-extra/trunk/clang-tidy/readability/NamespaceCommentCheck.h clang-tools-extra/trunk/clang-tidy/readability/RedundantSmartptrGetCheck.h clang-tools-extra/trunk/clang-tidy/readability/RedundantStringCStrCheck.h clang-tools-extra/trunk/clang-tidy/readability/ShrinkToFitCheck.h clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.h clang-tools-extra/trunk/clang-tidy/utils/HeaderGuard.h Modified: clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.h?rev=246169r1=246168r2=246169view=diff == --- clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.h (original) +++ clang-tools-extra/trunk/clang-tidy/google/AvoidCStyleCastsCheck.h Thu Aug 27 13:01:58 2015 @@ -17,14 +17,15 @@ namespace tidy { namespace google { namespace readability { -/// \brief Finds usages of C-style casts. +/// Finds usages of C-style casts. /// /// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Casting#Casting +/// /// Corresponding cpplint.py check name: 'readability/casting'. /// -/// This check is similar to -Wold-style-cast, but it will suggest automated -/// fixes eventually. The reported locations should not be different from the -/// ones generated by -Wold-style-cast. +/// This check is similar to `-Wold-style-cast`, but it suggests automated fixes +/// in some cases. The reported locations should not be different from the +/// ones generated by `-Wold-style-cast`. class AvoidCStyleCastsCheck : public ClangTidyCheck { public: AvoidCStyleCastsCheck(StringRef Name, ClangTidyContext *Context) Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.h URL:
Re: [PATCH] D12134: Improve debug info for implicitly captured vars in lambdas
On Tue, Aug 25, 2015 at 10:50 AM, Bataev, Alexey a.bat...@hotmail.com wrote: Guys, talking about implicitly captured variables we have to deal with 2 locations: 1) point of real capturing (it is the point of '=' or '' symbols in lambda capture-list); I'm not sure that's the point of real capturing if it's an implicit capture - nature of it being implicit is that there is no point where the variable is explicitly captured. 2) a point of first use of variable inside lambda's body. When we're talking about diagnostic for implicitly captured variables we have to deal with the second point, not the first one, because of usability. That's what I'm trying to understand - why is (2) relevant for diagnostic usability, but not for debugger usability? I don't think that the diagnostic consumer would be happy to see a message like unnamed variable cannot be implicitly captured in a lambda expression pointing to '=' or ''. Here we have to emit the diagnostic at the point of the very first use of the variable we're going to capture to make diagnostic more user-friendly. But actual point of capturing is still a point, where we have '=' or '' symbols in capture-list. Best regards, Alexey Bataev = Software Engineer Intel Compiler Team 25.08.2015 19:00, Eric Christopher пишет: Yeah. I can't see a difference here being useful, and more likely harmful. On Tue, Aug 25, 2015, 8:48 AM David Blaikie dblai...@gmail.com mailto: dblai...@gmail.com wrote: On Tue, Aug 25, 2015 at 8:44 AM, Bataev, Alexey a.bat...@hotmail.com mailto:a.bat...@hotmail.com wrote: Debug info points to the real place where it is captured, while diagnostics points to the first use of implicitly captured variable. Right, but I'm trying to understand the justification for why that's the right thing to do. Why the debug info user would want a different experience than the compiler diagnostic consumer would want. - David Best regards, Alexey Bataev = Software Engineer Intel Compiler Team 25.08.2015 18 tel:25.08.2015%2018:22, David Blaikie пишет: On Tue, Aug 25, 2015 at 8:18 AM, Bataev, Alexey a.bat...@hotmail.com mailto:a.bat...@hotmail.com mailto:a.bat...@hotmail.com mailto:a.bat...@hotmail.com wrote: I though about this. I think it will be more convenient for user to see the diagnostic on the first use of the variable rather than on '=' or '' symbol. Why the difference between the diagnostic the debug info, then? Best regards, Alexey Bataev = Software Engineer Intel Compiler Team 25.08.2015 18 tel:25.08.2015%2018 tel:25.08.2015%2018:07, David Blaikie пишет: On Tue, Aug 18, 2015 at 9:05 PM, Alexey Bataev via cfe-commits cfe-commits@lists.llvm.org mailto:cfe-commits@lists.llvm.org mailto:cfe-commits@lists.llvm.org mailto:cfe-commits@lists.llvm.org mailto:cfe-commits@lists.llvm.org mailto:cfe-commits@lists.llvm.org mailto:cfe-commits@lists.llvm.org mailto:cfe-commits@lists.llvm.org wrote: ABataev created this revision. ABataev added reviewers: echristo, rjmccall, rsmith. ABataev added a subscriber: cfe-commits. When variables are implicitly captured in lambdas, debug info generated for captured variables points to location where they are used first. This patch makes debug info to point to capture default location. Not sure if this is the right tradeoff, or if it is, perhaps we should reconsider how our diagnostics work too? Currently if you, say, capture a variable by value and that variable doesn't have an accessible copy ctor, the diagnostic points to the first use. Should we change that too? http://reviews.llvm.org/D12134 Files: lib/Sema/SemaLambda.cpp test/CodeGenCXX/debug-lambda-expressions.cpp Index: lib/Sema/SemaLambda.cpp === --- lib/Sema/SemaLambda.cpp +++ lib/Sema/SemaLambda.cpp @@
Re: [PATCH] D9639: Do not include pthread.h and sched.h when threads are disabled
jroelofs added a comment. @blastrock have you committed this yet? http://reviews.llvm.org/D9639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r246150 - Remove a switch statement, and replace with a bunch of ifs to silence a warning about 'all the enumeration values covered'. No functional change.
On Aug 27, 2015 7:38 AM, Marshall Clow via cfe-commits cfe-commits@lists.llvm.org wrote: Author: marshall Date: Thu Aug 27 09:37:22 2015 New Revision: 246150 URL: http://llvm.org/viewvc/llvm-project?rev=246150view=rev Log: Remove a switch statement, and replace with a bunch of ifs to silence a warning about 'all the enumeration values covered'. No functional change. Just for the record you can also supports this'd warning by casting the switch expression to an integer type. (If I've correctly understood the warning your getting) Modified: libcxx/trunk/include/locale Modified: libcxx/trunk/include/locale URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=246150r1=246149r2=246150view=diff == --- libcxx/trunk/include/locale (original) +++ libcxx/trunk/include/locale Thu Aug 27 09:37:22 2015 @@ -4316,18 +4316,9 @@ wbuffer_convert_Codecvt, _Elem, _Tr::s int __width = __cv_-encoding(); if (__cv_ == 0 || __bufptr_ == 0 || (__width = 0 __off != 0) || sync()) return pos_type(off_type(-1)); -// __width 0 || __off == 0 -switch (__way) -{ -case ios_base::beg: -break; -case ios_base::cur: -break; -case ios_base::end: -break; -default: +// __width 0 || __off == 0, now check __way +if (__way != ios_base::beg __way != ios_base::cur __way != ios_base::end) return pos_type(off_type(-1)); -} pos_type __r = __bufptr_-pubseekoff(__width * __off, __way, __om); __r.state(__st_); return __r; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11433: [Static Analyzer] Make NonNullParamChecker emit implicit null dereference events.
xazax.hun updated this revision to Diff 5. xazax.hun added a comment. - Updated to latest trunk. - Added a new field to the event with documentation. - Rebased the patch on the top of nullability checker. - Added covered cases to the nullability checker tests. http://reviews.llvm.org/D11433 Files: include/clang/StaticAnalyzer/Core/Checker.h lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp test/Analysis/nullability.mm Index: test/Analysis/nullability.mm === --- test/Analysis/nullability.mm +++ test/Analysis/nullability.mm @@ -50,6 +50,8 @@ template typename T T *eraseNullab(T *p) { return p; } +void takesAttrNonnull(Dummy *p) __attribute((nonnull(1))); + void testBasicRules() { Dummy *p = returnsNullable(); int *ptr = returnsNullableInt(); @@ -73,10 +75,8 @@ Dummy dd(d); break; } - // Here the copy constructor is called, so a reference is initialized with the - // value of p. No ImplicitNullDereference event will be dispatched for this - // case. A followup patch is expected to fix this in NonNullParamChecker. - default: { Dummy d = *p; } break; // No warning. + case 5: takesAttrNonnull(p); break; // expected-warning {{Nullable pointer is passed to}} + default: { Dummy d = *p; } break; // expected-warning {{Nullable pointer is dereferenced}} } if (p) { takesNonnull(p); Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp === --- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp +++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp @@ -335,7 +335,10 @@ if (Filter.CheckNullableDereferenced TrackedNullability-getValue() == Nullability::Nullable) { BugReporter BR = *Event.BR; -reportBug(ErrorKind::NullableDereferenced, Event.SinkNode, Region, BR); +if (Event.IsDirectDereference) + reportBug(ErrorKind::NullableDereferenced, Event.SinkNode, Region, BR); +else + reportBug(ErrorKind::NullablePassedToNonnull, Event.SinkNode, Region, BR); } } Index: lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp === --- lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp +++ lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp @@ -28,7 +28,7 @@ namespace { class NonNullParamChecker - : public Checker check::PreCall { + : public Checker check::PreCall, EventDispatcherImplicitNullDerefEvent { mutable std::unique_ptrBugType BTAttrNonNull; mutable std::unique_ptrBugType BTNullRefArg; @@ -139,26 +139,34 @@ ProgramStateRef stateNotNull, stateNull; std::tie(stateNotNull, stateNull) = CM.assumeDual(state, *DV); -if (stateNull !stateNotNull) { - // Generate an error node. Check for a null node in case - // we cache out. - if (ExplodedNode *errorNode = C.generateSink(stateNull)) { +if (stateNull) { + if (!stateNotNull) { +// Generate an error node. Check for a null node in case +// we cache out. +if (ExplodedNode *errorNode = C.generateSink(stateNull)) { -std::unique_ptrBugReport R; -if (haveAttrNonNull) - R = genReportNullAttrNonNull(errorNode, ArgE); -else if (haveRefTypeParam) - R = genReportReferenceToNullPointer(errorNode, ArgE); + std::unique_ptrBugReport R; + if (haveAttrNonNull) +R = genReportNullAttrNonNull(errorNode, ArgE); + else if (haveRefTypeParam) +R = genReportReferenceToNullPointer(errorNode, ArgE); -// Highlight the range of the argument that was null. -R-addRange(Call.getArgSourceRange(idx)); + // Highlight the range of the argument that was null. + R-addRange(Call.getArgSourceRange(idx)); -// Emit the bug report. -C.emitReport(std::move(R)); - } + // Emit the bug report. + C.emitReport(std::move(R)); +} - // Always return. Either we cached out or we just emitted an error. - return; +// Always return. Either we cached out or we just emitted an error. +return; + } + if (ExplodedNode *N = C.generateSink(stateNull)) { +ImplicitNullDerefEvent event = { +V, false, N, C.getBugReporter(), +/*IsDirectDereference=*/haveRefTypeParam}; +dispatchEvent(event); + } } // If a pointer value passed the check we should assume that it is Index: lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp === --- lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp +++ lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp @@ -220,7 +220,8 @@ // null or not-null. Record the error node as an implicit null // dereference. if
Re: [PATCH] D9639: Do not include pthread.h and sched.h when threads are disabled
jroelofs accepted this revision. jroelofs added a comment. r246168 http://reviews.llvm.org/D9639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r246170 - [clang-tidy] Renamed a test file to check-name.cpp.
Author: alexfh Date: Thu Aug 27 13:03:37 2015 New Revision: 246170 URL: http://llvm.org/viewvc/llvm-project?rev=246170view=rev Log: [clang-tidy] Renamed a test file to check-name.cpp. Added: clang-tools-extra/trunk/test/clang-tidy/misc-argument-comment.cpp - copied unchanged from r245699, clang-tools-extra/trunk/test/clang-tidy/arg-comments.cpp Removed: clang-tools-extra/trunk/test/clang-tidy/arg-comments.cpp Removed: clang-tools-extra/trunk/test/clang-tidy/arg-comments.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/arg-comments.cpp?rev=246169view=auto == --- clang-tools-extra/trunk/test/clang-tidy/arg-comments.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/arg-comments.cpp (removed) @@ -1,40 +0,0 @@ -// RUN: %python %S/check_clang_tidy.py %s misc-argument-comment %t - -// FIXME: clang-tidy should provide a -verify mode to make writing these checks -// easier and more accurate. - -void (int , int ); - -void f(int x, int y); -void g() { - // CHECK-MESSAGES: [[@LINE+4]]:5: warning: argument name 'y' in comment does not match parameter name 'x' - // CHECK-MESSAGES: :[[@LINE-3]]:12: note: 'x' declared here - // CHECK-MESSAGES: [[@LINE+2]]:14: warning: argument name 'z' in comment does not match parameter name 'y' - // CHECK-MESSAGES: :[[@LINE-5]]:19: note: 'y' declared here - f(/*y=*/0, /*z=*/0); -} - -struct Closure {}; - -template typename T1, typename T2 -Closure *NewCallback(void (*f)(T1, T2), T1 arg1, T2 arg2) { return nullptr; } - -template typename T1, typename T2 -Closure *NewPermanentCallback(void (*f)(T1, T2), T1 arg1, T2 arg2) { return nullptr; } - -void h() { - (void)NewCallback(, /*=*/11, /*=*/22); - (void)NewPermanentCallback(, /*=*/11, /*=*/22); -} - -templatetypename... Args -void variadic(Args... args); - -templatetypename... Args -void variadic2(int zzz, Args... args); - -void templates() { - variadic(/*xxx=*/0, /*yyy=*/1); - variadic2(/*zzZ=*/0, /*xxx=*/1, /*yyy=*/2); - // CHECK-MESSAGES: [[@LINE-1]]:13: warning: argument name 'zzZ' in comment does not match parameter name 'zzz' -} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r246168 - Do not include pthread.h and sched.h when threads are disabled
Author: jroelofs Date: Thu Aug 27 12:47:34 2015 New Revision: 246168 URL: http://llvm.org/viewvc/llvm-project?rev=246168view=rev Log: Do not include pthread.h and sched.h when threads are disabled Patch by Philippe Daouadi! http://reviews.llvm.org/D9639 Modified: libcxx/trunk/include/__mutex_base libcxx/trunk/include/mutex Modified: libcxx/trunk/include/__mutex_base URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__mutex_base?rev=246168r1=246167r2=246168view=diff == --- libcxx/trunk/include/__mutex_base (original) +++ libcxx/trunk/include/__mutex_base Thu Aug 27 12:47:34 2015 @@ -14,7 +14,9 @@ #include __config #include chrono #include system_error +#ifndef _LIBCPP_HAS_NO_THREADS #include pthread.h +#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header Modified: libcxx/trunk/include/mutex URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/mutex?rev=246168r1=246167r2=246168view=diff == --- libcxx/trunk/include/mutex (original) +++ libcxx/trunk/include/mutex Thu Aug 27 12:47:34 2015 @@ -179,7 +179,9 @@ templateclass Callable, class ...Args #ifndef _LIBCPP_HAS_NO_VARIADICS #include tuple #endif +#ifndef _LIBCPP_HAS_NO_THREADS #include sched.h +#endif #include __undef_min_max ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11280: [CUDA] Improve CUDA compilation pipeline creation.
This revision was automatically updated to reflect the committed changes. Closed by commit rL246174: [CUDA] Improve CUDA compilation pipeline creation. (authored by tra). Changed prior to commit: http://reviews.llvm.org/D11280?vs=29947id=33341#toc Repository: rL LLVM http://reviews.llvm.org/D11280 Files: cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/test/Driver/cuda-options.cu Index: cfe/trunk/test/Driver/cuda-options.cu === --- cfe/trunk/test/Driver/cuda-options.cu +++ cfe/trunk/test/Driver/cuda-options.cu @@ -6,16 +6,16 @@ // Simple compilation case: // RUN: %clang -### -target x86_64-linux-gnu -c %s 21 \ // Compile device-side to PTX assembly and make sure we use it on the host side. -// RUN: | FileCheck -check-prefix CUDA-D1 \ +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS\ // Then compile host side and incorporate device code. // RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ // Make sure we don't link anything. // RUN: -check-prefix CUDA-NL %s // Typical compilation + link case: // RUN: %clang -### -target x86_64-linux-gnu %s 21 \ // Compile device-side to PTX assembly and make sure we use it on the host side -// RUN: | FileCheck -check-prefix CUDA-D1 \ +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS\ // Then compile host side and incorporate device code. // RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ // Then link things. @@ -33,15 +33,15 @@ // Verify that -cuda-no-host disables host-side compilation and linking // RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only %s 21 \ // Compile device-side to PTX assembly -// RUN: | FileCheck -check-prefix CUDA-D1 \ +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS\ // Make sure there are no host cmpilation or linking. // RUN: -check-prefix CUDA-NH -check-prefix CUDA-NL %s // Verify that with -S we compile host and device sides to assembly // and incorporate device code on the host side. // RUN: %clang -### -target x86_64-linux-gnu -S -c %s 21 \ // Compile device-side to PTX assembly -// RUN: | FileCheck -check-prefix CUDA-D1 \ +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS\ // Then compile host side and incorporate GPU code. // RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ // Make sure we don't link anything. @@ -51,24 +51,56 @@ // archtecture info to device compilation. // RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_35 -c %s 21 \ // Compile device-side to PTX assembly. -// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1-SM35 \ +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS \ +// RUN: -check-prefix CUDA-D1-SM35 \ // Then compile host side and incorporate GPU code. // RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ // Make sure we don't link anything. // RUN: -check-prefix CUDA-NL %s // Verify that there is device-side compilation per --cuda-gpu-arch args // and that all results are included on the host side. -// RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_30 -c %s 21 \ +// RUN: %clang -### -target x86_64-linux-gnu \ +// RUN:--cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_30 -c %s 21 \ // Compile both device-sides to PTX assembly // RUN: | FileCheck \ -// RUN: -check-prefix CUDA-D1 -check-prefix CUDA-D1-SM35 \ +// RUN: -check-prefix CUDA-D1 -check-prefix CUDA-D1NS -check-prefix CUDA-D1-SM35 \ // RUN: -check-prefix CUDA-D2 -check-prefix CUDA-D2-SM30 \ // Then compile host side and incorporate both device-side outputs -// RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 -check-prefix CUDA-H-I2 \ +// RUN: -check-prefix CUDA-H -check-prefix CUDA-HNS \ +// RUN: -check-prefix CUDA-H-I1 -check-prefix CUDA-H-I2 \ // Make sure we don't link anything. // RUN: -check-prefix CUDA-NL %s +// Verify that device-side results are passed to correct tool when +// -save-temps is used +// RUN: %clang -### -target x86_64-linux-gnu -save-temps -c %s 21 \ +// Compile device-side to PTX assembly and make sure we use it on the host side. +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1S \ +// Then compile host side and incorporate device code. +// RUN: -check-prefix CUDA-H -check-prefix CUDA-HS -check-prefix CUDA-HS-I1 \ +// Make sure we don't link anything. +// RUN: -check-prefix CUDA-NL %s + +// Verify that device-side results are passed to correct tool when +// -fno-integrated-as is used +// RUN: %clang -### -target x86_64-linux-gnu -fno-integrated-as -c %s 21 \ +// Compile device-side to PTX assembly and make sure we use it on the host side. +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS \ +// Then compile host side and incorporate device code. +// RUN: -check-prefix CUDA-H -check-prefix CUDA-HNS -check-prefix CUDA-HS-I1 \ +// RUN: -check-prefix CUDA-H-AS \ +// Make sure we
Re: [PATCH] D12278: [X86] Add MSVC-compatible intrinsics for clac, stac, lgdt and sgdt
rnk added inline comments. Comment at: lib/Headers/Intrin.h:961 @@ +960,3 @@ +static __inline__ void __DEFAULT_FN_ATTRS _lgdt(void *__ptr) { + __builtin_ia32_lgdt(__ptr); +} compnerd wrote: mkuper wrote: compnerd wrote: Why does this need a builtin? Is an inline assembly block using lgdt insufficient for some reason? I think using a builtin is, generally, cleaner. I'm ok with using inline asm (and abandoning the LLVM part of the patch), if that's the more popular option. Yes, that is the preference in my experience. Please do switch to the inline asm option. I guess the distinction between these operations and others is that it isn't useful for the compiler to try to reason about these instructions, in the way that it's useful for it to reason about vector intrinsics. I'm happy with either LLVM intrinsics or inline asm. http://reviews.llvm.org/D12278 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r245779 - [modules] Rearrange how redeclaration chains are loaded, to remove a walk over
Richard Smith via cfe-commits cfe-commits@lists.llvm.org writes: Author: rsmith Date: Fri Aug 21 20:47:18 2015 New Revision: 245779 URL: http://llvm.org/viewvc/llvm-project?rev=245779view=rev Log: [modules] Rearrange how redeclaration chains are loaded, to remove a walk over all modules and reduce the number of declarations we load when loading a redeclaration chain. It looks like ASTDeclWriter::AddFirstDeclFromEachModule is called with a null `this` since this change, which has been causing ubsan failures on 76 tests since it went in: ASTWriterDecl.cpp:170:18: runtime error: member call on null pointer of type 'clang::ASTReader' Logs and other failures here: http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check/146/ I guess you must've missed the failure email. Could you please take a look? The new approach is: * when loading the first declaration of an entity within a module file, we first load all declarations of the entity that were imported into that module file, and then load all the other declarations of that entity from that module file and build a suitable decl chain from them * when loading any other declaration of an entity, we first load the first declaration from the same module file As before, we complete redecl chains through name lookup where necessary. To make this work, I also had to change the way that template specializations are stored -- it no longer suffices to track only canonical specializations; we now emit all first local declarations when emitting a list of specializations for a template. On one testcase with several thousand imported module files, this reduces the total runtime by 72%. Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/lib/Serialization/ASTWriterDecl.cpp cfe/trunk/test/Modules/cxx-templates.cpp Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=245779r1=245778r2=245779view=diff == --- cfe/trunk/include/clang/Serialization/ASTWriter.h (original) +++ cfe/trunk/include/clang/Serialization/ASTWriter.h Fri Aug 21 20:47:18 2015 @@ -405,6 +405,10 @@ private: /// \brief The set of declarations that may have redeclaration chains that /// need to be serialized. llvm::SmallVectorconst Decl *, 16 Redeclarations; + + /// \brief A cache of the first local declaration for interesting + /// redeclaration chains. + llvm::DenseMapconst Decl *, const Decl * FirstLocalDeclCache; /// \brief Statements that we've encountered while serializing a /// declaration or type. @@ -676,6 +680,10 @@ public: const ASTTemplateArgumentListInfo *ASTTemplArgList, RecordDataImpl Record); + /// \brief Find the first local declaration of a given local redeclarable + /// decl. + const Decl *getFirstLocalDecl(const Decl *D); + /// \brief Emit a reference to a declaration. void AddDeclRef(const Decl *D, RecordDataImpl Record); @@ -857,12 +865,6 @@ public: void CompletedTagDefinition(const TagDecl *D) override; void AddedVisibleDecl(const DeclContext *DC, const Decl *D) override; void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) override; - void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, - const ClassTemplateSpecializationDecl *D) override; - void AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, - const VarTemplateSpecializationDecl *D) override; - void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, - const FunctionDecl *D) override; void ResolvedExceptionSpec(const FunctionDecl *FD) override; void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) override; void ResolvedOperatorDelete(const CXXDestructorDecl *DD, Modified: cfe/trunk/lib/Serialization/ASTReader.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=245779r1=245778r2=245779view=diff == --- cfe/trunk/lib/Serialization/ASTReader.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Aug 21 20:47:18 2015 @@ -8123,11 +8123,8 @@ void ASTReader::finishPendingActions() { PendingIncompleteDeclChains.clear(); // Load pending declaration chains. -for (unsigned I = 0; I != PendingDeclChains.size(); ++I) { - PendingDeclChainsKnown.erase(PendingDeclChains[I]); +for (unsigned I = 0; I != PendingDeclChains.size();
[clang-tools-extra] r246173 - [clang-tidy] Move clang-tidy docs to a separate directory. Create doc files for checks
Author: alexfh Date: Thu Aug 27 13:10:07 2015 New Revision: 246173 URL: http://llvm.org/viewvc/llvm-project?rev=246173view=rev Log: [clang-tidy] Move clang-tidy docs to a separate directory. Create doc files for checks The doc files for checks have been generated from the corresponding header files using the docs/clang-tidy/tools/dump_check_docs.py script. Committing the script as well, but the intention is to move all the user-facing docs from header files to the rST files and add links to .h files appropriately. Added: clang-tools-extra/trunk/docs/clang-tidy/ clang-tools-extra/trunk/docs/clang-tidy/checks/ clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-explicit-make-pair.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-namespaces.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-build-using-namespace.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-explicit-constructor.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-global-names-in-headers.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-braces-around-statements.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-casting.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-function-size.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-namespace-comments.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-redundant-smartptr-get.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-readability-todo.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-int.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-member-string-references.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-memset.rst clang-tools-extra/trunk/docs/clang-tidy/checks/google-runtime-operator.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-header-guard.rst clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-include-order.rst clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-namespace-comment.rst clang-tools-extra/trunk/docs/clang-tidy/checks/llvm-twine-local.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-argument-comment.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assert-side-effect.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-assign-operator-signature.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-bool-pointer-implicit-conversion.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-inaccurate-erase.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-inefficient-algorithm.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-macro-parentheses.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-macro-repeated-side-effects.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-noexcept-move-constructor.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-static-assert.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-swapped-arguments.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-undelegated-constructor.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-uniqueptr-reset-release.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-alias-decls.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-parameters.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst clang-tools-extra/trunk/docs/clang-tidy/checks/misc-use-override.rst clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-loop-convert.rst clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-nullptr.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-braces-around-statements.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-container-size-empty.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-else-after-return.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-function-size.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-identifier-naming.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-named-parameter.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-redundant-smartptr-get.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-redundant-string-cstr.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-shrink-to-fit.rst clang-tools-extra/trunk/docs/clang-tidy/checks/readability-simplify-boolean-expr.rst clang-tools-extra/trunk/docs/clang-tidy/index.rst - copied, changed from r246170, clang-tools-extra/trunk/docs/clang-tidy.rst
r246174 - [CUDA] Improve CUDA compilation pipeline creation.
Author: tra Date: Thu Aug 27 13:10:41 2015 New Revision: 246174 URL: http://llvm.org/viewvc/llvm-project?rev=246174view=rev Log: [CUDA] Improve CUDA compilation pipeline creation. Current implementation tries to guess which Action will result in a job which needs to incorporate device-side GPU binaries. The guessing was attempting to work around the fact that multiple actions may be combined into a single compiler invocation. If CudaHostAction ends up being combined (and thus bypassed during action list traversal) no device-side actions it pointed to were processed. The guessing worked for most of the usual cases, but fell apart when external assembler was used. This change removes the guessing and makes sure we create and pass device-side jobs regardless of how the jobs get combined. * CudaHostAction is always inserted either at Compile phase or the FinalPhase of current compilation, whichever happens first. * If selectToolForJob combines CudaHostAction with other actions, it passes info about CudaHostAction up to the caller * When it sees that CudaHostAction got combined with other actions (and hence will never be passed to BuildJobsForActions), BuildJobsForActions creates device-side jobs the same way they would be created if CudaHostAction was passed to BuildJobsForActions directly. * Added two more test cases to make sure GPU binaries are passed to correct jobs. Differential Revision: http://reviews.llvm.org/D11280 Modified: cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/test/Driver/cuda-options.cu Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=246174r1=246173r2=246174view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Thu Aug 27 13:10:41 2015 @@ -1233,11 +1233,13 @@ void Driver::BuildInputs(const ToolChain } } -// For each unique --cuda-gpu-arch= argument creates a TY_CUDA_DEVICE input -// action and then wraps each in CudaDeviceAction paired with appropriate GPU -// arch name. If we're only building device-side code, each action remains -// independent. Otherwise we pass device-side actions as inputs to a new -// CudaHostAction which combines both host and device side actions. +// For each unique --cuda-gpu-arch= argument creates a TY_CUDA_DEVICE +// input action and then wraps each in CudaDeviceAction paired with +// appropriate GPU arch name. In case of partial (i.e preprocessing +// only) or device-only compilation, each device action is added to /p +// Actions and /p Current is released. Otherwise the function creates +// and returns a new CudaHostAction which wraps /p Current and device +// side actions. static std::unique_ptrAction buildCudaActions(const Driver D, const ToolChain TC, DerivedArgList Args, const Arg *InputArg, std::unique_ptrAction HostAction, @@ -1421,22 +1423,14 @@ void Driver::BuildActions(const ToolChai } phases::ID CudaInjectionPhase; -if (isSaveTempsEnabled()) { - // All phases are done independently, inject GPU blobs during compilation - // phase as that's where we generate glue code to init them. - CudaInjectionPhase = phases::Compile; -} else { - // Assumes that clang does everything up until linking phase, so we inject - // cuda device actions at the last step before linking. Otherwise CUDA - // host action forces preprocessor into a separate invocation. - CudaInjectionPhase = FinalPhase; - if (FinalPhase == phases::Link) -for (auto PI = PL.begin(), PE = PL.end(); PI != PE; ++PI) { - auto next = PI + 1; - if (next != PE *next == phases::Link) -CudaInjectionPhase = *PI; -} -} +bool InjectCuda = (InputType == types::TY_CUDA + !Args.hasArg(options::OPT_cuda_host_only)); +CudaInjectionPhase = FinalPhase; +for (auto Phase : PL) + if (Phase = FinalPhase Phase == phases::Compile) { +CudaInjectionPhase = Phase; +break; + } // Build the pipeline for this file. std::unique_ptrAction Current(new InputAction(*InputArg, InputType)); @@ -1464,8 +1458,7 @@ void Driver::BuildActions(const ToolChai // Otherwise construct the appropriate action. Current = ConstructPhaseAction(TC, Args, Phase, std::move(Current)); - if (InputType == types::TY_CUDA Phase == CudaInjectionPhase - !Args.hasArg(options::OPT_cuda_host_only)) { + if (InjectCuda Phase == CudaInjectionPhase) { Current = buildCudaActions(*this, TC, Args, InputArg, std::move(Current), Actions); if (!Current) @@ -1679,10 +1672,17 @@ void Driver::BuildJobs(Compilation C) c } } -static const Tool *SelectToolForJob(Compilation C, bool SaveTemps, +// Returns a Tool for a given JobAction. In case the action and its +//
Re: [PATCH] D12407: [clang-format-vs] Add an option to reformat source code when file is saved to disk
djasper added a comment. I know nothing of Visual Studio, so I have added better reviewers. http://reviews.llvm.org/D12407 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12402: PR24595: clang-cl fails to compile vswriter.h header from Windows SDK 8.1 in 32 bit mode
rnk added a comment. MSVC appears to ignore __stdcall on virtual destructors, and I think the correct fix is for us to do the same. See this test case: $ cat t.cpp struct A { virtual __stdcall ~A(); }; A::~A() {} $ cl -c t.cpp Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86 Copyright (C) Microsoft Corporation. All rights reserved. t.cpp $ dumpbin /symbols t.obj | grep ~A 00B SECT3 notype ()External | ??1A@@UAE@XZ (public: virtual __thiscall A::~A(void)) Notice the __thiscall part of the symbol name. The assembly also shows that it pulls 'this' from ecx. http://reviews.llvm.org/D12402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12358: [Analyzer] Handling constant bound loops
seaneveson added a comment. In http://reviews.llvm.org/D12358#233983, @zaks.anna wrote: This will leave us in a state that is wrong and will likely lead to false positives and inconsistencies, avoiding which is extremely important. I accept that my current patch is not a comprehensive solution to the problem and that it may introduce false positives, however I do think it is an improvement, where it is preferable to have false positives over doing no analysis after the loop. In http://reviews.llvm.org/D12358#234016, @krememek wrote: My recommendation is that we still unroll loops a couple times, getting full precision, and then employ a widening technique like the ones being discussed to allow the last loop iteration to act as the last one, but as a conservative over-approximation. In the patch, constant bound loops are unrolled with the “max-loop” setting (default of 4), (i = 0, 1, 2, 99) rather than (i = 0, 1, 2, 3); as such, we analyze the same number of paths through the loop body. In my experience, constant bound loops are normally used to make simple modifications to fixed length collections of data, I think the behaviour of the majority of these loops will be represented by the first and last iteration. In http://reviews.llvm.org/D12358#234016, @krememek wrote: Another, more principled hack, would be to look at all DeclRefExprs within a loop and invalidate all memory in the cone-of-influence of those variables (i.e., values they point to, etc.), but that's it. Could this be done easily with a visitor and the existing invalidate methods? In cases where the anaylzer is unsure which values might be modified by the loop, it could fall back to invalidating all the values in the state. In http://reviews.llvm.org/D12358#234016, @krememek wrote: Then there is the problem of called functions within the loop, as they won't be analyzed. Those could interfere with the ability of a checker to do its job. My recommendation is that we still unroll loops a couple times, getting full precision, and then employ a widening technique like the ones being discussed to allow the last loop iteration to act as the last one, but as a conservative over-approximation. Wouldn’t widening before the last iteration result in more paths being explored than additional unrolling? i.e. as a result of values in conditions being unknown. Regards, Sean Eveson SN Systems - Sony Computer Entertainment Group http://reviews.llvm.org/D12358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D9639: Do not include pthread.h and sched.h when threads are disabled
blastrock added a comment. Thank you! http://reviews.llvm.org/D9639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12389: Conditionalize X86 Darwin MaxVectorAlign on the presence of AVX.
rjmccall added a comment. Okay, and you're doing the avx512 part of this in a separate commit? LGTM. http://reviews.llvm.org/D12389 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246180 - const-ify TargetInfo::handleUserFeatures.
Author: echristo Date: Thu Aug 27 13:42:57 2015 New Revision: 246180 URL: http://llvm.org/viewvc/llvm-project?rev=246180view=rev Log: const-ify TargetInfo::handleUserFeatures. Modified: cfe/trunk/include/clang/Basic/TargetInfo.h cfe/trunk/lib/Basic/Targets.cpp Modified: cfe/trunk/include/clang/Basic/TargetInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=246180r1=246179r2=246180view=diff == --- cfe/trunk/include/clang/Basic/TargetInfo.h (original) +++ cfe/trunk/include/clang/Basic/TargetInfo.h Thu Aug 27 13:42:57 2015 @@ -788,7 +788,7 @@ public: /// \return False on error. virtual bool handleUserFeatures(llvm::StringMapbool Features, std::vectorstd::string UserFeatures, - DiagnosticsEngine Diags) { + DiagnosticsEngine Diags) const { for (const auto F : UserFeatures) { const char *Name = F.c_str(); // Apply the feature via the target. Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=246180r1=246179r2=246180view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug 27 13:42:57 2015 @@ -870,7 +870,7 @@ public: DiagnosticsEngine Diags) override; bool handleUserFeatures(llvm::StringMapbool Features, std::vectorstd::string UserFeatures, - DiagnosticsEngine Diags) override; + DiagnosticsEngine Diags) const override; bool hasFeature(StringRef Feature) const override; void setFeatureEnabled(llvm::StringMapbool Features, StringRef Name, bool Enabled) const override; @@ -1051,7 +1051,7 @@ bool PPCTargetInfo::handleTargetFeatures bool PPCTargetInfo::handleUserFeatures(llvm::StringMapbool Features, std::vectorstd::string UserFeatures, - DiagnosticsEngine Diags) { + DiagnosticsEngine Diags) const { // Handle explicit options being passed to the compiler here: if we've // explicitly turned off vsx and turned on power8-vector or direct-move then ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11433: [Static Analyzer] Make NonNullParamChecker emit implicit null dereference events.
zaks.anna accepted this revision. zaks.anna added a comment. This revision is now accepted and ready to land. Thanks! http://reviews.llvm.org/D11433 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D12411: [PATCH] Expose AST language options to checkers
aaron.ballman created this revision. aaron.ballman added reviewers: alexfh, djasper. aaron.ballman added a subscriber: cfe-commits. Some of the checkers need to know what language options are enabled in order to behave sensibly. For instance, the modernize-use-nullptr checker should not suggest use of nullptr when the file being checked is a C file, not a C++ file. This patch exposes the language options to checkers, and corrects the bug with modernize-use-nullptr by only registering the matcher if C++11 language features are enabled. ~Aaron http://reviews.llvm.org/D12411 Files: clang-tidy/ClangTidy.h clang-tidy/ClangTidyDiagnosticConsumer.cpp clang-tidy/ClangTidyDiagnosticConsumer.h clang-tidy/modernize/UseNullptrCheck.cpp test/clang-tidy/modernize-use-nullptr.c Index: test/clang-tidy/modernize-use-nullptr.c === --- test/clang-tidy/modernize-use-nullptr.c +++ test/clang-tidy/modernize-use-nullptr.c @@ -0,0 +1,10 @@ +// RUN: clang-tidy %s -checks=-*,modernize-use-nullptr -- | count 0 + +// Note: this test expects no diagnostics, but FileCheck cannot handle that, +// hence the use of | count 0. + +#define NULL 0 +void f(void) { + char *str = NULL; // ok + (void)str; +} Index: clang-tidy/modernize/UseNullptrCheck.cpp === --- clang-tidy/modernize/UseNullptrCheck.cpp +++ clang-tidy/modernize/UseNullptrCheck.cpp @@ -453,7 +453,9 @@ } void UseNullptrCheck::registerMatchers(MatchFinder *Finder) { - Finder-addMatcher(makeCastSequenceMatcher(), this); + // Only register the matcher for C++11. + if (getLangOpts().CPlusPlus11) +Finder-addMatcher(makeCastSequenceMatcher(), this); } void UseNullptrCheck::check(const MatchFinder::MatchResult Result) { Index: clang-tidy/ClangTidyDiagnosticConsumer.h === --- clang-tidy/ClangTidyDiagnosticConsumer.h +++ clang-tidy/ClangTidyDiagnosticConsumer.h @@ -149,6 +149,9 @@ /// \brief Sets ASTContext for the current translation unit. void setASTContext(ASTContext *Context); + /// \brief Gets the language options from the AST context + LangOptions getLangOpts() const { return LangOpts; } + /// \brief Returns the name of the clang-tidy check which produced this /// diagnostic ID. StringRef getCheckName(unsigned DiagnosticID) const; @@ -198,6 +201,8 @@ ClangTidyOptions CurrentOptions; std::unique_ptrGlobList CheckFilter; + LangOptions LangOpts; + ClangTidyStats Stats; llvm::DenseMapunsigned, std::string CheckNamesByDiagnosticID; Index: clang-tidy/ClangTidyDiagnosticConsumer.cpp === --- clang-tidy/ClangTidyDiagnosticConsumer.cpp +++ clang-tidy/ClangTidyDiagnosticConsumer.cpp @@ -212,6 +212,7 @@ void ClangTidyContext::setASTContext(ASTContext *Context) { DiagEngine-SetArgToStringFn(FormatASTNodeDiagnosticArgument, Context); + LangOpts = Context-getLangOpts(); } const ClangTidyGlobalOptions ClangTidyContext::getGlobalOptions() const { Index: clang-tidy/ClangTidy.h === --- clang-tidy/ClangTidy.h +++ clang-tidy/ClangTidy.h @@ -158,6 +158,8 @@ OptionsView Options; /// \brief Returns the main file name of the current translation unit. StringRef getCurrentMainFile() const { return Context-getCurrentFile(); } + /// \brief Returns the language options from the context. + LangOptions getLangOpts() const { return Context-getLangOpts(); } }; class ClangTidyCheckFactories; Index: test/clang-tidy/modernize-use-nullptr.c === --- test/clang-tidy/modernize-use-nullptr.c +++ test/clang-tidy/modernize-use-nullptr.c @@ -0,0 +1,10 @@ +// RUN: clang-tidy %s -checks=-*,modernize-use-nullptr -- | count 0 + +// Note: this test expects no diagnostics, but FileCheck cannot handle that, +// hence the use of | count 0. + +#define NULL 0 +void f(void) { + char *str = NULL; // ok + (void)str; +} Index: clang-tidy/modernize/UseNullptrCheck.cpp === --- clang-tidy/modernize/UseNullptrCheck.cpp +++ clang-tidy/modernize/UseNullptrCheck.cpp @@ -453,7 +453,9 @@ } void UseNullptrCheck::registerMatchers(MatchFinder *Finder) { - Finder-addMatcher(makeCastSequenceMatcher(), this); + // Only register the matcher for C++11. + if (getLangOpts().CPlusPlus11) +Finder-addMatcher(makeCastSequenceMatcher(), this); } void UseNullptrCheck::check(const MatchFinder::MatchResult Result) { Index: clang-tidy/ClangTidyDiagnosticConsumer.h === --- clang-tidy/ClangTidyDiagnosticConsumer.h +++ clang-tidy/ClangTidyDiagnosticConsumer.h @@ -149,6 +149,9 @@ /// \brief Sets ASTContext for the current translation unit. void
Re: [PATCH] D11433: [Static Analyzer] Make NonNullParamChecker emit implicit null dereference events.
This revision was automatically updated to reflect the committed changes. Closed by commit rL246182: [Static Analyzer] Make NonNullParamChecker emit implicit null dereference… (authored by xazax). Changed prior to commit: http://reviews.llvm.org/D11433?vs=5id=33344#toc Repository: rL LLVM http://reviews.llvm.org/D11433 Files: cfe/trunk/include/clang/StaticAnalyzer/Core/Checker.h cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp cfe/trunk/test/Analysis/nullability.mm Index: cfe/trunk/include/clang/StaticAnalyzer/Core/Checker.h === --- cfe/trunk/include/clang/StaticAnalyzer/Core/Checker.h +++ cfe/trunk/include/clang/StaticAnalyzer/Core/Checker.h @@ -514,6 +514,10 @@ bool IsLoad; ExplodedNode *SinkNode; BugReporter *BR; + // When true, the dereference is in the source code directly. When false, the + // dereference might happen later (for example pointer passed to a parameter + // that is marked with nonnull attribute.) + bool IsDirectDereference; }; /// \brief A helper class which wraps a boolean value set to false by default. Index: cfe/trunk/test/Analysis/nullability.mm === --- cfe/trunk/test/Analysis/nullability.mm +++ cfe/trunk/test/Analysis/nullability.mm @@ -50,6 +50,8 @@ template typename T T *eraseNullab(T *p) { return p; } +void takesAttrNonnull(Dummy *p) __attribute((nonnull(1))); + void testBasicRules() { Dummy *p = returnsNullable(); int *ptr = returnsNullableInt(); @@ -73,10 +75,8 @@ Dummy dd(d); break; } - // Here the copy constructor is called, so a reference is initialized with the - // value of p. No ImplicitNullDereference event will be dispatched for this - // case. A followup patch is expected to fix this in NonNullParamChecker. - default: { Dummy d = *p; } break; // No warning. + case 5: takesAttrNonnull(p); break; // expected-warning {{Nullable pointer is passed to}} + default: { Dummy d = *p; } break; // expected-warning {{Nullable pointer is dereferenced}} } if (p) { takesNonnull(p); Index: cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp === --- cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp +++ cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp @@ -28,7 +28,7 @@ namespace { class NonNullParamChecker - : public Checker check::PreCall { + : public Checker check::PreCall, EventDispatcherImplicitNullDerefEvent { mutable std::unique_ptrBugType BTAttrNonNull; mutable std::unique_ptrBugType BTNullRefArg; @@ -139,26 +139,34 @@ ProgramStateRef stateNotNull, stateNull; std::tie(stateNotNull, stateNull) = CM.assumeDual(state, *DV); -if (stateNull !stateNotNull) { - // Generate an error node. Check for a null node in case - // we cache out. - if (ExplodedNode *errorNode = C.generateSink(stateNull)) { - -std::unique_ptrBugReport R; -if (haveAttrNonNull) - R = genReportNullAttrNonNull(errorNode, ArgE); -else if (haveRefTypeParam) - R = genReportReferenceToNullPointer(errorNode, ArgE); +if (stateNull) { + if (!stateNotNull) { +// Generate an error node. Check for a null node in case +// we cache out. +if (ExplodedNode *errorNode = C.generateSink(stateNull)) { + + std::unique_ptrBugReport R; + if (haveAttrNonNull) +R = genReportNullAttrNonNull(errorNode, ArgE); + else if (haveRefTypeParam) +R = genReportReferenceToNullPointer(errorNode, ArgE); + + // Highlight the range of the argument that was null. + R-addRange(Call.getArgSourceRange(idx)); + + // Emit the bug report. + C.emitReport(std::move(R)); +} -// Highlight the range of the argument that was null. -R-addRange(Call.getArgSourceRange(idx)); - -// Emit the bug report. -C.emitReport(std::move(R)); +// Always return. Either we cached out or we just emitted an error. +return; + } + if (ExplodedNode *N = C.generateSink(stateNull)) { +ImplicitNullDerefEvent event = { +V, false, N, C.getBugReporter(), +/*IsDirectDereference=*/haveRefTypeParam}; +dispatchEvent(event); } - - // Always return. Either we cached out or we just emitted an error. - return; } // If a pointer value passed the check we should assume that it is Index: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp === --- cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp +++
r246183 - [Tests] Modified Lit Tests to be C++11 compatibile
Author: lcharles Date: Thu Aug 27 13:49:15 2015 New Revision: 246183 URL: http://llvm.org/viewvc/llvm-project?rev=246183view=rev Log: [Tests] Modified Lit Tests to be C++11 compatibile This 2nd patch should not change the test results, but it is useful if clang's default C++ language is ever changed from gnu++98. Added: cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp Modified: cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp cfe/trunk/test/CodeCompletion/ordinary-name.cpp cfe/trunk/test/Sema/switch-1.c cfe/trunk/test/Sema/thread-specifier.c Modified: cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp?rev=246183r1=246182r2=246183view=diff == --- cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp (original) +++ cfe/trunk/test/Analysis/temp-obj-dtors-cfg-output.cpp Thu Aug 27 13:49:15 2015 @@ -1,6 +1,8 @@ // RUN: rm -f %t -// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-temporary-dtors=true %s %t 21 -// RUN: FileCheck --input-file=%t %s +// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-temporary-dtors=true -std=c++98 %s %t 21 +// RUN: FileCheck --input-file=%t -check-prefix=CXX98 -check-prefix=CHECK %s +// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-temporary-dtors=true -std=c++11 %s %t 21 +// RUN: FileCheck --input-file=%t -check-prefix=CXX11 -check-prefix=CHECK %s class A { public: @@ -671,15 +673,23 @@ int testConsistencyNestedNormalReturn(bo // CHECK: Succs (1): B0 // CHECK: [B3] // CHECK: 1: D() (CXXConstructExpr, struct D) -// CHECK: 2: [B3.1] (ImplicitCastExpr, NoOp, const struct D) -// CHECK: 3: [B3.2] -// CHECK: 4: [B3.3] (CXXConstructExpr, struct D) -// CHECK: 5: D d = D(); -// CHECK: 6: d -// CHECK: 7: [B3.6].operator bool -// CHECK: 8: [B3.6] -// CHECK: 9: [B3.8] (ImplicitCastExpr, UserDefinedConversion, _Bool) -// CHECK: T: if [B3.9] +// CXX98: 2: [B3.1] (ImplicitCastExpr, NoOp, const struct D) +// CXX98: 3: [B3.2] +// CXX98: 4: [B3.3] (CXXConstructExpr, struct D) +// CXX98: 5: D d = D(); +// CXX98: 6: d +// CXX98: 7: [B3.6].operator bool +// CXX98: 8: [B3.6] +// CXX98: 9: [B3.8] (ImplicitCastExpr, UserDefinedConversion, _Bool) +// CXX98: T: if [B3.9] +// CXX11: 2: [B3.1] +// CXX11: 3: [B3.2] (CXXConstructExpr, struct D) +// CXX11: 4: D d = D(); +// CXX11: 5: d +// CXX11: 6: [B3.5].operator bool +// CXX11: 7: [B3.5] +// CXX11: 8: [B3.7] (ImplicitCastExpr, UserDefinedConversion, _Bool) +// CXX11: T: if [B3.8] // CHECK: Preds (1): B4 // CHECK: Succs (2): B2 B1 // CHECK: [B0 (EXIT)] Added: cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp?rev=246183view=auto == --- cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp (added) +++ cfe/trunk/test/CodeCompletion/ordinary-name-cxx11.cpp Thu Aug 27 13:49:15 2015 @@ -0,0 +1,252 @@ +struct X { int x; }; +void z(int); +typedef struct t TYPEDEF; + +void foo() { + int y = 17; + // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -code-completion-patterns -code-completion-at=%s:6:14 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s + // CHECK-CC1: COMPLETION: bool + // CHECK-CC1-NEXT: COMPLETION: char + // CHECK-CC1-NEXT: COMPLETION: char16 + // CHECK-CC1-NEXT: COMPLETION: char32 + // CHECK-CC1-NEXT: COMPLETION: class + // CHECK-CC1-NEXT: COMPLETION: const + // CHECK-CC1-NEXT: COMPLETION: Pattern : const_cast#type#(#expression#) + // CHECK-CC1: COMPLETION: Pattern : [#void#]delete #expression# + // CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]delete [] #expression# + // CHECK-CC1-NEXT: COMPLETION: Pattern : do{#statements# + // CHECK-CC1: COMPLETION: double + // CHECK-CC1-NEXT: COMPLETION: Pattern : dynamic_cast#type#(#expression#) + // CHECK-CC1-NEXT: COMPLETION: enum + // CHECK-CC1-NEXT: COMPLETION: extern + // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]false + // CHECK-CC1-NEXT: COMPLETION: float + // CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo() + // CHECK-CC1-NEXT: COMPLETION: Pattern : for(#init-statement#;#condition#;#inc-expression#){ + // CHECK-CC1: COMPLETION: Pattern : goto #label# + // CHECK-CC1-NEXT: COMPLETION: Pattern : if(#condition#){#statements# + // CHECK-CC1: COMPLETION: int + // CHECK-CC1-NEXT: COMPLETION: long + // CHECK-CC1-NEXT: COMPLETION: Pattern : new #type#(#expressions#) + // CHECK-CC1-NEXT: COMPLETION: Pattern : new #type#[#size#](#expressions#) + // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]noexcept(#expression#) + // CHECK-CC1-NEXT: COMPLETION: Pattern :
r246188 - [Static Analyzer] BugReporter.cpp:2869: Assertion failed: !RemainingNodes.empty() No error node found in the trimmed graph
Author: xazax Date: Thu Aug 27 13:57:00 2015 New Revision: 246188 URL: http://llvm.org/viewvc/llvm-project?rev=246188view=rev Log: [Static Analyzer] BugReporter.cpp:2869: Assertion failed: !RemainingNodes.empty() No error node found in the trimmed graph The assertion is caused by reusing a “filler” ExplodedNode as an error node. The “filler” nodes are only used for intermediate processing and are not essential for analyzer history, so they can be reclaimed when the ExplodedGraph is trimmed by the “collectNode” function. When a checker finds a bug, they generate a new transition in the ExplodedGraph. The analyzer will try to reuse the existing predecessor node. If it cannot, it creates a new ExplodedNode, which always has a tag to uniquely identify the creation site. The assertion is caused when the analyzer reuses a “filler” node. In the test case, some “filler” nodes were reused and then reclaimed later when the ExplodedGraph was trimmed. This caused an assertion because the node was needed to generate the report. The “filler” nodes should not be reused as error nodes. The patch adds a constraint to prevent this happening, which solves the problem and makes the test cases pass. Differential Revision: http://reviews.llvm.org/D11433 Patch by Ying Yi! Added: cfe/trunk/test/Analysis/PR24184.cpp Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h cfe/trunk/test/Analysis/malloc.c Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h?rev=246188r1=246187r2=246188view=diff == --- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h (original) +++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h Thu Aug 27 13:57:00 2015 @@ -287,7 +287,10 @@ private: bool MarkAsSink, ExplodedNode *P = nullptr, const ProgramPointTag *Tag = nullptr) { -if (!State || (State == Pred-getState() !Tag !MarkAsSink)) +// It may not be safe to use the Pred node with no tag because the Pred +// node may be recycled in the reclamation function. +if (!State || (State == Pred-getState() !Tag !MarkAsSink + Pred-getLocation().getTag())) return Pred; Changed = true; Added: cfe/trunk/test/Analysis/PR24184.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/PR24184.cpp?rev=246188view=auto == --- cfe/trunk/test/Analysis/PR24184.cpp (added) +++ cfe/trunk/test/Analysis/PR24184.cpp Thu Aug 27 13:57:00 2015 @@ -0,0 +1,97 @@ +// RUN: %clang_cc1 -w -analyze -analyzer-eagerly-assume -fcxx-exceptions -analyzer-checker=core -analyzer-checker=alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 64 -verify %s +// RUN: %clang_cc1 -w -analyze -analyzer-checker=core -analyzer-checker=cplusplus -fcxx-exceptions -analyzer-checker alpha.core.PointerArithm,alpha.core.CastToStruct -analyzer-max-loop 63 -verify %s + +// These tests used to hit an assertion in the bug report. Test case from http://llvm.org/PR24184. +typedef struct { + int cbData; + unsigned pbData; +} CRYPT_DATA_BLOB; + +typedef enum { DT_NONCE_FIXED } DATA_TYPE; +int a; +typedef int *vcreate_t(int *, DATA_TYPE, int, int); +void fn1(unsigned, unsigned) { + char b = 0; + for (; 1; a++, b + a * 0) // expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}} +; +} + +vcreate_t fn2; +struct A { + CRYPT_DATA_BLOB value; + int m_fn1() { +int c; +value.pbData == 0; +fn1(0, 0); + } +}; +struct B { + A IkeHashAlg; + A IkeGType; + A NoncePhase1_r; +}; +class C { + int m_fn2(B *); + void m_fn3(B *, int, int, int); +}; +int C::m_fn2(B *p1) { + int *d; + int e = p1-IkeHashAlg.m_fn1(); + unsigned f = p1-IkeGType.m_fn1(), h; + int g; + d = fn2(0, DT_NONCE_FIXED, (char)0, p1-NoncePhase1_r.value.cbData); + h = 0 | 0; + m_fn3(p1, 0, 0, 0); +} + +// case 2: +typedef struct { + int cbData; + unsigned char *pbData; +} CRYPT_DATA_BLOB_1; +typedef unsigned uint32_t; +void fn1_1(void *p1, const void *p2) { p1 != p2; } + +void fn2_1(uint32_t *p1, unsigned char *p2, uint32_t p3) { + unsigned i = 0; + for (0; i p3; i++) +fn1_1(p1 + i, p2 + i * 0);// expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}} +} + +struct A_1 { + CRYPT_DATA_BLOB_1 value; + uint32_t m_fn1() { +uint32_t a; +if (value.pbData) + fn2_1(a, value.pbData, value.cbData); +return 0; + } +}; +struct { + A_1 HashAlgId; +} *b; +void fn3() { + uint32_t c, d; + d = b-HashAlgId.m_fn1();
Re: [PATCH] D12390: Also enable the avx/avx512 ABIs for i386, not just x86_64.
ab added a comment. Unless I'm misunderstanding, I believe this has much less impact than you're thinking; there are three cases: - x86_64: no change (-mno-mmx is guarded by x86) - x86, with -mno-mmx: no change (because previously, we'd only set avx/avx512 for x86_64) - x86, without -mno-mmx: this will use an avx/avx512 ABI string where we'd have used , letting us use the better alignment (only for OpenMP and vectors, I think). http://reviews.llvm.org/D12390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12389: Conditionalize X86 Darwin MaxVectorAlign on the presence of AVX.
ab accepted this revision. ab added a reviewer: ab. ab added a comment. This revision is now accepted and ready to land. Yep, thanks! http://reviews.llvm.org/D12389 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12385: Generating Assumption loads fix
Prazek marked an inline comment as done. Prazek added a comment. http://reviews.llvm.org/D12385 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12390: Also enable the avx/avx512 ABIs for i386, not just x86_64.
rjmccall added a comment. This gives no-MMX priority over turning on SSE, which sounds like a major change in behavior to me. There are definitely clients that specifically never want to use MMX but do care deeply about SSE; my understanding is that modern microarchitectures heavily punish casual use of MMX. http://reviews.llvm.org/D12390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246182 - [Static Analyzer] Make NonNullParamChecker emit implicit null dereference events.
Author: xazax Date: Thu Aug 27 13:49:07 2015 New Revision: 246182 URL: http://llvm.org/viewvc/llvm-project?rev=246182view=rev Log: [Static Analyzer] Make NonNullParamChecker emit implicit null dereference events. Differential Revision: http://reviews.llvm.org/D11433 Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/Checker.h cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp cfe/trunk/test/Analysis/nullability.mm Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/Checker.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/Checker.h?rev=246182r1=246181r2=246182view=diff == --- cfe/trunk/include/clang/StaticAnalyzer/Core/Checker.h (original) +++ cfe/trunk/include/clang/StaticAnalyzer/Core/Checker.h Thu Aug 27 13:49:07 2015 @@ -514,6 +514,10 @@ struct ImplicitNullDerefEvent { bool IsLoad; ExplodedNode *SinkNode; BugReporter *BR; + // When true, the dereference is in the source code directly. When false, the + // dereference might happen later (for example pointer passed to a parameter + // that is marked with nonnull attribute.) + bool IsDirectDereference; }; /// \brief A helper class which wraps a boolean value set to false by default. Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp?rev=246182r1=246181r2=246182view=diff == --- cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp Thu Aug 27 13:49:07 2015 @@ -220,7 +220,8 @@ void DereferenceChecker::checkLocation(S // null or not-null. Record the error node as an implicit null // dereference. if (ExplodedNode *N = C.generateSink(nullState)) { - ImplicitNullDerefEvent event = { l, isLoad, N, C.getBugReporter() }; + ImplicitNullDerefEvent event = {l, isLoad, N, C.getBugReporter(), + /*IsDirectDereference=*/false}; dispatchEvent(event); } } @@ -257,8 +258,9 @@ void DereferenceChecker::checkBind(SVal // At this point the value could be either null or non-null. // Record this as an implicit null dereference. if (ExplodedNode *N = C.generateSink(StNull)) { - ImplicitNullDerefEvent event = { V, /*isLoad=*/true, N, - C.getBugReporter() }; + ImplicitNullDerefEvent event = {V, /*isLoad=*/true, N, + C.getBugReporter(), + /*IsDirectDereference=*/false}; dispatchEvent(event); } } Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp?rev=246182r1=246181r2=246182view=diff == --- cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp Thu Aug 27 13:49:07 2015 @@ -28,7 +28,7 @@ using namespace ento; namespace { class NonNullParamChecker - : public Checker check::PreCall { + : public Checker check::PreCall, EventDispatcherImplicitNullDerefEvent { mutable std::unique_ptrBugType BTAttrNonNull; mutable std::unique_ptrBugType BTNullRefArg; @@ -139,26 +139,34 @@ void NonNullParamChecker::checkPreCall(c ProgramStateRef stateNotNull, stateNull; std::tie(stateNotNull, stateNull) = CM.assumeDual(state, *DV); -if (stateNull !stateNotNull) { - // Generate an error node. Check for a null node in case - // we cache out. - if (ExplodedNode *errorNode = C.generateSink(stateNull)) { - -std::unique_ptrBugReport R; -if (haveAttrNonNull) - R = genReportNullAttrNonNull(errorNode, ArgE); -else if (haveRefTypeParam) - R = genReportReferenceToNullPointer(errorNode, ArgE); +if (stateNull) { + if (!stateNotNull) { +// Generate an error node. Check for a null node in case +// we cache out. +if (ExplodedNode *errorNode = C.generateSink(stateNull)) { + + std::unique_ptrBugReport R; + if (haveAttrNonNull) +R = genReportNullAttrNonNull(errorNode, ArgE); + else if (haveRefTypeParam) +R = genReportReferenceToNullPointer(errorNode, ArgE); + + // Highlight the range of the argument that was null. + R-addRange(Call.getArgSourceRange(idx)); + + // Emit the bug report. + C.emitReport(std::move(R)); +} -//
r246189 - Improve options printed on vectorization analysis diagnostics.
Author: tnowicki Date: Thu Aug 27 13:58:34 2015 New Revision: 246189 URL: http://llvm.org/viewvc/llvm-project?rev=246189view=rev Log: Improve options printed on vectorization analysis diagnostics. The LLVM patch changes the analysis diagnostics produced when loops with floating-point recurrences or memory operations are identified. The new messages say cannot prove it is safe to reorder * operations; allow reordering by specifying #pragma clang loop vectorize(enable). Depending on the type of diagnostic the message will include additional options such as ffast-math or __restrict__. Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td cfe/trunk/test/Frontend/optimization-remark-options.c Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=246189r1=246188r2=246189view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Thu Aug 27 13:58:34 2015 @@ -46,13 +46,14 @@ def remark_fe_backend_optimization_remar def remark_fe_backend_optimization_remark_analysis : Remark%0, BackendInfo, InGroupBackendOptimizationRemarkAnalysis; def remark_fe_backend_optimization_remark_analysis_fpcommute : Remark%0; -allow commutativity by specifying '#pragma clang loop vectorize(enable)' -before the loop or by providing the compiler option '-ffast-math', +allow reordering by specifying '#pragma clang loop vectorize(enable)' +before the loop or by providing the compiler option '-ffast-math'., BackendInfo, InGroupBackendOptimizationRemarkAnalysis; def remark_fe_backend_optimization_remark_analysis_aliasing : Remark%0; -avoid runtime pointer checking when you know the arrays will always be -independent by specifying '#pragma clang loop vectorize(assume_safety)' -before the loop or by specifying 'restrict' on the array arguments. +allow reordering by specifying '#pragma clang loop vectorize(enable)' +before the loop. If the arrays will always be independent specify +'#pragma clang loop vectorize(assume_safety)' before the loop or provide +the '__restrict__' qualifier with the independent array arguments. Erroneous results will occur if these options are incorrectly applied!, BackendInfo, InGroupBackendOptimizationRemarkAnalysis; def warn_fe_backend_optimization_failure : Warning%0, BackendInfo, Modified: cfe/trunk/test/Frontend/optimization-remark-options.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/optimization-remark-options.c?rev=246189r1=246188r2=246189view=diff == --- cfe/trunk/test/Frontend/optimization-remark-options.c (original) +++ cfe/trunk/test/Frontend/optimization-remark-options.c Thu Aug 27 13:58:34 2015 @@ -1,6 +1,6 @@ // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -Rpass-analysis=loop-vectorize -emit-llvm -S %s -o - 21 | FileCheck %s -// CHECK: {{.*}}:9:11: remark: loop not vectorized: vectorization requires changes in the order of operations, however IEEE 754 floating-point operations are not commutative; allow commutativity by specifying '#pragma clang loop vectorize(enable)' before the loop or by providing the compiler option '-ffast-math' +// CHECK: {{.*}}:9:11: remark: loop not vectorized: cannot prove it is safe to reorder floating-point operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop or by providing the compiler option '-ffast-math'. double foo(int N) { double v = 0.0; @@ -11,7 +11,7 @@ double foo(int N) { return v; } -// CHECK: {{.*}}:18:13: remark: loop not vectorized: cannot prove pointers refer to independent arrays in memory. The loop requires 9 runtime independence checks to vectorize the loop, but that would exceed the limit of 8 checks; avoid runtime pointer checking when you know the arrays will always be independent by specifying '#pragma clang loop vectorize(assume_safety)' before the loop or by specifying 'restrict' on the array arguments. Erroneous results will occur if these options are incorrectly applied! +// CHECK: {{.*}}:18:13: remark: loop not vectorized: cannot prove it is safe to reorder memory operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop. If the arrays will always be independent specify '#pragma clang loop vectorize(assume_safety)' before the loop or provide the '__restrict__' qualifier with the independent array arguments. Erroneous results will occur if these options are incorrectly applied! void foo2(int *dw, int *uw, int *A, int *B, int *C, int *D, int N) {
Re: [PATCH] D12163: [Patch] [Analyzer] BugReporter.cpp:2869: Assertion failed: !RemainingNodes.empty() No error node found in the trimmed graph (PR 24184)
xazax.hun added a subscriber: xazax.hun. xazax.hun closed this revision. xazax.hun added a comment. Committed in http://reviews.llvm.org/rL246188. Thanks for the patch. http://reviews.llvm.org/D12163 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246195 - Rewrite the code generation handling for function feature and cpu attributes.
Author: echristo Date: Thu Aug 27 14:59:34 2015 New Revision: 246195 URL: http://llvm.org/viewvc/llvm-project?rev=246195view=rev Log: Rewrite the code generation handling for function feature and cpu attributes. A couple of changes here: a) Do less work in the case where we don't have a target attribute on the function. We've already canonicalized the attributes for the function - no need to do more work. b) Use the newer canonicalized feature adding functions from TargetInfo to do the work when we do have a target attribute. This enables us to diagnose some warnings in the case of conflicting written attributes (only ppc does this today) and also make sure to get all of the features for a cpu that's listed rather than just change the cpu. Updated all testcases accordingly and added a new testcase to verify that we'll error out on ppc if we have some incompatible options using the existing diagnosis framework there. Added: cfe/trunk/test/CodeGen/attr-target-ppc.c Modified: cfe/trunk/lib/CodeGen/CGCall.cpp cfe/trunk/test/CodeGen/attr-target.c Modified: cfe/trunk/lib/CodeGen/CGCall.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=246195r1=246194r2=246195view=diff == --- cfe/trunk/lib/CodeGen/CGCall.cpp (original) +++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Aug 27 14:59:34 2015 @@ -1496,70 +1496,78 @@ void CodeGenModule::ConstructAttributeLi // we have a decl for the function and it has a target attribute then // parse that and add it to the feature set. StringRef TargetCPU = getTarget().getTargetOpts().CPU; - -// TODO: Features gets us the features on the command line including -// feature dependencies. For canonicalization purposes we might want to -// avoid putting features in the target-features set if we know it'll be -// one of the default features in the backend, e.g. corei7-avx and +avx or -// figure out non-explicit dependencies. -// Canonicalize the existing features in a new feature map. -// TODO: Migrate the existing backends to keep the map around rather than -// the vector. -llvm::StringMapbool FeatureMap; -for (auto F : getTarget().getTargetOpts().Features) { - const char *Name = F.c_str(); - bool Enabled = Name[0] == '+'; - getTarget().setFeatureEnabled(FeatureMap, Name + 1, Enabled); -} - const FunctionDecl *FD = dyn_cast_or_nullFunctionDecl(TargetDecl); -if (FD) { - if (const auto *TD = FD-getAttrTargetAttr()) { -StringRef FeaturesStr = TD-getFeatures(); -SmallVectorStringRef, 1 AttrFeatures; -FeaturesStr.split(AttrFeatures, ,); - -// Grab the various features and prepend a + to turn on the feature to -// the backend and add them to our existing set of features. -for (auto Feature : AttrFeatures) { - // Go ahead and trim whitespace rather than either erroring or - // accepting it weirdly. - Feature = Feature.trim(); - - // While we're here iterating check for a different target cpu. - if (Feature.startswith(arch=)) -TargetCPU = Feature.split(=).second.trim(); - else if (Feature.startswith(tune=)) -// We don't support cpu tuning this way currently. -; - else if (Feature.startswith(fpmath=)) -// TODO: Support the fpmath option this way. It will require checking -// overall feature validity for the function with the rest of the -// attributes on the function. -; - else if (Feature.startswith(mno-)) -getTarget().setFeatureEnabled(FeatureMap, Feature.split(-).second, - false); - else -getTarget().setFeatureEnabled(FeatureMap, Feature, true); -} +if (FD FD-getAttrTargetAttr()) { + llvm::StringMapbool FeatureMap; + const auto *TD = FD-getAttrTargetAttr(); + + // Make a copy of the features as passed on the command line. + std::vectorstd::string FnFeatures( + getTarget().getTargetOpts().FeaturesAsWritten); + + // Grab the target attribute string. + StringRef FeaturesStr = TD-getFeatures(); + SmallVectorStringRef, 1 AttrFeatures; + FeaturesStr.split(AttrFeatures, ,); + + // Grab the various features and prepend a + to turn on the feature to + // the backend and add them to our existing set of features. + for (auto Feature : AttrFeatures) { +// Go ahead and trim whitespace rather than either erroring or +// accepting it weirdly. +Feature = Feature.trim(); + +// While we're here iterating check for a different target cpu. +if (Feature.startswith(arch=)) + TargetCPU = Feature.split(=).second.trim(); +else if (Feature.startswith(tune=)) + // We don't support cpu tuning this
Re: [PATCH] D12313: Introduce __builtin_nontemporal_store and __builtin_nontemporal_load.
hfinkel added a comment. I also like this intrinsic approach better than the type attribute. The fact that it does not work with builtin vector types, however, is quite unfortunate. Plus, I don't understand why you're implementing another place in CodeGen that generates IR to load and store scalar values. Can't you enhance EmitLoadOfScalar/EmitStoreOfScalar and then use those functions? If nothing else, you're already missing setting of TBAA metadata and other things that these functions do. http://reviews.llvm.org/D12313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246193 - [CUDA] Check register names on appropriate side of cuda compilation only.
Author: tra Date: Thu Aug 27 14:54:21 2015 New Revision: 246193 URL: http://llvm.org/viewvc/llvm-project?rev=246193view=rev Log: [CUDA] Check register names on appropriate side of cuda compilation only. Differential Revision: http://reviews.llvm.org/D11950 Modified: cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaStmtAsm.cpp cfe/trunk/test/SemaCUDA/asm-constraints-mixed.cu Modified: cfe/trunk/lib/Sema/SemaDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=246193r1=246192r2=246193view=diff == --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Aug 27 14:54:21 2015 @@ -5998,7 +5998,8 @@ Sema::ActOnVariableDeclarator(Scope *S, break; case SC_Register: // Local Named register -if (!Context.getTargetInfo().isValidGCCRegisterName(Label)) +if (!Context.getTargetInfo().isValidGCCRegisterName(Label) +DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl())) Diag(E-getExprLoc(), diag::err_asm_unknown_register_name) Label; break; case SC_Static: @@ -6009,7 +6010,8 @@ Sema::ActOnVariableDeclarator(Scope *S, } } else if (SC == SC_Register) { // Global Named register - if (!Context.getTargetInfo().isValidGCCRegisterName(Label)) + if (!Context.getTargetInfo().isValidGCCRegisterName(Label) + DeclAttrsMatchCUDAMode(getLangOpts(), NewVD)) Diag(E-getExprLoc(), diag::err_asm_unknown_register_name) Label; if (!R-isIntegralType(Context) !R-isPointerType()) { Diag(D.getLocStart(), diag::err_asm_bad_register_type); Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=246193r1=246192r2=246193view=diff == --- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original) +++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Thu Aug 27 14:54:21 2015 @@ -155,8 +155,14 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceL // The parser verifies that there is a string literal here. assert(AsmString-isAscii()); - bool ValidateConstraints = - DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl()); + // If we're compiling CUDA file and function attributes indicate that it's not + // for this compilation side, skip all the checks. + if (!DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl())) { +GCCAsmStmt *NS = new (Context) GCCAsmStmt( +Context, AsmLoc, IsSimple, IsVolatile, NumOutputs, NumInputs, Names, +Constraints, Exprs.data(), AsmString, NumClobbers, Clobbers, RParenLoc); +return NS; + } for (unsigned i = 0; i != NumOutputs; i++) { StringLiteral *Literal = Constraints[i]; @@ -167,8 +173,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceL OutputName = Names[i]-getName(); TargetInfo::ConstraintInfo Info(Literal-getString(), OutputName); -if (ValidateConstraints -!Context.getTargetInfo().validateOutputConstraint(Info)) +if (!Context.getTargetInfo().validateOutputConstraint(Info)) return StmtError(Diag(Literal-getLocStart(), diag::err_asm_invalid_output_constraint) Info.getConstraintStr()); @@ -247,8 +252,7 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceL InputName = Names[i]-getName(); TargetInfo::ConstraintInfo Info(Literal-getString(), InputName); -if (ValidateConstraints -!Context.getTargetInfo().validateInputConstraint( +if (!Context.getTargetInfo().validateInputConstraint( OutputConstraintInfos.data(), NumOutputs, Info)) { return StmtError(Diag(Literal-getLocStart(), diag::err_asm_invalid_input_constraint) Modified: cfe/trunk/test/SemaCUDA/asm-constraints-mixed.cu URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCUDA/asm-constraints-mixed.cu?rev=246193r1=246192r2=246193view=diff == --- cfe/trunk/test/SemaCUDA/asm-constraints-mixed.cu (original) +++ cfe/trunk/test/SemaCUDA/asm-constraints-mixed.cu Thu Aug 27 14:54:21 2015 @@ -1,15 +1,39 @@ +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -fcuda-is-device -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s -// expected-no-diagnostics + +__attribute__((device)) register long global_dev_reg asm(r0); +__attribute__((device)) register long +global_dev_hreg asm(rax); // device-side error + +register long global_host_reg asm(rax); +register long global_host_dreg asm(r0); // host-side error __attribute__((device)) void df() { + register long local_dev_reg asm(r0); + register long local_host_reg asm(rax); // device-side error
Re: [PATCH] D11950: [CUDA] Check register names on appropriate side of cuda compilation only.
This revision was automatically updated to reflect the committed changes. Closed by commit rL246193: [CUDA] Check register names on appropriate side of cuda compilation only. (authored by tra). Changed prior to commit: http://reviews.llvm.org/D11950?vs=32611id=33348#toc Repository: rL LLVM http://reviews.llvm.org/D11950 Files: cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaStmtAsm.cpp cfe/trunk/test/SemaCUDA/asm-constraints-mixed.cu Index: cfe/trunk/test/SemaCUDA/asm-constraints-mixed.cu === --- cfe/trunk/test/SemaCUDA/asm-constraints-mixed.cu +++ cfe/trunk/test/SemaCUDA/asm-constraints-mixed.cu @@ -1,15 +1,39 @@ +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -fcuda-is-device -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s -// expected-no-diagnostics + +__attribute__((device)) register long global_dev_reg asm(r0); +__attribute__((device)) register long +global_dev_hreg asm(rax); // device-side error + +register long global_host_reg asm(rax); +register long global_host_dreg asm(r0); // host-side error __attribute__((device)) void df() { + register long local_dev_reg asm(r0); + register long local_host_reg asm(rax); // device-side error short h; // asm with PTX constraints. Some of them are PTX-specific. - __asm__(dont care : =h(h): f(0.0), d(0.0), h(0), r(0), l(0)); + __asm__(dont care : =h(h) : f(0.0), d(0.0), h(0), r(0), l(0)); } void hf() { + register long local_dev_reg asm(r0); // host-side error + register long local_host_reg asm(rax); int a; - // Asm with x86 constraints that are not supported by PTX. - __asm__(dont care : =a(a): a(0), b(0), c(0)); + // Asm with x86 constraints and registers that are not supported by PTX. + __asm__(dont care : =a(a) : a(0), b(0), c(0) : flags); } + +// Check errors in named register variables. +// We should only see errors relevant to current compilation mode. +#if defined(__CUDA_ARCH__) +// Device-side compilation: +// expected-error@8 {{unknown register name 'rax' in asm}} +// expected-error@15 {{unknown register name 'rax' in asm}} +#else +// Host-side compilation: +// expected-error@11 {{unknown register name 'r0' in asm}} +// expected-error@22 {{unknown register name 'r0' in asm}} +#endif Index: cfe/trunk/lib/Sema/SemaStmtAsm.cpp === --- cfe/trunk/lib/Sema/SemaStmtAsm.cpp +++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp @@ -155,8 +155,14 @@ // The parser verifies that there is a string literal here. assert(AsmString-isAscii()); - bool ValidateConstraints = - DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl()); + // If we're compiling CUDA file and function attributes indicate that it's not + // for this compilation side, skip all the checks. + if (!DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl())) { +GCCAsmStmt *NS = new (Context) GCCAsmStmt( +Context, AsmLoc, IsSimple, IsVolatile, NumOutputs, NumInputs, Names, +Constraints, Exprs.data(), AsmString, NumClobbers, Clobbers, RParenLoc); +return NS; + } for (unsigned i = 0; i != NumOutputs; i++) { StringLiteral *Literal = Constraints[i]; @@ -167,8 +173,7 @@ OutputName = Names[i]-getName(); TargetInfo::ConstraintInfo Info(Literal-getString(), OutputName); -if (ValidateConstraints -!Context.getTargetInfo().validateOutputConstraint(Info)) +if (!Context.getTargetInfo().validateOutputConstraint(Info)) return StmtError(Diag(Literal-getLocStart(), diag::err_asm_invalid_output_constraint) Info.getConstraintStr()); @@ -247,8 +252,7 @@ InputName = Names[i]-getName(); TargetInfo::ConstraintInfo Info(Literal-getString(), InputName); -if (ValidateConstraints -!Context.getTargetInfo().validateInputConstraint( +if (!Context.getTargetInfo().validateInputConstraint( OutputConstraintInfos.data(), NumOutputs, Info)) { return StmtError(Diag(Literal-getLocStart(), diag::err_asm_invalid_input_constraint) Index: cfe/trunk/lib/Sema/SemaDecl.cpp === --- cfe/trunk/lib/Sema/SemaDecl.cpp +++ cfe/trunk/lib/Sema/SemaDecl.cpp @@ -5998,7 +5998,8 @@ break; case SC_Register: // Local Named register -if (!Context.getTargetInfo().isValidGCCRegisterName(Label)) +if (!Context.getTargetInfo().isValidGCCRegisterName(Label) +DeclAttrsMatchCUDAMode(getLangOpts(), getCurFunctionDecl())) Diag(E-getExprLoc(), diag::err_asm_unknown_register_name) Label; break; case SC_Static: @@ -6009,7 +6010,8 @@ } } else if (SC == SC_Register) { // Global Named register - if
r246197 - Target attribute syntax compatibility fix - gcc uses no- rather than mno-.
Author: echristo Date: Thu Aug 27 15:05:48 2015 New Revision: 246197 URL: http://llvm.org/viewvc/llvm-project?rev=246197view=rev Log: Target attribute syntax compatibility fix - gcc uses no- rather than mno-. Modified: cfe/trunk/lib/CodeGen/CGCall.cpp cfe/trunk/test/CodeGen/attr-target-ppc.c cfe/trunk/test/CodeGen/attr-target-x86.c Modified: cfe/trunk/lib/CodeGen/CGCall.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=246197r1=246196r2=246197view=diff == --- cfe/trunk/lib/CodeGen/CGCall.cpp (original) +++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Aug 27 15:05:48 2015 @@ -1528,7 +1528,7 @@ void CodeGenModule::ConstructAttributeLi // overall feature validity for the function with the rest of the // attributes on the function. ; -else if (Feature.startswith(mno-)) +else if (Feature.startswith(no-)) FnFeatures.push_back(- + Feature.split(-).second.str()); else FnFeatures.push_back(+ + Feature.str()); Modified: cfe/trunk/test/CodeGen/attr-target-ppc.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-target-ppc.c?rev=246197r1=246196r2=246197view=diff == --- cfe/trunk/test/CodeGen/attr-target-ppc.c (original) +++ cfe/trunk/test/CodeGen/attr-target-ppc.c Thu Aug 27 15:05:48 2015 @@ -1,4 +1,4 @@ // RUN: not %clang_cc1 -triple powerpc64le-linux-gnu -emit-llvm %s -o - -long __attribute__((target(power8-vector,mno-vsx))) foo (void) { return 0; } // expected-error {{option '-mpower8-vector' cannot be specified with '-mno-vsx'}} +long __attribute__((target(power8-vector,no-vsx))) foo (void) { return 0; } // expected-error {{option '-mpower8-vector' cannot be specified with '-mno-vsx'}} Modified: cfe/trunk/test/CodeGen/attr-target-x86.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-target-x86.c?rev=246197r1=246196r2=246197view=diff == --- cfe/trunk/test/CodeGen/attr-target-x86.c (original) +++ cfe/trunk/test/CodeGen/attr-target-x86.c Thu Aug 27 15:05:48 2015 @@ -7,14 +7,14 @@ int __attribute__((target(avx,sse4.2,ar int __attribute__((target(tune=sandybridge))) walrus(int a) { return 4; } int __attribute__((target(fpmath=387))) koala(int a) { return 4; } -int __attribute__((target(mno-sse2))) echidna(int a) { return 4; } +int __attribute__((target(no-sse2))) echidna(int a) { return 4; } int __attribute__((target(sse4))) panda(int a) { return 4; } int bar(int a) { return baz(a) + foo(a); } int __attribute__((target(avx, sse4.2, arch= ivybridge))) qux(int a) { return 4; } -int __attribute__((target(mno-aes, arch=ivybridge))) qax(int a) { return 4; } +int __attribute__((target(no-aes, arch=ivybridge))) qax(int a) { return 4; } // Check that we emit the additional subtarget and cpu features for foo and not for baz or bar. // CHECK: baz{{.*}} #0 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11297: PR17829: Functions declared extern C with a name matching a mangled C++ function are allowed
rjmccall added inline comments. Comment at: lib/CodeGen/CodeGenModule.h:354 @@ +353,3 @@ + /// call). + llvm::DenseSetGlobalDecl ExplicitDefinitions; + andreybokhanko wrote: Checking that a GlobalDecl is not in ExplicitDefinitions yet is actually required to avoid printing multiple identical warnings. In my example: ``` 1: struct T { 2: ~T() {} 3: }; 4: 5: extern C void _ZN1TD1Ev(); 6: 7: int main() { 8: _ZN1TD1Ev(); 9: T t; 10: } ``` ~T() is added to the list of deferred decls twice. Judging from this comment in EmitDeferred method: // Check to see if we've already emitted this. This is necessary // for a couple of reasons: first, decls can end up in the // deferred-decls queue multiple times, and second, decls can end // up with definitions in unusual ways (e.g. by an extern inline // function acquiring a strong function redefinition). Just // ignore these cases. this is pretty normal (decls can end up in the deferred-decls queue multiple times). This means that we can call GetOrCreateLLVMFunction(..., /*IsForDefinition*/=true) for duplicated decls several times, which is fine in general, *but* will print the duplicated mangled names diagnostic multiple times as well -- unless we check that we already printed a warning on duplicated mangled names for given decl. As for not emitting diagnostics for different globals -- this won't happen, as we will call GetOrCreateLLVMFunction at least once for each global with a definition, and thus, will print a warning for everyone. I thought really hard (honestly!) on how to prevent duplicated diagnostics without usage of an additional set, but didn't found any solution. If you have any hints here, they would be much appreciated. Okay, that's fine. Can you at least make sure you only add to the set when you emit the warning? As a minor optimization, you can add it to the set and check whether it was already there in the same operation, so that this would look like: if (LookupRepresentativeDecl(...) DiagnosedConflictingDefinitions.insert(GD).second) { ... } http://reviews.llvm.org/D11297 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r246027 - Convert a bunch of loops to ranged-for and clean up accordingly.
Eric Christopher via cfe-commits cfe-commits@lists.llvm.org writes: Author: echristo Date: Wed Aug 26 03:21:55 2015 New Revision: 246027 URL: http://llvm.org/viewvc/llvm-project?rev=246027view=rev Log: Convert a bunch of loops to ranged-for and clean up accordingly. Modified: cfe/trunk/lib/Basic/Targets.cpp Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=246027r1=246026r2=246027view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 26 03:21:55 2015 @@ -1023,53 +1023,24 @@ const Builtin::Info PPCTargetInfo::Built /// configured set of features. bool PPCTargetInfo::handleTargetFeatures(std::vectorstd::string Features, DiagnosticsEngine Diags) { - for (unsigned i = 0, e = Features.size(); i !=e; ++i) { -// Ignore disabled features. -if (Features[i][0] == '-') - continue; - -StringRef Feature = StringRef(Features[i]).substr(1); - -if (Feature == vsx) { + for (const auto Feature : Features) { +if (Feature == +vsx) { HasVSX = true; - continue; -} - -if (Feature == bpermd) { +} else if (Feature == +bpermd) { HasBPERMD = true; - continue; -} - -if (Feature == extdiv) { +} else if (Feature == +extdiv) { HasExtDiv = true; - continue; -} - -if (Feature == power8-vector) { +} else if (Feature == +power8-vector) { HasP8Vector = true; - continue; -} - -if (Feature == crypto) { +} else if (Feature == +crypto) { HasP8Crypto = true; - continue; -} - -if (Feature == direct-move) { +} else if (Feature == +direct-move) { HasDirectMove = true; - continue; -} - -if (Feature == qpx) { +} else if (Feature == +qpx) { HasQPX = true; - continue; -} - -if (Feature == htm) { +} else if (Feature == +htm) { HasHTM = true; - continue; } - // TODO: Finish this list and add an assert that we've handled them // all. } @@ -2886,155 +2857,84 @@ void X86TargetInfo::setFeatureEnabledImp /// configured set of features. bool X86TargetInfo::handleTargetFeatures(std::vectorstd::string Features, DiagnosticsEngine Diags) { - // Remember the maximum enabled sselevel. - for (unsigned i = 0, e = Features.size(); i !=e; ++i) { -// Ignore disabled features. -if (Features[i][0] == '-') + for (const auto Feature : Features) { +if (Feature[0] != '+') continue; -StringRef Feature = StringRef(Features[i]).substr(1); - -if (Feature == aes) { +if (Feature == +aes) { HasAES = true; - continue; -} - -if (Feature == pclmul) { +} else if (Feature == +pclmul) { HasPCLMUL = true; - continue; -} - -if (Feature == lzcnt) { +} else if (Feature == +lzcnt) { HasLZCNT = true; - continue; -} - -if (Feature == rdrnd) { +} else if (Feature == +rdrnd) { HasRDRND = true; - continue; -} - -if (Feature == fsgsbase) { +} else if (Feature == +fsgsbase) { HasFSGSBASE = true; - continue; -} - -if (Feature == bmi) { +} else if (Feature == +bmi) { HasBMI = true; - continue; -} - -if (Feature == bmi2) { +} else if (Feature == +bmi2) { HasBMI2 = true; - continue; -} - -if (Feature == popcnt) { +} else if (Feature == +popcnt) { HasPOPCNT = true; - continue; -} - -if (Feature == rtm) { +} else if (Feature == +rtm) { HasRTM = true; - continue; -} - -if (Feature == prfchw) { +} else if (Feature == +prfchw) { HasPRFCHW = true; - continue; -} - -if (Feature == rdseed) { +} else if (Feature == +rdseed) { HasRDSEED = true; - continue; -} - -if (Feature == adx) { +} else if (Feature == +adx) { HasADX = true; - continue; -} - -if (Feature == tbm) { +} else if (Feature == +tbm) { HasTBM = true; - continue; -} - -if (Feature == fma) { +} else if (Feature == +fma) { HasFMA = true; - continue; -} - -if (Feature == f16c) { +} else if (Feature == +f16c) { HasF16C = true; - continue; -} - -if (Feature == avx512cd) { +} else if (Feature == +avx512cd) { HasAVX512CD = true; - continue; -} - -if (Feature == avx512er) { +} else if (Feature == +avx512er) { HasAVX512ER = true; - continue; -} - -if (Feature == avx512pf) { +} else if (Feature == +avx512pf) { HasAVX512PF =
r246202 - Remove a dead assert, we'd have gotten the case above.
Author: echristo Date: Thu Aug 27 15:32:24 2015 New Revision: 246202 URL: http://llvm.org/viewvc/llvm-project?rev=246202view=rev Log: Remove a dead assert, we'd have gotten the case above. Modified: cfe/trunk/lib/Basic/Targets.cpp Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=246202r1=246201r2=246202view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug 27 15:32:24 2015 @@ -2917,7 +2917,6 @@ bool X86TargetInfo::handleTargetFeatures HasCX16 = true; } -assert(Feature[0] == '+' Invalid target feature!); X86SSEEnum Level = llvm::StringSwitchX86SSEEnum(Feature) .Case(+avx512f, AVX512F) .Case(+avx2, AVX2) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12411: [PATCH] Expose AST language options to checkers
aaron.ballman closed this revision. aaron.ballman added a comment. Thanks! I've commit in r246209. I plan to do a more thorough search of clang-tidy to see what else can make use of this feature, this just happened to be low-hanging fruit that I found today by accident. ~Aaron http://reviews.llvm.org/D12411 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r246210 - CGDebugInfo: Factor out a getOrCreateStandaloneType() method.
On Thu, Aug 27, 2015 at 2:21 PM, Adrian Prantl via cfe-commits cfe-commits@lists.llvm.org wrote: Author: adrian Date: Thu Aug 27 16:21:19 2015 New Revision: 246210 URL: http://llvm.org/viewvc/llvm-project?rev=246210view=rev Log: CGDebugInfo: Factor out a getOrCreateStandaloneType() method. Usually debug info is created on the fly while during codegen. With this API it becomes possible to create standalone debug info for types that are not referenced by any code, such as emitting debug info for a clang module or for implementing something like -gfull. Because on-the-fly debug info generation may still insert retained types on top of them, all RetainedTypes are uniqued in CGDebugInfo::finalize(). I don't quite understand why the new uniquing code is required - what is it about this new codepath that necessitates that? Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.h Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=246210r1=246209r2=246210view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Aug 27 16:21:19 2015 @@ -1398,8 +1398,15 @@ llvm::DIType *CGDebugInfo::getOrCreateRe llvm::DIType *CGDebugInfo::getOrCreateInterfaceType(QualType D, SourceLocation Loc) { + return getOrCreateStandaloneType(D, Loc); +} + +llvm::DIType *CGDebugInfo::getOrCreateStandaloneType(QualType D, + SourceLocation Loc) { assert(DebugKind = CodeGenOptions::LimitedDebugInfo); + assert(!D.isNull() null type); llvm::DIType *T = getOrCreateType(D, getOrCreateFile(Loc)); + assert(T could not create debug info for type); RetainedTypes.push_back(D.getAsOpaquePtr()); return T; } @@ -3360,9 +3367,14 @@ void CGDebugInfo::finalize() { // We keep our own list of retained types, because we need to look // up the final type in the type cache. - for (std::vectorvoid *::const_iterator RI = RetainedTypes.begin(), - RE = RetainedTypes.end(); RI != RE; ++RI) -DBuilder.retainType(castllvm::DIType(TypeCache[*RI])); + llvm::DenseSetvoid * UniqueTypes; + UniqueTypes.resize(RetainedTypes.size() * 2); + for (auto RT : RetainedTypes) { +if (!UniqueTypes.insert(RT).second) + continue; +if (auto MD = TypeCache[RT]) + DBuilder.retainType(castllvm::DIType(MD)); + } DBuilder.finalize(); } Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=246210r1=246209r2=246210view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Aug 27 16:21:19 2015 @@ -344,6 +344,9 @@ public: /// Emit an Objective-C interface type standalone debug info. llvm::DIType *getOrCreateInterfaceType(QualType Ty, SourceLocation Loc); + /// Emit standalone debug info for a type. + llvm::DIType *getOrCreateStandaloneType(QualType Ty, SourceLocation Loc); + void completeType(const EnumDecl *ED); void completeType(const RecordDecl *RD); void completeRequiredType(const RecordDecl *RD); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r246027 - Convert a bunch of loops to ranged-for and clean up accordingly.
-assert(Features[i][0] == '+' Invalid target feature!); +assert(Feature[0] == '+' Invalid target feature!); This assert is kind of pointless now, since we'll have continued in that case and the following code will DTRT anyway. Was fairly pointless to begin with. I'll remove it :) -eric X86SSEEnum Level = llvm::StringSwitchX86SSEEnum(Feature) - .Case(avx512f, AVX512F) - .Case(avx2, AVX2) - .Case(avx, AVX) - .Case(sse4.2, SSE42) - .Case(sse4.1, SSE41) - .Case(ssse3, SSSE3) - .Case(sse3, SSE3) - .Case(sse2, SSE2) - .Case(sse, SSE1) + .Case(+avx512f, AVX512F) + .Case(+avx2, AVX2) + .Case(+avx, AVX) + .Case(+sse4.2, SSE42) + .Case(+sse4.1, SSE41) + .Case(+ssse3, SSSE3) + .Case(+sse3, SSE3) + .Case(+sse2, SSE2) + .Case(+sse, SSE1) .Default(NoSSE); SSELevel = std::max(SSELevel, Level); MMX3DNowEnum ThreeDNowLevel = llvm::StringSwitchMMX3DNowEnum(Feature) -.Case(3dnowa, AMD3DNowAthlon) -.Case(3dnow, AMD3DNow) -.Case(mmx, MMX) +.Case(+3dnowa, AMD3DNowAthlon) +.Case(+3dnow, AMD3DNow) +.Case(+mmx, MMX) .Default(NoMMX3DNow); MMX3DNowLevel = std::max(MMX3DNowLevel, ThreeDNowLevel); XOPEnum XLevel = llvm::StringSwitchXOPEnum(Feature) -.Case(xop, XOP) -.Case(fma4, FMA4) -.Case(sse4a, SSE4A) +.Case(+xop, XOP) +.Case(+fma4, FMA4) +.Case(+sse4a, SSE4A) .Default(NoXOP); XOPLevel = std::max(XOPLevel, XLevel); } @@ -5247,12 +5147,12 @@ public: FPU = FPUMode; CRC = 0; Crypto = 0; -for (unsigned i = 0, e = Features.size(); i != e; ++i) { - if (Features[i] == +neon) +for (const auto Feature : Features) { + if (Feature == +neon) FPU = NeonMode; - if (Features[i] == +crc) + if (Feature == +crc) CRC = 1; - if (Features[i] == +crypto) + if (Feature == +crypto) Crypto = 1; } @@ -5926,10 +5826,10 @@ public: bool handleTargetFeatures(std::vectorstd::string Features, DiagnosticsEngine Diags) override { HasTransactionalExecution = false; -for (unsigned i = 0, e = Features.size(); i != e; ++i) { - if (Features[i] == +transactional-execution) +for (const auto Feature : Features) { + if (Feature == +transactional-execution) HasTransactionalExecution = true; - if (Features[i] == +vector) + else if (Feature == +vector) HasVector = true; } // If we use the vector ABI, vector types are 64-bit aligned. @@ -6477,29 +6377,28 @@ public: DspRev = NoDSP; HasFP64 = isFP64Default(); -for (std::vectorstd::string::iterator it = Features.begin(), - ie = Features.end(); it != ie; ++it) { - if (*it == +single-float) +for (const auto Feature : Features) { + if (Feature == +single-float) IsSingleFloat = true; - else if (*it == +soft-float) + else if (Feature == +soft-float) FloatABI = SoftFloat; - else if (*it == +mips16) + else if (Feature == +mips16) IsMips16 = true; - else if (*it == +micromips) + else if (Feature == +micromips) IsMicromips = true; - else if (*it == +dsp) + else if (Feature == +dsp) DspRev = std::max(DspRev, DSP1); - else if (*it == +dspr2) + else if (Feature == +dspr2) DspRev = std::max(DspRev, DSP2); - else if (*it == +msa) + else if (Feature == +msa) HasMSA = true; - else if (*it == +fp64) + else if (Feature == +fp64) HasFP64 = true; - else if (*it == -fp64) + else if (Feature == -fp64) HasFP64 = false; - else if (*it == +nan2008) + else if (Feature == +nan2008) IsNan2008 = true; - else if (*it == -nan2008) + else if (Feature == -nan2008) IsNan2008 = false; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246204 - [X86][F16C] Added debug codegen test for F16C intrinsics
Author: rksimon Date: Thu Aug 27 15:34:02 2015 New Revision: 246204 URL: http://llvm.org/viewvc/llvm-project?rev=246204view=rev Log: [X86][F16C] Added debug codegen test for F16C intrinsics Part of PR24590 Modified: cfe/trunk/test/CodeGen/f16c-builtins.c Modified: cfe/trunk/test/CodeGen/f16c-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/f16c-builtins.c?rev=246204r1=246203r2=246204view=diff == --- cfe/trunk/test/CodeGen/f16c-builtins.c (original) +++ cfe/trunk/test/CodeGen/f16c-builtins.c Thu Aug 27 15:34:02 2015 @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +f16c -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +f16c -emit-llvm -o - -Werror | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +f16c -S -o - -Werror | FileCheck %s --check-prefix=CHECK-ASM // Don't include mm_malloc.h, it's system specific. #define __MM_MALLOC_H @@ -7,20 +8,24 @@ __m128 test_mm_cvtph_ps(__m128i a) { // CHECK: @llvm.x86.vcvtph2ps.128 + // CHECK-ASM: vcvtph2ps %xmm{{.*}}, %xmm{{.*}} return _mm_cvtph_ps(a); } __m256 test_mm256_cvtph_ps(__m128i a) { // CHECK: @llvm.x86.vcvtph2ps.256 + // CHECK-ASM: vcvtph2ps %xmm{{.*}}, %ymm{{.*}} return _mm256_cvtph_ps(a); } __m128i test_mm_cvtps_ph(__m128 a) { // CHECK: @llvm.x86.vcvtps2ph.128 + // CHECK-ASM: vcvtps2ph $0, %xmm{{.*}}, %xmm{{.*}} return _mm_cvtps_ph(a, 0); } __m128i test_mm256_cvtps_ph(__m256 a) { // CHECK: @llvm.x86.vcvtps2ph.256 + // CHECK-ASM: vcvtps2ph $0, %ymm{{.*}}, %xmm{{.*}} return _mm256_cvtps_ph(a, 0); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246210 - CGDebugInfo: Factor out a getOrCreateStandaloneType() method.
Author: adrian Date: Thu Aug 27 16:21:19 2015 New Revision: 246210 URL: http://llvm.org/viewvc/llvm-project?rev=246210view=rev Log: CGDebugInfo: Factor out a getOrCreateStandaloneType() method. Usually debug info is created on the fly while during codegen. With this API it becomes possible to create standalone debug info for types that are not referenced by any code, such as emitting debug info for a clang module or for implementing something like -gfull. Because on-the-fly debug info generation may still insert retained types on top of them, all RetainedTypes are uniqued in CGDebugInfo::finalize(). Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.h Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=246210r1=246209r2=246210view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Aug 27 16:21:19 2015 @@ -1398,8 +1398,15 @@ llvm::DIType *CGDebugInfo::getOrCreateRe llvm::DIType *CGDebugInfo::getOrCreateInterfaceType(QualType D, SourceLocation Loc) { + return getOrCreateStandaloneType(D, Loc); +} + +llvm::DIType *CGDebugInfo::getOrCreateStandaloneType(QualType D, + SourceLocation Loc) { assert(DebugKind = CodeGenOptions::LimitedDebugInfo); + assert(!D.isNull() null type); llvm::DIType *T = getOrCreateType(D, getOrCreateFile(Loc)); + assert(T could not create debug info for type); RetainedTypes.push_back(D.getAsOpaquePtr()); return T; } @@ -3360,9 +3367,14 @@ void CGDebugInfo::finalize() { // We keep our own list of retained types, because we need to look // up the final type in the type cache. - for (std::vectorvoid *::const_iterator RI = RetainedTypes.begin(), - RE = RetainedTypes.end(); RI != RE; ++RI) -DBuilder.retainType(castllvm::DIType(TypeCache[*RI])); + llvm::DenseSetvoid * UniqueTypes; + UniqueTypes.resize(RetainedTypes.size() * 2); + for (auto RT : RetainedTypes) { +if (!UniqueTypes.insert(RT).second) + continue; +if (auto MD = TypeCache[RT]) + DBuilder.retainType(castllvm::DIType(MD)); + } DBuilder.finalize(); } Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=246210r1=246209r2=246210view=diff == --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Aug 27 16:21:19 2015 @@ -344,6 +344,9 @@ public: /// Emit an Objective-C interface type standalone debug info. llvm::DIType *getOrCreateInterfaceType(QualType Ty, SourceLocation Loc); + /// Emit standalone debug info for a type. + llvm::DIType *getOrCreateStandaloneType(QualType Ty, SourceLocation Loc); + void completeType(const EnumDecl *ED); void completeType(const RecordDecl *RD); void completeRequiredType(const RecordDecl *RD); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246211 - [X86][XOP] Added debug codegen test for XOP intrinsics
Author: rksimon Date: Thu Aug 27 16:32:03 2015 New Revision: 246211 URL: http://llvm.org/viewvc/llvm-project?rev=246211view=rev Log: [X86][XOP] Added debug codegen test for XOP intrinsics Part of PR24590 Modified: cfe/trunk/test/CodeGen/xop-builtins.c Modified: cfe/trunk/test/CodeGen/xop-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/xop-builtins.c?rev=246211r1=246210r2=246211view=diff == --- cfe/trunk/test/CodeGen/xop-builtins.c (original) +++ cfe/trunk/test/CodeGen/xop-builtins.c Thu Aug 27 16:32:03 2015 @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +xop -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +xop -emit-llvm -o - -Werror | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +xop -S -o - -Werror | FileCheck %s --check-prefix=CHECK-ASM // Don't include mm_malloc.h, it's system specific. #define __MM_MALLOC_H @@ -7,320 +8,384 @@ __m128i test_mm_maccs_epi16(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmacssww + // CHECK-ASM: vpmacssww %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_maccs_epi16(a, b, c); } __m128i test_mm_macc_epi16(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmacsww + // CHECK-ASM: vpmacsww %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_macc_epi16(a, b, c); } __m128i test_mm_maccsd_epi16(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmacsswd + // CHECK-ASM: vpmacsswd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_maccsd_epi16(a, b, c); } __m128i test_mm_maccd_epi16(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmacswd + // CHECK-ASM: vpmacswd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_maccd_epi16(a, b, c); } __m128i test_mm_maccs_epi32(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmacssdd + // CHECK-ASM: vpmacssdd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_maccs_epi32(a, b, c); } __m128i test_mm_macc_epi32(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmacsdd + // CHECK-ASM: vpmacsdd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_macc_epi32(a, b, c); } __m128i test_mm_maccslo_epi32(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmacssdql + // CHECK-ASM: vpmacssdql %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_maccslo_epi32(a, b, c); } __m128i test_mm_macclo_epi32(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmacsdql + // CHECK-ASM: vpmacsdql %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_macclo_epi32(a, b, c); } __m128i test_mm_maccshi_epi32(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmacssdqh + // CHECK-ASM: vpmacssdqh %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_maccshi_epi32(a, b, c); } __m128i test_mm_macchi_epi32(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmacsdqh + // CHECK-ASM: vpmacsdqh %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_macchi_epi32(a, b, c); } __m128i test_mm_maddsd_epi16(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmadcsswd + // CHECK-ASM: vpmadcsswd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_maddsd_epi16(a, b, c); } __m128i test_mm_maddd_epi16(__m128i a, __m128i b, __m128i c) { // CHECK: @llvm.x86.xop.vpmadcswd + // CHECK-ASM: vpmadcswd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_maddd_epi16(a, b, c); } __m128i test_mm_haddw_epi8(__m128i a) { // CHECK: @llvm.x86.xop.vphaddbw + // CHECK-ASM: vphaddbw %xmm{{.*}}, %xmm{{.*}} return _mm_haddw_epi8(a); } __m128i test_mm_haddd_epi8(__m128i a) { // CHECK: @llvm.x86.xop.vphaddbd + // CHECK-ASM: vphaddbd %xmm{{.*}}, %xmm{{.*}} return _mm_haddd_epi8(a); } __m128i test_mm_haddq_epi8(__m128i a) { // CHECK: @llvm.x86.xop.vphaddbq + // CHECK-ASM: vphaddbq %xmm{{.*}}, %xmm{{.*}} return _mm_haddq_epi8(a); } __m128i test_mm_haddd_epi16(__m128i a) { // CHECK: @llvm.x86.xop.vphaddwd + // CHECK-ASM: vphaddwd %xmm{{.*}}, %xmm{{.*}} return _mm_haddd_epi16(a); } __m128i test_mm_haddq_epi16(__m128i a) { // CHECK: @llvm.x86.xop.vphaddwq + // CHECK-ASM: vphaddwq %xmm{{.*}}, %xmm{{.*}} return _mm_haddq_epi16(a); } __m128i test_mm_haddq_epi32(__m128i a) { // CHECK: @llvm.x86.xop.vphadddq + // CHECK-ASM: vphadddq %xmm{{.*}}, %xmm{{.*}} return _mm_haddq_epi32(a); } __m128i test_mm_haddw_epu8(__m128i a) { // CHECK: @llvm.x86.xop.vphaddubw + // CHECK-ASM: vphaddubw %xmm{{.*}}, %xmm{{.*}} return _mm_haddw_epu8(a); } __m128i test_mm_haddd_epu8(__m128i a) { // CHECK: @llvm.x86.xop.vphaddubd + // CHECK-ASM: vphaddubd %xmm{{.*}}, %xmm{{.*}} return _mm_haddd_epu8(a); }
r246214 - Assume loads fix #2
Author: prazek Date: Thu Aug 27 16:35:41 2015 New Revision: 246214 URL: http://llvm.org/viewvc/llvm-project?rev=246214view=rev Log: Assume loads fix #2 There was linker problem, and it turns out that it is not always safe to refer to vtable. If the vtable is used, then we can refer to it without any problem, but because we don't know when it will be used or not, we can only check if vtable is external or it is safe to to emit it speculativly (when class it doesn't have any inline virtual functions). It should be fixed in the future. http://reviews.llvm.org/D12385 Modified: cfe/trunk/lib/CodeGen/CGCXXABI.h cfe/trunk/lib/CodeGen/CGClass.cpp cfe/trunk/lib/CodeGen/CGVTables.cpp cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp cfe/trunk/test/CodeGenCXX/template-instantiation.cpp cfe/trunk/test/CodeGenCXX/thunks.cpp cfe/trunk/test/CodeGenCXX/vtable-assume-load.cpp cfe/trunk/test/CodeGenCXX/vtable-available-externally.cpp Modified: cfe/trunk/lib/CodeGen/CGCXXABI.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXABI.h?rev=246214r1=246213r2=246214view=diff == --- cfe/trunk/lib/CodeGen/CGCXXABI.h (original) +++ cfe/trunk/lib/CodeGen/CGCXXABI.h Thu Aug 27 16:35:41 2015 @@ -218,8 +218,10 @@ public: virtual void emitThrow(CodeGenFunction CGF, const CXXThrowExpr *E) = 0; virtual llvm::GlobalVariable *getThrowInfo(QualType T) { return nullptr; } - virtual bool canEmitAvailableExternallyVTable( - const CXXRecordDecl *RD) const = 0; + /// \brief Determine whether it's possible to emit a vtable for \p RD, even + /// though we do not know that the vtable has been marked as used by semantic + /// analysis. + virtual bool canSpeculativelyEmitVTable(const CXXRecordDecl *RD) const = 0; virtual void emitBeginCatch(CodeGenFunction CGF, const CXXCatchStmt *C) = 0; Modified: cfe/trunk/lib/CodeGen/CGClass.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=246214r1=246213r2=246214view=diff == --- cfe/trunk/lib/CodeGen/CGClass.cpp (original) +++ cfe/trunk/lib/CodeGen/CGClass.cpp Thu Aug 27 16:35:41 2015 @@ -1857,8 +1857,15 @@ void CodeGenFunction::EmitCXXConstructor // with a vtable. We don't do this for base subobjects for two reasons: // first, it's incorrect for classes with virtual bases, and second, we're // about to overwrite the vptrs anyway. + // We also have to make sure if we can refer to vtable: + // - If vtable is external then it's safe to use it (for available_externally + // CGVTables will make sure if it can emit it). + // - Otherwise we can refer to vtable if it's safe to speculatively emit. + // FIXME: If vtable is used by ctor/dtor, we are always safe to refer to it. if (CGM.getCodeGenOpts().OptimizationLevel 0 - ClassDecl-isDynamicClass() Type != Ctor_Base) + ClassDecl-isDynamicClass() Type != Ctor_Base + (CGM.getVTables().isVTableExternal(ClassDecl) || + CGM.getCXXABI().canSpeculativelyEmitVTable(ClassDecl))) EmitVTableAssumptionLoads(ClassDecl, This); } Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=246214r1=246213r2=246214view=diff == --- cfe/trunk/lib/CodeGen/CGVTables.cpp (original) +++ cfe/trunk/lib/CodeGen/CGVTables.cpp Thu Aug 27 16:35:41 2015 @@ -682,7 +682,7 @@ CodeGenVTables::GenerateConstructionVTab static bool shouldEmitAvailableExternallyVTable(const CodeGenModule CGM, const CXXRecordDecl *RD) { return CGM.getCodeGenOpts().OptimizationLevel 0 -CGM.getCXXABI().canEmitAvailableExternallyVTable(RD); +CGM.getCXXABI().canSpeculativelyEmitVTable(RD); } /// Compute the required linkage of the v-table for the given class. @@ -832,11 +832,11 @@ bool CodeGenVTables::isVTableExternal(co /// we define that v-table? static bool shouldEmitVTableAtEndOfTranslationUnit(CodeGenModule CGM, const CXXRecordDecl *RD) { - // If vtable is internal then it has to be done + // If vtable is internal then it has to be done. if (!CGM.getVTables().isVTableExternal(RD)) return true; - // If it's external then maybe we will need it as available_externally + // If it's external then maybe we will need it as available_externally. return shouldEmitAvailableExternallyVTable(CGM, RD); } Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=246214r1=246213r2=246214view=diff == --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
Re: [PATCH] D12247: [libc++] remove possible trailing padding from aligned_storage
yiranwang added a comment. In http://reviews.llvm.org/D12247#234533, @EricWF wrote: So this patch LGTM. Sorry for being slow to understand it. However I want to see two things before it lands. 1. I would like to see a test of some sort that the resulting type has the same size and alignment requirements it did before the change. I'm not sure what the best way to test this is. 2. I would like @mclow.lists to approve this as well. I just want to be cautious. I think now we are on the same page about these bugs. Also, thanks for your review and findings (hopefully fix it soon too). For the test, we compile it with -O3 -fstrict-aliasing -finline-limit=300, and as mentioned before the target is AARCH64+ANDROID. http://reviews.llvm.org/D12247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12163: [Patch] [Analyzer] BugReporter.cpp:2869: Assertion failed: !RemainingNodes.empty() No error node found in the trimmed graph (PR 24184)
MaggieYi added a comment. Thanks for helping me review and submit the patch. http://reviews.llvm.org/D12163 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12401: Handling i686 architecture in makefiles for clang.
samsonov added a comment. See my comment in a different CL - I would strongly prefer to not touch autoconf build system unless absolutely necessary. Repository: rL LLVM http://reviews.llvm.org/D12401 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246206 - [X86][FMA4] Added debug codegen test for FMA4 intrinsics
Author: rksimon Date: Thu Aug 27 15:41:45 2015 New Revision: 246206 URL: http://llvm.org/viewvc/llvm-project?rev=246206view=rev Log: [X86][FMA4] Added debug codegen test for FMA4 intrinsics Part of PR24590 Modified: cfe/trunk/test/CodeGen/fma4-builtins.c Modified: cfe/trunk/test/CodeGen/fma4-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/fma4-builtins.c?rev=246206r1=246205r2=246206view=diff == --- cfe/trunk/test/CodeGen/fma4-builtins.c (original) +++ cfe/trunk/test/CodeGen/fma4-builtins.c Thu Aug 27 15:41:45 2015 @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +fma4 -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +fma4 -emit-llvm -o - -Werror | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-feature +fma4 -S -o - -Werror | FileCheck %s --check-prefix=CHECK-ASM // Don't include mm_malloc.h, it's system specific. #define __MM_MALLOC_H @@ -7,160 +8,192 @@ __m128 test_mm_macc_ps(__m128 a, __m128 b, __m128 c) { // CHECK: @llvm.x86.fma.vfmadd.ps + // CHECK-ASM: vfmaddps %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_macc_ps(a, b, c); } __m128d test_mm_macc_pd(__m128d a, __m128d b, __m128d c) { // CHECK: @llvm.x86.fma.vfmadd.pd + // CHECK-ASM: vfmaddpd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_macc_pd(a, b, c); } __m128 test_mm_macc_ss(__m128 a, __m128 b, __m128 c) { // CHECK: @llvm.x86.fma.vfmadd.ss + // CHECK-ASM: vfmaddss %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_macc_ss(a, b, c); } __m128d test_mm_macc_sd(__m128d a, __m128d b, __m128d c) { // CHECK: @llvm.x86.fma.vfmadd.sd + // CHECK-ASM: vfmaddsd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_macc_sd(a, b, c); } __m128 test_mm_msub_ps(__m128 a, __m128 b, __m128 c) { // CHECK: @llvm.x86.fma.vfmsub.ps + // CHECK-ASM: vfmsubps %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_msub_ps(a, b, c); } __m128d test_mm_msub_pd(__m128d a, __m128d b, __m128d c) { // CHECK: @llvm.x86.fma.vfmsub.pd + // CHECK-ASM: vfmsubpd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_msub_pd(a, b, c); } __m128 test_mm_msub_ss(__m128 a, __m128 b, __m128 c) { // CHECK: @llvm.x86.fma.vfmsub.ss + // CHECK-ASM: vfmsubss %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_msub_ss(a, b, c); } __m128d test_mm_msub_sd(__m128d a, __m128d b, __m128d c) { // CHECK: @llvm.x86.fma.vfmsub.sd + // CHECK-ASM: vfmsubsd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_msub_sd(a, b, c); } __m128 test_mm_nmacc_ps(__m128 a, __m128 b, __m128 c) { // CHECK: @llvm.x86.fma.vfnmadd.ps + // CHECK-ASM: vfnmaddps %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_nmacc_ps(a, b, c); } __m128d test_mm_nmacc_pd(__m128d a, __m128d b, __m128d c) { // CHECK: @llvm.x86.fma.vfnmadd.pd + // CHECK-ASM: vfnmaddpd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_nmacc_pd(a, b, c); } __m128 test_mm_nmacc_ss(__m128 a, __m128 b, __m128 c) { // CHECK: @llvm.x86.fma.vfnmadd.ss + // CHECK-ASM: vfnmaddss %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_nmacc_ss(a, b, c); } __m128d test_mm_nmacc_sd(__m128d a, __m128d b, __m128d c) { // CHECK: @llvm.x86.fma.vfnmadd.sd + // CHECK-ASM: vfnmaddsd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_nmacc_sd(a, b, c); } __m128 test_mm_nmsub_ps(__m128 a, __m128 b, __m128 c) { // CHECK: @llvm.x86.fma.vfnmsub.ps + // CHECK-ASM: vfnmsubps %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_nmsub_ps(a, b, c); } __m128d test_mm_nmsub_pd(__m128d a, __m128d b, __m128d c) { // CHECK: @llvm.x86.fma.vfnmsub.pd + // CHECK-ASM: vfnmsubpd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_nmsub_pd(a, b, c); } __m128 test_mm_nmsub_ss(__m128 a, __m128 b, __m128 c) { // CHECK: @llvm.x86.fma.vfnmsub.ss + // CHECK-ASM: vfnmsubss %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_nmsub_ss(a, b, c); } __m128d test_mm_nmsub_sd(__m128d a, __m128d b, __m128d c) { // CHECK: @llvm.x86.fma.vfnmsub.sd + // CHECK-ASM: vfnmsubsd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_nmsub_sd(a, b, c); } __m128 test_mm_maddsub_ps(__m128 a, __m128 b, __m128 c) { // CHECK: @llvm.x86.fma.vfmaddsub.ps + // CHECK-ASM: vfmaddsubps %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_maddsub_ps(a, b, c); } __m128d test_mm_maddsub_pd(__m128d a, __m128d b, __m128d c) { // CHECK: @llvm.x86.fma.vfmaddsub.pd + // CHECK-ASM: vfmaddsubpd %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}}, %xmm{{.*}} return _mm_maddsub_pd(a, b, c); } __m128 test_mm_msubadd_ps(__m128 a, __m128 b, __m128 c) { // CHECK: @llvm.x86.fma.vfmsubadd.ps + // CHECK-ASM: vfmsubaddps %xmm{{.*}},
Re: [PATCH] D12411: [PATCH] Expose AST language options to checkers
alexfh accepted this revision. alexfh added a comment. This revision is now accepted and ready to land. Looks good .Thanks for fixing this! BTW, there are other checks that use LangOpts in the check() method. IIRC, misc-use-override, google-readabiity-casting and maybe something else. We need to fix those as well. http://reviews.llvm.org/D12411 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12247: [libc++] remove possible trailing padding from aligned_storage
EricWF added a comment. So this patch LGTM. Sorry for being slow to understand it. However I want to see two things before it lands. 1. I would like to see a test of some sort that the resulting type has the same size and alignment requirements it did before the change. I'm not sure what the best way to test this is. 2. I would like @mclow.lists to approve this as well. I just want to be cautious. http://reviews.llvm.org/D12247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12390: Also enable the avx/avx512 ABIs for i386, not just x86_64.
rjmccall added a comment. In http://reviews.llvm.org/D12390#234458, @ab wrote: Unless I'm misunderstanding, I believe this has much less impact than you're thinking; there are three cases: - x86_64: no change (-mno-mmx is guarded by x86) - x86, with -mno-mmx: no change (because previously, we'd only set avx/avx512 for x86_64) - x86, without -mno-mmx: this will use an avx/avx512 ABI string where we'd have used , letting us use the better alignment (only for OpenMP and vectors, I think). Ok, I see. The outcome we want is that things like the max vector alignment should be properly honoring whatever target features are actually enabled. Specifically, if AVX is enabled, we should be setting the max vector alignment to the maximum enabled AVX alignment, regardless of whether MMX is enabled. This ABI string is an artifact of the interface between the AST and IRGen TargetInfos. We should probably just remove it in favor of some kind of openly-extensible query interface so that IRGen can just directly ask things like whether AVX is enabled instead of parsing some random string. But for this patch, let's just leave it as it is, and instead just set the max vector alignment directly from the target features. http://reviews.llvm.org/D12390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r245779 - [modules] Rearrange how redeclaration chains are loaded, to remove a walk over
On Thu, Aug 27, 2015 at 10:47 AM, Justin Bogner m...@justinbogner.com wrote: Richard Smith via cfe-commits cfe-commits@lists.llvm.org writes: Author: rsmith Date: Fri Aug 21 20:47:18 2015 New Revision: 245779 URL: http://llvm.org/viewvc/llvm-project?rev=245779view=rev Log: [modules] Rearrange how redeclaration chains are loaded, to remove a walk over all modules and reduce the number of declarations we load when loading a redeclaration chain. It looks like ASTDeclWriter::AddFirstDeclFromEachModule is called with a null `this` since this change, which has been causing ubsan failures on 76 tests since it went in: ASTWriterDecl.cpp:170:18: runtime error: member call on null pointer of type 'clang::ASTReader' Logs and other failures here: http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check/146/ I guess you must've missed the failure email. Could you please take a look? Thanks, fixed in r246215. The new approach is: * when loading the first declaration of an entity within a module file, we first load all declarations of the entity that were imported into that module file, and then load all the other declarations of that entity from that module file and build a suitable decl chain from them * when loading any other declaration of an entity, we first load the first declaration from the same module file As before, we complete redecl chains through name lookup where necessary. To make this work, I also had to change the way that template specializations are stored -- it no longer suffices to track only canonical specializations; we now emit all first local declarations when emitting a list of specializations for a template. On one testcase with several thousand imported module files, this reduces the total runtime by 72%. Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/lib/Serialization/ASTWriterDecl.cpp cfe/trunk/test/Modules/cxx-templates.cpp Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=245779r1=245778r2=245779view=diff == --- cfe/trunk/include/clang/Serialization/ASTWriter.h (original) +++ cfe/trunk/include/clang/Serialization/ASTWriter.h Fri Aug 21 20:47:18 2015 @@ -405,6 +405,10 @@ private: /// \brief The set of declarations that may have redeclaration chains that /// need to be serialized. llvm::SmallVectorconst Decl *, 16 Redeclarations; + + /// \brief A cache of the first local declaration for interesting + /// redeclaration chains. + llvm::DenseMapconst Decl *, const Decl * FirstLocalDeclCache; /// \brief Statements that we've encountered while serializing a /// declaration or type. @@ -676,6 +680,10 @@ public: const ASTTemplateArgumentListInfo *ASTTemplArgList, RecordDataImpl Record); + /// \brief Find the first local declaration of a given local redeclarable + /// decl. + const Decl *getFirstLocalDecl(const Decl *D); + /// \brief Emit a reference to a declaration. void AddDeclRef(const Decl *D, RecordDataImpl Record); @@ -857,12 +865,6 @@ public: void CompletedTagDefinition(const TagDecl *D) override; void AddedVisibleDecl(const DeclContext *DC, const Decl *D) override; void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) override; - void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, - const ClassTemplateSpecializationDecl *D) override; - void AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, - const VarTemplateSpecializationDecl *D) override; - void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, - const FunctionDecl *D) override; void ResolvedExceptionSpec(const FunctionDecl *FD) override; void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) override; void ResolvedOperatorDelete(const CXXDestructorDecl *DD, Modified: cfe/trunk/lib/Serialization/ASTReader.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=245779r1=245778r2=245779view=diff == --- cfe/trunk/lib/Serialization/ASTReader.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Aug 21 20:47:18 2015 @@ -8123,11 +8123,8 @@ void ASTReader::finishPendingActions() { PendingIncompleteDeclChains.clear(); // Load pending declaration chains. -for (unsigned I =
r246215 - Don't call a member function on a null pointer.
Author: rsmith Date: Thu Aug 27 16:38:25 2015 New Revision: 246215 URL: http://llvm.org/viewvc/llvm-project?rev=246215view=rev Log: Don't call a member function on a null pointer. Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=246215r1=246214r2=246215view=diff == --- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original) +++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Thu Aug 27 16:38:25 2015 @@ -165,9 +165,12 @@ namespace clang { void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) { llvm::MapVectorModuleFile*, const Decl* Firsts; // FIXME: We can skip entries that we know are implied by others. - for (const Decl *R = D-getMostRecentDecl(); R; R = R-getPreviousDecl()) -if (IncludeLocal || R-isFromASTFile()) + for (const Decl *R = D-getMostRecentDecl(); R; R = R-getPreviousDecl()) { +if (R-isFromASTFile()) Firsts[Writer.Chain-getOwningModuleFile(R)] = R; +else if (IncludeLocal) + Firsts[nullptr] = R; + } for (const auto F : Firsts) Writer.AddDeclRef(F.second, Record); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r245779 - [modules] Rearrange how redeclaration chains are loaded, to remove a walk over
On Sat, Aug 22, 2015 at 1:16 AM, Vassil Vassilev vvasi...@cern.ch wrote: On 22/08/15 03:47, Richard Smith via cfe-commits wrote: Author: rsmith Date: Fri Aug 21 20:47:18 2015 New Revision: 245779 URL: http://llvm.org/viewvc/llvm-project?rev=245779view=rev Log: [modules] Rearrange how redeclaration chains are loaded, to remove a walk over all modules and reduce the number of declarations we load when loading a redeclaration chain. The new approach is: * when loading the first declaration of an entity within a module file, we first load all declarations of the entity that were imported into that module file, and then load all the other declarations of that entity from that module file and build a suitable decl chain from them * when loading any other declaration of an entity, we first load the first declaration from the same module file As before, we complete redecl chains through name lookup where necessary. To make this work, I also had to change the way that template specializations are stored -- it no longer suffices to track only canonical specializations; we now emit all first local declarations when emitting a list of specializations for a template. On one testcase with several thousand imported module files, this reduces the total runtime by 72%. Very nice! Does it reduce the depth of the redecl chains when merging? I.e. does this mean memory footprint reduction too? I wouldn't expect any difference there, and in any case, I think this would only affect the stack depth, which is typically bounded anyway since we normally build modules on a separate thread. Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/lib/Serialization/ASTWriterDecl.cpp cfe/trunk/test/Modules/cxx-templates.cpp Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=245779r1=245778r2=245779view=diff == --- cfe/trunk/include/clang/Serialization/ASTWriter.h (original) +++ cfe/trunk/include/clang/Serialization/ASTWriter.h Fri Aug 21 20:47:18 2015 @@ -405,6 +405,10 @@ private: /// \brief The set of declarations that may have redeclaration chains that /// need to be serialized. llvm::SmallVectorconst Decl *, 16 Redeclarations; + + /// \brief A cache of the first local declaration for interesting + /// redeclaration chains. + llvm::DenseMapconst Decl *, const Decl * FirstLocalDeclCache; /// \brief Statements that we've encountered while serializing a /// declaration or type. @@ -676,6 +680,10 @@ public: const ASTTemplateArgumentListInfo *ASTTemplArgList, RecordDataImpl Record); + /// \brief Find the first local declaration of a given local redeclarable + /// decl. + const Decl *getFirstLocalDecl(const Decl *D); + /// \brief Emit a reference to a declaration. void AddDeclRef(const Decl *D, RecordDataImpl Record); @@ -857,12 +865,6 @@ public: void CompletedTagDefinition(const TagDecl *D) override; void AddedVisibleDecl(const DeclContext *DC, const Decl *D) override; void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) override; - void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, - const ClassTemplateSpecializationDecl *D) override; - void AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, - const VarTemplateSpecializationDecl *D) override; - void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, - const FunctionDecl *D) override; void ResolvedExceptionSpec(const FunctionDecl *FD) override; void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) override; void ResolvedOperatorDelete(const CXXDestructorDecl *DD, Modified: cfe/trunk/lib/Serialization/ASTReader.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=245779r1=245778r2=245779view=diff == --- cfe/trunk/lib/Serialization/ASTReader.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Aug 21 20:47:18 2015 @@ -8123,11 +8123,8 @@ void ASTReader::finishPendingActions() { PendingIncompleteDeclChains.clear(); // Load pending declaration chains. -for (unsigned I = 0; I != PendingDeclChains.size(); ++I) { - PendingDeclChainsKnown.erase(PendingDeclChains[I]); +for (unsigned I = 0; I != PendingDeclChains.size(); ++I)
Re: [PATCH] D11740: ABI versioning macros for libc++
EricWF added a comment. Thanks for doing all of this work. It's really appreciated. First, I don't really think we should have the notion of a minor ABI version. It will be hard enough to maintain 2 major versions and I don't understand what a minor ABI version buys us. In my opinion libc++ should support the following ABI configurations: 1. Previous: The previous major ABI version. 2. Default: The current major ABI version. 3. Unstable: The current major ABI version + all pending ABI breaking changes. I would like to see the ABI minor version replaced with `_LIBCPP_ABI_UNSTABLE` macro that @mclow.lists originally proposed. http://reviews.llvm.org/D11740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11740: ABI versioning macros for libc++
EricWF added a comment. In http://reviews.llvm.org/D11740#234575, @eugenis wrote: Yes, not being able to use headers in the libcxx source tree is quite unpleasant. It can be fixed by providing a __config_version in libcxx/include with the default version values. Or, in the approach of http://reviews.llvm.org/D11963, do something smart in __config to default to the right version numbers. I'm not sure what you mean by smart because IMO http://reviews.llvm.org/D11963 is pretty dumb, but I would like to see `__config` have a default value for `_LIBCPP_ABI_VERSION` wrapped in a `#ifndef _LIBCPP_ABI_VERSION`. Why do we need _LIBCPP_ABI_UNSTABLE at all? How is it different from setting LIBCPP_ABI_MAJOR_VERSION to the current default version + 1? Interesting question. I'm think trying to draw a distinction between the stable ABI versions and unversioned ABI changes that are currently being staged for the next release. My main concern is that using default version + 1 to stage future changes is that it could look like that is a stable ABI configuration. http://reviews.llvm.org/D11740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.
aaron.ballman added a subscriber: aaron.ballman. aaron.ballman added a comment. While working on r246209, one of the build bots ran into an issue (commented below) that has me slightly perplexed. The build break can be found at: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/30516 What's also strange is that I could not reproduce that failure locally (MSVC 2015 debug build, Windows 10)... Comment at: test/clang-tidy/modernize-use-nullptr-basic.cpp:2 @@ +1,3 @@ +// RUN: $(dirname %s)/check_clang_tidy.sh %s modernize-use-nullptr %t -- \ +// RUN: -std=c++98 -Wno-non-literal-null-conversion +// REQUIRES: shell Sorry for bringing this up later, but how is this test supposed to work? nullptr is not a valid C++98 construct, and so I don't think we should be recommending fixes to use nullptr in this case. Is there a reason this test case is using -std=c++98 instead of -std=c++11? http://reviews.llvm.org/D12081 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.
On Thu, Aug 27, 2015 at 7:20 PM, Alexander Kornienko ale...@google.com wrote: alexfh added a comment. In http://reviews.llvm.org/D12081#234614, @aaron.ballman wrote: While working on r246209, one of the build bots ran into an issue (commented below) that has me slightly perplexed. The build break can be found at: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/30516 Seems to be related to the -std=c++98 in the test? That's what I figured as well. What's also strange is that I could not reproduce that failure locally (MSVC 2015 debug build, Windows 10)... That's strange. Maybe there's some command-line argument parsing magic when targeting windows? That's what I'm slightly more concerned by. I will investigate in the morning on my machine and see what I come up with. Comment at: test/clang-tidy/modernize-use-nullptr-basic.cpp:2 @@ +1,3 @@ +// RUN: $(dirname %s)/check_clang_tidy.sh %s modernize-use-nullptr %t -- \ +// RUN: -std=c++98 -Wno-non-literal-null-conversion +// REQUIRES: shell aaron.ballman wrote: Sorry for bringing this up later, but how is this test supposed to work? nullptr is not a valid C++98 construct, and so I don't think we should be recommending fixes to use nullptr in this case. Is there a reason this test case is using -std=c++98 instead of -std=c++11? Looks like a mistake. It should be -std=c++11. But while the check wasn't looking at LangOpts, it didn't make any difference, because we don't try to compile the fixed code. Okay, glad it's just a mistake. When I recommit my patch, I'll correct this RUN line. Thanks! ~Aaron http://reviews.llvm.org/D12081 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12081: Add use-nullptr check to clang-tidy.
On Fri, Aug 28, 2015 at 1:23 AM, Aaron Ballman aaron.ball...@gmail.com wrote: On Thu, Aug 27, 2015 at 7:20 PM, Alexander Kornienko ale...@google.com wrote: alexfh added a comment. In http://reviews.llvm.org/D12081#234614, @aaron.ballman wrote: While working on r246209, one of the build bots ran into an issue (commented below) that has me slightly perplexed. The build break can be found at: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/30516 Seems to be related to the -std=c++98 in the test? That's what I figured as well. What's also strange is that I could not reproduce that failure locally (MSVC 2015 debug build, Windows 10)... That's strange. Maybe there's some command-line argument parsing magic when targeting windows? That's what I'm slightly more concerned by. I will investigate in the morning on my machine and see what I come up with. Comment at: test/clang-tidy/modernize-use-nullptr-basic.cpp:2 @@ +1,3 @@ +// RUN: $(dirname %s)/check_clang_tidy.sh %s modernize-use-nullptr %t -- \ +// RUN: -std=c++98 -Wno-non-literal-null-conversion +// REQUIRES: shell aaron.ballman wrote: Sorry for bringing this up later, but how is this test supposed to work? nullptr is not a valid C++98 construct, and so I don't think we should be recommending fixes to use nullptr in this case. Is there a reason this test case is using -std=c++98 instead of -std=c++11? Looks like a mistake. It should be -std=c++11. But while the check wasn't looking at LangOpts, it didn't make any difference, because we don't try to compile the fixed code. Okay, glad it's just a mistake. When I recommit my patch, I'll correct this RUN line. Apparently, I was wrong. Some of the constructs in the test file fail to compile in c++11. So maybe we should allow the check to run in c++98 mode: to migrate the constructs that otherwise wouldn't compile. It still makes sense to require C++, I guess. Thanks! ~Aaron http://reviews.llvm.org/D12081 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246223 - [X86][3DNow] Added debug codegen test for 3DNow! intrinsics
Author: rksimon Date: Thu Aug 27 17:18:09 2015 New Revision: 246223 URL: http://llvm.org/viewvc/llvm-project?rev=246223view=rev Log: [X86][3DNow] Added debug codegen test for 3DNow! intrinsics Part of PR24590 Modified: cfe/trunk/test/CodeGen/3dnow-builtins.c Modified: cfe/trunk/test/CodeGen/3dnow-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/3dnow-builtins.c?rev=246223r1=246222r2=246223view=diff == --- cfe/trunk/test/CodeGen/3dnow-builtins.c (original) +++ cfe/trunk/test/CodeGen/3dnow-builtins.c Thu Aug 27 17:18:09 2015 @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 %s -O3 -triple=x86_64-unknown-unknown -target-feature +3dnow -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple=x86_64-unknown-unknown -target-feature +3dnow -emit-llvm -o - -Werror | FileCheck %s +// RUN: %clang_cc1 %s -O0 -triple=x86_64-unknown-unknown -target-feature +3dnow -S -o - -Werror | FileCheck %s --check-prefix=CHECK-ASM // Don't include mm_malloc.h, it's system specific. #define __MM_MALLOC_H @@ -8,108 +9,126 @@ __m64 test_m_pavgusb(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pavgusb // CHECK: @llvm.x86.3dnow.pavgusb + // CHECK-ASM: pavgusb %mm{{.*}}, %mm{{.*}} return _m_pavgusb(m1, m2); } __m64 test_m_pf2id(__m64 m) { // CHECK-LABEL: define i64 @test_m_pf2id // CHECK: @llvm.x86.3dnow.pf2id + // CHECK-ASM: pf2id %mm{{.*}}, %mm{{.*}} return _m_pf2id(m); } __m64 test_m_pfacc(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfacc // CHECK: @llvm.x86.3dnow.pfacc + // CHECK-ASM: pfacc %mm{{.*}}, %mm{{.*}} return _m_pfacc(m1, m2); } __m64 test_m_pfadd(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfadd // CHECK: @llvm.x86.3dnow.pfadd + // CHECK-ASM: pfadd %mm{{.*}}, %mm{{.*}} return _m_pfadd(m1, m2); } __m64 test_m_pfcmpeq(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfcmpeq // CHECK: @llvm.x86.3dnow.pfcmpeq + // CHECK-ASM: pfcmpeq %mm{{.*}}, %mm{{.*}} return _m_pfcmpeq(m1, m2); } __m64 test_m_pfcmpge(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfcmpge // CHECK: @llvm.x86.3dnow.pfcmpge + // CHECK-ASM: pfcmpge %mm{{.*}}, %mm{{.*}} return _m_pfcmpge(m1, m2); } __m64 test_m_pfcmpgt(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfcmpgt // CHECK: @llvm.x86.3dnow.pfcmpgt + // CHECK-ASM: pfcmpgt %mm{{.*}}, %mm{{.*}} return _m_pfcmpgt(m1, m2); } __m64 test_m_pfmax(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfmax // CHECK: @llvm.x86.3dnow.pfmax + // CHECK-ASM: pfmax %mm{{.*}}, %mm{{.*}} return _m_pfmax(m1, m2); } __m64 test_m_pfmin(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfmin // CHECK: @llvm.x86.3dnow.pfmin + // CHECK-ASM: pfmin %mm{{.*}}, %mm{{.*}} return _m_pfmin(m1, m2); } __m64 test_m_pfmul(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfmul // CHECK: @llvm.x86.3dnow.pfmul + // CHECK-ASM: pfmul %mm{{.*}}, %mm{{.*}} return _m_pfmul(m1, m2); } __m64 test_m_pfrcp(__m64 m) { // CHECK-LABEL: define i64 @test_m_pfrcp // CHECK: @llvm.x86.3dnow.pfrcp + // CHECK-ASM: pfrcp %mm{{.*}}, %mm{{.*}} return _m_pfrcp(m); } __m64 test_m_pfrcpit1(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfrcpit1 // CHECK: @llvm.x86.3dnow.pfrcpit1 + // CHECK-ASM: pfrcpit1 %mm{{.*}}, %mm{{.*}} return _m_pfrcpit1(m1, m2); } __m64 test_m_pfrcpit2(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfrcpit2 // CHECK: @llvm.x86.3dnow.pfrcpit2 + // CHECK-ASM: pfrcpit2 %mm{{.*}}, %mm{{.*}} return _m_pfrcpit2(m1, m2); } __m64 test_m_pfrsqrt(__m64 m) { // CHECK-LABEL: define i64 @test_m_pfrsqrt // CHECK: @llvm.x86.3dnow.pfrsqrt + // CHECK-ASM: pfrsqrt %mm{{.*}}, %mm{{.*}} return _m_pfrsqrt(m); } __m64 test_m_pfrsqrtit1(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfrsqrtit1 // CHECK: @llvm.x86.3dnow.pfrsqit1 + // CHECK-ASM: pfrsqit1 %mm{{.*}}, %mm{{.*}} return _m_pfrsqrtit1(m1, m2); } __m64 test_m_pfsub(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfsub // CHECK: @llvm.x86.3dnow.pfsub + // CHECK-ASM: pfsub %mm{{.*}}, %mm{{.*}} return _m_pfsub(m1, m2); } __m64 test_m_pfsubr(__m64 m1, __m64 m2) { // CHECK-LABEL: define i64 @test_m_pfsubr // CHECK: @llvm.x86.3dnow.pfsubr + // CHECK-ASM: pfsubr %mm{{.*}}, %mm{{.*}} return _m_pfsubr(m1, m2); } __m64 test_m_pi2fd(__m64 m) { // CHECK-LABEL: define i64 @test_m_pi2fd // CHECK: @llvm.x86.3dnow.pi2fd + // CHECK-ASM: pi2fd %mm{{.*}}, %mm{{.*}} return _m_pi2fd(m); } @@ -122,35 +141,41 @@ __m64 test_m_pmulhrw(__m64 m1, __m64 m2) __m64 test_m_pf2iw(__m64 m) { // CHECK-LABEL: define i64 @test_m_pf2iw // CHECK: @llvm.x86.3dnowa.pf2iw + // CHECK-ASM: pf2iw %mm{{.*}}, %mm{{.*}} return _m_pf2iw(m); } __m64
r246225 - Use an explicit assignment.
Author: echristo Date: Thu Aug 27 17:20:03 2015 New Revision: 246225 URL: http://llvm.org/viewvc/llvm-project?rev=246225view=rev Log: Use an explicit assignment. Modified: cfe/trunk/lib/CodeGen/CGCall.cpp Modified: cfe/trunk/lib/CodeGen/CGCall.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=246225r1=246224r2=246225view=diff == --- cfe/trunk/lib/CodeGen/CGCall.cpp (original) +++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Aug 27 17:20:03 2015 @@ -1503,8 +1503,8 @@ void CodeGenModule::ConstructAttributeLi const auto *TD = FD-getAttrTargetAttr(); // Make a copy of the features as passed on the command line. - std::vectorstd::string FnFeatures( - getTarget().getTargetOpts().FeaturesAsWritten); + std::vectorstd::string FnFeatures = + getTarget().getTargetOpts().FeaturesAsWritten; // Grab the target attribute string. StringRef FeaturesStr = TD-getFeatures(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12390: Use 32/64 SimdDefaultAlign when AVX/AVX512 is enabled, even on i386.
ab added a comment. r246228 using the features Thanks for the reviews! Repository: rL LLVM http://reviews.llvm.org/D12390 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11740: ABI versioning macros for libc++
EricWF added a comment. In http://reviews.llvm.org/D11740#234642, @eugenis wrote: OK. Then _LIBCPP_ABI_UNSTABLE won't bump the ABI version (as seen in library soname and header path)? Yeah. That was how I imagined it. http://reviews.llvm.org/D11740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246228 - [X86] Use AVX features instead of ABI to init. SimdDefaultAlign.
Author: ab Date: Thu Aug 27 17:24:56 2015 New Revision: 246228 URL: http://llvm.org/viewvc/llvm-project?rev=246228view=rev Log: [X86] Use AVX features instead of ABI to init. SimdDefaultAlign. The ABI string only exists to communicate with TargetCodeGenInfo. Concretely, since we only used avx* ABI strings on x86_64 (as AVX doesn't affect the i386 ABIs), this meant that, when initializing SimdDefaultAlign, we would ignore AVX/AVX512 on i386, for no good reason. Instead, directly check the features. A similar change for MaxVectorAlign will follow. Differential Revision: http://reviews.llvm.org/D12390 Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/OpenMP/simd_metadata.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=246228r1=246227r2=246228view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug 27 17:24:56 2015 @@ -2984,7 +2984,7 @@ bool X86TargetInfo::handleTargetFeatures MMX3DNowLevel = std::max(MMX3DNowLevel, MMX); SimdDefaultAlign = - (getABI() == avx512) ? 512 : (getABI() == avx) ? 256 : 128; + hasFeature(avx512f) ? 512 : hasFeature(avx) ? 256 : 128; return true; } Modified: cfe/trunk/test/OpenMP/simd_metadata.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/simd_metadata.c?rev=246228r1=246227r2=246228view=diff == --- cfe/trunk/test/OpenMP/simd_metadata.c (original) +++ cfe/trunk/test/OpenMP/simd_metadata.c Thu Aug 27 17:24:56 2015 @@ -1,6 +1,9 @@ // RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86 // RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -target-feature +avx -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86-AVX // RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -target-feature +avx512f -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86-AVX512 +// RUN: %clang_cc1 -fopenmp -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86 +// RUN: %clang_cc1 -fopenmp -triple i386-unknown-unknown -target-feature +avx -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86-AVX +// RUN: %clang_cc1 -fopenmp -triple i386-unknown-unknown -target-feature +avx512f -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86-AVX512 // RUN: %clang_cc1 -fopenmp -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=PPC // RUN: %clang_cc1 -fopenmp -triple powerpc64-unknown-unknown -target-abi elfv1-qpx -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=PPC-QPX ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246229 - [X86] Conditionalize Darwin MaxVectorAlign on the presence of AVX.
Author: ab Date: Thu Aug 27 17:30:38 2015 New Revision: 246229 URL: http://llvm.org/viewvc/llvm-project?rev=246229view=rev Log: [X86] Conditionalize Darwin MaxVectorAlign on the presence of AVX. There's no point in using a larger alignment if we have no instructions that would benefit from it. Differential Revision: http://reviews.llvm.org/D12389 Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/CodeGen/vector-alignment.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=246229r1=246228r2=246229view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug 27 17:30:38 2015 @@ -3629,13 +3629,21 @@ public: LongDoubleWidth = 128; LongDoubleAlign = 128; SuitableAlign = 128; -MaxVectorAlign = 256; SizeType = UnsignedLong; IntPtrType = SignedLong; DataLayoutString = e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128; HasAlignMac68kSupport = true; } + bool handleTargetFeatures(std::vectorstd::string Features, +DiagnosticsEngine Diags) override { +if (!DarwinTargetInfoX86_32TargetInfo::handleTargetFeatures(Features, + Diags)) + return false; +// Now that we know if we have AVX, we can decide how to align vectors. +MaxVectorAlign = hasFeature(avx) ? 256 : 128; +return true; + } }; // x86-32 Windows target @@ -3986,13 +3994,22 @@ public: DarwinX86_64TargetInfo(const llvm::Triple Triple) : DarwinTargetInfoX86_64TargetInfo(Triple) { Int64Type = SignedLongLong; -MaxVectorAlign = 256; // The 64-bit iOS simulator uses the builtin bool type for Objective-C. llvm::Triple T = llvm::Triple(Triple); if (T.isiOS()) UseSignedCharForObjCBool = false; DataLayoutString = e-m:o-i64:64-f80:128-n8:16:32:64-S128; } + + bool handleTargetFeatures(std::vectorstd::string Features, +DiagnosticsEngine Diags) override { +if (!DarwinTargetInfoX86_64TargetInfo::handleTargetFeatures(Features, + Diags)) + return false; +// Now that we know if we have AVX, we can decide how to align vectors. +MaxVectorAlign = hasFeature(avx) ? 256 : 128; +return true; + } }; class OpenBSDX86_64TargetInfo : public OpenBSDTargetInfoX86_64TargetInfo { Modified: cfe/trunk/test/CodeGen/vector-alignment.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/vector-alignment.c?rev=246229r1=246228r2=246229view=diff == --- cfe/trunk/test/CodeGen/vector-alignment.c (original) +++ cfe/trunk/test/CodeGen/vector-alignment.c Thu Aug 27 17:30:38 2015 @@ -1,38 +1,51 @@ -// RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=SSE +// RUN: %clang_cc1 -w -triple i386-apple-darwin10 \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=SSE +// RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -target-feature +avx \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX +// RUN: %clang_cc1 -w -triple i386-apple-darwin10 -target-feature +avx \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX // rdar://11759609 // At or below target max alignment with no aligned attribute should align based // on the size of vector. double __attribute__((vector_size(16))) v1; -// CHECK: @v1 {{.*}}, align 16 +// SSE: @v1 {{.*}}, align 16 +// AVX: @v1 {{.*}}, align 16 double __attribute__((vector_size(32))) v2; -// CHECK: @v2 {{.*}}, align 32 +// SSE: @v2 {{.*}}, align 16 +// AVX: @v2 {{.*}}, align 32 // Alignment above target max alignment with no aligned attribute should align // based on the target max. double __attribute__((vector_size(64))) v3; -// CHECK: @v3 {{.*}}, align 32 +// SSE: @v3 {{.*}}, align 16 +// AVX: @v3 {{.*}}, align 32 double __attribute__((vector_size(1024))) v4; -// CHECK: @v4 {{.*}}, align 32 +// SSE: @v4 {{.*}}, align 16 +// AVX: @v4 {{.*}}, align 32 // Aliged attribute should always override. double __attribute__((vector_size(16), aligned(16))) v5; -// CHECK: @v5 {{.*}}, align 16 +// ALL: @v5 {{.*}}, align 16 double __attribute__((vector_size(16), aligned(64))) v6; -// CHECK: @v6 {{.*}}, align 64 +// ALL: @v6 {{.*}}, align 64 double __attribute__((vector_size(32), aligned(16))) v7; -// CHECK: @v7 {{.*}}, align 16 +// ALL: @v7 {{.*}}, align 16 double __attribute__((vector_size(32), aligned(64))) v8; -// CHECK: @v8 {{.*}}, align 64 +// ALL: @v8 {{.*}}, align 64 // Check non-power of 2 widths.
r246230 - [X86] Bump Darwin MaxVectorAlign to 64 when AVX512 is enabled.
Author: ab Date: Thu Aug 27 17:42:12 2015 New Revision: 246230 URL: http://llvm.org/viewvc/llvm-project?rev=246230view=rev Log: [X86] Bump Darwin MaxVectorAlign to 64 when AVX512 is enabled. Without this, 64-byte vector types (__m512), specified to be 64-byte aligned in the AVX512 draft SysV ABI, will only be 32-byte aligned. This is analoguous to AVX, for which we accept 32-byte max alignment. Differential Revision: http://reviews.llvm.org/D10724 Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/CodeGen/vector-alignment.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=246230r1=246229r2=246230view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug 27 17:42:12 2015 @@ -3640,8 +3640,9 @@ public: if (!DarwinTargetInfoX86_32TargetInfo::handleTargetFeatures(Features, Diags)) return false; -// Now that we know if we have AVX, we can decide how to align vectors. -MaxVectorAlign = hasFeature(avx) ? 256 : 128; +// We now know the features we have: we can decide how to align vectors. +MaxVectorAlign = +hasFeature(avx512f) ? 512 : hasFeature(avx) ? 256 : 128; return true; } }; @@ -4006,8 +4007,9 @@ public: if (!DarwinTargetInfoX86_64TargetInfo::handleTargetFeatures(Features, Diags)) return false; -// Now that we know if we have AVX, we can decide how to align vectors. -MaxVectorAlign = hasFeature(avx) ? 256 : 128; +// We now know the features we have: we can decide how to align vectors. +MaxVectorAlign = +hasFeature(avx512f) ? 512 : hasFeature(avx) ? 256 : 128; return true; } }; Modified: cfe/trunk/test/CodeGen/vector-alignment.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/vector-alignment.c?rev=246230r1=246229r2=246230view=diff == --- cfe/trunk/test/CodeGen/vector-alignment.c (original) +++ cfe/trunk/test/CodeGen/vector-alignment.c Thu Aug 27 17:42:12 2015 @@ -6,6 +6,10 @@ // RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX // RUN: %clang_cc1 -w -triple i386-apple-darwin10 -target-feature +avx \ // RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX +// RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -target-feature +avx512f \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 +// RUN: %clang_cc1 -w -triple i386-apple-darwin10 -target-feature +avx512f \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 // rdar://11759609 // At or below target max alignment with no aligned attribute should align based @@ -13,18 +17,22 @@ double __attribute__((vector_size(16))) v1; // SSE: @v1 {{.*}}, align 16 // AVX: @v1 {{.*}}, align 16 +// AVX512: @v1 {{.*}}, align 16 double __attribute__((vector_size(32))) v2; // SSE: @v2 {{.*}}, align 16 // AVX: @v2 {{.*}}, align 32 +// AVX512: @v2 {{.*}}, align 32 // Alignment above target max alignment with no aligned attribute should align // based on the target max. double __attribute__((vector_size(64))) v3; // SSE: @v3 {{.*}}, align 16 // AVX: @v3 {{.*}}, align 32 +// AVX512: @v3 {{.*}}, align 64 double __attribute__((vector_size(1024))) v4; // SSE: @v4 {{.*}}, align 16 // AVX: @v4 {{.*}}, align 32 +// AVX512: @v4 {{.*}}, align 64 // Aliged attribute should always override. double __attribute__((vector_size(16), aligned(16))) v5; @@ -40,9 +48,11 @@ double __attribute__((vector_size(32), a double __attribute__((vector_size(24))) v9; // SSE: @v9 {{.*}}, align 16 // AVX: @v9 {{.*}}, align 32 +// AVX512: @v9 {{.*}}, align 32 double __attribute__((vector_size(40))) v10; // SSE: @v10 {{.*}}, align 16 // AVX: @v10 {{.*}}, align 32 +// AVX512: @v10 {{.*}}, align 64 // Check non-power of 2 widths with aligned attribute. double __attribute__((vector_size(24), aligned(64))) v11; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12355: [libcxx] Optimize away unneeded length calculation in basic_string::compare(const char*)
EricWF updated this revision to Diff 33368. EricWF added a comment. Remove unnecessary call to `std::min`. http://reviews.llvm.org/D12355 Files: include/string Index: include/string === --- include/string +++ include/string @@ -3795,7 +3795,10 @@ operator==(const _CharT* __lhs, const basic_string_CharT, _Traits, _Allocator __rhs) _NOEXCEPT { -return __rhs.compare(__lhs) == 0; +_LIBCPP_ASSERT(__lhs != nullptr, operator==(char*, basic_string): received nullptr); +size_t __lhs_len = _Traits::length(__lhs); +if (__lhs_len != __rhs.size()) return false; +return _Traits::compare(__rhs.data(), __lhs, __lhs_len) == 0; } templateclass _CharT, class _Traits, class _Allocator @@ -3804,7 +3807,10 @@ operator==(const basic_string_CharT,_Traits,_Allocator __lhs, const _CharT* __rhs) _NOEXCEPT { -return __lhs.compare(__rhs) == 0; +_LIBCPP_ASSERT(__rhs != nullptr, operator==(basic_string, char*): received nullptr); +size_t __rhs_len = _Traits::length(__rhs); +if (__rhs_len != __lhs.size()) return false; +return _Traits::compare(__lhs.data(), __rhs, __rhs_len) == 0; } // operator!= Index: include/string === --- include/string +++ include/string @@ -3795,7 +3795,10 @@ operator==(const _CharT* __lhs, const basic_string_CharT, _Traits, _Allocator __rhs) _NOEXCEPT { -return __rhs.compare(__lhs) == 0; +_LIBCPP_ASSERT(__lhs != nullptr, operator==(char*, basic_string): received nullptr); +size_t __lhs_len = _Traits::length(__lhs); +if (__lhs_len != __rhs.size()) return false; +return _Traits::compare(__rhs.data(), __lhs, __lhs_len) == 0; } templateclass _CharT, class _Traits, class _Allocator @@ -3804,7 +3807,10 @@ operator==(const basic_string_CharT,_Traits,_Allocator __lhs, const _CharT* __rhs) _NOEXCEPT { -return __lhs.compare(__rhs) == 0; +_LIBCPP_ASSERT(__rhs != nullptr, operator==(basic_string, char*): received nullptr); +size_t __rhs_len = _Traits::length(__rhs); +if (__rhs_len != __lhs.size()) return false; +return _Traits::compare(__lhs.data(), __rhs, __rhs_len) == 0; } // operator!= ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12312: Emiting invariant.group.barrier and adding -fstrict-vptrs
rjmccall added inline comments. Comment at: include/clang/Driver/Options.td:990 @@ -988,2 +989,3 @@ value range; +def fstrict_vptrs: Flag[-], fstrict-vptrs, Groupf_Group, Flags[CC1Option]; def fstrict_overflow : Flag[-], fstrict-overflow, Groupf_Group; This needs documentation for the --help output, something like Enable optimizations based on the strict rules for overwriting polymorphic C++ objects. This option should eventually be promoted to be a driver option, so we might as well figure out the name now. I'd rather not introduce vptr to the user lexicon. I suggest -fstrict-vtable-pointers. Comment at: lib/CodeGen/CGClass.cpp:1279 @@ +1278,3 @@ + if (CGM.getCodeGenOpts().StrictVPtrs BaseVPtrsInitialized) +CXXThisValue = Builder.CreateInvariantGroupBarrier(LoadCXXThis()); + Prazek wrote: rjmccall wrote: Should this just be in InitializeVTablePointers? I want to add invariant.group.barrier only if it's needed. F.e. I don't want to put before I initialize vptrs for base, or when my class doesn't inherit frome anything. I want emit barrier after I will initialize some other vptrs. InitializeVptrs is called in EmitBaseInitializer, and also I woudnt want to put some extra flag if it must produce barrier or not (because it is hard to distinguish it from inside) Fair enough. Do we need to emit these barriers in unoptimized builds? Comment at: lib/CodeGen/CGClass.cpp:1487 @@ +1486,3 @@ +if (!CanSkipVTablePointerInitialization(getContext(), Dtor)) { + // Inserting llvm.invariant.group.barrier intrinsic before base vptrs + // initialization to stop propagating previous vptr value. Grammar: Insert the llvm.invariant.group.barrier intrinsic before initializing the vptrs to cancel any previous assumptions we might have made. http://reviews.llvm.org/D12312 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12313: Introduce __builtin_nontemporal_store and __builtin_nontemporal_load.
mzolotukhin updated this revision to Diff 33396. mzolotukhin added a comment. Address review remarks: - Remove typed versions - indeed, we don't need them. - Allow vector types. - Properly handle bool-type (promote i1 to i8). - Check arguments number. - Simplify SemaBuiltinNontemporalOverloaded (as we don't use typed versions now). - Add tests for vector and bool types. http://reviews.llvm.org/D12313 Files: include/clang/Basic/Builtins.def include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/Sema.h lib/CodeGen/CGBuiltin.cpp lib/Sema/SemaChecking.cpp test/CodeGen/Nontemporal.cpp Index: test/CodeGen/Nontemporal.cpp === --- /dev/null +++ test/CodeGen/Nontemporal.cpp @@ -0,0 +1,48 @@ +// Test frontend handling of nontemporal builtins. +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s + +signed char sc; +unsigned char uc; +signed short ss; +unsigned short us; +signed int si; +unsigned int ui; +signed long long sll; +unsigned long long ull; +float f1, f2; +double d1, d2; +float __attribute__((vector_size(16))) vf1, vf2; +char __attribute__((vector_size(8))) vc1, vc2; +bool b1, b2; + +void test_all_sizes(void) // CHECK-LABEL: test_all_sizes +{ + __builtin_nontemporal_store(true, b1); // CHECK: store i8 1, i8* @b1, align 1, !nontemporal + __builtin_nontemporal_store(b1, b2); // CHECK: store i8{{.*}}, align 1, !nontemporal + __builtin_nontemporal_store(1, uc);// CHECK: store i8{{.*}}align 1, !nontemporal + __builtin_nontemporal_store(1, sc);// CHECK: store i8{{.*}}align 1, !nontemporal + __builtin_nontemporal_store(1, us);// CHECK: store i16{{.*}}align 2, !nontemporal + __builtin_nontemporal_store(1, ss);// CHECK: store i16{{.*}}align 2, !nontemporal + __builtin_nontemporal_store(1, ui);// CHECK: store i32{{.*}}align 4, !nontemporal + __builtin_nontemporal_store(1, si);// CHECK: store i32{{.*}}align 4, !nontemporal + __builtin_nontemporal_store(1, ull); // CHECK: store i64{{.*}}align 8, !nontemporal + __builtin_nontemporal_store(1, sll); // CHECK: store i64{{.*}}align 8, !nontemporal + __builtin_nontemporal_store(1.0, f1); // CHECK: store float{{.*}}align 4, !nontemporal + __builtin_nontemporal_store(1.0, d1); // CHECK: store double{{.*}}align 8, !nontemporal + __builtin_nontemporal_store(vf1, vf2); // CHECK: store 4 x float{{.*}}align 16, !nontemporal + __builtin_nontemporal_store(vc1, vc2); // CHECK: store 8 x i8{{.*}}align 8, !nontemporal + + b1 = __builtin_nontemporal_load(b2); // CHECK: load i8{{.*}}align 1, !nontemporal + uc = __builtin_nontemporal_load(sc); // CHECK: load i8{{.*}}align 1, !nontemporal + sc = __builtin_nontemporal_load(uc); // CHECK: load i8{{.*}}align 1, !nontemporal + us = __builtin_nontemporal_load(ss); // CHECK: load i16{{.*}}align 2, !nontemporal + ss = __builtin_nontemporal_load(us); // CHECK: load i16{{.*}}align 2, !nontemporal + ui = __builtin_nontemporal_load(si); // CHECK: load i32{{.*}}align 4, !nontemporal + si = __builtin_nontemporal_load(ui); // CHECK: load i32{{.*}}align 4, !nontemporal + ull = __builtin_nontemporal_load(sll); // CHECK: load i64{{.*}}align 8, !nontemporal + sll = __builtin_nontemporal_load(ull); // CHECK: load i64{{.*}}align 8, !nontemporal + f1 = __builtin_nontemporal_load(f2); // CHECK: load float{{.*}}align 4, !nontemporal + d1 = __builtin_nontemporal_load(d2); // CHECK: load double{{.*}}align 8, !nontemporal + vf2 = __builtin_nontemporal_load(vf1); // CHECK: load 4 x float{{.*}}align 16, !nontemporal + vc2 = __builtin_nontemporal_load(vc1); // CHECK: load 8 x i8{{.*}}align 8, !nontemporal +} Index: lib/Sema/SemaChecking.cpp === --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -441,6 +441,9 @@ case Builtin::BI__sync_swap_8: case Builtin::BI__sync_swap_16: return SemaBuiltinAtomicOverloaded(TheCallResult); + case Builtin::BI__builtin_nontemporal_load: + case Builtin::BI__builtin_nontemporal_store: +return SemaBuiltinNontemporalOverloaded(TheCallResult); #define BUILTIN(ID, TYPE, ATTRS) #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \ case Builtin::BI##ID: \ @@ -2210,6 +2213,80 @@ return TheCallResult; } +/// SemaBuiltinNontemporalOverloaded - We have a call to +/// __builtin_nontemporal_store or __builtin_nontemporal_load, which is an +/// overloaded function based on the pointer type of its last argument. +/// The main ActOnCallExpr routines have already promoted the types of +/// arguments because all of these calls are prototyped as void(...). +/// +/// This function goes through and does final semantic checking for these +/// builtins. +ExprResult Sema::SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult) { + CallExpr *TheCall = (CallExpr *)TheCallResult.get(); + DeclRefExpr *DRE = +
[libcxx] r246250 - Creating release candidate final from release_370 branch
Author: hans Date: Thu Aug 27 20:43:57 2015 New Revision: 246250 URL: http://llvm.org/viewvc/llvm-project?rev=246250view=rev Log: Creating release candidate final from release_370 branch Added: libcxx/tags/RELEASE_370/final/ (props changed) - copied from r246249, libcxx/branches/release_37/ Propchange: libcxx/tags/RELEASE_370/final/ -- --- svn:mergeinfo (added) +++ svn:mergeinfo Thu Aug 27 20:43:57 2015 @@ -0,0 +1,2 @@ +/libcxx/branches/apple:136569-137939 +/libcxx/trunk:242377,242421,243530,243641,244003,244462 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r246251 - Creating release candidate final from release_370 branch
Author: hans Date: Thu Aug 27 20:44:00 2015 New Revision: 246251 URL: http://llvm.org/viewvc/llvm-project?rev=246251view=rev Log: Creating release candidate final from release_370 branch Added: libcxxabi/tags/RELEASE_370/final/ (props changed) - copied from r246250, libcxxabi/branches/release_37/ Propchange: libcxxabi/tags/RELEASE_370/final/ -- svn:mergeinfo = /libcxxabi/trunk:244004 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r246257 - Creating release candidate final from release_370 branch
Author: hans Date: Thu Aug 27 20:44:18 2015 New Revision: 246257 URL: http://llvm.org/viewvc/llvm-project?rev=246257view=rev Log: Creating release candidate final from release_370 branch Added: libunwind/tags/RELEASE_370/final/ (props changed) - copied from r246256, libunwind/branches/release_37/ Propchange: libunwind/tags/RELEASE_370/final/ -- svn:mergeinfo = /libunwind/trunk:242642,243073,244005,244237 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12355: [libcxx] Optimize away unneeded length calculation in basic_string::compare(const char*)
mclow.lists added a comment. The first change LGTM. The second one needs to match it. Comment at: include/string:3816 @@ -3808,2 +3815,3 @@ +return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0; } You'll want to do the same as above here. http://reviews.llvm.org/D12355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11380: Implement LFTS searchers. Boyer_Moore and Boyer_Moore_Horspool
mclow.lists added a comment. Two comments answered. One still remaining. Comment at: include/experimental/functional:256 @@ +255,3 @@ + +public: // TODO private: +_RandomAccessIterator1 __first_; EricWF wrote: Is this for testing? Well, for debugging. My first comment addressed this (basically, it will get changed). Comment at: include/experimental/functional:313 @@ +312,3 @@ + +void build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, +_BinaryPredicate __pred) EricWF wrote: This needs to be a reserved identifier right? You are correct. http://reviews.llvm.org/D11380 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r246275 - Finally get the test suite passing in C++03!!
Author: ericwf Date: Fri Aug 28 00:46:17 2015 New Revision: 246275 URL: http://llvm.org/viewvc/llvm-project?rev=246275view=rev Log: Finally get the test suite passing in C++03!! After months of work there are only 4 tests still failing in C++03. This patch fixes those tests. All of the libc++ builders should be green. Modified: libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp libcxx/trunk/test/std/experimental/algorithms/alg.search/search.pass.cpp libcxx/trunk/test/std/re/re.alg/re.alg.search/grep.pass.cpp libcxx/trunk/test/std/thread/thread.condition/notify_all_at_thread_exit.pass.cpp Modified: libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp?rev=246275r1=246274r2=246275view=diff == --- libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp (original) +++ libcxx/trunk/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp Fri Aug 28 00:46:17 2015 @@ -87,7 +87,8 @@ int main() { } { // Test with in-place shared_count. -Ptr p = std::make_sharedint(42); +int val = 42; +Ptr p = std::make_sharedint(val); run_test(p); assert(p.use_count() == 1); } Modified: libcxx/trunk/test/std/experimental/algorithms/alg.search/search.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/algorithms/alg.search/search.pass.cpp?rev=246275r1=246274r2=246275view=diff == --- libcxx/trunk/test/std/experimental/algorithms/alg.search/search.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/algorithms/alg.search/search.pass.cpp Fri Aug 28 00:46:17 2015 @@ -35,9 +35,9 @@ struct MySearcher { int main() { typedef int * RI; -static_assert(std::is_sameRI, decltype(std::experimental::search(RI(), RI(), MySearcher()))::value, ); +static_assert((std::is_sameRI, decltype(std::experimental::search(RI(), RI(), MySearcher()))::value), ); -RI it{nullptr}; +RI it(nullptr); assert(it == std::experimental::search(it, it, MySearcher())); assert(searcher_called == 1); } Modified: libcxx/trunk/test/std/re/re.alg/re.alg.search/grep.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.alg/re.alg.search/grep.pass.cpp?rev=246275r1=246274r2=246275view=diff == --- libcxx/trunk/test/std/re/re.alg/re.alg.search/grep.pass.cpp (original) +++ libcxx/trunk/test/std/re/re.alg/re.alg.search/grep.pass.cpp Fri Aug 28 00:46:17 2015 @@ -19,6 +19,7 @@ #include regex #include cassert +#include test_macros.h #include test_iterators.h extern C void LLVMFuzzerTestOneInput(const char *data) @@ -40,7 +41,10 @@ extern C void LLVMFuzzerTestOneInput(c void fuzz_tests() // patterns that the fuzzer has found { +// Raw string literals are a C++11 +#if TEST_STD_VER = 11 LLVMFuzzerTestOneInput(RXX(Ã)_%()()((\8'_%()_%()_%()_%(()_%()_%()_%(.t;)()Â¥f()_%()(.)_%;)()!Â¥f)()XX); +#endif } int main() Modified: libcxx/trunk/test/std/thread/thread.condition/notify_all_at_thread_exit.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.condition/notify_all_at_thread_exit.pass.cpp?rev=246275r1=246274r2=246275view=diff == --- libcxx/trunk/test/std/thread/thread.condition/notify_all_at_thread_exit.pass.cpp (original) +++ libcxx/trunk/test/std/thread/thread.condition/notify_all_at_thread_exit.pass.cpp Fri Aug 28 00:46:17 2015 @@ -9,6 +9,10 @@ // // UNSUPPORTED: libcpp-has-no-threads +// notify_all_at_thread_exit(...) requires move semantics to transfer the +// unique_lock. +// UNSUPPORTED: c++98, c++03 + // condition_variable // void ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12312: Emiting invariant.group.barrier and adding -fstrict-vptrs
rjmccall added inline comments. Comment at: lib/CodeGen/CGClass.cpp:1279 @@ +1278,3 @@ + if (CGM.getCodeGenOpts().StrictVPtrs BaseVPtrsInitialized) +CXXThisValue = Builder.CreateInvariantGroupBarrier(LoadCXXThis()); + Prazek wrote: rjmccall wrote: Prazek wrote: rjmccall wrote: Should this just be in InitializeVTablePointers? I want to add invariant.group.barrier only if it's needed. F.e. I don't want to put before I initialize vptrs for base, or when my class doesn't inherit frome anything. I want emit barrier after I will initialize some other vptrs. InitializeVptrs is called in EmitBaseInitializer, and also I woudnt want to put some extra flag if it must produce barrier or not (because it is hard to distinguish it from inside) Fair enough. Do we need to emit these barriers in unoptimized builds? It depends - if we will not add invariant.group metadata to loads/stores without optimizations, then we can not add theis invariant barrier stuff. My question is, if I will run clang clang++ stuff.cpp -O0 -fstrict-vptrs does it mean, that I don't want any optimizations, or it means that I don't want any optimizations except strict-vptrs? If answer is second one, then I think not checking for optimizations is fine (If we will change it to be default, then we will have to add Optmizations turned check) Well, we're not actually going to do the optimizations at -O0 in any case, and please emit the information necessary to do the optimizations without actually doing them is not an intermediate state that users actually want. The basic problem here continues to be that, as designed, this optimization is unsound without cooperation from every module that emitted any IR. In order for this optimization to qualify as a non-experimental feature, you will need to actually fix that so that it decays gracefully in the presence of a non-cooperating module. Once you do that, it will also be reasonable to omit these barriers at -O0. When we talked about this before, we had a workable, if conservative, plan for how to implement that graceful decay: you need to tag cooperating functions and then untag them when information is merged (e.g. by the inliner) from non-cooperating functions. Do you still see that as practical? http://reviews.llvm.org/D12312 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12381: [Static Analyzer] Merge the Objective-C Generics Checker into Dynamic Type Propagation checker.
zaks.anna added a comment. Partial review in-line. Comment at: lib/StaticAnalyzer/Checkers/Checkers.td:456 @@ -455,2 +455,3 @@ def ObjCGenericsChecker : CheckerObjCGenerics, HelpTextCheck for incorrect usages of parameterized types., + DescFileDynamicTypePropagation.cpp; We need a better description here this one is too vague. Maybe something like this one: Check for type errors when using Objective-C generics. Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:17 @@ -11,1 +16,3 @@ // +// Generics Checker: +// This checker tries to find type errors that the compiler is not able to catch Mention ObjC here. Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:45 @@ +44,3 @@ +class DynamicTypePropagation +: public Checkercheck::PreCall, check::PostCall, check::PreObjCMessage, + check::PostObjCMessage, check::DeadSymbols, nit: Let's go back to the formatting with a single line per callback. Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:48 @@ +47,3 @@ + check::PostStmtCastExpr, check::PostStmtCXXNewExpr { + mutable std::unique_ptrBugType BT; + Better name please, we might add more bug types. Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:76 @@ +75,3 @@ + + void reportGenericsBug(const ObjCObjectPointerType *From, + const ObjCObjectPointerType *To, ExplodedNode *N, Please, move the definitions outside to reduce clutter. Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:81 @@ +80,3 @@ +initBugType(); +SmallString64 Buf; +llvm::raw_svector_ostream OS(Buf); How do we know that the string is big enough? Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:83 @@ +82,3 @@ +llvm::raw_svector_ostream OS(Buf); +OS Incompatible pointer types assigning to '; +QualType::print(To, Qualifiers(), OS, C.getLangOpts(), llvm::Twine()); The error message does not sounds like a proper sentence.. Assigning from 'A' to 'B' sounds more natural. Are we only warning on assignments? Maybe converting would be more applicable in some contexts.. Something like this might be better: Conversion from value of type 'Integer' to incompatible type 'String' Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:105 @@ -43,1 +104,3 @@ + + DefaultBool CheckGenerics; }; Doxygen comment please. Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:179 @@ -178,3 @@ - // We only track dynamic type info for regions. - const MemRegion *ToR = C.getSVal(CastE).getAsRegion(); - if (!ToR) This line used to be unconditional and now, it's only executed if we are casting between ObjC Types. Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:407 @@ +406,3 @@ +// Clean up the states stored by the generics checker. +void DynamicTypePropagation::checkDeadSymbols(SymbolReaper SR, + CheckerContext C) const { Do you know if the info tracked by the DynamicTypeInfo checker gets cleaned up for dead symbols? Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:448 @@ -251,9 +447,3 @@ - // Get the old and new types. - const ObjCObjectPointerType *NewTy = - CastE-getType()-getAsObjCObjectPointerType(); - if (!NewTy) -return nullptr; - QualType OldDTy = C.getState()-getDynamicTypeInfo(ToR).getType(); - if (OldDTy.isNull()) { -return NewTy; +/// Get the most derived class if From that do not loose information about type +/// parameters. To has to be a subclass of From. From has to be specialized. Please, use doxygen. Also, the comment is not clear.. Ex: most derived class if From Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:456 @@ +455,3 @@ + +static bool storeWhenMoreInformative(ProgramStateRef State, SymbolRef Sym, + const ObjCObjectPointerType *const *Old, There s nothing about picking more informative type here.. especially with respect to informative term used in the previous function.. http://reviews.llvm.org/D12381 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12135: [libcxx] Mark most test/std/future tests as UNSUPPORTED in C++03
mclow.lists accepted this revision. mclow.lists added a comment. This revision is now accepted and ready to land. This looks very mechanical, except for the changes to test_allocator.h, and that's a bug fix. http://reviews.llvm.org/D12135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r246266 - [libcxx] Optimize away unneeded length calculation in basic_string::compare(const char*)
Author: ericwf Date: Thu Aug 27 22:02:37 2015 New Revision: 246266 URL: http://llvm.org/viewvc/llvm-project?rev=246266view=rev Log: [libcxx] Optimize away unneeded length calculation in basic_string::compare(const char*) Summary: This patch optimizes basic_string::compare to use strcmp when the default char_traits has been given. See PR19900 for more information. https://llvm.org/bugs/show_bug.cgi?id=19900 Reviewers: mclow.lists Subscribers: bkramer, cfe-commits Differential Revision: http://reviews.llvm.org/D12355 Modified: libcxx/trunk/include/string Modified: libcxx/trunk/include/string URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=246266r1=246265r2=246266view=diff == --- libcxx/trunk/include/string (original) +++ libcxx/trunk/include/string Thu Aug 27 22:02:37 2015 @@ -3795,7 +3795,11 @@ bool operator==(const _CharT* __lhs, const basic_string_CharT, _Traits, _Allocator __rhs) _NOEXCEPT { -return __rhs.compare(__lhs) == 0; +typedef basic_string_CharT, _Traits, _Allocator _String; +_LIBCPP_ASSERT(__lhs != nullptr, operator==(char*, basic_string): received nullptr); +size_t __lhs_len = _Traits::length(__lhs); +if (__lhs_len != __rhs.size()) return false; +return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0; } templateclass _CharT, class _Traits, class _Allocator @@ -3804,7 +3808,11 @@ bool operator==(const basic_string_CharT,_Traits,_Allocator __lhs, const _CharT* __rhs) _NOEXCEPT { -return __lhs.compare(__rhs) == 0; +typedef basic_string_CharT, _Traits, _Allocator _String; +_LIBCPP_ASSERT(__rhs != nullptr, operator==(basic_string, char*): received nullptr); +size_t __rhs_len = _Traits::length(__rhs); +if (__rhs_len != __lhs.size()) return false; +return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0; } // operator!= ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r246270 - Fix bug in test_allocatorvoid that used the wrong value to represent object state
Author: ericwf Date: Fri Aug 28 00:00:25 2015 New Revision: 246270 URL: http://llvm.org/viewvc/llvm-project?rev=246270view=rev Log: Fix bug in test_allocatorvoid that used the wrong value to represent object state Modified: libcxx/trunk/test/support/test_allocator.h Modified: libcxx/trunk/test/support/test_allocator.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_allocator.h?rev=246270r1=246269r2=246270view=diff == --- libcxx/trunk/test/support/test_allocator.h (original) +++ libcxx/trunk/test/support/test_allocator.h Fri Aug 28 00:00:25 2015 @@ -171,13 +171,13 @@ public: template class U struct rebind {typedef test_allocatorU other;}; -test_allocator() throw() : data_(-1) {} +test_allocator() throw() : data_(0) {} explicit test_allocator(int i) throw() : data_(i) {} test_allocator(const test_allocator a) throw() : data_(a.data_) {} template class U test_allocator(const test_allocatorU a) throw() : data_(a.data_) {} -~test_allocator() throw() {data_ = 0;} +~test_allocator() throw() {data_ = -1;} friend bool operator==(const test_allocator x, const test_allocator y) {return x.data_ == y.data_;} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12173: [libcxx] Constrain unique_ptr::operator=(unique_ptrTp, Dp) in C++03 mode
mclow.lists accepted this revision. mclow.lists added a comment. This revision is now accepted and ready to land. This is just making the two halves of the #ifdef consistent. LGTM. http://reviews.llvm.org/D12173 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r246260 - Instead of duplicating code, call the base implementation.
Author: echristo Date: Thu Aug 27 21:14:00 2015 New Revision: 246260 URL: http://llvm.org/viewvc/llvm-project?rev=246260view=rev Log: Instead of duplicating code, call the base implementation. Modified: cfe/trunk/lib/Basic/Targets.cpp Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=246260r1=246259r2=246260view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug 27 21:14:00 2015 @@ -1071,13 +1071,7 @@ bool PPCTargetInfo::handleUserFeatures(l } } - for (const auto F : FAW) { -const char *Name = F.c_str(); -// Apply the feature via the target. -bool Enabled = Name[0] == '+'; -setFeatureEnabled(Features, Name + 1, Enabled); - } - return true; + return TargetInfo::handleUserFeatures(Features, FAW, Diags); } /// PPCTargetInfo::getTargetDefines - Return a set of the PowerPC-specific ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r246272 - [libcxx] Constrain unique_ptr::operator=(unique_ptrTp, Dp) in C++03 mode
Author: ericwf Date: Fri Aug 28 00:07:06 2015 New Revision: 246272 URL: http://llvm.org/viewvc/llvm-project?rev=246272view=rev Log: [libcxx] Constrain unique_ptr::operator=(unique_ptrTp, Dp) in C++03 mode Summary: This patch properly constrains the converting assignment operator in C++03. It also fixes a bug where std::forward was given the wrong type. The following two tests begin passing in C++03: * `unique_ptr.single.asgn/move_convert.pass.cpp` * `unique_ptr.single.asgn/move_convert13.fail.cpp` Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12173 Modified: libcxx/trunk/include/memory Modified: libcxx/trunk/include/memory URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=246272r1=246271r2=246272view=diff == --- libcxx/trunk/include/memory (original) +++ libcxx/trunk/include/memory Fri Aug 28 00:07:06 2015 @@ -2668,10 +2668,17 @@ public: : __ptr_(__u-release(), _VSTD::forwarddeleter_type(__u-get_deleter())) {} template class _Up, class _Ep -_LIBCPP_INLINE_VISIBILITY unique_ptr operator=(unique_ptr_Up, _Ep __u) +_LIBCPP_INLINE_VISIBILITY +typename enable_if +!is_array_Up::value +is_convertibletypename unique_ptr_Up, _Ep::pointer, pointer::value +is_assignabledeleter_type, _Ep::value, +unique_ptr +::type +operator=(unique_ptr_Up, _Ep __u) { reset(__u.release()); -__ptr_.second() = _VSTD::forwarddeleter_type(__u.get_deleter()); +__ptr_.second() = _VSTD::forward_Ep(__u.get_deleter()); return *this; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12358: [Analyzer] Handling constant bound loops
zaks.anna added a comment. I accept that my current patch is not a comprehensive solution to the problem and that it may introduce false positives, however I do think it is an improvement, where it is preferable to have false positives over doing no analysis after the loop. We try to avoid false positives as much as possible. They are very painful for users to deal with. In my experience, constant bound loops are normally used to make simple modifications to fixed length collections of data, I think the behaviour of the majority of these loops will be represented by the first and last iteration. The main issue with the patch is that it produces a false path on which value of only one of the variables is reset to the last iteration of the loop and the rest of them are set as if it is the 3d iteration. A way to solve this is to compute what can be invalidated by the loop and set those to unknown values (a widening operation). You should develop this feature behind a flag. This would allow for incremental development and simplify evaluation. http://reviews.llvm.org/D12358 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12313: Introduce __builtin_nontemporal_store and __builtin_nontemporal_load.
mzolotukhin added a comment. Hi Richard, Hal, and others, I updated the patch according to review remarks - now we support vector and boolean types too! Could you please take a look? Thanks, Michael Comment at: lib/CodeGen/CGBuiltin.cpp:128-129 @@ +127,4 @@ + Val = CGF.EmitToMemory(Val, E-getArg(0)-getType()); + Value *BC = CGF.Builder.CreateBitCast( + Address, llvm::PointerType::getUnqual(Val-getType()), cast); + StoreInst *SI = CGF.Builder.CreateStore(Val, BC); Thanks! Fixed. Comment at: lib/CodeGen/CGBuiltin.cpp:149 @@ +148,3 @@ + return LI; +} + In this case we already have with `i8` value - AFAIU, we get `i8*` pointer from `EmitScalarExpr(E-getArg(0))`. Do I miss something here? Comment at: lib/Sema/SemaChecking.cpp:2236-2242 @@ +2235,9 @@ + + // Ensure that we have the proper number of arguments. + if (checkArgCount(*this, TheCall, numArgs)) +return ExprError(); + + // Inspect the last argument of the nontemporal builtin. This should always + // be a pointer type, from which we imply the type of the memory access. + // Because it is a pointer type, we don't have to worry about any implicit + // casts here. Good idea, thanks! http://reviews.llvm.org/D12313 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D12422: Allow TLS vars in dllimport/export functions; only inline dllimport functions when safe (PR24593)
hans created this revision. hans added a reviewer: majnemer. hans added a subscriber: cfe-commits. This seems to match the MS behaviour. http://reviews.llvm.org/D12422 Files: lib/CodeGen/CodeGenModule.cpp lib/Sema/SemaDecl.cpp test/CodeGenCXX/dllimport.cpp test/SemaCXX/dllexport.cpp test/SemaCXX/dllimport.cpp Index: test/SemaCXX/dllimport.cpp === --- test/SemaCXX/dllimport.cpp +++ test/SemaCXX/dllimport.cpp @@ -93,6 +93,18 @@ // Thread local variables are invalid. __declspec(dllimport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllimport'}} +inline void InlineWithThreadLocal() { + static __declspec(dllimport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllimport'}} +} + +// But if they're in a dllimported function, it's OK because we will not inline the function. +// This doesn't work on MinGW, because there, dllimport on the inline function is ignored. +#ifndef GNU +inline void __declspec(dllimport) ImportedInlineWithThreadLocal() { + static __declspec(dllimport) __thread int OK1; // no-error + static __thread int OK2; // no-error +} +#endif // Import in local scope. __declspec(dllimport) float LocalRedecl1; // expected-note{{previous declaration is here}} Index: test/SemaCXX/dllexport.cpp === --- test/SemaCXX/dllexport.cpp +++ test/SemaCXX/dllexport.cpp @@ -71,6 +71,15 @@ // Thread local variables are invalid. __declspec(dllexport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllexport'}} +inline void InlineWithThreadLocal() { + static __declspec(dllexport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllexport'}} +} + +// But if they're in a dllexport function, it's ok, because they will never get imported. +inline void __declspec(dllexport) ExportedInlineWithThreadLocal() { + static __declspec(dllexport) __thread int OK1; // no-error + static __thread int OK2; // no-error +} // Export in local scope. void functionScope() { Index: test/CodeGenCXX/dllimport.cpp === --- test/CodeGenCXX/dllimport.cpp +++ test/CodeGenCXX/dllimport.cpp @@ -86,7 +86,7 @@ namespace ns { __declspec(dllimport) int ExternalGlobal; } USEVAR(ns::ExternalGlobal) -int f(); +int __declspec(dllimport) f(); // MO1-DAG: @\01?x@?1??inlineStaticLocalsFunc@@YAHXZ@4HA = available_externally dllimport global i32 0 // MO1-DAG: @\01??_B?1??inlineStaticLocalsFunc@@YAHXZ@51 = available_externally dllimport global i32 0 inline int __declspec(dllimport) inlineStaticLocalsFunc() { @@ -314,6 +314,46 @@ namespace ns { __declspec(dllimport) void externalFunc(); } USE(ns::externalFunc) +// A dllimport function referencing non-imported vars or functions must not be available_externally. +__declspec(dllimport) int ImportedVar; +int NonImportedVar; +__declspec(dllimport) int ImportedFunc(); +int NonImportedFunc(); +__declspec(dllimport) inline int ReferencingImportedVar() { return ImportedVar; } +// MO1-DAG: define available_externally dllimport i32 @\01?ReferencingImportedVar@@YAHXZ +__declspec(dllimport) inline int ReferencingNonImportedVar() { return NonImportedVar; } +// MO1-DAG: declare dllimport i32 @\01?ReferencingNonImportedVar@@YAHXZ() +__declspec(dllimport) inline int ReferencingImportedFunc() { return ImportedFunc(); } +// MO1-DAG: define available_externally dllimport i32 @\01?ReferencingImportedFunc@@YAHXZ +__declspec(dllimport) inline int ReferencingNonImportedFunc() { return NonImportedFunc(); } +// MO1-DAG: declare dllimport i32 @\01?ReferencingNonImportedFunc@@YAHXZ() +USE(ReferencingImportedVar) +USE(ReferencingNonImportedVar) +USE(ReferencingImportedFunc) +USE(ReferencingNonImportedFunc) +// References to operator new and delete count too, despite not being DeclRefExprs. +__declspec(dllimport) inline int *ReferencingNonImportedNew() { return new int[2]; } +// MO1-DAG: declare dllimport i32* @\01?ReferencingNonImportedNew@@YAPAHXZ +__declspec(dllimport) inline int *ReferencingNonImportedDelete() { delete (int*)nullptr; } +// MO1-DAG: declare dllimport i32* @\01?ReferencingNonImportedDelete@@YAPAHXZ +USE(ReferencingNonImportedNew) +USE(ReferencingNonImportedDelete) +__declspec(dllimport) void* operator new[](__SIZE_TYPE__); +__declspec(dllimport) void operator delete(void*); +__declspec(dllimport) inline int *ReferencingImportedNew() { return new int[2]; } +// MO1-DAG: define available_externally dllimport i32* @\01?ReferencingImportedNew@@YAPAHXZ +__declspec(dllimport) inline int *ReferencingImportedDelete() { delete (int*)nullptr; } +// MO1-DAG: define available_externally dllimport i32* @\01?ReferencingImportedDelete@@YAPAHXZ
Re: r246229 - [X86] Conditionalize Darwin MaxVectorAlign on the presence of AVX.
Hi Ahmed, A quick note: I think this is going to fail in the presence of the target attribute. I.e. if someone decorates a function with __attribute__((target(avx512))) this is unlikely to catch that. Also, should we do this for all of the x86 OSes? -eric On Thu, Aug 27, 2015 at 3:31 PM Ahmed Bougacha via cfe-commits cfe-commits@lists.llvm.org wrote: Author: ab Date: Thu Aug 27 17:30:38 2015 New Revision: 246229 URL: http://llvm.org/viewvc/llvm-project?rev=246229view=rev Log: [X86] Conditionalize Darwin MaxVectorAlign on the presence of AVX. There's no point in using a larger alignment if we have no instructions that would benefit from it. Differential Revision: http://reviews.llvm.org/D12389 Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/CodeGen/vector-alignment.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=246229r1=246228r2=246229view=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Thu Aug 27 17:30:38 2015 @@ -3629,13 +3629,21 @@ public: LongDoubleWidth = 128; LongDoubleAlign = 128; SuitableAlign = 128; -MaxVectorAlign = 256; SizeType = UnsignedLong; IntPtrType = SignedLong; DataLayoutString = e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128; HasAlignMac68kSupport = true; } + bool handleTargetFeatures(std::vectorstd::string Features, +DiagnosticsEngine Diags) override { +if (!DarwinTargetInfoX86_32TargetInfo::handleTargetFeatures(Features, + Diags)) + return false; +// Now that we know if we have AVX, we can decide how to align vectors. +MaxVectorAlign = hasFeature(avx) ? 256 : 128; +return true; + } }; // x86-32 Windows target @@ -3986,13 +3994,22 @@ public: DarwinX86_64TargetInfo(const llvm::Triple Triple) : DarwinTargetInfoX86_64TargetInfo(Triple) { Int64Type = SignedLongLong; -MaxVectorAlign = 256; // The 64-bit iOS simulator uses the builtin bool type for Objective-C. llvm::Triple T = llvm::Triple(Triple); if (T.isiOS()) UseSignedCharForObjCBool = false; DataLayoutString = e-m:o-i64:64-f80:128-n8:16:32:64-S128; } + + bool handleTargetFeatures(std::vectorstd::string Features, +DiagnosticsEngine Diags) override { +if (!DarwinTargetInfoX86_64TargetInfo::handleTargetFeatures(Features, + Diags)) + return false; +// Now that we know if we have AVX, we can decide how to align vectors. +MaxVectorAlign = hasFeature(avx) ? 256 : 128; +return true; + } }; class OpenBSDX86_64TargetInfo : public OpenBSDTargetInfoX86_64TargetInfo { Modified: cfe/trunk/test/CodeGen/vector-alignment.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/vector-alignment.c?rev=246229r1=246228r2=246229view=diff == --- cfe/trunk/test/CodeGen/vector-alignment.c (original) +++ cfe/trunk/test/CodeGen/vector-alignment.c Thu Aug 27 17:30:38 2015 @@ -1,38 +1,51 @@ -// RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=SSE +// RUN: %clang_cc1 -w -triple i386-apple-darwin10 \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=SSE +// RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -target-feature +avx \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX +// RUN: %clang_cc1 -w -triple i386-apple-darwin10 -target-feature +avx \ +// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX // rdar://11759609 // At or below target max alignment with no aligned attribute should align based // on the size of vector. double __attribute__((vector_size(16))) v1; -// CHECK: @v1 {{.*}}, align 16 +// SSE: @v1 {{.*}}, align 16 +// AVX: @v1 {{.*}}, align 16 double __attribute__((vector_size(32))) v2; -// CHECK: @v2 {{.*}}, align 32 +// SSE: @v2 {{.*}}, align 16 +// AVX: @v2 {{.*}}, align 32 // Alignment above target max alignment with no aligned attribute should align // based on the target max. double __attribute__((vector_size(64))) v3; -// CHECK: @v3 {{.*}}, align 32 +// SSE: @v3 {{.*}}, align 16 +// AVX: @v3 {{.*}}, align 32 double __attribute__((vector_size(1024))) v4; -// CHECK: @v4 {{.*}}, align 32 +// SSE: @v4 {{.*}}, align 16 +// AVX: @v4 {{.*}}, align 32 // Aliged attribute should always override. double __attribute__((vector_size(16), aligned(16)))
r246263 - PR24597: Fix in-place evaluation of call expressions to provide a proper this
Author: rsmith Date: Thu Aug 27 21:43:42 2015 New Revision: 246263 URL: http://llvm.org/viewvc/llvm-project?rev=246263view=rev Log: PR24597: Fix in-place evaluation of call expressions to provide a proper this pointer to an RVO construction of a returned object. Modified: cfe/trunk/lib/AST/ExprConstant.cpp cfe/trunk/test/PCH/cxx1y-default-initializer.cpp cfe/trunk/test/SemaCXX/constant-expression-cxx11.cpp Modified: cfe/trunk/lib/AST/ExprConstant.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=246263r1=246262r2=246263view=diff == --- cfe/trunk/lib/AST/ExprConstant.cpp (original) +++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Aug 27 21:43:42 2015 @@ -3248,12 +3248,21 @@ static bool EvaluateCond(EvalInfo Info, return EvaluateAsBooleanCondition(Cond, Result, Info); } -static EvalStmtResult EvaluateStmt(APValue Result, EvalInfo Info, +/// \brief A location where the result (returned value) of evaluating a +/// statement should be stored. +struct StmtResult { + /// The APValue that should be filled in with the returned value. + APValue Value; + /// The location containing the result, if any (used to support RVO). + const LValue *Slot; +}; + +static EvalStmtResult EvaluateStmt(StmtResult Result, EvalInfo Info, const Stmt *S, const SwitchCase *SC = nullptr); /// Evaluate the body of a loop, and translate the result as appropriate. -static EvalStmtResult EvaluateLoopBody(APValue Result, EvalInfo Info, +static EvalStmtResult EvaluateLoopBody(StmtResult Result, EvalInfo Info, const Stmt *Body, const SwitchCase *Case = nullptr) { BlockScopeRAII Scope(Info); @@ -3272,7 +3281,7 @@ static EvalStmtResult EvaluateLoopBody(A } /// Evaluate a switch statement. -static EvalStmtResult EvaluateSwitch(APValue Result, EvalInfo Info, +static EvalStmtResult EvaluateSwitch(StmtResult Result, EvalInfo Info, const SwitchStmt *SS) { BlockScopeRAII Scope(Info); @@ -3329,7 +3338,7 @@ static EvalStmtResult EvaluateSwitch(APV } // Evaluate a statement. -static EvalStmtResult EvaluateStmt(APValue Result, EvalInfo Info, +static EvalStmtResult EvaluateStmt(StmtResult Result, EvalInfo Info, const Stmt *S, const SwitchCase *Case) { if (!Info.nextStep(S)) return ESR_Failed; @@ -3435,7 +3444,10 @@ static EvalStmtResult EvaluateStmt(APVal case Stmt::ReturnStmtClass: { const Expr *RetExpr = castReturnStmt(S)-getRetValue(); FullExpressionRAII Scope(Info); -if (RetExpr !Evaluate(Result, Info, RetExpr)) +if (RetExpr +!(Result.Slot + ? EvaluateInPlace(Result.Value, Info, *Result.Slot, RetExpr) + : Evaluate(Result.Value, Info, RetExpr))) return ESR_Failed; return ESR_Returned; } @@ -3705,7 +3717,8 @@ static bool EvaluateArgs(ArrayRefconst static bool HandleFunctionCall(SourceLocation CallLoc, const FunctionDecl *Callee, const LValue *This, ArrayRefconst Expr* Args, const Stmt *Body, - EvalInfo Info, APValue Result) { + EvalInfo Info, APValue Result, + const LValue *ResultSlot) { ArgVector ArgValues(Args.size()); if (!EvaluateArgs(Args, ArgValues, Info)) return false; @@ -3740,7 +3753,8 @@ static bool HandleFunctionCall(SourceLoc return true; } - EvalStmtResult ESR = EvaluateStmt(Result, Info, Body); + StmtResult Ret = {Result, ResultSlot}; + EvalStmtResult ESR = EvaluateStmt(Ret, Info, Body); if (ESR == ESR_Succeeded) { if (Callee-getReturnType()-isVoidType()) return true; @@ -3769,6 +3783,11 @@ static bool HandleConstructorCall(Source CallStackFrame Frame(Info, CallLoc, Definition, This, ArgValues.data()); + // FIXME: Creating an APValue just to hold a nonexistent return value is + // wasteful. + APValue RetVal; + StmtResult Ret = {RetVal, nullptr}; + // If it's a delegating constructor, just delegate. if (Definition-isDelegatingConstructor()) { CXXConstructorDecl::init_const_iterator I = Definition-init_begin(); @@ -3777,7 +3796,7 @@ static bool HandleConstructorCall(Source if (!EvaluateInPlace(Result, Info, This, (*I)-getInit())) return false; } -return EvaluateStmt(Result, Info, Definition-getBody()) != ESR_Failed; +return EvaluateStmt(Ret, Info, Definition-getBody()) != ESR_Failed; } // For a trivial copy or move constructor, perform an APValue copy. This is @@ -3885,7 +3904,7 @@ static bool HandleConstructorCall(Source } return Success - EvaluateStmt(Result, Info, Definition-getBody()) != ESR_Failed; + EvaluateStmt(Ret,