Re: r213213 - DebugInfo: Forward HandleTagDeclRequiredDefinition through MultiplexConsumer to fix debug info emission in the presence of plugins.
Zombie review comment: ".test" isn't part of test/lit.cfg::config.suffixes, so the two .test files added in this change never run unless you explicitly run them (e.g. with `bin/llvm-lit ../llvm-rw/tools/clang/test/CodeGenCXX/*.test`). CodeGenCXX/debug-info-class-limited.test fails when I run it like that. (resending with cfe-commits address changed to new address) On Wed, Jul 16, 2014 at 7:52 PM, David Blaikiewrote: > Author: dblaikie > Date: Wed Jul 16 18:52:46 2014 > New Revision: 213213 > > URL: http://llvm.org/viewvc/llvm-project?rev=213213=rev > Log: > DebugInfo: Forward HandleTagDeclRequiredDefinition through > MultiplexConsumer to fix debug info emission in the presence of plugins. > > When plugins are used the Multiplex(AST)Consumer is employed to dispatch > to both the plugin ASTConsumers and the IRGen ASTConsumer. It wasn't > dispatching a critical call for debug info, resulting in plugin users > having a negative debugging experience. > > While I'm here, forward a bunch of other missing calls through the > consumer that seem like they should be there. > > To test this, use the example plugin (requires plugins and examples) and > split the test case up so that the plugin testing can be done under that > requirement while the non-plugin testing will execute even in builds > that don't include plugin support or examples. > > Added: > cfe/trunk/test/CodeGenCXX/Inputs/debug-info-class-limited.cpp > - copied, changed from r213212, > cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp > cfe/trunk/test/CodeGenCXX/debug-info-class-limited-plugin.test > cfe/trunk/test/CodeGenCXX/debug-info-class-limited.test > Removed: > cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp > Modified: > cfe/trunk/include/clang/Frontend/MultiplexConsumer.h > cfe/trunk/lib/Frontend/MultiplexConsumer.cpp > > Modified: cfe/trunk/include/clang/Frontend/MultiplexConsumer.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/MultiplexConsumer.h?rev=213213=213212=213213=diff > > == > --- cfe/trunk/include/clang/Frontend/MultiplexConsumer.h (original) > +++ cfe/trunk/include/clang/Frontend/MultiplexConsumer.h Wed Jul 16 > 18:52:46 2014 > @@ -40,8 +40,14 @@ public: >void HandleInterestingDecl(DeclGroupRef D) override; >void HandleTranslationUnit(ASTContext ) override; >void HandleTagDeclDefinition(TagDecl *D) override; > + void HandleTagDeclRequiredDefinition(const TagDecl *D) override; >void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D) override; >void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) override; > + void HandleImplicitImportDecl(ImportDecl *D) override; > + void HandleLinkerOptionPragma(llvm::StringRef Opts) override; > + void HandleDetectMismatch(llvm::StringRef Name, > +llvm::StringRef Value) override; > + void HandleDependentLibrary(llvm::StringRef Lib) override; >void CompleteTentativeDefinition(VarDecl *D) override; >void HandleVTable(CXXRecordDecl *RD, bool DefinitionRequired) override; >ASTMutationListener *GetASTMutationListener() override; > > Modified: cfe/trunk/lib/Frontend/MultiplexConsumer.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/MultiplexConsumer.cpp?rev=213213=213212=213213=diff > > == > --- cfe/trunk/lib/Frontend/MultiplexConsumer.cpp (original) > +++ cfe/trunk/lib/Frontend/MultiplexConsumer.cpp Wed Jul 16 18:52:46 2014 > @@ -251,6 +251,11 @@ void MultiplexConsumer::HandleTagDeclDef > Consumers[i]->HandleTagDeclDefinition(D); > } > > +void MultiplexConsumer::HandleTagDeclRequiredDefinition(const TagDecl *D) > { > + for (size_t i = 0, e = Consumers.size(); i != e; ++i) > +Consumers[i]->HandleTagDeclRequiredDefinition(D); > +} > + > void > MultiplexConsumer::HandleCXXImplicitFunctionInstantiation(FunctionDecl *D){ >for (size_t i = 0, e = Consumers.size(); i != e; ++i) > Consumers[i]->HandleCXXImplicitFunctionInstantiation(D); > @@ -261,6 +266,26 @@ void MultiplexConsumer::HandleTopLevelDe > Consumers[i]->HandleTopLevelDeclInObjCContainer(D); > } > > +void MultiplexConsumer::HandleImplicitImportDecl(ImportDecl *D) { > + for (size_t i = 0, e = Consumers.size(); i != e; ++i) > +Consumers[i]->HandleImplicitImportDecl(D); > +} > + > +void MultiplexConsumer::HandleLinkerOptionPragma(llvm::StringRef Opts) { > + for (size_t i = 0, e = Consumers.size(); i != e; ++i) > +Consumers[i]->HandleLinkerOptionPragma(Opts); > +} > + > +void MultiplexConsumer::HandleDetectMismatch(llvm::StringRef Name, > llvm::StringRef Value) { > + for (size_t i = 0, e = Consumers.size(); i != e; ++i) > +Consumers[i]->HandleDetectMismatch(Name, Value); > +} > + > +void MultiplexConsumer::HandleDependentLibrary(llvm::StringRef Lib) { > + for (size_t i = 0,
Re: [PATCH] D20608: clang-cl: Treat dllimport explicit template instantiation definitions as declarations (PR27810, PR27811)
thakis added a comment. Looks great, thanks! A few minor questions below. I verified that this has the same effect as my brute-force patch I tried locally. Do we have test coverage for `template class __declspec(dllexport) codecvt;` somewhere already? Comment at: lib/Sema/SemaTemplate.cpp:7382 @@ +7381,3 @@ + if (A->getKind() == AttributeList::AT_DLLExport) +DLLImport = false; +} If there are multiple dllexports and dllimports on an explicit instantiation, cl.exe just silently picks the last one? Comment at: lib/Sema/SemaTemplate.cpp:7467 @@ +7466,3 @@ +// The new specialization might add a dllimport attribute. +HasNoEffect = false; + } HasNoEffect is read two times before it's updated here. Is it intentional that you only change it after it's been read twice? If so, maybe add a comment why, since it looks not intentional else. (And make sure there's test coverage for setting it at the right time) http://reviews.llvm.org/D20608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20621: [include-fixer] Create a mode in vim integration to show multiple potential headers.
bkramer added inline comments. Comment at: include-fixer/IncludeFixer.h:51 @@ -50,6 +50,3 @@ - /// Headers to be added. - std::set - - /// Replacements are written here. - std::vector + /// The context that contains all information about queried symbol. + IncludeFixerContext maybe 'about the symbol being queried'? Comment at: include-fixer/IncludeFixer.h:72 @@ +71,3 @@ +StringRef Code, StringRef FilePath, StringRef FallbackStyle, +unsigned FirstIncludeOffset, const std::string ); + 'Header' looks like it should be a StringRef too. Comment at: include-fixer/IncludeFixerContext.h:19 @@ +18,3 @@ + +struct IncludeFixerContext { + std::string SymbolIdentifer; I think some doxygen comments would be in order for this struct and its members. Comment at: include-fixer/tool/ClangIncludeFixer.cpp:62 @@ -58,1 +61,3 @@ +cl::opt OuputHeaders( +"output-headers", typo: Ouput http://reviews.llvm.org/D20621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20621: [include-fixer] Create a mode in vim integration to show multiple potential headers.
bkramer added a comment. Can you add some lit tests for the various command line modes clang-include-fixer has now. We can't reasonably test the vim integration but we can tests the bits it's composed of. http://reviews.llvm.org/D20621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20621: [include-fixer] Create a mode in vim integration to show multiple potential headers.
hokein updated this revision to Diff 58448. hokein marked 6 inline comments as done. hokein added a comment. Update and address comments. http://reviews.llvm.org/D20621 Files: include-fixer/IncludeFixer.cpp include-fixer/IncludeFixer.h include-fixer/IncludeFixerContext.h include-fixer/tool/ClangIncludeFixer.cpp include-fixer/tool/clang-include-fixer.py unittests/include-fixer/IncludeFixerTest.cpp Index: unittests/include-fixer/IncludeFixerTest.cpp === --- unittests/include-fixer/IncludeFixerTest.cpp +++ unittests/include-fixer/IncludeFixerTest.cpp @@ -70,11 +70,16 @@ SymbolIndexMgr->addSymbolIndex( llvm::make_unique(Symbols)); - std::set Headers; - std::vector Replacements; - IncludeFixerActionFactory Factory(*SymbolIndexMgr, Headers, Replacements, -"llvm"); + IncludeFixerContext FixerContext; + IncludeFixerActionFactory Factory(*SymbolIndexMgr, FixerContext, "llvm"); + runOnCode(, Code, "input.cc", ExtraArgs); + std::vector Replacements; + if (!FixerContext.Headers.empty()) { +Replacements = clang::include_fixer::CreateReplacementsForHeader( +Code, "input.cc", "llvm", FixerContext.FirstIncludeOffset, +FixerContext.Headers.front()); + } clang::RewriterTestContext Context; clang::FileID ID = Context.createInMemoryFile("input.cc", Code); clang::tooling::applyAllReplacements(Replacements, Context.Rewrite); Index: include-fixer/tool/clang-include-fixer.py === --- include-fixer/tool/clang-include-fixer.py +++ include-fixer/tool/clang-include-fixer.py @@ -28,6 +28,34 @@ if vim.eval('exists("g:clang_include_fixer_path")') == "1": binary = vim.eval('g:clang_include_fixer_path') +choosing_mode = False +if vim.eval('exists("g:clang_include_fixer_choosing_mode")') == "1": + choosing_mode = vim.eval('g:clang_include_fixer_choosing_mode') + + +def FillVimBuffer(stdout): + if stdout: +lines = stdout.splitlines() +sequence = difflib.SequenceMatcher(None, vim.current.buffer, lines) +for op in reversed(sequence.get_opcodes()): + if op[0] is not 'equal': +vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]] + + +def ShowDialog(message, choices, default_choice_index=0): + to_eval = "confirm('{0}', '{1}', '{2}')".format(message, + choices, + default_choice_index) + return int(vim.eval(to_eval)); + + +def execute(command, text): + p = subprocess.Popen(command, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + stdin=subprocess.PIPE) + return p.communicate(input=text) + + def main(): parser = argparse.ArgumentParser( description='Vim integration for clang-include-fixer') @@ -41,24 +69,42 @@ buf = vim.current.buffer text = '\n'.join(buf) + if choosing_mode: +# Run command to get all headers. +command = [binary, "-output-headers", "-db="+args.db, "-input="+args.input, + vim.current.buffer.name] +stdout, stderr = execute(command, text) +lines = stdout.splitlines() +if len(lines) == 0: + return +# The first line is the symbol name. +symbol = lines[0] +choices_message = "" +index = 1; +for header in lines[1:]: + choices_message += "&" + str(index) + header + "\n" + index += 1 +select = ShowDialog("choose a header file for {0}.".format(symbol), +choices_message) +# Insert a selected header. +command = [binary, "-stdin", "-insert-header="+lines[select], + vim.current.buffer.name] +stdout, stderr = execute(command, text) +FillVimBuffer(stdout) +print "Added #include {0}.".format(lines[select]) +return; + + # Call clang-include-fixer. command = [binary, "-stdin", "-db="+args.db, "-input="+args.input, vim.current.buffer.name] - p = subprocess.Popen(command, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, - stdin=subprocess.PIPE) - stdout, stderr = p.communicate(input=text) + stdout, stderr = execute(command, text) # If successful, replace buffer contents. if stderr: print stderr - if stdout: -lines = stdout.splitlines() -sequence = difflib.SequenceMatcher(None, vim.current.buffer, lines) -for op in reversed(sequence.get_opcodes()): - if op[0] is not 'equal': -vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]] + FillVimBuffer(stdout) if __name__ == '__main__': main() Index: include-fixer/tool/ClangIncludeFixer.cpp === --- include-fixer/tool/ClangIncludeFixer.cpp +++ include-fixer/tool/ClangIncludeFixer.cpp @@ -9,13 +9,16 @@ #include "InMemorySymbolIndex.h" #include "IncludeFixer.h" +#include
Re: [PATCH] D20608: clang-cl: Treat dllimport explicit template instantiation definitions as declarations (PR27810, PR27811)
hans added a comment. In http://reviews.llvm.org/D20608#438760, @majnemer wrote: > Does this change our behavior for mingw? No, this only affects the MS ABI. MinGW doesn't seem to do this trick. For example, in this code, they will emit a definition for S::Inner::f: template struct S { struct Inner { void f() {} }; }; template struct __declspec(dllimport) S; http://reviews.llvm.org/D20608 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20320: [libunwind] Improve unwinder stack usage - II
bcraig added a comment. LGTM. You probably need to get an approval from someone else though, as I haven't really established myself in the libunwind code base. As a side note... one of these days clang / llvm stack compaction may actually work reasonably well, and tricks like this won't be necessary. I look forward to that day. http://reviews.llvm.org/D20320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20597: Speed up check by using a recursive visitor.
This revision was automatically updated to reflect the committed changes. Closed by commit rL270714: Speed up check by using a recursive visitor. (authored by sbenza). Changed prior to commit: http://reviews.llvm.org/D20597?vs=58438=58440#toc Repository: rL LLVM http://reviews.llvm.org/D20597 Files: clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.h Index: clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp === --- clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp @@ -8,14 +8,66 @@ //===--===// #include "FunctionSizeCheck.h" +#include "clang/AST/RecursiveASTVisitor.h" #include "clang/ASTMatchers/ASTMatchFinder.h" using namespace clang::ast_matchers; namespace clang { namespace tidy { namespace readability { +class FunctionASTVisitor : public RecursiveASTVisitor { + using Base = RecursiveASTVisitor; + +public: + bool TraverseStmt(Stmt *Node) { +if (!Node) + return Base::TraverseStmt(Node); + +if (TrackedParent.back() && !isa(Node)) + ++Info.Statements; + +switch (Node->getStmtClass()) { +case Stmt::IfStmtClass: +case Stmt::WhileStmtClass: +case Stmt::DoStmtClass: +case Stmt::CXXForRangeStmtClass: +case Stmt::ForStmtClass: +case Stmt::SwitchStmtClass: + ++Info.Branches; +// fallthrough +case Stmt::CompoundStmtClass: + TrackedParent.push_back(true); + break; +default: + TrackedParent.push_back(false); + break; +} + +Base::TraverseStmt(Node); + +TrackedParent.pop_back(); +return true; + } + + bool TraverseDecl(Decl *Node) { +TrackedParent.push_back(false); +Base::TraverseDecl(Node); +TrackedParent.pop_back(); +return true; + } + + struct FunctionInfo { +FunctionInfo() : Lines(0), Statements(0), Branches(0) {} +unsigned Lines; +unsigned Statements; +unsigned Branches; + }; + FunctionInfo Info; + std::vector TrackedParent; +}; + FunctionSizeCheck::FunctionSizeCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), LineThreshold(Options.get("LineThreshold", -1U)), @@ -29,76 +81,52 @@ } void FunctionSizeCheck::registerMatchers(MatchFinder *Finder) { - Finder->addMatcher( - functionDecl( - unless(isInstantiated()), - forEachDescendant( - stmt(unless(compoundStmt()), - hasParent(stmt(anyOf(compoundStmt(), ifStmt(), -anyOf(whileStmt(), doStmt(), - cxxForRangeStmt(), forStmt()) - .bind("stmt"))).bind("func"), - this); + Finder->addMatcher(functionDecl(unless(isInstantiated())).bind("func"), this); } void FunctionSizeCheck::check(const MatchFinder::MatchResult ) { const auto *Func = Result.Nodes.getNodeAs("func"); - FunctionInfo = FunctionInfos[Func]; + FunctionASTVisitor Visitor; + Visitor.TraverseDecl(const_cast(Func)); + auto = Visitor.Info; + + if (FI.Statements == 0) +return; // Count the lines including whitespace and comments. Really simple. - if (!FI.Lines) { -if (const Stmt *Body = Func->getBody()) { - SourceManager *SM = Result.SourceManager; - if (SM->isWrittenInSameFile(Body->getLocStart(), Body->getLocEnd())) { -FI.Lines = SM->getSpellingLineNumber(Body->getLocEnd()) - - SM->getSpellingLineNumber(Body->getLocStart()); - } + if (const Stmt *Body = Func->getBody()) { +SourceManager *SM = Result.SourceManager; +if (SM->isWrittenInSameFile(Body->getLocStart(), Body->getLocEnd())) { + FI.Lines = SM->getSpellingLineNumber(Body->getLocEnd()) - + SM->getSpellingLineNumber(Body->getLocStart()); } } - const auto *Statement = Result.Nodes.getNodeAs("stmt"); - ++FI.Statements; - - // TODO: switch cases, gotos - if (isa(Statement) || isa(Statement) || - isa(Statement) || isa(Statement) || - isa(Statement) || isa(Statement)) -++FI.Branches; -} - -void FunctionSizeCheck::onEndOfTranslationUnit() { - // If we're above the limit emit a warning. - for (const auto : FunctionInfos) { -const FunctionInfo = P.second; -if (FI.Lines > LineThreshold || FI.Statements > StatementThreshold || -FI.Branches > BranchThreshold) { - diag(P.first->getLocation(), - "function %0 exceeds recommended size/complexity thresholds") - << P.first; -} - -if (FI.Lines > LineThreshold) { - diag(P.first->getLocation(), - "%0 lines including whitespace and comments (threshold %1)", - DiagnosticIDs::Note) - << FI.Lines << LineThreshold; -} + if
[clang-tools-extra] r270714 - Speed up check by using a recursive visitor.
Author: sbenza Date: Wed May 25 11:19:23 2016 New Revision: 270714 URL: http://llvm.org/viewvc/llvm-project?rev=270714=rev Log: Speed up check by using a recursive visitor. Summary: Use a recursive visitor instead of forEachDescendant() matcher. The latter requires several layers of virtual function calls for each node and it is more expensive than the visitor. Benchmark results show improvement of ~6% walltime in clang-tidy. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20597 Modified: clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.h Modified: clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp?rev=270714=270713=270714=diff == --- clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp Wed May 25 11:19:23 2016 @@ -8,6 +8,7 @@ //===--===// #include "FunctionSizeCheck.h" +#include "clang/AST/RecursiveASTVisitor.h" #include "clang/ASTMatchers/ASTMatchFinder.h" using namespace clang::ast_matchers; @@ -16,6 +17,57 @@ namespace clang { namespace tidy { namespace readability { +class FunctionASTVisitor : public RecursiveASTVisitor { + using Base = RecursiveASTVisitor; + +public: + bool TraverseStmt(Stmt *Node) { +if (!Node) + return Base::TraverseStmt(Node); + +if (TrackedParent.back() && !isa(Node)) + ++Info.Statements; + +switch (Node->getStmtClass()) { +case Stmt::IfStmtClass: +case Stmt::WhileStmtClass: +case Stmt::DoStmtClass: +case Stmt::CXXForRangeStmtClass: +case Stmt::ForStmtClass: +case Stmt::SwitchStmtClass: + ++Info.Branches; +// fallthrough +case Stmt::CompoundStmtClass: + TrackedParent.push_back(true); + break; +default: + TrackedParent.push_back(false); + break; +} + +Base::TraverseStmt(Node); + +TrackedParent.pop_back(); +return true; + } + + bool TraverseDecl(Decl *Node) { +TrackedParent.push_back(false); +Base::TraverseDecl(Node); +TrackedParent.pop_back(); +return true; + } + + struct FunctionInfo { +FunctionInfo() : Lines(0), Statements(0), Branches(0) {} +unsigned Lines; +unsigned Statements; +unsigned Branches; + }; + FunctionInfo Info; + std::vector TrackedParent; +}; + FunctionSizeCheck::FunctionSizeCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), LineThreshold(Options.get("LineThreshold", -1U)), @@ -29,76 +81,52 @@ void FunctionSizeCheck::storeOptions(Cla } void FunctionSizeCheck::registerMatchers(MatchFinder *Finder) { - Finder->addMatcher( - functionDecl( - unless(isInstantiated()), - forEachDescendant( - stmt(unless(compoundStmt()), - hasParent(stmt(anyOf(compoundStmt(), ifStmt(), -anyOf(whileStmt(), doStmt(), - cxxForRangeStmt(), forStmt()) - .bind("stmt"))).bind("func"), - this); + Finder->addMatcher(functionDecl(unless(isInstantiated())).bind("func"), this); } void FunctionSizeCheck::check(const MatchFinder::MatchResult ) { const auto *Func = Result.Nodes.getNodeAs("func"); - FunctionInfo = FunctionInfos[Func]; + FunctionASTVisitor Visitor; + Visitor.TraverseDecl(const_cast(Func)); + auto = Visitor.Info; + + if (FI.Statements == 0) +return; // Count the lines including whitespace and comments. Really simple. - if (!FI.Lines) { -if (const Stmt *Body = Func->getBody()) { - SourceManager *SM = Result.SourceManager; - if (SM->isWrittenInSameFile(Body->getLocStart(), Body->getLocEnd())) { -FI.Lines = SM->getSpellingLineNumber(Body->getLocEnd()) - - SM->getSpellingLineNumber(Body->getLocStart()); - } + if (const Stmt *Body = Func->getBody()) { +SourceManager *SM = Result.SourceManager; +if (SM->isWrittenInSameFile(Body->getLocStart(), Body->getLocEnd())) { + FI.Lines = SM->getSpellingLineNumber(Body->getLocEnd()) - + SM->getSpellingLineNumber(Body->getLocStart()); } } - const auto *Statement = Result.Nodes.getNodeAs("stmt"); - ++FI.Statements; - - // TODO: switch cases, gotos - if (isa(Statement) || isa(Statement) || - isa(Statement) || isa(Statement) || - isa(Statement) || isa(Statement)) -++FI.Branches; -} - -void FunctionSizeCheck::onEndOfTranslationUnit() { - // If we're above the limit emit a warning. - for (const auto : FunctionInfos) { -const FunctionInfo = P.second; -
Re: [PATCH] D20597: Speed up check by using a recursive visitor.
sbenza updated this revision to Diff 58438. sbenza marked an inline comment as done. sbenza added a comment. Reformat code http://reviews.llvm.org/D20597 Files: clang-tidy/readability/FunctionSizeCheck.cpp clang-tidy/readability/FunctionSizeCheck.h Index: clang-tidy/readability/FunctionSizeCheck.h === --- clang-tidy/readability/FunctionSizeCheck.h +++ clang-tidy/readability/FunctionSizeCheck.h @@ -34,21 +34,11 @@ void storeOptions(ClangTidyOptions::OptionMap ) override; void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult ) override; - void onEndOfTranslationUnit() override; private: - struct FunctionInfo { -FunctionInfo() : Lines(0), Statements(0), Branches(0) {} -unsigned Lines; -unsigned Statements; -unsigned Branches; - }; - const unsigned LineThreshold; const unsigned StatementThreshold; const unsigned BranchThreshold; - - llvm::DenseMap FunctionInfos; }; } // namespace readability Index: clang-tidy/readability/FunctionSizeCheck.cpp === --- clang-tidy/readability/FunctionSizeCheck.cpp +++ clang-tidy/readability/FunctionSizeCheck.cpp @@ -8,14 +8,66 @@ //===--===// #include "FunctionSizeCheck.h" +#include "clang/AST/RecursiveASTVisitor.h" #include "clang/ASTMatchers/ASTMatchFinder.h" using namespace clang::ast_matchers; namespace clang { namespace tidy { namespace readability { +class FunctionASTVisitor : public RecursiveASTVisitor { + using Base = RecursiveASTVisitor; + +public: + bool TraverseStmt(Stmt *Node) { +if (!Node) + return Base::TraverseStmt(Node); + +if (TrackedParent.back() && !isa(Node)) + ++Info.Statements; + +switch (Node->getStmtClass()) { +case Stmt::IfStmtClass: +case Stmt::WhileStmtClass: +case Stmt::DoStmtClass: +case Stmt::CXXForRangeStmtClass: +case Stmt::ForStmtClass: +case Stmt::SwitchStmtClass: + ++Info.Branches; +// fallthrough +case Stmt::CompoundStmtClass: + TrackedParent.push_back(true); + break; +default: + TrackedParent.push_back(false); + break; +} + +Base::TraverseStmt(Node); + +TrackedParent.pop_back(); +return true; + } + + bool TraverseDecl(Decl *Node) { +TrackedParent.push_back(false); +Base::TraverseDecl(Node); +TrackedParent.pop_back(); +return true; + } + + struct FunctionInfo { +FunctionInfo() : Lines(0), Statements(0), Branches(0) {} +unsigned Lines; +unsigned Statements; +unsigned Branches; + }; + FunctionInfo Info; + std::vector TrackedParent; +}; + FunctionSizeCheck::FunctionSizeCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), LineThreshold(Options.get("LineThreshold", -1U)), @@ -29,76 +81,52 @@ } void FunctionSizeCheck::registerMatchers(MatchFinder *Finder) { - Finder->addMatcher( - functionDecl( - unless(isInstantiated()), - forEachDescendant( - stmt(unless(compoundStmt()), - hasParent(stmt(anyOf(compoundStmt(), ifStmt(), -anyOf(whileStmt(), doStmt(), - cxxForRangeStmt(), forStmt()) - .bind("stmt"))).bind("func"), - this); + Finder->addMatcher(functionDecl(unless(isInstantiated())).bind("func"), this); } void FunctionSizeCheck::check(const MatchFinder::MatchResult ) { const auto *Func = Result.Nodes.getNodeAs("func"); - FunctionInfo = FunctionInfos[Func]; + FunctionASTVisitor Visitor; + Visitor.TraverseDecl(const_cast(Func)); + auto = Visitor.Info; + + if (FI.Statements == 0) +return; // Count the lines including whitespace and comments. Really simple. - if (!FI.Lines) { -if (const Stmt *Body = Func->getBody()) { - SourceManager *SM = Result.SourceManager; - if (SM->isWrittenInSameFile(Body->getLocStart(), Body->getLocEnd())) { -FI.Lines = SM->getSpellingLineNumber(Body->getLocEnd()) - - SM->getSpellingLineNumber(Body->getLocStart()); - } + if (const Stmt *Body = Func->getBody()) { +SourceManager *SM = Result.SourceManager; +if (SM->isWrittenInSameFile(Body->getLocStart(), Body->getLocEnd())) { + FI.Lines = SM->getSpellingLineNumber(Body->getLocEnd()) - + SM->getSpellingLineNumber(Body->getLocStart()); } } - const auto *Statement = Result.Nodes.getNodeAs("stmt"); - ++FI.Statements; - - // TODO: switch cases, gotos - if (isa(Statement) || isa(Statement) || - isa(Statement) || isa(Statement) || - isa(Statement) || isa(Statement)) -++FI.Branches; -} - -void FunctionSizeCheck::onEndOfTranslationUnit() { - // If we're above the limit emit a warning. -
[PATCH] D20630: [OpenCL] Allow -std=CL|CL1.1|CL1.2|CL2.0 in driver
yaxunl created this revision. yaxunl added a reviewer: Anastasia. yaxunl added subscribers: pxli168, bader, tstellarAMD, cfe-commits. Fix a regression which forbids using -std=CL|CL1.1|CL1.2|CL2.0 in driver. Changed -std=cl to -std=CL to match -cl-std=CL. http://reviews.llvm.org/D20630 Files: include/clang/Frontend/LangStandards.def lib/Frontend/CompilerInvocation.cpp test/Driver/opencl.cl Index: test/Driver/opencl.cl === --- /dev/null +++ test/Driver/opencl.cl @@ -0,0 +1,11 @@ +// RUN: %clang %s +// RUN: %clang -std=CL %s +// RUN: %clang -std=CL1.1 %s +// RUN: %clang -std=CL1.2 %s +// RUN: %clang -std=CL2.0 %s +// RUN: not %clang_cc1 -std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s +// RUN: not %clang_cc1 -std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s +// CHECK-C99: error: invalid argument '-std=c99' not allowed with 'OpenCL' +// CHECK-INVALID: error: invalid value 'invalid' in '-std=invalid' + +kernel void func(void); Index: lib/Frontend/CompilerInvocation.cpp === --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -1398,6 +1398,13 @@ Opts.AddVFSOverlayFile(A->getValue()); } +bool isOpenCL(LangStandard::Kind LangStd) { + return LangStd == LangStandard::lang_opencl +|| LangStd == LangStandard::lang_opencl11 +|| LangStd == LangStandard::lang_opencl12 +|| LangStd == LangStandard::lang_opencl20; +} + void CompilerInvocation::setLangDefaults(LangOptions , InputKind IK, const llvm::Triple , LangStandard::Kind LangStd) { @@ -1462,7 +1469,7 @@ Opts.ImplicitInt = Std.hasImplicitInt(); // Set OpenCL Version. - Opts.OpenCL = LangStd == LangStandard::lang_opencl || IK == IK_OpenCL; + Opts.OpenCL = isOpenCL(LangStd) || IK == IK_OpenCL; if (LangStd == LangStandard::lang_opencl) Opts.OpenCLVersion = 100; else if (LangStd == LangStandard::lang_opencl11) @@ -1555,8 +1562,9 @@ << A->getAsString(Args) << "C++/ObjC++"; break; case IK_OpenCL: -Diags.Report(diag::err_drv_argument_not_allowed_with) - << A->getAsString(Args) << "OpenCL"; +if (!isOpenCL(LangStd)) + Diags.Report(diag::err_drv_argument_not_allowed_with) +<< A->getAsString(Args) << "OpenCL"; break; case IK_CUDA: case IK_PreprocessedCuda: Index: include/clang/Frontend/LangStandards.def === --- include/clang/Frontend/LangStandards.def +++ include/clang/Frontend/LangStandards.def @@ -132,7 +132,7 @@ Digraphs | HexFloat | GNUMode) // OpenCL -LANGSTANDARD(opencl, "cl", +LANGSTANDARD(opencl, "CL", "OpenCL 1.0", LineComment | C99 | Digraphs | HexFloat) LANGSTANDARD(opencl11, "CL1.1", Index: test/Driver/opencl.cl === --- /dev/null +++ test/Driver/opencl.cl @@ -0,0 +1,11 @@ +// RUN: %clang %s +// RUN: %clang -std=CL %s +// RUN: %clang -std=CL1.1 %s +// RUN: %clang -std=CL1.2 %s +// RUN: %clang -std=CL2.0 %s +// RUN: not %clang_cc1 -std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s +// RUN: not %clang_cc1 -std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s +// CHECK-C99: error: invalid argument '-std=c99' not allowed with 'OpenCL' +// CHECK-INVALID: error: invalid value 'invalid' in '-std=invalid' + +kernel void func(void); Index: lib/Frontend/CompilerInvocation.cpp === --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -1398,6 +1398,13 @@ Opts.AddVFSOverlayFile(A->getValue()); } +bool isOpenCL(LangStandard::Kind LangStd) { + return LangStd == LangStandard::lang_opencl +|| LangStd == LangStandard::lang_opencl11 +|| LangStd == LangStandard::lang_opencl12 +|| LangStd == LangStandard::lang_opencl20; +} + void CompilerInvocation::setLangDefaults(LangOptions , InputKind IK, const llvm::Triple , LangStandard::Kind LangStd) { @@ -1462,7 +1469,7 @@ Opts.ImplicitInt = Std.hasImplicitInt(); // Set OpenCL Version. - Opts.OpenCL = LangStd == LangStandard::lang_opencl || IK == IK_OpenCL; + Opts.OpenCL = isOpenCL(LangStd) || IK == IK_OpenCL; if (LangStd == LangStandard::lang_opencl) Opts.OpenCLVersion = 100; else if (LangStd == LangStandard::lang_opencl11) @@ -1555,8 +1562,9 @@ << A->getAsString(Args) << "C++/ObjC++"; break; case IK_OpenCL: -Diags.Report(diag::err_drv_argument_not_allowed_with) - << A->getAsString(Args) << "OpenCL"; +if (!isOpenCL(LangStd)) +
Re: [PATCH] D20437: [MSVC] Support of __unaligned qualifier for function types
majnemer accepted this revision. majnemer added a comment. This revision is now accepted and ready to land. LGTM Comment at: lib/Sema/SemaExprCXX.cpp:937 @@ -936,2 +936,3 @@ + CXXThisTypeQuals &= Qualifiers::FastMask; S.CXXThisTypeOverride Can you add a comment for this line. http://reviews.llvm.org/D20437 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18369: [OpenCL] Upstreaming khronos OpenCL header file.
Anastasia accepted this revision. Anastasia added a comment. LGTM! Thanks! http://reviews.llvm.org/D18369 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D17438: [OpenCL] Add Sema checks for atomics and implicit declaration
Anastasia added a comment. @pxli168, do you still plan to update this? I think the implicit declarations would be quite useful to have. http://reviews.llvm.org/D17438 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20444: [OpenCL] Include opencl-c.h by default as a module
Anastasia added inline comments. Comment at: include/clang/Basic/LangOptions.def:219 @@ -218,3 +218,3 @@ ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, "OpenCL address space map mangling mode") - +LANGOPT(NoDefaultHeader, 1, 0, "Do not include default header file for OpenCL") BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing") I was just thinking whether it would make sense to do the opposite i.e. to have a flag that would enable loading of the header (which won't be loaded by default). This might be better for compatibility. The issues might arise because the users already have their own BIF declaration mechanisms in place in Clang or because of the parsing speed increase. The latter can affect testing significantly. Does the module mechanism use PCH? Have you compared the speed with and without including the OpenCL header? Is there any difference? http://reviews.llvm.org/D20444 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow
bcraig added a comment. In http://reviews.llvm.org/D20334#438052, @ahatanak wrote: > My understanding is that typically std::ends is explicitly appended to > null-terminate the stream buffer. The test case in the example does that. > > http://en.cppreference.com/w/cpp/io/ostrstream/str Doh! You're right. I'm still confused though, so please entertain my blind fumblings. ASAN is complaining about an excessively large read. If the problem was in overflow, I would expect ASAN to complain about an out-of-bounds write instead. http://reviews.llvm.org/D20334 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20617: [X86][SSE] _mm_store1_ps/_mm_store1_pd should require an aligned pointer
RKSimon added a comment. In http://reviews.llvm.org/D20617#439200, @craig.topper wrote: > Can you double check gcc's xmmintrin.h again. I'm pretty sure _mm_store1_ps > is calling _mm_storeu_ps. Yes you're right - for gcc _mm_store1_pd is aligned (and there is a comment saying it must be), but _mm_store1_ps is unaligned. The intel intrinsics docs and msvc codegen both set both ps and pd versions to aligned store though. If you wish I can just do the pd fixes - we are alone in doing a extract + 2*movsd - the rest all use shufpd+movapd Suggestions for ps? Repository: rL LLVM http://reviews.llvm.org/D20617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20626: [Clang][AVX512][intrinsics] Adding missing intrinsics div_pd and div_ps
m_zuckerman created this revision. m_zuckerman added reviewers: AsafBadouh, igorb, delena. m_zuckerman added a subscriber: cfe-commits. http://reviews.llvm.org/D20626 Files: lib/Headers/avx512fintrin.h test/CodeGen/avx512f-builtins.c Index: lib/Headers/avx512fintrin.h === --- lib/Headers/avx512fintrin.h +++ lib/Headers/avx512fintrin.h @@ -2209,6 +2209,12 @@ (__v2df)_mm_setzero_pd(), \ (__mmask8)(U), (int)(R)); }) +static __inline __m512d __DEFAULT_FN_ATTRS +_mm512_div_pd(__m512d __a, __m512d __b) +{ + return (__m512d)((__v8df)__a/(__v8df)__b); +} + static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) { return (__m512d) __builtin_ia32_divpd512_mask ((__v8df) __A, @@ -2228,6 +2234,12 @@ _MM_FROUND_CUR_DIRECTION); } +static __inline __m512 __DEFAULT_FN_ATTRS +_mm512_div_ps(__m512 __a, __m512 __b) +{ + return (__m512)((__v16sf)__a/(__v16sf)__b); +} + static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) { return (__m512) __builtin_ia32_divps512_mask ((__v16sf) __A, Index: test/CodeGen/avx512f-builtins.c === --- test/CodeGen/avx512f-builtins.c +++ test/CodeGen/avx512f-builtins.c @@ -1922,10 +1922,15 @@ // CHECK: @llvm.x86.avx512.mask.div.pd.512 return _mm512_maskz_div_round_pd(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); } -__m512d test_mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) { - // CHECK-LABEL: @test_mm512_mask_div_pd - // CHECK: @llvm.x86.avx512.mask.div.pd.512 - return _mm512_mask_div_pd(__W,__U,__A,__B); +__m512d test_mm512_div_pd(__m512d __a, __m512d __b) { + // check-label: @test_mm512_div_pd + // check: @llvm.x86.avx512.mask.div.pd.512 + return _mm512_div_pd(__a,__b); +} +__m512d test_mm512_mask_div_pd(__m512d __w, __mmask8 __u, __m512d __a, __m512d __b) { + // check-label: @test_mm512_mask_div_pd + // check: @llvm.x86.avx512.mask.div.pd.512 + return _mm512_mask_div_pd(__w,__u,__a,__b); } __m512d test_mm512_maskz_div_pd(__mmask8 __U, __m512d __A, __m512d __B) { // CHECK-LABEL: @test_mm512_maskz_div_pd @@ -1947,6 +1952,11 @@ // CHECK: @llvm.x86.avx512.mask.div.ps.512 return _mm512_maskz_div_round_ps(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); } +__m512 test_mm512_div_ps(__m512 __A, __m512 __B) { + // CHECK-LABEL: @test_mm512_div_ps + // CHECK: @llvm.x86.avx512.mask.div.ps.512 + return _mm512_div_ps(__W,__U,__A,__B); +} __m512 test_mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) { // CHECK-LABEL: @test_mm512_mask_div_ps // CHECK: @llvm.x86.avx512.mask.div.ps.512 Index: lib/Headers/avx512fintrin.h === --- lib/Headers/avx512fintrin.h +++ lib/Headers/avx512fintrin.h @@ -2209,6 +2209,12 @@ (__v2df)_mm_setzero_pd(), \ (__mmask8)(U), (int)(R)); }) +static __inline __m512d __DEFAULT_FN_ATTRS +_mm512_div_pd(__m512d __a, __m512d __b) +{ + return (__m512d)((__v8df)__a/(__v8df)__b); +} + static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) { return (__m512d) __builtin_ia32_divpd512_mask ((__v8df) __A, @@ -2228,6 +2234,12 @@ _MM_FROUND_CUR_DIRECTION); } +static __inline __m512 __DEFAULT_FN_ATTRS +_mm512_div_ps(__m512 __a, __m512 __b) +{ + return (__m512)((__v16sf)__a/(__v16sf)__b); +} + static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_mask_div_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) { return (__m512) __builtin_ia32_divps512_mask ((__v16sf) __A, Index: test/CodeGen/avx512f-builtins.c === --- test/CodeGen/avx512f-builtins.c +++ test/CodeGen/avx512f-builtins.c @@ -1922,10 +1922,15 @@ // CHECK: @llvm.x86.avx512.mask.div.pd.512 return _mm512_maskz_div_round_pd(__U,__A,__B,_MM_FROUND_TO_NEAREST_INT); } -__m512d test_mm512_mask_div_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) { - // CHECK-LABEL: @test_mm512_mask_div_pd - // CHECK: @llvm.x86.avx512.mask.div.pd.512 - return _mm512_mask_div_pd(__W,__U,__A,__B); +__m512d test_mm512_div_pd(__m512d __a, __m512d __b) { + // check-label: @test_mm512_div_pd + // check: @llvm.x86.avx512.mask.div.pd.512 + return _mm512_div_pd(__a,__b); +} +__m512d test_mm512_mask_div_pd(__m512d __w, __mmask8 __u, __m512d __a, __m512d __b) { + // check-label: @test_mm512_mask_div_pd + // check: @llvm.x86.avx512.mask.div.pd.512 + return _mm512_mask_div_pd(__w,__u,__a,__b); } __m512d test_mm512_maskz_div_pd(__mmask8 __U, __m512d __A, __m512d __B) { // CHECK-LABEL:
Re: [PATCH] D20328: [libcxx] Externally threaded libc++ variant
bcraig added inline comments. Comment at: include/__threading_support:201 @@ +200,3 @@ +// Mutex +#define _LIBCPP_MUTEX_INITIALIZER nullptr +struct __libcpp_platform_mutex_t; rmaprath wrote: > rmaprath wrote: > > bcraig wrote: > > > rmaprath wrote: > > > > bcraig wrote: > > > > > rmaprath wrote: > > > > > > bcraig wrote: > > > > > > > I'm not sure I like taking the freedom to define > > > > > > > _LIBCPP_MUTEX_INITIALIZER away from implementers. > > > > > > > > > > > > > > Would it be too terrible to replace this entire #elif block with > > > > > > > something like the following? > > > > > > > > > > > > > > ``` > > > > > > > #if !defined(__has_include) || > > > > > > > __has_include() > > > > > > > #include > > > > > > > #else > > > > > > > #error "_LIBCPP_THREAD_API_EXTERNAL requires the implementer to > > > > > > > provide in the include path" > > > > > > > #endif > > > > > > > ``` > > > > > > > > > > > > > > > > > > > > The problem is that, `std::mutex` constructor needs to be > > > > > > `constexpr` (as you pointed out earlier). And since > > > > > > `__libcpp_mutex_t` is a pointer type (for this externally threaded > > > > > > variant), sensible definitions for `_LIBCPP_MUTEX_INITIALIZER` are > > > > > > limited. > > > > > > > > > > > > Other than `nullptr`, one may be able to define > > > > > > `_LIBCPP_MUTEX_INITIALIZER` to be a pointer to some constant mutex > > > > > > (presuming that make it `constexpr` OK?) but I'm not convinced if > > > > > > such a setup would be very useful. > > > > > > > > > > > > Hope that sounds sensible? > > > > > If the implementer gets to provide an entire header, then they also > > > > > get to choose what libcpp_mutex_t will be. They could make it a > > > > > struct. > > > > This externally-threaded library variant needs to be compiled against a > > > > set API, so we have this header with declarations like > > > > `__libcpp_mutex_lock()` which are referred from within the library > > > > sources (same function signatures as those used in > > > > `LIBCPP_THREAD_API_PTHREAD` - this allows us to keep the library source > > > > changes to a minimum). > > > > > > > > Now, in this particular library variant, we want to differ these calls > > > > to runtime rather than libcxx compile-time! > > > > > > > > On the other hand, I think you are proposing a compile-time (static) > > > > thread porting setup where the platform vendors need to supply a header > > > > file with appropriate definitions for these functions / types, and they > > > > would compile libcxx themselves? That sounds like a good idea, but the > > > > current patch is aiming for a different goal: we provide a pre-compiled > > > > libcxx library which calls out to those `__libcpp_xxx` functions at > > > > runtime, and platform vendors need to provide those functions, they > > > > don't have to compile libcxx themselves. This is what forces us to use > > > > opaque pointer types to capture platform-defined threading primitives. > > > > > > > > Perhaps I could improve the naming here, may be > > > > `LIBCPP_HAS_RUNTIME_THREAD_API`? Or `LIBCPP_HAS_DYNAMIC_THREAD_API`? > > > That is an excellent summary, and it does a good job of explaining the > > > disconnect we were having. I'm going to push forward with the disconnect > > > though :) > > > > > > I think you can implement the dynamic case in terms of the static case > > > without loss of generality or performance. You ("Vendor X") could > > > pre-compile your library with a pointer-sized libcpp_mutex_t defined in > > > , and at runtime call out to a different library > > > that has an implementation of libcpp_mutex_lock. Someone else ("Vendor > > > Y") could have a larger libcpp_mutex_t defined, and provide a static > > > inline definition of libcpp_mutex_lock. > > OK, I think I understand your point :) > > > > Will meditate on it a bit and spin a new patch tomorrow. Thanks! > > > > > There is a slight complication here. If we fully offload the external > thread-API to platform vendors, nobody will be able to build this > externally-threaded library variant using the vanilla libcxx sources, because > they would have to first come up with a `platform_threads.h` header. > > We could provide a `dynamic_threads.h` header with the method signatures only > (which is selected if the `platform_threads.h` header is absent - and you get > a "dynamically-threaded" library build). Now the library can be built + > tested with the vanilla upstream sources. But note that we are introducing > yet another header. I remember @mclow.lists mentioned that each additional > header adds to the overhead of header lookup and we should try to keep that > to a minimum. > > We can workaround this additional header by not collecting it when building > the normal library variant (so it doesn't add to the header lookup overhead). > > Does that sound like an OK approach? Sounds reasonable.
r270708 - [X86][AVX2] Full set of AVX2 intrinsics tests
Author: rksimon Date: Wed May 25 10:10:49 2016 New Revision: 270708 URL: http://llvm.org/viewvc/llvm-project?rev=270708=rev Log: [X86][AVX2] Full set of AVX2 intrinsics tests llvm/test/CodeGen/X86/avx2-intrinsics-fast-isel.ll will be synced to this Modified: cfe/trunk/test/CodeGen/avx2-builtins.c Modified: cfe/trunk/test/CodeGen/avx2-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx2-builtins.c?rev=270708=270707=270708=diff == --- cfe/trunk/test/CodeGen/avx2-builtins.c (original) +++ cfe/trunk/test/CodeGen/avx2-builtins.c Wed May 25 10:10:49 2016 @@ -4,179 +4,113 @@ // Don't include mm_malloc.h, it's system specific. #define __MM_MALLOC_H -#include +#include -__m256i test_mm256_mpsadbw_epu8(__m256i x, __m256i y) { - // CHECK: @llvm.x86.avx2.mpsadbw({{.*}}, {{.*}}, i8 3) - return _mm256_mpsadbw_epu8(x, y, 3); -} - -__m256i test_mm256_sad_epu8(__m256i x, __m256i y) { - // CHECK: @llvm.x86.avx2.psad.bw - return _mm256_sad_epu8(x, y); -} +// NOTE: This should match the tests in llvm/test/CodeGen/X86/avx2-intrinsics-fast-isel.ll __m256i test_mm256_abs_epi8(__m256i a) { - // CHECK: @llvm.x86.avx2.pabs.b + // CHECK-LABEL: test_mm256_abs_epi8 + // CHECK: call <32 x i8> @llvm.x86.avx2.pabs.b(<32 x i8> %{{.*}}) return _mm256_abs_epi8(a); } __m256i test_mm256_abs_epi16(__m256i a) { - // CHECK: @llvm.x86.avx2.pabs.w + // CHECK-LABEL: test_mm256_abs_epi16 + // CHECK: call <16 x i16> @llvm.x86.avx2.pabs.w(<16 x i16> %{{.*}}) return _mm256_abs_epi16(a); } __m256i test_mm256_abs_epi32(__m256i a) { - // CHECK: @llvm.x86.avx2.pabs.d + // CHECK-LABEL: test_mm256_abs_epi32 + // CHECK: call <8 x i32> @llvm.x86.avx2.pabs.d(<8 x i32> %{{.*}}) return _mm256_abs_epi32(a); } -__m256i test_mm256_packs_epi16(__m256i a, __m256i b) { - // CHECK: @llvm.x86.avx2.packsswb - return _mm256_packs_epi16(a, b); -} - -__m256i test_mm256_packs_epi32(__m256i a, __m256i b) { - // CHECK: @llvm.x86.avx2.packssdw - return _mm256_packs_epi32(a, b); -} - -__m256i test_mm256_packs_epu16(__m256i a, __m256i b) { - // CHECK: @llvm.x86.avx2.packuswb - return _mm256_packus_epi16(a, b); -} - -__m256i test_mm256_packs_epu32(__m256i a, __m256i b) { - // CHECK: @llvm.x86.avx2.packusdw - return _mm256_packus_epi32(a, b); -} - __m256i test_mm256_add_epi8(__m256i a, __m256i b) { + // CHECK-LABEL: test_mm256_add_epi8 // CHECK: add <32 x i8> return _mm256_add_epi8(a, b); } __m256i test_mm256_add_epi16(__m256i a, __m256i b) { + // CHECK-LABEL: test_mm256_add_epi16 // CHECK: add <16 x i16> return _mm256_add_epi16(a, b); } __m256i test_mm256_add_epi32(__m256i a, __m256i b) { + // CHECK-LABEL: test_mm256_add_epi32 // CHECK: add <8 x i32> return _mm256_add_epi32(a, b); } __m256i test_mm256_add_epi64(__m256i a, __m256i b) { + // CHECK-LABEL: test_mm256_add_epi64 // CHECK: add <4 x i64> return _mm256_add_epi64(a, b); } __m256i test_mm256_adds_epi8(__m256i a, __m256i b) { - // CHECK: @llvm.x86.avx2.padds.b + // CHECK-LABEL: test_mm256_adds_epi8 + // CHECK: call <32 x i8> @llvm.x86.avx2.padds.b(<32 x i8> %{{.*}}, <32 x i8> %{{.*}}) return _mm256_adds_epi8(a, b); } __m256i test_mm256_adds_epi16(__m256i a, __m256i b) { - // CHECK: @llvm.x86.avx2.padds.w + // CHECK-LABEL: test_mm256_adds_epi16 + // CHECK: call <16 x i16> @llvm.x86.avx2.padds.w(<16 x i16> %{{.*}}, <16 x i16> %{{.*}}) return _mm256_adds_epi16(a, b); } __m256i test_mm256_adds_epu8(__m256i a, __m256i b) { - // CHECK: @llvm.x86.avx2.paddus.b + // CHECK-LABEL: test_mm256_adds_epu8 + // CHECK: call <32 x i8> @llvm.x86.avx2.paddus.b(<32 x i8> %{{.*}}, <32 x i8> %{{.*}}) return _mm256_adds_epu8(a, b); } __m256i test_mm256_adds_epu16(__m256i a, __m256i b) { - // CHECK: @llvm.x86.avx2.paddus.w + // CHECK-LABEL: test_mm256_adds_epu16 + // CHECK: call <16 x i16> @llvm.x86.avx2.paddus.w(<16 x i16> %{{.*}}, <16 x i16> %{{.*}}) return _mm256_adds_epu16(a, b); } __m256i test_mm256_alignr_epi8(__m256i a, __m256i b) { + // CHECK-LABEL: test_mm256_alignr_epi8 // CHECK: shufflevector <32 x i8> %{{.*}}, <32 x i8> %{{.*}}, <32 x i32> return _mm256_alignr_epi8(a, b, 2); } __m256i test2_mm256_alignr_epi8(__m256i a, __m256i b) { + // CHECK-LABEL: test2_mm256_alignr_epi8 // CHECK: shufflevector <32 x i8> %{{.*}}, <32 x i8> zeroinitializer, <32 x i32> return _mm256_alignr_epi8(a, b, 17); } -__m256i test_mm256_sub_epi8(__m256i a, __m256i b) { - // CHECK: sub <32 x i8> - return _mm256_sub_epi8(a, b); -} - -__m256i test_mm256_sub_epi16(__m256i a, __m256i b) { - // CHECK: sub <16 x i16> - return _mm256_sub_epi16(a, b); -} - -__m256i test_mm256_sub_epi32(__m256i a, __m256i b) { - // CHECK: sub <8 x i32> - return _mm256_sub_epi32(a, b); -} - -__m256i test_mm256_sub_epi64(__m256i a, __m256i b) { - // CHECK: sub <4 x i64> - return _mm256_sub_epi64(a, b); -} -
Re: [PATCH] D20620: [Clang][AVX512][Builtin] Fix palignr intrinsics header
This revision was automatically updated to reflect the committed changes. Closed by commit rL270707: [Clang][AVX512][Builtin] Fix palignr intrinsics header (authored by mzuckerm). Changed prior to commit: http://reviews.llvm.org/D20620?vs=58406=58425#toc Repository: rL LLVM http://reviews.llvm.org/D20620 Files: cfe/trunk/lib/Headers/avx512bwintrin.h Index: cfe/trunk/lib/Headers/avx512bwintrin.h === --- cfe/trunk/lib/Headers/avx512bwintrin.h +++ cfe/trunk/lib/Headers/avx512bwintrin.h @@ -2145,19 +2145,19 @@ #define _mm512_alignr_epi8(A, B, N) __extension__ ({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)_mm512_undefined_pd(), \ (__mmask64)-1); }) #define _mm512_mask_alignr_epi8(W, U, A, B, N) __extension__({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)(__m512i)(W), \ (__mmask64)(U)); }) #define _mm512_maskz_alignr_epi8(U, A, B, N) __extension__({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)_mm512_setzero_si512(), \ (__mmask64)(U)); }) Index: cfe/trunk/lib/Headers/avx512bwintrin.h === --- cfe/trunk/lib/Headers/avx512bwintrin.h +++ cfe/trunk/lib/Headers/avx512bwintrin.h @@ -2145,19 +2145,19 @@ #define _mm512_alignr_epi8(A, B, N) __extension__ ({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)_mm512_undefined_pd(), \ (__mmask64)-1); }) #define _mm512_mask_alignr_epi8(W, U, A, B, N) __extension__({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)(__m512i)(W), \ (__mmask64)(U)); }) #define _mm512_maskz_alignr_epi8(U, A, B, N) __extension__({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)_mm512_setzero_si512(), \ (__mmask64)(U)); }) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270707 - [Clang][AVX512][Builtin] Fix palignr intrinsics header
Author: mzuckerm Date: Wed May 25 10:05:03 2016 New Revision: 270707 URL: http://llvm.org/viewvc/llvm-project?rev=270707=rev Log: [Clang][AVX512][Builtin] Fix palignr intrinsics header Differential Revision: http://reviews.llvm.org/D20620 Modified: cfe/trunk/lib/Headers/avx512bwintrin.h Modified: cfe/trunk/lib/Headers/avx512bwintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=270707=270706=270707=diff == --- cfe/trunk/lib/Headers/avx512bwintrin.h (original) +++ cfe/trunk/lib/Headers/avx512bwintrin.h Wed May 25 10:05:03 2016 @@ -2145,19 +2145,19 @@ _mm512_mask_permutexvar_epi16 (__m512i _ #define _mm512_alignr_epi8(A, B, N) __extension__ ({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)_mm512_undefined_pd(), \ (__mmask64)-1); }) #define _mm512_mask_alignr_epi8(W, U, A, B, N) __extension__({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)(__m512i)(W), \ (__mmask64)(U)); }) #define _mm512_maskz_alignr_epi8(U, A, B, N) __extension__({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)_mm512_setzero_si512(), \ (__mmask64)(U)); }) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20617: [X86][SSE] _mm_store1_ps/_mm_store1_pd should require an aligned pointer
Can you double check gcc's xmmintrin.h again. I'm pretty sure _mm_store1_ps is calling _mm_storeu_ps. On Wed, May 25, 2016 at 3:31 AM, Simon Pilgrimwrote: > RKSimon created this revision. > RKSimon added reviewers: craig.topper, spatel, andreadb. > RKSimon added a subscriber: cfe-commits. > RKSimon set the repository for this revision to rL LLVM. > > According to the gcc headers, intel intrinsics docs and msdn codegen the > _mm_store1_ps/_mm_store1_pd (and their _mm_store_ps1/_mm_store_pd1 > analogues) should require an aligned pointer - the clang headers are the > only implementation I can find that assume non-aligned stores (by storing > with _mm_storeu_ps/_mm_storeu_pd). > > This patch raises the alignment requirements to match the other > implementations by calling _mm_store_ps/_mm_store_pd instead. > > I've also added the missing _mm_store_pd1 intrinsic (which maps to > _mm_store1_pd like _mm_store_ps1 does to _mm_store1_ps). > > As a followup I'll update the llvm fast-isel tests to match this codegen. > > Repository: > rL LLVM > > http://reviews.llvm.org/D20617 > > Files: > lib/Headers/emmintrin.h > lib/Headers/xmmintrin.h > test/CodeGen/sse-builtins.c > test/CodeGen/sse2-builtins.c > > -- ~Craig ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20111: [OpenMP] Adjust map type bits according to latest spec and use zero size array sections for pointers.
sfantao added inline comments. Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:4874-4878 @@ -4881,1 +4873,7 @@ +OMP_MAP_IS_PTR = 0x10, +/// \brief This flags signals that an argument is the first one relating to +/// a map/private clause expression. For some cases a single +/// map/privatization results in multiple arguments passed to the runtime +/// library. +OMP_MAP_FIRST_REF = 0x20, /// \brief Pass the element to the device by value. ABataev wrote: > The question is not answered yet. Sorry Alexey, forgot to address this one. Right now we support maps of patters like (you can find some of this patters in the tests for map clause) `S.p1->p2->p3`, or `S.p[3][0:N]` where `S.p` is an array of pointers. Each individual pointer requires its own map but have to be bound by the runtime to the same base declaration `S` so that on the device the code can properly dereference `S` to get to the pointers. This flag is used to signal that. http://reviews.llvm.org/D20111 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20328: [libcxx] Externally threaded libc++ variant
rmaprath added inline comments. Comment at: include/__threading_support:201 @@ +200,3 @@ +// Mutex +#define _LIBCPP_MUTEX_INITIALIZER nullptr +struct __libcpp_platform_mutex_t; rmaprath wrote: > bcraig wrote: > > rmaprath wrote: > > > bcraig wrote: > > > > rmaprath wrote: > > > > > bcraig wrote: > > > > > > I'm not sure I like taking the freedom to define > > > > > > _LIBCPP_MUTEX_INITIALIZER away from implementers. > > > > > > > > > > > > Would it be too terrible to replace this entire #elif block with > > > > > > something like the following? > > > > > > > > > > > > ``` > > > > > > #if !defined(__has_include) || __has_include() > > > > > > #include > > > > > > #else > > > > > > #error "_LIBCPP_THREAD_API_EXTERNAL requires the implementer to > > > > > > provide in the include path" > > > > > > #endif > > > > > > ``` > > > > > > > > > > > > > > > > > The problem is that, `std::mutex` constructor needs to be `constexpr` > > > > > (as you pointed out earlier). And since `__libcpp_mutex_t` is a > > > > > pointer type (for this externally threaded variant), sensible > > > > > definitions for `_LIBCPP_MUTEX_INITIALIZER` are limited. > > > > > > > > > > Other than `nullptr`, one may be able to define > > > > > `_LIBCPP_MUTEX_INITIALIZER` to be a pointer to some constant mutex > > > > > (presuming that make it `constexpr` OK?) but I'm not convinced if > > > > > such a setup would be very useful. > > > > > > > > > > Hope that sounds sensible? > > > > If the implementer gets to provide an entire header, then they also get > > > > to choose what libcpp_mutex_t will be. They could make it a struct. > > > This externally-threaded library variant needs to be compiled against a > > > set API, so we have this header with declarations like > > > `__libcpp_mutex_lock()` which are referred from within the library > > > sources (same function signatures as those used in > > > `LIBCPP_THREAD_API_PTHREAD` - this allows us to keep the library source > > > changes to a minimum). > > > > > > Now, in this particular library variant, we want to differ these calls to > > > runtime rather than libcxx compile-time! > > > > > > On the other hand, I think you are proposing a compile-time (static) > > > thread porting setup where the platform vendors need to supply a header > > > file with appropriate definitions for these functions / types, and they > > > would compile libcxx themselves? That sounds like a good idea, but the > > > current patch is aiming for a different goal: we provide a pre-compiled > > > libcxx library which calls out to those `__libcpp_xxx` functions at > > > runtime, and platform vendors need to provide those functions, they don't > > > have to compile libcxx themselves. This is what forces us to use opaque > > > pointer types to capture platform-defined threading primitives. > > > > > > Perhaps I could improve the naming here, may be > > > `LIBCPP_HAS_RUNTIME_THREAD_API`? Or `LIBCPP_HAS_DYNAMIC_THREAD_API`? > > That is an excellent summary, and it does a good job of explaining the > > disconnect we were having. I'm going to push forward with the disconnect > > though :) > > > > I think you can implement the dynamic case in terms of the static case > > without loss of generality or performance. You ("Vendor X") could > > pre-compile your library with a pointer-sized libcpp_mutex_t defined in > > , and at runtime call out to a different library that > > has an implementation of libcpp_mutex_lock. Someone else ("Vendor Y") > > could have a larger libcpp_mutex_t defined, and provide a static inline > > definition of libcpp_mutex_lock. > OK, I think I understand your point :) > > Will meditate on it a bit and spin a new patch tomorrow. Thanks! > > There is a slight complication here. If we fully offload the external thread-API to platform vendors, nobody will be able to build this externally-threaded library variant using the vanilla libcxx sources, because they would have to first come up with a `platform_threads.h` header. We could provide a `dynamic_threads.h` header with the method signatures only (which is selected if the `platform_threads.h` header is absent - and you get a "dynamically-threaded" library build). Now the library can be built + tested with the vanilla upstream sources. But note that we are introducing yet another header. I remember @mclow.lists mentioned that each additional header adds to the overhead of header lookup and we should try to keep that to a minimum. We can workaround this additional header by not collecting it when building the normal library variant (so it doesn't add to the header lookup overhead). Does that sound like an OK approach? http://reviews.llvm.org/D20328 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20621: [include-fixer] Create a mode in vim integration to show multiple potential headers.
ioeric added inline comments. Comment at: include-fixer/IncludeFixer.cpp:241 @@ -280,5 +240,3 @@ /// \return true if changes will be made, false otherwise. - bool Rewrite(clang::SourceManager , - clang::HeaderSearch , - std::set , - std::vector ) { + bool MinimizeAllIncludeHeaders(clang::SourceManager , + clang::HeaderSearch , This doesn't seem to be the right name. It does more than minimizing headers. Comment at: include-fixer/tool/ClangIncludeFixer.cpp:121 @@ +120,3 @@ +clang::include_fixer::CreateReplacementsForHeader( +/*Code=*/Buffer.get()->getBuffer(), +/*FilePath=*/FilePath, These comments seem redundant since it is already clear what those parameters are from variables' names. Comment at: include-fixer/tool/ClangIncludeFixer.cpp:129 @@ +128,3 @@ +tooling::applyAllReplacements(Buffer.get()->getBuffer(), Replaces); +llvm::outs() << ChangedCode; +return 0; This should only be for vim-mode or STDINMode I think. For normal mode, we should apply replacements on the rewriter. Comment at: include-fixer/tool/ClangIncludeFixer.cpp:208 @@ +207,3 @@ + clang::include_fixer::CreateReplacementsForHeader( + /*Code=*/Buffer.get()->getBuffer(), + /*FilePath=*/FilePath, Same here. Comment at: include-fixer/tool/clang-include-fixer.py:31 @@ -30,1 +30,3 @@ +choosing_mode = False; +if vim.eval('exists("g:clang_include_fixer_choosing_mode")') == "1": I think we can simply have one mode where a header is inserted if there is only one result, and a dialog is shown only if there are multiple headers for user to choose from. Comment at: include-fixer/tool/clang-include-fixer.py:31 @@ -30,1 +30,3 @@ +choosing_mode = False; +if vim.eval('exists("g:clang_include_fixer_choosing_mode")') == "1": ioeric wrote: > I think we can simply have one mode where a header is inserted if there is > only one result, and a dialog is shown only if there are multiple headers for > user to choose from. Also remove semicolons here and below... Comment at: include-fixer/tool/clang-include-fixer.py:78 @@ +77,3 @@ +stdout, stderr = execute(command, text) +vim.current.buffer[:] = None; +vim.current.buffer.append(stdout.splitlines()) I think we should also update the buffer with the diff method below. It doesn't make sense to clear the buffer if we are just inserting one line. http://reviews.llvm.org/D20621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: r267590 - [OpenCL] Add predefined macros.
Great! Thanks! Anastasia -Original Message- From: Liu, Yaxun (Sam) [mailto:yaxun@amd.com] Sent: 25 May 2016 15:46 To: Anastasia Stulova; cfe-commits@lists.llvm.org Cc: nd Subject: RE: r267590 - [OpenCL] Add predefined macros. I will take a look. Thanks. Sam -Original Message- From: Anastasia Stulova [mailto:anastasia.stul...@arm.com] Sent: Wednesday, May 25, 2016 10:29 AM To: Liu, Yaxun (Sam); cfe-commits@lists.llvm.org Cc: nd Subject: RE: r267590 - [OpenCL] Add predefined macros. This is because OpenCL sets C99 flag as being superset of it. If you check in clang/Frontend/LangStandards.def LANGSTANDARD(opencl, "cl", "OpenCL 1.0", LineComment | C99 | Digraphs | HexFloat) We should undo this change as it leaves no possibility to specify an OpenCL version during compilation apart from using the frontend option (which isn't conventional approach). Anastasia -Original Message- From: Liu, Yaxun (Sam) [mailto:yaxun@amd.com] Sent: 24 May 2016 19:58 To: Anastasia Stulova; cfe-commits@lists.llvm.org Cc: nd Subject: RE: r267590 - [OpenCL] Add predefined macros. Did clang accept -std=CL2.0 before this change? According to this diff, the only accepted option for -std= is c99 when compiling OpenCL programs. Sam -Original Message- From: Anastasia Stulova [mailto:anastasia.stul...@arm.com] Sent: Tuesday, May 24, 2016 2:48 PM To: Liu, Yaxun (Sam) ; cfe-commits@lists.llvm.org Cc: nd Subject: RE: r267590 - [OpenCL] Add predefined macros. Hi Sam, I think this commit broke Clang. It seems we are no longer able to pass the -std=CL2.0, which is important for the standalone Clang OpenCL users as -cl-std is frontend only option. clang -std=CL2.0 test.cl error: invalid argument '-std=CL2.0' not allowed with 'OpenCL' We might have to revert or rework this bit: --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Apr 26 14:25:46 +++ 2016 @@ -1495,9 +1495,8 @@ static void ParseLangArgs(LangOptions << A->getAsString(Args) << "C++/ObjC++"; break; case IK_OpenCL: -if (!Std.isC99()) - Diags.Report(diag::err_drv_argument_not_allowed_with) -<< A->getAsString(Args) << "OpenCL"; +Diags.Report(diag::err_drv_argument_not_allowed_with) + << A->getAsString(Args) << "OpenCL"; break; case IK_CUDA: case IK_PreprocessedCuda: Do you think you could look into this? Thanks, Anastasia -Original Message- From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of Yaxun Liu via cfe-commits Sent: 26 April 2016 20:26 To: cfe-commits@lists.llvm.org Subject: r267590 - [OpenCL] Add predefined macros. Author: yaxunl Date: Tue Apr 26 14:25:46 2016 New Revision: 267590 URL: http://llvm.org/viewvc/llvm-project?rev=267590=rev Log: [OpenCL] Add predefined macros. OpenCL spec requires __OPENCL_C_VERSION__ to be defined based on -cl-std option. This patch implements that. The patch also defines __FAST_RELAXED_MATH__ based on -cl-fast-relaxed-math option. Also fixed a test using -std=c99 for OpenCL program. Limit allowed language standard of OpenCL to be OpenCL standards. Differential Revision: http://reviews.llvm.org/D19071 Removed: cfe/trunk/test/Frontend/std.cl Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/InitPreprocessor.cpp cfe/trunk/test/Frontend/stdlang.c cfe/trunk/test/Preprocessor/predefined-macros.c Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=267590=267589=267590=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Apr 26 14:25:46 +++ 2016 @@ -1495,9 +1495,8 @@ static void ParseLangArgs(LangOptions << A->getAsString(Args) << "C++/ObjC++"; break; case IK_OpenCL: -if (!Std.isC99()) - Diags.Report(diag::err_drv_argument_not_allowed_with) -<< A->getAsString(Args) << "OpenCL"; +Diags.Report(diag::err_drv_argument_not_allowed_with) + << A->getAsString(Args) << "OpenCL"; break; case IK_CUDA: case IK_PreprocessedCuda: Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=267590=267589=267590=diff == --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original) +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Tue Apr 26 14:25:46 2016 @@ -408,6 +408,39 @@ static void InitializeStandardPredefined if (LangOpts.ObjC1) Builder.defineMacro("__OBJC__"); +
Re: [PATCH] D20447: [OpenCL] Fixup extension list
Anastasia added inline comments. Comment at: test/SemaOpenCL/extension-version.cl:11 @@ +10,3 @@ +#endif +#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable + jvesely wrote: > Anastasia wrote: > > jvesely wrote: > > > Anastasia wrote: > > > > Could you use standard diagnostic check please: > > > > expected-warning{{unknown OpenCL extension ... > > > > > > > > Similarly to SemaOpenCL/extensions.cl > > > not sure I follow, the test does not trigger any diagnostics (by design). > > > are you saying that I should introduce negative checks to make sure > > > extensions are not available outside of their respective context? > > > Is there a way to filter verifier tags based on clang invocation? > > > (something like FileCheck prefix) > > Exactly, you should check that the extensions are enabled correctly based > > on CL versions. > > > > For example if you compile this without passing -cl-std=CL1.2: > > #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable > > the following error is produced: > > unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring > > > > You can condition error directives on CL version passed as it's done in the > > example test SemaOpenCL/extensions.cl. > > > > So what is the original intension of this tests? Not sure I understand what > > you are trying to test. > it's a positive test that checks that extensions are available (both that the > define is present, and that #pragma passes without error). > > I did not include negative tests (check that extension is not available > outside of its respective context), because I think it's a bit overzealous > reading of the specs. > For example cl_khr_d3d10_sharing is first mentioned in OpenCL 1.1 specs, but > the text of the extension says that it is written against OpenCL 1.0.48 spec. > (I moved cl_khr_icd to 1.0 for the same reason). I think if a vendor can add > vendor specific extensions to the list of supported extensions, it should be > possible to add extensions from higher CL versions. > > similarly, I would argue against warnings for extensions promoted to core > features (or at least hide the warning behind -pedantic). they are listed in > CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to allow > pragmas in higher CLC versions for backward compatibility. I agree with this: "similarly, I would argue against warnings for extensions promoted to core features (or at least hide the warning behind -pedantic). they are listed in CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to allow pragmas in higher CLC versions for backward compatibility." @yaxunl, what's your opinion here? Regarding the test, I think we should still check the diagnostics being given correctly especially for the extensions unavailable in the earlier versions. It should be quite straight forward to extend this test. Repository: rL LLVM http://reviews.llvm.org/D20447 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20119: [libunwind] Improve unwinder stack usage
rmaprath closed this revision. rmaprath added a comment. Accepted + closed. Patch committed as r270692. http://reviews.llvm.org/D20119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: r267590 - [OpenCL] Add predefined macros.
I will take a look. Thanks. Sam -Original Message- From: Anastasia Stulova [mailto:anastasia.stul...@arm.com] Sent: Wednesday, May 25, 2016 10:29 AM To: Liu, Yaxun (Sam); cfe-commits@lists.llvm.org Cc: nd Subject: RE: r267590 - [OpenCL] Add predefined macros. This is because OpenCL sets C99 flag as being superset of it. If you check in clang/Frontend/LangStandards.def LANGSTANDARD(opencl, "cl", "OpenCL 1.0", LineComment | C99 | Digraphs | HexFloat) We should undo this change as it leaves no possibility to specify an OpenCL version during compilation apart from using the frontend option (which isn't conventional approach). Anastasia -Original Message- From: Liu, Yaxun (Sam) [mailto:yaxun@amd.com] Sent: 24 May 2016 19:58 To: Anastasia Stulova; cfe-commits@lists.llvm.org Cc: nd Subject: RE: r267590 - [OpenCL] Add predefined macros. Did clang accept -std=CL2.0 before this change? According to this diff, the only accepted option for -std= is c99 when compiling OpenCL programs. Sam -Original Message- From: Anastasia Stulova [mailto:anastasia.stul...@arm.com] Sent: Tuesday, May 24, 2016 2:48 PM To: Liu, Yaxun (Sam) ; cfe-commits@lists.llvm.org Cc: nd Subject: RE: r267590 - [OpenCL] Add predefined macros. Hi Sam, I think this commit broke Clang. It seems we are no longer able to pass the -std=CL2.0, which is important for the standalone Clang OpenCL users as -cl-std is frontend only option. clang -std=CL2.0 test.cl error: invalid argument '-std=CL2.0' not allowed with 'OpenCL' We might have to revert or rework this bit: --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Apr 26 14:25:46 +++ 2016 @@ -1495,9 +1495,8 @@ static void ParseLangArgs(LangOptions << A->getAsString(Args) << "C++/ObjC++"; break; case IK_OpenCL: -if (!Std.isC99()) - Diags.Report(diag::err_drv_argument_not_allowed_with) -<< A->getAsString(Args) << "OpenCL"; +Diags.Report(diag::err_drv_argument_not_allowed_with) + << A->getAsString(Args) << "OpenCL"; break; case IK_CUDA: case IK_PreprocessedCuda: Do you think you could look into this? Thanks, Anastasia -Original Message- From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of Yaxun Liu via cfe-commits Sent: 26 April 2016 20:26 To: cfe-commits@lists.llvm.org Subject: r267590 - [OpenCL] Add predefined macros. Author: yaxunl Date: Tue Apr 26 14:25:46 2016 New Revision: 267590 URL: http://llvm.org/viewvc/llvm-project?rev=267590=rev Log: [OpenCL] Add predefined macros. OpenCL spec requires __OPENCL_C_VERSION__ to be defined based on -cl-std option. This patch implements that. The patch also defines __FAST_RELAXED_MATH__ based on -cl-fast-relaxed-math option. Also fixed a test using -std=c99 for OpenCL program. Limit allowed language standard of OpenCL to be OpenCL standards. Differential Revision: http://reviews.llvm.org/D19071 Removed: cfe/trunk/test/Frontend/std.cl Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/InitPreprocessor.cpp cfe/trunk/test/Frontend/stdlang.c cfe/trunk/test/Preprocessor/predefined-macros.c Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=267590=267589=267590=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Apr 26 14:25:46 +++ 2016 @@ -1495,9 +1495,8 @@ static void ParseLangArgs(LangOptions << A->getAsString(Args) << "C++/ObjC++"; break; case IK_OpenCL: -if (!Std.isC99()) - Diags.Report(diag::err_drv_argument_not_allowed_with) -<< A->getAsString(Args) << "OpenCL"; +Diags.Report(diag::err_drv_argument_not_allowed_with) + << A->getAsString(Args) << "OpenCL"; break; case IK_CUDA: case IK_PreprocessedCuda: Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=267590=267589=267590=diff == --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original) +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Tue Apr 26 14:25:46 2016 @@ -408,6 +408,39 @@ static void InitializeStandardPredefined if (LangOpts.ObjC1) Builder.defineMacro("__OBJC__"); + // OpenCL v1.0/1.1 s6.9, v1.2/2.0 s6.10: Preprocessor Directives and Macros. + if (LangOpts.OpenCL) { +// OpenCL v1.0 and v1.1 do not have a predefined macro to indicate the +// language standard with which the program is
r270704 - [AVX512] Don't rely on value names. They're different in release builds.
Author: d0k Date: Wed May 25 09:30:01 2016 New Revision: 270704 URL: http://llvm.org/viewvc/llvm-project?rev=270704=rev Log: [AVX512] Don't rely on value names. They're different in release builds. Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=270704=270703=270704=diff == --- cfe/trunk/test/CodeGen/avx512f-builtins.c (original) +++ cfe/trunk/test/CodeGen/avx512f-builtins.c Wed May 25 09:30:01 2016 @@ -5921,21 +5921,21 @@ __m256i test_mm512_maskz_cvttpd_epu32(__ __m512 test_mm512_castpd_ps (__m512d __A) { // CHECK-LABEL: @test_mm512_castpd_ps - // CHECK: bitcast <8 x double> %1 to <16 x float> + // CHECK: bitcast <8 x double> %{{.}} to <16 x float> return _mm512_castpd_ps (__A); } __m512d test_mm512_castps_pd (__m512 __A) { // CHECK-LABEL: @test_mm512_castps_pd - // CHECK: bitcast <16 x float> %1 to <8 x double> + // CHECK: bitcast <16 x float> %{{.}} to <8 x double> return _mm512_castps_pd (__A); } __m512i test_mm512_castpd_si512 (__m512d __A) { // CHECK-LABEL: @test_mm512_castpd_si512 - // CHECK: bitcast <8 x double> %1 to <8 x i64> + // CHECK: bitcast <8 x double> %{{.}} to <8 x i64> return _mm512_castpd_si512 (__A); } @@ -5961,21 +5961,21 @@ __m512d test_mm512_castpd256_pd512(__m25 __m256d test_mm512_castpd512_pd256 (__m512d __A) { // CHECK-LABEL: @test_mm512_castpd512_pd256 - // CHECK: shufflevector <8 x double> %1, <8 x double> %2, <4 x i32> + // CHECK: shufflevector <8 x double> %{{.}}, <8 x double> %{{.}}, <4 x i32> return _mm512_castpd512_pd256 (__A); } __m256 test_mm512_castps512_ps256 (__m512 __A) { // CHECK-LABEL: @test_mm512_castps512_ps256 - // CHECK: shufflevector <16 x float> %1, <16 x float> %2, <8 x i32> + // CHECK: shufflevector <16 x float> %{{.}}, <16 x float> %{{.}}, <8 x i32> return _mm512_castps512_ps256 (__A); } __m512i test_mm512_castps_si512 (__m512 __A) { // CHECK-LABEL: @test_mm512_castps_si512 - // CHECK: bitcast <16 x float> %1 to <8 x i64> + // CHECK: bitcast <16 x float> %{{.}} to <8 x i64> return _mm512_castps_si512 (__A); } __m512i test_mm512_castsi128_si512(__m128i __A) { @@ -5993,21 +5993,21 @@ __m512i test_mm512_castsi256_si512(__m25 __m512 test_mm512_castsi512_ps (__m512i __A) { // CHECK-LABEL: @test_mm512_castsi512_ps - // CHECK: bitcast <8 x i64> %1 to <16 x float> + // CHECK: bitcast <8 x i64> %{{.}} to <16 x float> return _mm512_castsi512_ps (__A); } __m512d test_mm512_castsi512_pd (__m512i __A) { // CHECK-LABEL: @test_mm512_castsi512_pd - // CHECK: bitcast <8 x i64> %1 to <8 x double> + // CHECK: bitcast <8 x i64> %{{.}} to <8 x double> return _mm512_castsi512_pd (__A); } __m128i test_mm512_castsi512_si128 (__m512i __A) { // CHECK-LABEL: @test_mm512_castsi512_si128 - // CHECK: shufflevector <8 x i64> %1, <8 x i64> %2, <2 x i32> + // CHECK: shufflevector <8 x i64> %{{.}}, <8 x i64> %{{.}}, <2 x i32> return _mm512_castsi512_si128 (__A); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20621: [include-fixer] Create a mode in vim integration to show multiple potential headers.
hokein updated this revision to Diff 58420. hokein added a comment. Fix a nit. http://reviews.llvm.org/D20621 Files: include-fixer/IncludeFixer.cpp include-fixer/IncludeFixer.h include-fixer/IncludeFixerContext.h include-fixer/tool/ClangIncludeFixer.cpp include-fixer/tool/clang-include-fixer.py unittests/include-fixer/IncludeFixerTest.cpp Index: unittests/include-fixer/IncludeFixerTest.cpp === --- unittests/include-fixer/IncludeFixerTest.cpp +++ unittests/include-fixer/IncludeFixerTest.cpp @@ -70,11 +70,16 @@ SymbolIndexMgr->addSymbolIndex( llvm::make_unique(Symbols)); - std::set Headers; - std::vector Replacements; - IncludeFixerActionFactory Factory(*SymbolIndexMgr, Headers, Replacements, -"llvm"); + IncludeFixerContext FixerContext; + IncludeFixerActionFactory Factory(*SymbolIndexMgr, FixerContext, "llvm"); + runOnCode(, Code, "input.cc", ExtraArgs); + std::vector Replacements; + if (!FixerContext.Headers.empty()) { +Replacements = clang::include_fixer::CreateReplacementsForHeader( +Code, "input.cc", "llvm", FixerContext.FirstIncludeOffset, +FixerContext.Headers.front()); + } clang::RewriterTestContext Context; clang::FileID ID = Context.createInMemoryFile("input.cc", Code); clang::tooling::applyAllReplacements(Replacements, Context.Rewrite); Index: include-fixer/tool/clang-include-fixer.py === --- include-fixer/tool/clang-include-fixer.py +++ include-fixer/tool/clang-include-fixer.py @@ -28,6 +28,22 @@ if vim.eval('exists("g:clang_include_fixer_path")') == "1": binary = vim.eval('g:clang_include_fixer_path') +choosing_mode = False; +if vim.eval('exists("g:clang_include_fixer_choosing_mode")') == "1": + choosing_mode = vim.eval('g:clang_include_fixer_choosing_mode') + +def ShowDialog(message, choices, default_choice_index=0): + to_eval = "confirm('{0}', '{1}', '{2}')".format(message, choices, default_choice_index) + return int(vim.eval(to_eval)); + + +def execute(command, text): + p = subprocess.Popen(command, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + stdin=subprocess.PIPE) + return p.communicate(input=text) + + def main(): parser = argparse.ArgumentParser( description='Vim integration for clang-include-fixer') @@ -41,13 +57,34 @@ buf = vim.current.buffer text = '\n'.join(buf) + if choosing_mode: +# Run command to get all headers. +command = [binary, "-output-headers", "-db="+args.db, "-input="+args.input, + vim.current.buffer.name] +stdout, stderr = execute(command, text) +lines = stdout.splitlines() +if len(lines) == 0: + return +symbol = lines[0] +choices_message = "" +index = 1; +for line in lines[1:]: + choices_message += "&" + str(index) + line + "\n" + index += 1 +select = ShowDialog("choose a header file for {0}.".format(symbol), choices_message) +# Insert a selected header. +command = [binary, "-insert-header="+lines[select], vim.current.buffer.name] +stdout, stderr = execute(command, text) +vim.current.buffer[:] = None; +vim.current.buffer.append(stdout.splitlines()) +print "Added #include {0}.".format(lines[select]) +return; + + # Call clang-include-fixer. command = [binary, "-stdin", "-db="+args.db, "-input="+args.input, vim.current.buffer.name] - p = subprocess.Popen(command, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, - stdin=subprocess.PIPE) - stdout, stderr = p.communicate(input=text) + stdout, stderr = execute(command, text) # If successful, replace buffer contents. if stderr: Index: include-fixer/tool/ClangIncludeFixer.cpp === --- include-fixer/tool/ClangIncludeFixer.cpp +++ include-fixer/tool/ClangIncludeFixer.cpp @@ -9,13 +9,16 @@ #include "InMemorySymbolIndex.h" #include "IncludeFixer.h" +#include "IncludeFixerContext.h" #include "SymbolIndexManager.h" #include "YamlSymbolIndex.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Rewrite/Core/Rewriter.h" #include "clang/Tooling/CommonOptionsParser.h" +#include "clang/Tooling/ReplacementsYaml.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/YAMLTraits.h" using namespace clang; using namespace llvm; @@ -56,6 +59,23 @@ "used for editor integration."), cl::init(false), cl::cat(IncludeFixerCategory)); +cl::opt OuputHeaders( +"output-headers", +cl::desc("Output the queried symbol and its relevant headers.\n" + "The first line is the symbol name. The other lines\n" + "are the headers: \n" + " b::foo\n" + "
RE: r267590 - [OpenCL] Add predefined macros.
This is because OpenCL sets C99 flag as being superset of it. If you check in clang/Frontend/LangStandards.def LANGSTANDARD(opencl, "cl", "OpenCL 1.0", LineComment | C99 | Digraphs | HexFloat) We should undo this change as it leaves no possibility to specify an OpenCL version during compilation apart from using the frontend option (which isn't conventional approach). Anastasia -Original Message- From: Liu, Yaxun (Sam) [mailto:yaxun@amd.com] Sent: 24 May 2016 19:58 To: Anastasia Stulova; cfe-commits@lists.llvm.org Cc: nd Subject: RE: r267590 - [OpenCL] Add predefined macros. Did clang accept -std=CL2.0 before this change? According to this diff, the only accepted option for -std= is c99 when compiling OpenCL programs. Sam -Original Message- From: Anastasia Stulova [mailto:anastasia.stul...@arm.com] Sent: Tuesday, May 24, 2016 2:48 PM To: Liu, Yaxun (Sam); cfe-commits@lists.llvm.org Cc: nd Subject: RE: r267590 - [OpenCL] Add predefined macros. Hi Sam, I think this commit broke Clang. It seems we are no longer able to pass the -std=CL2.0, which is important for the standalone Clang OpenCL users as -cl-std is frontend only option. clang -std=CL2.0 test.cl error: invalid argument '-std=CL2.0' not allowed with 'OpenCL' We might have to revert or rework this bit: --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Apr 26 14:25:46 +++ 2016 @@ -1495,9 +1495,8 @@ static void ParseLangArgs(LangOptions << A->getAsString(Args) << "C++/ObjC++"; break; case IK_OpenCL: -if (!Std.isC99()) - Diags.Report(diag::err_drv_argument_not_allowed_with) -<< A->getAsString(Args) << "OpenCL"; +Diags.Report(diag::err_drv_argument_not_allowed_with) + << A->getAsString(Args) << "OpenCL"; break; case IK_CUDA: case IK_PreprocessedCuda: Do you think you could look into this? Thanks, Anastasia -Original Message- From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of Yaxun Liu via cfe-commits Sent: 26 April 2016 20:26 To: cfe-commits@lists.llvm.org Subject: r267590 - [OpenCL] Add predefined macros. Author: yaxunl Date: Tue Apr 26 14:25:46 2016 New Revision: 267590 URL: http://llvm.org/viewvc/llvm-project?rev=267590=rev Log: [OpenCL] Add predefined macros. OpenCL spec requires __OPENCL_C_VERSION__ to be defined based on -cl-std option. This patch implements that. The patch also defines __FAST_RELAXED_MATH__ based on -cl-fast-relaxed-math option. Also fixed a test using -std=c99 for OpenCL program. Limit allowed language standard of OpenCL to be OpenCL standards. Differential Revision: http://reviews.llvm.org/D19071 Removed: cfe/trunk/test/Frontend/std.cl Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/InitPreprocessor.cpp cfe/trunk/test/Frontend/stdlang.c cfe/trunk/test/Preprocessor/predefined-macros.c Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=267590=267589=267590=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Apr 26 14:25:46 +++ 2016 @@ -1495,9 +1495,8 @@ static void ParseLangArgs(LangOptions << A->getAsString(Args) << "C++/ObjC++"; break; case IK_OpenCL: -if (!Std.isC99()) - Diags.Report(diag::err_drv_argument_not_allowed_with) -<< A->getAsString(Args) << "OpenCL"; +Diags.Report(diag::err_drv_argument_not_allowed_with) + << A->getAsString(Args) << "OpenCL"; break; case IK_CUDA: case IK_PreprocessedCuda: Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=267590=267589=267590=diff == --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original) +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Tue Apr 26 14:25:46 2016 @@ -408,6 +408,39 @@ static void InitializeStandardPredefined if (LangOpts.ObjC1) Builder.defineMacro("__OBJC__"); + // OpenCL v1.0/1.1 s6.9, v1.2/2.0 s6.10: Preprocessor Directives and Macros. + if (LangOpts.OpenCL) { +// OpenCL v1.0 and v1.1 do not have a predefined macro to indicate the +// language standard with which the program is compiled. __OPENCL_VERSION__ +// is for the OpenCL version supported by the OpenCL device, which is not +// necessarily the language standard with which the program is compiled. +// A shared OpenCL header file requires a macro to indicate the language +// standard. As a workaround,
Re: [PATCH] D20113: Fix mangled name of method with ns_consumed parameters.
thakis added a subscriber: thakis. thakis accepted this revision. thakis added a reviewer: thakis. thakis added a comment. This revision is now accepted and ready to land. We use phabricator not very dogmatically. If John says this looks good, then this looks good, even if phab didn't get the message :-) You do need a commit bit to land things. I've landed this change for you in r270702 (http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160523/159820.html). http://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access documents how to obtain commit access. http://reviews.llvm.org/D20113 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r270703 - [include-fixer] /usr/include/xlocal.h to include/xlocal.h in hardcoded map.
Author: ioeric Date: Wed May 25 09:17:09 2016 New Revision: 270703 URL: http://llvm.org/viewvc/llvm-project?rev=270703=rev Log: [include-fixer] /usr/include/xlocal.h to include/xlocal.h in hardcoded map. Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp?rev=270703=270702=270703=diff == --- clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp (original) +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp Wed May 25 09:17:09 2016 @@ -337,7 +337,7 @@ const HeaderMapCollector::HeaderMap *get {"sys/sysmacros.h", ""}, {"sys/types.h", ""}, {"sys/ucontext.h", ""}, - {"/usr/include/xlocale.h", ""}, + {"include/xlocale.h", ""}, {"bits/atomic_word.h", ""}, {"bits/basic_file.h", ""}, {"bits/c++allocator.h", ""}, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20621: [include-fixer] Create a mode in vim integration to show multiple potential headers.
hokein updated this revision to Diff 58415. hokein added a comment. Rebase http://reviews.llvm.org/D20621 Files: include-fixer/IncludeFixer.cpp include-fixer/IncludeFixer.h include-fixer/IncludeFixerContext.h include-fixer/tool/ClangIncludeFixer.cpp include-fixer/tool/clang-include-fixer.py unittests/include-fixer/IncludeFixerTest.cpp Index: unittests/include-fixer/IncludeFixerTest.cpp === --- unittests/include-fixer/IncludeFixerTest.cpp +++ unittests/include-fixer/IncludeFixerTest.cpp @@ -70,11 +70,16 @@ SymbolIndexMgr->addSymbolIndex( llvm::make_unique(Symbols)); - std::set Headers; - std::vector Replacements; - IncludeFixerActionFactory Factory(*SymbolIndexMgr, Headers, Replacements, -"llvm"); + IncludeFixerContext FixerContext; + IncludeFixerActionFactory Factory(*SymbolIndexMgr, FixerContext, "llvm"); + runOnCode(, Code, "input.cc", ExtraArgs); + std::vector Replacements; + if (!FixerContext.Headers.empty()) { +Replacements = clang::include_fixer::CreateReplacementsForHeader( +Code, "input.cc", "llvm", FixerContext.FirstIncludeOffset, +FixerContext.Headers.front()); + } clang::RewriterTestContext Context; clang::FileID ID = Context.createInMemoryFile("input.cc", Code); clang::tooling::applyAllReplacements(Replacements, Context.Rewrite); Index: include-fixer/tool/clang-include-fixer.py === --- include-fixer/tool/clang-include-fixer.py +++ include-fixer/tool/clang-include-fixer.py @@ -28,6 +28,22 @@ if vim.eval('exists("g:clang_include_fixer_path")') == "1": binary = vim.eval('g:clang_include_fixer_path') +choosing_mode = False; +if vim.eval('exists("g:clang_include_fixer_choosing_mode")') == "1": + choosing_mode = vim.eval('g:clang_include_fixer_choosing_mode') + +def ShowDialog(message, choices, default_choice_index=0): + to_eval = "confirm('{0}', '{1}', '{2}')".format(message, choices, default_choice_index) + return int(vim.eval(to_eval)); + + +def execute(command, text): + p = subprocess.Popen(command, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + stdin=subprocess.PIPE) + return p.communicate(input=text) + + def main(): parser = argparse.ArgumentParser( description='Vim integration for clang-include-fixer') @@ -41,13 +57,34 @@ buf = vim.current.buffer text = '\n'.join(buf) + if choosing_mode: +# Run command to get all headers. +command = [binary, "-output-headers", "-db="+args.db, "-input="+args.input, + vim.current.buffer.name] +stdout, stderr = execute(command, text) +lines = stdout.splitlines() +if len(lines) == 0: + return +symbol = lines[0] +choices_message = "" +index = 1; +for line in lines[1:]: + choices_message += "&" + str(index) + line + "\n" + index += 1 +select = ShowDialog("choose a header file for {0}.".format(symbol), choices_message) +# Insert a selected header. +command = [binary, "-insert-header="+lines[select], vim.current.buffer.name] +stdout, stderr = execute(command, text) +vim.current.buffer[:] = None; +vim.current.buffer.append(stdout.splitlines()) +print "Added #include {0}.".format(lines[select]) +return; + + # Call clang-include-fixer. command = [binary, "-stdin", "-db="+args.db, "-input="+args.input, vim.current.buffer.name] - p = subprocess.Popen(command, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, - stdin=subprocess.PIPE) - stdout, stderr = p.communicate(input=text) + stdout, stderr = execute(command, text) # If successful, replace buffer contents. if stderr: Index: include-fixer/tool/ClangIncludeFixer.cpp === --- include-fixer/tool/ClangIncludeFixer.cpp +++ include-fixer/tool/ClangIncludeFixer.cpp @@ -9,13 +9,16 @@ #include "InMemorySymbolIndex.h" #include "IncludeFixer.h" +#include "IncludeFixerContext.h" #include "SymbolIndexManager.h" #include "YamlSymbolIndex.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Rewrite/Core/Rewriter.h" #include "clang/Tooling/CommonOptionsParser.h" +#include "clang/Tooling/ReplacementsYaml.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/YAMLTraits.h" using namespace clang; using namespace llvm; @@ -56,6 +59,23 @@ "used for editor integration."), cl::init(false), cl::cat(IncludeFixerCategory)); +cl::opt OuputHeaders( +"output-headers", +cl::desc("Output the queried symbol and its relevant headers.\n" + "The first line is the symbol name. The other lines\n" + "are the headers: \n" + " b::foo\n" + "
[clang-tools-extra] r270701 - Include local header with quotes instead of angle brackets.
Author: d0k Date: Wed May 25 09:14:52 2016 New Revision: 270701 URL: http://llvm.org/viewvc/llvm-project?rev=270701=rev Log: Include local header with quotes instead of angle brackets. This works by accident because we pass '-I.' Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.h Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.h?rev=270701=270700=270701=diff == --- clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.h (original) +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.h Wed May 25 09:14:52 2016 @@ -10,7 +10,7 @@ #ifndef LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_TOOL_STL_POSTFIX_HEADER_MAP_H #define LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_TOOL_STL_POSTFIX_HEADER_MAP_H -#include +#include "HeaderMapCollector.h" namespace clang { namespace find_all_symbols { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270702 - Fix mangled name of method with ns_consumed parameters.
Author: nico Date: Wed May 25 09:15:08 2016 New Revision: 270702 URL: http://llvm.org/viewvc/llvm-project?rev=270702=rev Log: Fix mangled name of method with ns_consumed parameters. When a function/method use a parameter with "ns_consumed" attribute, ensure that the mangled name is the same whether -fobjc-arc is used or not. Since "ns_consumed" attribute is generally used to inform ARC that a function/method does sink the reference, it mean it is usually implemented in a compilation unit compiled without -fobjc-arc but used form a compilation unit compiled with it. Originally found while trying to use "ns_consumed" attribute in an Objective-C++ file in Chromium (http://crbug.com/599980) where it caused a linker error. Regression introduced by revision 262278 (previously the attribute was incorrectly not part of the mangled name). Patch from Sylvain Defresne! http://reviews.llvm.org/D20113 Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp cfe/trunk/test/CodeGenObjCXX/arc-attrs.mm cfe/trunk/test/CodeGenObjCXX/arc-mangle.mm cfe/trunk/test/CodeGenObjCXX/mangle.mm Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=270702=270701=270702=diff == --- cfe/trunk/lib/AST/ItaniumMangle.cpp (original) +++ cfe/trunk/lib/AST/ItaniumMangle.cpp Wed May 25 09:15:08 2016 @@ -2243,7 +2243,7 @@ void CXXNameMangler::mangleBareFunctionT FunctionTypeDepth.enterResultType(); // Mangle ns_returns_retained as an order-sensitive qualifier here. -if (Proto->getExtInfo().getProducesResult()) +if (Proto->getExtInfo().getProducesResult() && FD == nullptr) mangleVendorQualifier("ns_returns_retained"); // Mangle the return type without any direct ARC ownership qualifiers. @@ -2269,7 +2269,7 @@ void CXXNameMangler::mangleBareFunctionT assert(!FD || FD->getNumParams() == Proto->getNumParams()); for (unsigned I = 0, E = Proto->getNumParams(); I != E; ++I) { // Mangle extended parameter info as order-sensitive qualifiers here. -if (Proto->hasExtParameterInfos()) { +if (Proto->hasExtParameterInfos() && FD == nullptr) { mangleExtParameterInfo(Proto->getExtParameterInfo(I)); } @@ -3819,7 +3819,7 @@ void CXXNameMangler::mangleTemplateArg(T Out << 'L'; // References to external entities use the mangled name; if the name would -// not normally be manged then mangle it as unqualified. +// not normally be mangled then mangle it as unqualified. mangle(D); Out << 'E'; Modified: cfe/trunk/test/CodeGenObjCXX/arc-attrs.mm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/arc-attrs.mm?rev=270702=270701=270702=diff == --- cfe/trunk/test/CodeGenObjCXX/arc-attrs.mm (original) +++ cfe/trunk/test/CodeGenObjCXX/arc-attrs.mm Wed May 25 09:15:08 2016 @@ -12,7 +12,7 @@ void sanityTest() { id x = makeObject1(); // CHECK-NEXT: [[OBJ2:%.*]] = call i8* @_Z11makeObject2v() - // CHECK-NEXT: call void @_Z13releaseObjectU11ns_consumedP11objc_object(i8* [[OBJ2]]) + // CHECK-NEXT: call void @_Z13releaseObjectP11objc_object(i8* [[OBJ2]]) releaseObject(makeObject2()); // CHECK-NEXT: call void @objc_storeStrong(i8** [[X]], i8* null) @@ -31,16 +31,16 @@ void releaseObjectT(__attribute__((ns_co // CHECK-LABEL: define void @_Z12templateTestv void templateTest() { // CHECK: [[X:%.*]] = alloca i8*, align 8 - // CHECK-NEXT: [[OBJ1:%.*]] = call i8* @_Z12makeObjectT1IU8__strongP11objc_objectEU19ns_returns_retainedT_v() + // CHECK-NEXT: [[OBJ1:%.*]] = call i8* @_Z12makeObjectT1IU8__strongP11objc_objectET_v() // CHECK-NEXT: store i8* [[OBJ1]], i8** [[X]], align 8 id x = makeObjectT1(); - // CHECK-NEXT: [[OBJ2:%.*]] = call i8* @_Z12makeObjectT2IU8__strongP11objc_objectEU19ns_returns_retainedT_v() - // CHECK-NEXT: call void @_Z13releaseObjectU11ns_consumedP11objc_object(i8* [[OBJ2]]) + // CHECK-NEXT: [[OBJ2:%.*]] = call i8* @_Z12makeObjectT2IU8__strongP11objc_objectET_v() + // CHECK-NEXT: call void @_Z13releaseObjectP11objc_object(i8* [[OBJ2]]) releaseObject(makeObjectT2()); // CHECK-NEXT: [[OBJ3:%.*]] = call i8* @_Z11makeObject1v() - // CHECK-NEXT: call void @_Z14releaseObjectTIU8__strongP11objc_objectEvU11ns_consumedT_(i8* [[OBJ3]]) + // CHECK-NEXT: call void @_Z14releaseObjectTIU8__strongP11objc_objectEvT_(i8* [[OBJ3]]) releaseObjectT(makeObject1()); // CHECK-NEXT: call void @objc_storeStrong(i8** [[X]], i8* null) Modified: cfe/trunk/test/CodeGenObjCXX/arc-mangle.mm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/arc-mangle.mm?rev=270702=270701=270702=diff == --- cfe/trunk/test/CodeGenObjCXX/arc-mangle.mm (original) +++
Re: [PATCH] D20581: [include-fixer] Simplify the code since we won't handle multiple includes at once.
This revision was automatically updated to reflect the committed changes. Closed by commit rL270700: [include-fixer] Simplify the code since we won't handle multiple includes at… (authored by hokein). Changed prior to commit: http://reviews.llvm.org/D20581?vs=58272=58412#toc Repository: rL LLVM http://reviews.llvm.org/D20581 Files: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp Index: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp === --- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp +++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp @@ -282,64 +282,46 @@ clang::HeaderSearch , std::set , std::vector ) { -if (Untried.empty()) +if (SymbolQueryResults.empty()) return false; -const auto = UntriedList.front(); +// FIXME: Rank the results and pick the best one instead of the first one. +const auto = SymbolQueryResults.front(); Headers.insert(minimizeInclude(ToTry, SourceManager, HeaderSearch)); StringRef Code = SourceManager.getBufferData(SourceManager.getMainFileID()); Replacements = CreateReplacementsForHeaders(Code, Headers); // We currently abort after the first inserted include. The more // includes we have the less safe this becomes due to error recovery // changing the results. -// FIXME: Handle multiple includes at once. return true; } /// Sets the location at the very top of the file. void setFileBegin(clang::SourceLocation Location) { FileBegin = Location; } - /// Add an include to the set of includes to try. - /// \param include_path The include path to try. - void TryInclude(const std::string , const std::string _path) { -if (Untried.insert(include_path).second) - UntriedList.push_back(include_path); - } - private: /// Query the database for a given identifier. bool query(StringRef Query, SourceLocation Loc) { assert(!Query.empty() && "Empty query!"); -// Save database lookups by not looking up identifiers multiple times. -if (!SeenQueries.insert(Query).second) - return true; +// Skip other identifers once we have discovered an identfier successfully. +if (!SymbolQueryResults.empty()) + return false; DEBUG(llvm::dbgs() << "Looking up '" << Query << "' at "); DEBUG(Loc.print(llvm::dbgs(), getCompilerInstance().getSourceManager())); DEBUG(llvm::dbgs() << " ..."); -std::string error_text; -auto SearchReply = SymbolIndexMgr.search(Query); -DEBUG(llvm::dbgs() << SearchReply.size() << " replies\n"); -if (SearchReply.empty()) - return false; - -// Add those files to the set of includes to try out. -// FIXME: Rank the results and pick the best one instead of the first one. -TryInclude(Query, SearchReply[0]); - -return true; +SymbolQueryResults = SymbolIndexMgr.search(Query); +DEBUG(llvm::dbgs() << SymbolQueryResults.size() << " replies\n"); +return !SymbolQueryResults.empty(); } /// The client to use to find cross-references. SymbolIndexManager - // Remeber things we looked up to avoid querying things twice. - llvm::StringSet<> SeenQueries; - /// The absolute path to the file being processed. std::string Filename; @@ -354,11 +336,9 @@ /// clang-format config file found. std::string FallbackStyle; - /// Includes we have left to try. A set to unique them and a list to keep - /// track of the order. We prefer includes that were discovered early to avoid - /// getting caught in results from error recovery. - std::set Untried; - std::vector UntriedList; + /// The query results of an identifier. We only include the first discovered + /// identifier to avoid getting caught in results from error recovery. + std::vector SymbolQueryResults; /// Whether we should use the smallest possible include path. bool MinimizeIncludePaths = true; Index: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp === --- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp +++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp @@ -282,64 +282,46 @@ clang::HeaderSearch , std::set , std::vector ) { -if (Untried.empty()) +if (SymbolQueryResults.empty()) return false; -const auto = UntriedList.front(); +// FIXME: Rank the results and pick the best one instead of the first one. +const auto = SymbolQueryResults.front(); Headers.insert(minimizeInclude(ToTry, SourceManager, HeaderSearch)); StringRef Code = SourceManager.getBufferData(SourceManager.getMainFileID()); Replacements = CreateReplacementsForHeaders(Code, Headers); // We currently abort after the first inserted include. The more // includes we have the less safe this becomes due to error recovery
[clang-tools-extra] r270700 - [include-fixer] Simplify the code since we won't handle multiple includes at once.
Author: hokein Date: Wed May 25 09:06:12 2016 New Revision: 270700 URL: http://llvm.org/viewvc/llvm-project?rev=270700=rev Log: [include-fixer] Simplify the code since we won't handle multiple includes at once. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20581 Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp?rev=270700=270699=270700=diff == --- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp (original) +++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp Wed May 25 09:06:12 2016 @@ -282,10 +282,11 @@ public: clang::HeaderSearch , std::set , std::vector ) { -if (Untried.empty()) +if (SymbolQueryResults.empty()) return false; -const auto = UntriedList.front(); +// FIXME: Rank the results and pick the best one instead of the first one. +const auto = SymbolQueryResults.front(); Headers.insert(minimizeInclude(ToTry, SourceManager, HeaderSearch)); StringRef Code = SourceManager.getBufferData(SourceManager.getMainFileID()); @@ -294,52 +295,33 @@ public: // We currently abort after the first inserted include. The more // includes we have the less safe this becomes due to error recovery // changing the results. -// FIXME: Handle multiple includes at once. return true; } /// Sets the location at the very top of the file. void setFileBegin(clang::SourceLocation Location) { FileBegin = Location; } - /// Add an include to the set of includes to try. - /// \param include_path The include path to try. - void TryInclude(const std::string , const std::string _path) { -if (Untried.insert(include_path).second) - UntriedList.push_back(include_path); - } - private: /// Query the database for a given identifier. bool query(StringRef Query, SourceLocation Loc) { assert(!Query.empty() && "Empty query!"); -// Save database lookups by not looking up identifiers multiple times. -if (!SeenQueries.insert(Query).second) - return true; +// Skip other identifers once we have discovered an identfier successfully. +if (!SymbolQueryResults.empty()) + return false; DEBUG(llvm::dbgs() << "Looking up '" << Query << "' at "); DEBUG(Loc.print(llvm::dbgs(), getCompilerInstance().getSourceManager())); DEBUG(llvm::dbgs() << " ..."); -std::string error_text; -auto SearchReply = SymbolIndexMgr.search(Query); -DEBUG(llvm::dbgs() << SearchReply.size() << " replies\n"); -if (SearchReply.empty()) - return false; - -// Add those files to the set of includes to try out. -// FIXME: Rank the results and pick the best one instead of the first one. -TryInclude(Query, SearchReply[0]); - -return true; +SymbolQueryResults = SymbolIndexMgr.search(Query); +DEBUG(llvm::dbgs() << SymbolQueryResults.size() << " replies\n"); +return !SymbolQueryResults.empty(); } /// The client to use to find cross-references. SymbolIndexManager - // Remeber things we looked up to avoid querying things twice. - llvm::StringSet<> SeenQueries; - /// The absolute path to the file being processed. std::string Filename; @@ -354,11 +336,9 @@ private: /// clang-format config file found. std::string FallbackStyle; - /// Includes we have left to try. A set to unique them and a list to keep - /// track of the order. We prefer includes that were discovered early to avoid - /// getting caught in results from error recovery. - std::set Untried; - std::vector UntriedList; + /// The query results of an identifier. We only include the first discovered + /// identifier to avoid getting caught in results from error recovery. + std::vector SymbolQueryResults; /// Whether we should use the smallest possible include path. bool MinimizeIncludePaths = true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20523: [Clang][AVX512][BUILTIN] Add missing intrinsics for cast .
This revision was automatically updated to reflect the committed changes. Closed by commit rL270699: [Clang][AVX512][BUILTIN] Add missing intrinsics for cast (authored by mzuckerm). Changed prior to commit: http://reviews.llvm.org/D20523?vs=58095=58411#toc Repository: rL LLVM http://reviews.llvm.org/D20523 Files: cfe/trunk/lib/Headers/avx512fintrin.h cfe/trunk/test/CodeGen/avx512f-builtins.c Index: cfe/trunk/test/CodeGen/avx512f-builtins.c === --- cfe/trunk/test/CodeGen/avx512f-builtins.c +++ cfe/trunk/test/CodeGen/avx512f-builtins.c @@ -328,13 +328,6 @@ return _mm512_set1_pd(d); } -__m512d test_mm512_castpd256_pd512(__m256d a) -{ - // CHECK-LABEL: @test_mm512_castpd256_pd512 - // CHECK: shufflevector <4 x double> {{.*}} - return _mm512_castpd256_pd512(a); -} - __mmask16 test_mm512_knot(__mmask16 a) { // CHECK-LABEL: @test_mm512_knot @@ -5925,18 +5918,66 @@ return _mm512_maskz_cvttpd_epu32(__U, __A); } -__m512d test_mm512_castpd128_pd512(__m128d __A) { - // CHECK-LABEL: @test_mm512_castpd128_pd512 - // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <8 x i32> - return _mm512_castpd128_pd512(__A); +__m512 test_mm512_castpd_ps (__m512d __A) +{ + // CHECK-LABEL: @test_mm512_castpd_ps + // CHECK: bitcast <8 x double> %1 to <16 x float> + return _mm512_castpd_ps (__A); +} + +__m512d test_mm512_castps_pd (__m512 __A) +{ + // CHECK-LABEL: @test_mm512_castps_pd + // CHECK: bitcast <16 x float> %1 to <8 x double> + return _mm512_castps_pd (__A); +} + +__m512i test_mm512_castpd_si512 (__m512d __A) +{ + // CHECK-LABEL: @test_mm512_castpd_si512 + // CHECK: bitcast <8 x double> %1 to <8 x i64> + return _mm512_castpd_si512 (__A); } __m512 test_mm512_castps128_ps512(__m128 __A) { // CHECK-LABEL: @test_mm512_castps128_ps512 // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <16 x i32> return _mm512_castps128_ps512(__A); } +__m512d test_mm512_castpd128_pd512(__m128d __A) { + // CHECK-LABEL: @test_mm512_castpd128_pd512 + // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <8 x i32> + return _mm512_castpd128_pd512(__A); +} + +__m512d test_mm512_castpd256_pd512(__m256d a) +{ + // CHECK-LABEL: @test_mm512_castpd256_pd512 + // CHECK: shufflevector <4 x double> {{.*}} + return _mm512_castpd256_pd512(a); +} + +__m256d test_mm512_castpd512_pd256 (__m512d __A) +{ + // CHECK-LABEL: @test_mm512_castpd512_pd256 + // CHECK: shufflevector <8 x double> %1, <8 x double> %2, <4 x i32> + return _mm512_castpd512_pd256 (__A); +} + +__m256 test_mm512_castps512_ps256 (__m512 __A) +{ + // CHECK-LABEL: @test_mm512_castps512_ps256 + // CHECK: shufflevector <16 x float> %1, <16 x float> %2, <8 x i32> + return _mm512_castps512_ps256 (__A); +} + +__m512i test_mm512_castps_si512 (__m512 __A) +{ + // CHECK-LABEL: @test_mm512_castps_si512 + // CHECK: bitcast <16 x float> %1 to <8 x i64> + return _mm512_castps_si512 (__A); +} __m512i test_mm512_castsi128_si512(__m128i __A) { // CHECK-LABEL: @test_mm512_castsi128_si512 // CHECK: shufflevector <2 x i64> %{{.*}}, <2 x i64> %{{.*}}, <8 x i32> @@ -5949,6 +5990,26 @@ return _mm512_castsi256_si512(__A); } +__m512 test_mm512_castsi512_ps (__m512i __A) +{ + // CHECK-LABEL: @test_mm512_castsi512_ps + // CHECK: bitcast <8 x i64> %1 to <16 x float> + return _mm512_castsi512_ps (__A); +} + +__m512d test_mm512_castsi512_pd (__m512i __A) +{ + // CHECK-LABEL: @test_mm512_castsi512_pd + // CHECK: bitcast <8 x i64> %1 to <8 x double> + return _mm512_castsi512_pd (__A); +} + +__m128i test_mm512_castsi512_si128 (__m512i __A) +{ + // CHECK-LABEL: @test_mm512_castsi512_si128 + // CHECK: shufflevector <8 x i64> %1, <8 x i64> %2, <2 x i32> + return _mm512_castsi512_si128 (__A); +} __m128 test_mm_cvt_roundsd_ss(__m128 __A, __m128d __B) { // CHECK-LABEL: @test_mm_cvt_roundsd_ss Index: cfe/trunk/lib/Headers/avx512fintrin.h === --- cfe/trunk/lib/Headers/avx512fintrin.h +++ cfe/trunk/lib/Headers/avx512fintrin.h @@ -337,19 +337,54 @@ return __builtin_shufflevector(__a, __a, 0, 1); } +static __inline __m256d __DEFAULT_FN_ATTRS +_mm512_castpd512_pd256 (__m512d __A) +{ + return __builtin_shufflevector(__A, __A, 0, 1, 2, 3); +} + static __inline __m128 __DEFAULT_FN_ATTRS _mm512_castps512_ps128(__m512 __a) { return __builtin_shufflevector(__a, __a, 0, 1, 2, 3); } +static __inline __m256 __DEFAULT_FN_ATTRS +_mm512_castps512_ps256 (__m512 __A) +{ + return __builtin_shufflevector(__A, __A, 0, 1, 2, 3, 4, 5, 6, 7); +} + +static __inline __m512 __DEFAULT_FN_ATTRS +_mm512_castpd_ps (__m512d __A) +{ + return (__m512) (__A); +} + +static __inline __m512i __DEFAULT_FN_ATTRS +_mm512_castpd_si512 (__m512d __A) +{ + return (__m512i) (__A); +} static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_castpd128_pd512 (__m128d __A) {
r270699 - [Clang][AVX512][BUILTIN] Add missing intrinsics for cast
Author: mzuckerm Date: Wed May 25 09:04:21 2016 New Revision: 270699 URL: http://llvm.org/viewvc/llvm-project?rev=270699=rev Log: [Clang][AVX512][BUILTIN] Add missing intrinsics for cast Differential Revision: http://reviews.llvm.org/D20523 Modified: cfe/trunk/lib/Headers/avx512fintrin.h cfe/trunk/test/CodeGen/avx512f-builtins.c Modified: cfe/trunk/lib/Headers/avx512fintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=270699=270698=270699=diff == --- cfe/trunk/lib/Headers/avx512fintrin.h (original) +++ cfe/trunk/lib/Headers/avx512fintrin.h Wed May 25 09:04:21 2016 @@ -337,12 +337,35 @@ _mm512_castpd512_pd128(__m512d __a) return __builtin_shufflevector(__a, __a, 0, 1); } +static __inline __m256d __DEFAULT_FN_ATTRS +_mm512_castpd512_pd256 (__m512d __A) +{ + return __builtin_shufflevector(__A, __A, 0, 1, 2, 3); +} + static __inline __m128 __DEFAULT_FN_ATTRS _mm512_castps512_ps128(__m512 __a) { return __builtin_shufflevector(__a, __a, 0, 1, 2, 3); } +static __inline __m256 __DEFAULT_FN_ATTRS +_mm512_castps512_ps256 (__m512 __A) +{ + return __builtin_shufflevector(__A, __A, 0, 1, 2, 3, 4, 5, 6, 7); +} + +static __inline __m512 __DEFAULT_FN_ATTRS +_mm512_castpd_ps (__m512d __A) +{ + return (__m512) (__A); +} + +static __inline __m512i __DEFAULT_FN_ATTRS +_mm512_castpd_si512 (__m512d __A) +{ + return (__m512i) (__A); +} static __inline__ __m512d __DEFAULT_FN_ATTRS _mm512_castpd128_pd512 (__m128d __A) @@ -350,6 +373,18 @@ _mm512_castpd128_pd512 (__m128d __A) return __builtin_shufflevector( __A, __A, 0, 1, -1, -1, -1, -1, -1, -1); } +static __inline __m512d __DEFAULT_FN_ATTRS +_mm512_castps_pd (__m512 __A) +{ + return (__m512d) (__A); +} + +static __inline __m512i __DEFAULT_FN_ATTRS +_mm512_castps_si512 (__m512 __A) +{ + return (__m512i) (__A); +} + static __inline__ __m512 __DEFAULT_FN_ATTRS _mm512_castps128_ps512 (__m128 __A) { @@ -368,6 +403,24 @@ _mm512_castsi256_si512 (__m256i __A) return __builtin_shufflevector( __A, __A, 0, 1, 2, 3, -1, -1, -1, -1); } +static __inline __m512 __DEFAULT_FN_ATTRS +_mm512_castsi512_ps (__m512i __A) +{ + return (__m512) (__A); +} + +static __inline __m512d __DEFAULT_FN_ATTRS +_mm512_castsi512_pd (__m512i __A) +{ + return (__m512d) (__A); +} + +static __inline __m128i __DEFAULT_FN_ATTRS +_mm512_castsi512_si128 (__m512i __A) +{ + return (__m128i)__builtin_shufflevector(__A, __A , 0, 1); +} + /* Bitwise operators */ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_and_epi32(__m512i __a, __m512i __b) Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=270699=270698=270699=diff == --- cfe/trunk/test/CodeGen/avx512f-builtins.c (original) +++ cfe/trunk/test/CodeGen/avx512f-builtins.c Wed May 25 09:04:21 2016 @@ -328,13 +328,6 @@ __m512d test_mm512_set1_pd(double d) return _mm512_set1_pd(d); } -__m512d test_mm512_castpd256_pd512(__m256d a) -{ - // CHECK-LABEL: @test_mm512_castpd256_pd512 - // CHECK: shufflevector <4 x double> {{.*}} - return _mm512_castpd256_pd512(a); -} - __mmask16 test_mm512_knot(__mmask16 a) { // CHECK-LABEL: @test_mm512_knot @@ -5925,10 +5918,25 @@ __m256i test_mm512_maskz_cvttpd_epu32(__ return _mm512_maskz_cvttpd_epu32(__U, __A); } -__m512d test_mm512_castpd128_pd512(__m128d __A) { - // CHECK-LABEL: @test_mm512_castpd128_pd512 - // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <8 x i32> - return _mm512_castpd128_pd512(__A); +__m512 test_mm512_castpd_ps (__m512d __A) +{ + // CHECK-LABEL: @test_mm512_castpd_ps + // CHECK: bitcast <8 x double> %1 to <16 x float> + return _mm512_castpd_ps (__A); +} + +__m512d test_mm512_castps_pd (__m512 __A) +{ + // CHECK-LABEL: @test_mm512_castps_pd + // CHECK: bitcast <16 x float> %1 to <8 x double> + return _mm512_castps_pd (__A); +} + +__m512i test_mm512_castpd_si512 (__m512d __A) +{ + // CHECK-LABEL: @test_mm512_castpd_si512 + // CHECK: bitcast <8 x double> %1 to <8 x i64> + return _mm512_castpd_si512 (__A); } __m512 test_mm512_castps128_ps512(__m128 __A) { @@ -5937,6 +5945,39 @@ __m512 test_mm512_castps128_ps512(__m128 return _mm512_castps128_ps512(__A); } +__m512d test_mm512_castpd128_pd512(__m128d __A) { + // CHECK-LABEL: @test_mm512_castpd128_pd512 + // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <8 x i32> + return _mm512_castpd128_pd512(__A); +} + +__m512d test_mm512_castpd256_pd512(__m256d a) +{ + // CHECK-LABEL: @test_mm512_castpd256_pd512 + // CHECK: shufflevector <4 x double> {{.*}} + return _mm512_castpd256_pd512(a); +} + +__m256d test_mm512_castpd512_pd256 (__m512d __A) +{ + // CHECK-LABEL: @test_mm512_castpd512_pd256 + // CHECK: shufflevector <8 x double> %1, <8 x double> %2,
Re: [PATCH] D19274: Compilation for Intel MCU (Part 2/3)
aturetsk added a comment. Ping. http://reviews.llvm.org/D19274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20619: [include-fixer] moved STLPostfixMap into findAllSymbols library and make it a static variable in function.
This revision was automatically updated to reflect the committed changes. Closed by commit rL270696: [include-fixer] moved STLPostfixMap into findAllSymbols library and make it a… (authored by ioeric). Changed prior to commit: http://reviews.llvm.org/D20619?vs=58408=58410#toc Repository: rL LLVM http://reviews.llvm.org/D20619 Files: clang-tools-extra/trunk/include-fixer/find-all-symbols/CMakeLists.txt clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.h clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/CMakeLists.txt clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/STLPostfixHeaderMap.cpp clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/STLPostfixHeaderMap.h Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/CMakeLists.txt === --- clang-tools-extra/trunk/include-fixer/find-all-symbols/CMakeLists.txt +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/CMakeLists.txt @@ -8,6 +8,7 @@ FindAllMacros.cpp HeaderMapCollector.cpp PragmaCommentHandler.cpp + STLPostfixHeaderMap.cpp SymbolInfo.cpp LINK_LIBS Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/CMakeLists.txt === --- clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/CMakeLists.txt +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/CMakeLists.txt @@ -1,9 +1,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) -add_clang_executable(find-all-symbols -FindAllSymbolsMain.cpp -STLPostfixHeaderMap.cpp -) +add_clang_executable(find-all-symbols FindAllSymbolsMain.cpp) target_link_libraries(find-all-symbols clangAST Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp === --- clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp @@ -149,7 +149,7 @@ auto Factory = llvm::make_unique( - , ::find_all_symbols::STLPostfixHeaderMap); + , clang::find_all_symbols::getSTLPostfixHeaderMap()); Tool.run(Factory.get()); return 0; } Index: clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/STLPostfixHeaderMap.cpp === --- clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/STLPostfixHeaderMap.cpp +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/STLPostfixHeaderMap.cpp @@ -1,358 +0,0 @@ -//===-- STLPostfixHeaderMap.h - hardcoded STL header map *- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#include "STLPostfixHeaderMap.h" - -namespace clang { -namespace find_all_symbols { - -const HeaderMapCollector::HeaderMap STLPostfixHeaderMap = { -{"include/__stddef_max_align_t.h", ""}, -{"include/__wmmintrin_aes.h", ""}, -{"include/__wmmintrin_pclmul.h", ""}, -{"include/adxintrin.h", ""}, -{"include/ammintrin.h", ""}, -{"include/avx2intrin.h", ""}, -{"include/avx512bwintrin.h", ""}, -{"include/avx512cdintrin.h", ""}, -{"include/avx512dqintrin.h", ""}, -{"include/avx512erintrin.h", ""}, -{"include/avx512fintrin.h", ""}, -{"include/avx512ifmaintrin.h", ""}, -{"include/avx512ifmavlintrin.h", ""}, -{"include/avx512pfintrin.h", ""}, -{"include/avx512vbmiintrin.h", ""}, -{"include/avx512vbmivlintrin.h", ""}, -{"include/avx512vlbwintrin.h", ""}, -{"include/avx512vlcdintrin.h", ""}, -{"include/avx512vldqintrin.h", ""}, -{"include/avx512vlintrin.h", ""}, -{"include/avxintrin.h", ""}, -{"include/bmi2intrin.h", ""}, -{"include/bmiintrin.h", ""}, -{"include/emmintrin.h", ""}, -{"include/f16cintrin.h", ""}, -{"include/float.h", ""}, -{"include/fma4intrin.h", ""}, -{"include/fmaintrin.h", ""}, -{"include/fxsrintrin.h", ""}, -{"include/ia32intrin.h", ""}, -{"include/immintrin.h", ""}, -{"include/inttypes.h", ""}, -{"include/limits.h", ""}, -{"include/lzcntintrin.h", ""}, -{"include/mm3dnow.h", ""}, -{"include/mm_malloc.h", ""}, -{"include/mmintrin.h", ""}, -{"include/mwaitxintrin.h", ""}, -{"include/pkuintrin.h", ""}, -{"include/pmmintrin.h", ""}, -{"include/popcntintrin.h", ""}, -{"include/prfchwintrin.h", ""}, -{"include/rdseedintrin.h", ""}, -{"include/rtmintrin.h", ""}, -
Re: [PATCH] D20621: [include-fixer] Create a mode in vim integration to show multiple potential headers.
hokein added a comment. Oh, sorry, I miss two separate commits here. This patch should not be ready for review. I need to rebase it after commit http://reviews.llvm.org/D20581. http://reviews.llvm.org/D20621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r270696 - [include-fixer] moved STLPostfixMap into findAllSymbols library and make it a static variable in function.
Author: ioeric Date: Wed May 25 08:53:33 2016 New Revision: 270696 URL: http://llvm.org/viewvc/llvm-project?rev=270696=rev Log: [include-fixer] moved STLPostfixMap into findAllSymbols library and make it a static variable in function. Summary: [include-fixer] moved STLPostfixMap into findAllSymbols library and make it a static variable in function. Reviewers: bkramer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20619 Added: clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.h - copied, changed from r270682, clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/STLPostfixHeaderMap.h Removed: clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/STLPostfixHeaderMap.cpp clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/STLPostfixHeaderMap.h Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/CMakeLists.txt clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/CMakeLists.txt clang-tools-extra/trunk/include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/CMakeLists.txt?rev=270696=270695=270696=diff == --- clang-tools-extra/trunk/include-fixer/find-all-symbols/CMakeLists.txt (original) +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/CMakeLists.txt Wed May 25 08:53:33 2016 @@ -8,6 +8,7 @@ add_clang_library(findAllSymbols FindAllMacros.cpp HeaderMapCollector.cpp PragmaCommentHandler.cpp + STLPostfixHeaderMap.cpp SymbolInfo.cpp LINK_LIBS Added: clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp?rev=270696=auto == --- clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp (added) +++ clang-tools-extra/trunk/include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp Wed May 25 08:53:33 2016 @@ -0,0 +1,360 @@ +//===-- STLPostfixHeaderMap.h - hardcoded STL header map *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "STLPostfixHeaderMap.h" + +namespace clang { +namespace find_all_symbols { + +const HeaderMapCollector::HeaderMap *getSTLPostfixHeaderMap() { + static const HeaderMapCollector::HeaderMap STLPostfixHeaderMap = { + {"include/__stddef_max_align_t.h", ""}, + {"include/__wmmintrin_aes.h", ""}, + {"include/__wmmintrin_pclmul.h", ""}, + {"include/adxintrin.h", ""}, + {"include/ammintrin.h", ""}, + {"include/avx2intrin.h", ""}, + {"include/avx512bwintrin.h", ""}, + {"include/avx512cdintrin.h", ""}, + {"include/avx512dqintrin.h", ""}, + {"include/avx512erintrin.h", ""}, + {"include/avx512fintrin.h", ""}, + {"include/avx512ifmaintrin.h", ""}, + {"include/avx512ifmavlintrin.h", ""}, + {"include/avx512pfintrin.h", ""}, + {"include/avx512vbmiintrin.h", ""}, + {"include/avx512vbmivlintrin.h", ""}, + {"include/avx512vlbwintrin.h", ""}, + {"include/avx512vlcdintrin.h", ""}, + {"include/avx512vldqintrin.h", ""}, + {"include/avx512vlintrin.h", ""}, + {"include/avxintrin.h", ""}, + {"include/bmi2intrin.h", ""}, + {"include/bmiintrin.h", ""}, + {"include/emmintrin.h", ""}, + {"include/f16cintrin.h", ""}, + {"include/float.h", ""}, + {"include/fma4intrin.h", ""}, + {"include/fmaintrin.h", ""}, + {"include/fxsrintrin.h", ""}, + {"include/ia32intrin.h", ""}, + {"include/immintrin.h", ""}, + {"include/inttypes.h", ""}, + {"include/limits.h", ""}, + {"include/lzcntintrin.h", ""}, + {"include/mm3dnow.h", ""}, + {"include/mm_malloc.h", ""}, + {"include/mmintrin.h", ""}, + {"include/mwaitxintrin.h", ""}, + {"include/pkuintrin.h", ""}, + {"include/pmmintrin.h", ""}, + {"include/popcntintrin.h", ""}, + {"include/prfchwintrin.h", ""}, + {"include/rdseedintrin.h", ""}, + {"include/rtmintrin.h", ""}, + {"include/shaintrin.h", ""}, + {"include/smmintrin.h", ""}, + {"include/stdalign.h", ""}, + {"include/stdarg.h", ""}, + {"include/stdbool.h", ""}, + {"include/stddef.h", ""}, + {"include/stdint.h", ""}, + {"include/tbmintrin.h", ""}, + {"include/tmmintrin.h", ""}, +
[PATCH] D20621: [include-fixer] Create a mode in vim integration to show multiple potential headers.
hokein created this revision. hokein added a reviewer: bkramer. hokein added subscribers: ioeric, cfe-commits. Some changes in the patch: * Add two commandline flags in clang-include-fixer. * Introduce a IncludeFixerContext for the queried symbol. * Pull out CreateReplacementsForHeader. http://reviews.llvm.org/D20621 Files: include-fixer/IncludeFixer.cpp include-fixer/IncludeFixer.h include-fixer/IncludeFixerContext.h include-fixer/tool/ClangIncludeFixer.cpp include-fixer/tool/clang-include-fixer.py unittests/include-fixer/IncludeFixerTest.cpp Index: unittests/include-fixer/IncludeFixerTest.cpp === --- unittests/include-fixer/IncludeFixerTest.cpp +++ unittests/include-fixer/IncludeFixerTest.cpp @@ -70,11 +70,16 @@ SymbolIndexMgr->addSymbolIndex( llvm::make_unique(Symbols)); - std::set Headers; - std::vector Replacements; - IncludeFixerActionFactory Factory(*SymbolIndexMgr, Headers, Replacements, -"llvm"); + IncludeFixerContext FixerContext; + IncludeFixerActionFactory Factory(*SymbolIndexMgr, FixerContext, "llvm"); + runOnCode(, Code, "input.cc", ExtraArgs); + std::vector Replacements; + if (!FixerContext.Headers.empty()) { +Replacements = clang::include_fixer::CreateReplacementsForHeader( +Code, "input.cc", "llvm", FixerContext.FirstIncludeOffset, +FixerContext.Headers.front()); + } clang::RewriterTestContext Context; clang::FileID ID = Context.createInMemoryFile("input.cc", Code); clang::tooling::applyAllReplacements(Replacements, Context.Rewrite); Index: include-fixer/tool/clang-include-fixer.py === --- include-fixer/tool/clang-include-fixer.py +++ include-fixer/tool/clang-include-fixer.py @@ -28,6 +28,22 @@ if vim.eval('exists("g:clang_include_fixer_path")') == "1": binary = vim.eval('g:clang_include_fixer_path') +choosing_mode = False; +if vim.eval('exists("g:clang_include_fixer_choosing_mode")') == "1": + choosing_mode = vim.eval('g:clang_include_fixer_choosing_mode') + +def ShowDialog(message, choices, default_choice_index=0): + to_eval = "confirm('{0}', '{1}', '{2}')".format(message, choices, default_choice_index) + return int(vim.eval(to_eval)); + + +def execute(command, text): + p = subprocess.Popen(command, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + stdin=subprocess.PIPE) + return p.communicate(input=text) + + def main(): parser = argparse.ArgumentParser( description='Vim integration for clang-include-fixer') @@ -41,13 +57,34 @@ buf = vim.current.buffer text = '\n'.join(buf) + if choosing_mode: +# Run command to get all headers. +command = [binary, "-output-headers", "-db="+args.db, "-input="+args.input, + vim.current.buffer.name] +stdout, stderr = execute(command, text) +lines = stdout.splitlines() +if len(lines) == 0: + return +symbol = lines[0] +choices_message = "" +index = 1; +for line in lines[1:]: + choices_message += "&" + str(index) + line + "\n" + index += 1 +select = ShowDialog("choose a header file for {0}.".format(symbol), choices_message) +# Insert a selected header. +command = [binary, "-insert-header="+lines[select], vim.current.buffer.name] +stdout, stderr = execute(command, text) +vim.current.buffer[:] = None; +vim.current.buffer.append(stdout.splitlines()) +print "Added #include {0}.".format(lines[select]) +return; + + # Call clang-include-fixer. command = [binary, "-stdin", "-db="+args.db, "-input="+args.input, vim.current.buffer.name] - p = subprocess.Popen(command, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, - stdin=subprocess.PIPE) - stdout, stderr = p.communicate(input=text) + stdout, stderr = execute(command, text) # If successful, replace buffer contents. if stderr: Index: include-fixer/tool/ClangIncludeFixer.cpp === --- include-fixer/tool/ClangIncludeFixer.cpp +++ include-fixer/tool/ClangIncludeFixer.cpp @@ -9,13 +9,16 @@ #include "InMemorySymbolIndex.h" #include "IncludeFixer.h" +#include "IncludeFixerContext.h" #include "SymbolIndexManager.h" #include "YamlSymbolIndex.h" #include "clang/Frontend/TextDiagnosticPrinter.h" #include "clang/Rewrite/Core/Rewriter.h" #include "clang/Tooling/CommonOptionsParser.h" +#include "clang/Tooling/ReplacementsYaml.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/YAMLTraits.h" using namespace clang; using namespace llvm; @@ -56,6 +59,23 @@ "used for editor integration."), cl::init(false), cl::cat(IncludeFixerCategory)); +cl::opt OuputHeaders( +"output-headers", +
Re: [PATCH] D20620: [Clang][AVX512][Builtin] Fix palignr intrinsics header
igorb accepted this revision. igorb added a comment. This revision is now accepted and ready to land. LGTM http://reviews.llvm.org/D20620 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20620: [Clang][AVX512][Builtin] Fix palignr intrinsics header
m_zuckerman created this revision. m_zuckerman added reviewers: AsafBadouh, igorb, delena. m_zuckerman added a subscriber: cfe-commits. We don't need to multiply by eight the IMM. The instruction is doing that. http://reviews.llvm.org/D20620 Files: lib/Headers/avx512bwintrin.h Index: lib/Headers/avx512bwintrin.h === --- lib/Headers/avx512bwintrin.h +++ lib/Headers/avx512bwintrin.h @@ -2145,19 +2145,19 @@ #define _mm512_alignr_epi8(A, B, N) __extension__ ({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)_mm512_undefined_pd(), \ (__mmask64)-1); }) #define _mm512_mask_alignr_epi8(W, U, A, B, N) __extension__({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)(__m512i)(W), \ (__mmask64)(U)); }) #define _mm512_maskz_alignr_epi8(U, A, B, N) __extension__({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)_mm512_setzero_si512(), \ (__mmask64)(U)); }) Index: lib/Headers/avx512bwintrin.h === --- lib/Headers/avx512bwintrin.h +++ lib/Headers/avx512bwintrin.h @@ -2145,19 +2145,19 @@ #define _mm512_alignr_epi8(A, B, N) __extension__ ({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)_mm512_undefined_pd(), \ (__mmask64)-1); }) #define _mm512_mask_alignr_epi8(W, U, A, B, N) __extension__({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)(__m512i)(W), \ (__mmask64)(U)); }) #define _mm512_maskz_alignr_epi8(U, A, B, N) __extension__({\ (__m512i)__builtin_ia32_palignr512_mask((__v64qi)(__m512i)(A), \ - (__v64qi)(__m512i)(B), (int)(N) * 8, \ + (__v64qi)(__m512i)(B), (int)(N), \ (__v64qi)_mm512_setzero_si512(), \ (__mmask64)(U)); }) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20562: [Clang][AVX512][BUILTIN] Adding intrinsics for set1
AsafBadouh accepted this revision. AsafBadouh added a comment. This revision is now accepted and ready to land. LGTM with small fix Comment at: test/CodeGen/avx512f-builtins.c:341 @@ +340,3 @@ + // CHECK: insertelement <64 x i8> {{.*}}, i32 6 + // CHECK: insertelement <64 x i8> {{.*}}, i32 7 + return _mm512_set1_epi8(d); can you add // CHECK: insertelement <64 x i8> {{.*}}, i32 63 Comment at: test/CodeGen/avx512f-builtins.c:356 @@ +355,3 @@ + // CHECK: insertelement <32 x i16> {{.*}}, i32 7 + return _mm512_set1_epi16(d); +} same here: // CHECK: insertelement <32 x i16> {{.*}}, i32 31 http://reviews.llvm.org/D20562 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20523: [Clang][AVX512][BUILTIN] Add missing intrinsics for cast .
AsafBadouh accepted this revision. AsafBadouh added a comment. This revision is now accepted and ready to land. LGTM http://reviews.llvm.org/D20523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20618: [Clang][avx512][builtin] Adding missing intrinsics for cvt
m_zuckerman created this revision. m_zuckerman added reviewers: AsafBadouh, igorb, delena. m_zuckerman added a subscriber: cfe-commits. http://reviews.llvm.org/D20618 Files: lib/Headers/avx512fintrin.h test/CodeGen/avx512f-builtins.c Index: lib/Headers/avx512fintrin.h === --- lib/Headers/avx512fintrin.h +++ lib/Headers/avx512fintrin.h @@ -3709,6 +3709,17 @@ _MM_FROUND_CUR_DIRECTION); } +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_cvtps_epu32 ( __mmask16 __U, __m512 __A) +{ + return (__m512i) __builtin_ia32_cvtps2udq512_mask ((__v16sf) __A, + (__v16si) + _mm512_setzero_si512 (), + (__mmask16) __U , + _MM_FROUND_CUR_DIRECTION); +} + + #define _mm512_cvt_roundpd_epu32(A, R) __extension__ ({ \ (__m256i)__builtin_ia32_cvtpd2udq512_mask((__v8df)(__m512d)(A), \ (__v8si)_mm256_setzero_si256(), \ Index: test/CodeGen/avx512f-builtins.c === --- test/CodeGen/avx512f-builtins.c +++ test/CodeGen/avx512f-builtins.c @@ -6302,6 +6302,13 @@ return _mm512_mask_cvtps_epu32( __W, __U, __A); } +__m512i test_mm512_maskz_cvtps_epu32 (__mmask16 __U, __m512 __A) +{ + // CHECK-LABEL: @test_mm512_mask_cvtps_epu32 + // CHECK: @llvm.x86.avx512.mask.cvtps2udq.512 + return _mm512_mask_cvtps_epu32( __U, __A); +} + __m512d test_mm512_mask_max_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) { // CHECK-LABEL: @test_mm512_mask_max_pd Index: lib/Headers/avx512fintrin.h === --- lib/Headers/avx512fintrin.h +++ lib/Headers/avx512fintrin.h @@ -3709,6 +3709,17 @@ _MM_FROUND_CUR_DIRECTION); } +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_maskz_cvtps_epu32 ( __mmask16 __U, __m512 __A) +{ + return (__m512i) __builtin_ia32_cvtps2udq512_mask ((__v16sf) __A, + (__v16si) + _mm512_setzero_si512 (), + (__mmask16) __U , + _MM_FROUND_CUR_DIRECTION); +} + + #define _mm512_cvt_roundpd_epu32(A, R) __extension__ ({ \ (__m256i)__builtin_ia32_cvtpd2udq512_mask((__v8df)(__m512d)(A), \ (__v8si)_mm256_setzero_si256(), \ Index: test/CodeGen/avx512f-builtins.c === --- test/CodeGen/avx512f-builtins.c +++ test/CodeGen/avx512f-builtins.c @@ -6302,6 +6302,13 @@ return _mm512_mask_cvtps_epu32( __W, __U, __A); } +__m512i test_mm512_maskz_cvtps_epu32 (__mmask16 __U, __m512 __A) +{ + // CHECK-LABEL: @test_mm512_mask_cvtps_epu32 + // CHECK: @llvm.x86.avx512.mask.cvtps2udq.512 + return _mm512_mask_cvtps_epu32( __U, __A); +} + __m512d test_mm512_mask_max_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) { // CHECK-LABEL: @test_mm512_mask_max_pd ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270693 - Fix build problem in MSVC
Author: abataev Date: Wed May 25 07:51:24 2016 New Revision: 270693 URL: http://llvm.org/viewvc/llvm-project?rev=270693=rev Log: Fix build problem in MSVC Modified: cfe/trunk/lib/AST/OpenMPClause.cpp Modified: cfe/trunk/lib/AST/OpenMPClause.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/OpenMPClause.cpp?rev=270693=270692=270693=diff == --- cfe/trunk/lib/AST/OpenMPClause.cpp (original) +++ cfe/trunk/lib/AST/OpenMPClause.cpp Wed May 25 07:51:24 2016 @@ -526,10 +526,7 @@ OMPDependClause *OMPDependClause::Create } OMPDependClause *OMPDependClause::CreateEmpty(const ASTContext , unsigned N) { - void *Mem = C.Allocate(totalSizeToAlloc( - static_cast::type>(N) + - 1)); + void *Mem = C.Allocate(totalSizeToAlloc(N + 1)); return new (Mem) OMPDependClause(N); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20119: [libunwind] Improve unwinder stack usage
rmaprath added a comment. Committed as r270692. But I forgot to mention this phab review in the commit message. Sigh. http://reviews.llvm.org/D20119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r270692 - Introduce a native-only unwinder build.
Author: asiri Date: Wed May 25 07:36:34 2016 New Revision: 270692 URL: http://llvm.org/viewvc/llvm-project?rev=270692=rev Log: Introduce a native-only unwinder build. Currently libunwind is built to support cross-unwinding [1] by default, which requires the buffers unw_context_t and unw_cursor_t to be large enough to hold the vritual register set (VRS) of any supported architecture. This is not desirable for some platforms where the stack usage of the unwinder needs to be kept to a minimum (e.g. bare-metal targets). The current patch introduces a native-only (-DLIBUNWIND_ENABLE_CROSS_UNWINDING=OFF) unwinder variant that adopts strict sizes for the buffers unw_context_t and unw_cursor_t depending on the target architecture. [1] http://www.nongnu.org/libunwind/man/libunwind(3).html#section_4 Change-Id: I380fff9a56c16a0fc520e3b1d8454a34b4a48373 Modified: libunwind/trunk/CMakeLists.txt libunwind/trunk/include/__libunwind_config.h libunwind/trunk/include/libunwind.h libunwind/trunk/src/CompactUnwinder.hpp libunwind/trunk/src/Registers.hpp libunwind/trunk/src/UnwindCursor.hpp libunwind/trunk/src/config.h libunwind/trunk/src/libunwind.cpp Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=270692=270691=270692=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Wed May 25 07:36:34 2016 @@ -103,6 +103,7 @@ option(LIBUNWIND_ENABLE_ASSERTIONS "Enab option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) option(LIBUNWIND_ENABLE_SHARED "Build libunwind as a shared library." ON) +option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding support." ON) set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE STRING "GCC toolchain for cross compiling.") set(LIBUNWIND_SYSROOT "" CACHE STRING "Sysroot for cross compiling.") @@ -202,6 +203,11 @@ else() endif () endif () +# Cross-unwinding +if (NOT LIBUNWIND_ENABLE_CROSS_UNWINDING) + list(APPEND LIBUNWIND_COMPILE_FLAGS -D_LIBUNWIND_IS_NATIVE_ONLY) +endif () + # This is the _ONLY_ place where add_definitions is called. if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=270692=270691=270692=diff == --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Wed May 25 07:36:34 2016 @@ -17,4 +17,43 @@ #define _LIBUNWIND_ARM_EHABI 0 #endif +#if defined(_LIBUNWIND_IS_NATIVE_ONLY) +# if defined(__i386__) +# define _LIBUNWIND_TARGET_I386 1 +# define _LIBUNWIND_CONTEXT_SIZE 8 +# define _LIBUNWIND_CURSOR_SIZE 19 +# elif defined(__x86_64__) +# define _LIBUNWIND_TARGET_X86_64 1 +# define _LIBUNWIND_CONTEXT_SIZE 21 +# define _LIBUNWIND_CURSOR_SIZE 33 +# elif defined(__ppc__) +# define _LIBUNWIND_TARGET_PPC 1 +# define _LIBUNWIND_CONTEXT_SIZE 117 +# define _LIBUNWIND_CURSOR_SIZE 128 +# elif defined(__aarch64__) +# define _LIBUNWIND_TARGET_AARCH64 1 +# define _LIBUNWIND_CONTEXT_SIZE 66 +# define _LIBUNWIND_CURSOR_SIZE 78 +# elif defined(__arm__) +# define _LIBUNWIND_TARGET_ARM 1 +# define _LIBUNWIND_CONTEXT_SIZE 60 +# define _LIBUNWIND_CURSOR_SIZE 67 +# elif defined(__or1k__) +# define _LIBUNWIND_TARGET_OR1K 1 +# define _LIBUNWIND_CONTEXT_SIZE 16 +# define _LIBUNWIND_CURSOR_SIZE 28 +# else +# error "Unsupported architecture." +# endif +#else // !_LIBUNWIND_IS_NATIVE_ONLY +# define _LIBUNWIND_TARGET_I386 1 +# define _LIBUNWIND_TARGET_X86_64 1 +# define _LIBUNWIND_TARGET_PPC 1 +# define _LIBUNWIND_TARGET_AARCH64 1 +# define _LIBUNWIND_TARGET_ARM 1 +# define _LIBUNWIND_TARGET_OR1K 1 +# define _LIBUNWIND_CONTEXT_SIZE 128 +# define _LIBUNWIND_CURSOR_SIZE 140 +#endif // _LIBUNWIND_IS_NATIVE_ONLY + #endif // LIBUNWIND_CONFIG_H__ Modified: libunwind/trunk/include/libunwind.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=270692=270691=270692=diff == --- libunwind/trunk/include/libunwind.h (original) +++ libunwind/trunk/include/libunwind.h Wed May 25 07:36:34 2016 @@ -46,12 +46,12 @@ enum { }; struct unw_context_t { - uint64_t data[128]; + uint64_t data[_LIBUNWIND_CONTEXT_SIZE]; }; typedef struct unw_context_t unw_context_t; struct unw_cursor_t { - uint64_t data[140]; + uint64_t data[_LIBUNWIND_CURSOR_SIZE]; }; typedef struct unw_cursor_t unw_cursor_t; Modified: libunwind/trunk/src/CompactUnwinder.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CompactUnwinder.hpp?rev=270692=270691=270692=diff
r270691 - Revert "[AArch64] Using new TargetParser in Clang"
Author: rengolin Date: Wed May 25 07:36:31 2016 New Revision: 270691 URL: http://llvm.org/viewvc/llvm-project?rev=270691=rev Log: Revert "[AArch64] Using new TargetParser in Clang" This reverts commit r270688 and r270689. The issue is not a random order, but a different order for some targets and others (prob. Linux vs Darwin). Reverting until we have a better fix. Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Preprocessor/aarch64-target-features.c Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=270691=270690=270691=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Wed May 25 07:36:31 2016 @@ -5665,10 +5665,14 @@ public: } bool setCPU(const std::string ) override { -if (Name == "generic" || llvm::AArch64::parseCPUArch(Name) != llvm::ARM::AK_INVALID) - return true; - -return false; +bool CPUKnown = llvm::StringSwitch(Name) +.Case("generic", true) +.Cases("cortex-a53", "cortex-a57", "cortex-a72", + "cortex-a35", "exynos-m1", true) +.Case("cyclone", true) +.Case("kryo", true) +.Default(false); +return CPUKnown; } void getTargetDefines(const LangOptions , Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270691=270690=270691=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Wed May 25 07:36:31 2016 @@ -2262,9 +2262,22 @@ static bool DecodeAArch64Features(const text.split(Split, StringRef("+"), -1, false); for (StringRef Feature : Split) { -const char *FeatureName = llvm::AArch64::getArchExtFeature(Feature); -if (FeatureName) - Features.push_back(FeatureName); +const char *result = llvm::StringSwitch(Feature) + .Case("fp", "+fp-armv8") + .Case("simd", "+neon") + .Case("crc", "+crc") + .Case("crypto", "+crypto") + .Case("fp16", "+fullfp16") + .Case("profile", "+spe") + .Case("nofp", "-fp-armv8") + .Case("nosimd", "-neon") + .Case("nocrc", "-crc") + .Case("nocrypto", "-crypto") + .Case("nofp16", "-fullfp16") + .Case("noprofile", "-spe") + .Default(nullptr); +if (result) + Features.push_back(result); else if (Feature == "neon" || Feature == "noneon") D.Diag(diag::err_drv_no_neon_modifier); else @@ -2279,16 +2292,20 @@ static bool DecodeAArch64Mcpu(const Driv std::vector ) { std::pairSplit = Mcpu.split("+"); CPU = Split.first; - - if (CPU == "generic") { + if (CPU == "cortex-a53" || CPU == "cortex-a57" || + CPU == "cortex-a72" || CPU == "cortex-a35" || CPU == "exynos-m1" || + CPU == "kryo") { +Features.push_back("+neon"); +Features.push_back("+crc"); +Features.push_back("+crypto"); + } else if (CPU == "cyclone") { +Features.push_back("+neon"); +Features.push_back("+crypto"); + } else if (CPU == "generic") { Features.push_back("+neon"); } else { -unsigned ArchKind = llvm::AArch64::parseCPUArch(CPU); -unsigned Extersion = llvm::AArch64::getDefaultExtensions(CPU,ArchKind); - -if (!llvm::AArch64::getExtensionFeatures(Extersion,Features)) - return false; - } +return false; + } if (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features)) return false; @@ -2300,13 +2317,20 @@ static bool getAArch64ArchFeaturesFromMarch(const Driver , StringRef March, const ArgList , std::vector ) { - unsigned ArchKind; std::string MarchLowerCase = March.lower(); std::pair Split = StringRef(MarchLowerCase).split("+"); - ArchKind = llvm::AArch64::parseArch(Split.first); - if (ArchKind == llvm::ARM::AK_INVALID || !llvm::AArch64::getArchFeatures(ArchKind, Features) || - (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features))) + if (Split.first == "armv8-a" || Split.first == "armv8a") { +// ok, no additional features. + } else if (Split.first == "armv8.1-a" || Split.first == "armv8.1a") { +Features.push_back("+v8.1a"); + } else if (Split.first == "armv8.2-a" || Split.first == "armv8.2a" ) { +Features.push_back("+v8.2a"); + } else { +
r270690 - [OPENMP 4.5] Codegen for dacross loop synchronization constructs.
Author: abataev Date: Wed May 25 07:36:08 2016 New Revision: 270690 URL: http://llvm.org/viewvc/llvm-project?rev=270690=rev Log: [OPENMP 4.5] Codegen for dacross loop synchronization constructs. OpenMP 4.5 adds support for doacross loop synchronization. Patch implements codegen for this construct. Added: cfe/trunk/test/OpenMP/ordered_doacross_codegen.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h cfe/trunk/include/clang/AST/StmtOpenMP.h cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/AST/OpenMPClause.cpp cfe/trunk/lib/AST/StmtOpenMP.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/Sema/SemaExprMember.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=270690=270689=270690=diff == --- cfe/trunk/include/clang/AST/OpenMPClause.h (original) +++ cfe/trunk/include/clang/AST/OpenMPClause.h Wed May 25 07:36:08 2016 @@ -2629,7 +2629,6 @@ public: /// \param DepLoc Location of the dependency type. /// \param ColonLoc Colon location. /// \param VL List of references to the variables. - /// static OMPDependClause * Create(const ASTContext , SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, OpenMPDependClauseKind DepKind, @@ -2648,6 +2647,14 @@ public: /// \brief Get colon location. SourceLocation getColonLoc() const { return ColonLoc; } + /// Set the loop counter value for the depend clauses with 'sink|source' kind + /// of dependency. Required for codegen. + void setCounterValue(Expr *V); + /// Get the loop counter value. + Expr *getCounterValue(); + /// Get the loop counter value. + const Expr *getCounterValue() const; + child_range children() { return child_range(reinterpret_cast(varlist_begin()), reinterpret_cast(varlist_end())); Modified: cfe/trunk/include/clang/AST/StmtOpenMP.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=270690=270689=270690=diff == --- cfe/trunk/include/clang/AST/StmtOpenMP.h (original) +++ cfe/trunk/include/clang/AST/StmtOpenMP.h Wed May 25 07:36:08 2016 @@ -325,9 +325,10 @@ class OMPLoopDirective : public OMPExecu EnsureUpperBoundOffset = 13, NextLowerBoundOffset = 14, NextUpperBoundOffset = 15, +NumIterationsOffset = 16, // Offset to the end (and start of the following counters/updates/finals // arrays) for worksharing loop directives. -WorksharingEnd = 16, +WorksharingEnd = 17, }; /// \brief Get the counters storage. @@ -475,6 +476,13 @@ protected: "expected worksharing loop directive"); *std::next(child_begin(), NextUpperBoundOffset) = NUB; } + void setNumIterations(Expr *NI) { +assert((isOpenMPWorksharingDirective(getDirectiveKind()) || +isOpenMPTaskLoopDirective(getDirectiveKind()) || +isOpenMPDistributeDirective(getDirectiveKind())) && + "expected worksharing loop directive"); +*std::next(child_begin(), NumIterationsOffset) = NI; + } void setCounters(ArrayRef A); void setPrivateCounters(ArrayRef A); void setInits(ArrayRef A); @@ -553,6 +561,7 @@ public: EUB = nullptr; NLB = nullptr; NUB = nullptr; + NumIterations = nullptr; Counters.resize(Size); PrivateCounters.resize(Size); Inits.resize(Size); @@ -660,6 +669,14 @@ public: return const_cast(reinterpret_cast( *std::next(child_begin(), NextUpperBoundOffset))); } + Expr *getNumIterations() const { +assert((isOpenMPWorksharingDirective(getDirectiveKind()) || +isOpenMPTaskLoopDirective(getDirectiveKind()) || +isOpenMPDistributeDirective(getDirectiveKind())) && + "expected worksharing loop directive"); +return const_cast(reinterpret_cast( +*std::next(child_begin(), NumIterationsOffset))); + } const Stmt *getBody() const { // This relies on the loop form is already checked by Sema. Stmt *Body = getAssociatedStmt()->IgnoreContainers(true); Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=270690=270689=270690=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed May 25 07:36:08 2016 @@ -8239,8 +8239,6 @@ def err_omp_firstprivate_distribute_in_t "reduction
r270689 - [AArch64] Try to fix test from r270688 with unordered output
Author: rengolin Date: Wed May 25 07:16:28 2016 New Revision: 270689 URL: http://llvm.org/viewvc/llvm-project?rev=270689=rev Log: [AArch64] Try to fix test from r270688 with unordered output Modified: cfe/trunk/test/Preprocessor/aarch64-target-features.c Modified: cfe/trunk/test/Preprocessor/aarch64-target-features.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/aarch64-target-features.c?rev=270689=270688=270689=diff == --- cfe/trunk/test/Preprocessor/aarch64-target-features.c (original) +++ cfe/trunk/test/Preprocessor/aarch64-target-features.c Wed May 25 07:16:28 2016 @@ -94,7 +94,10 @@ // RUN: %clang -target aarch64 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A72 %s // RUN: %clang -target aarch64 -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-M1 %s // RUN: %clang -target aarch64 -mcpu=kryo -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-KRYO %s -// CHECK-MCPU-CYCLONE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crypto" "-target-feature" "+zcm" "-target-feature" "+zcz" +// CHECK-MCPU-CYCLONE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" +// CHECK-MCPU-CYCLONE-DAG: "-target-feature" "+crypto" +// CHECK-MCPU-CYCLONE-DAG: "-target-feature" "+zcm" +// CHECK-MCPU-CYCLONE-DAG: "-target-feature" "+zcz" // CHECK-MCPU-A35: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" // CHECK-MCPU-A53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" // CHECK-MCPU-A57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20283: Add ras/noras flag to enable/disable RAS in clang
rogfer01 added a comment. I think this has become obsolete as of http://llvm.org/viewvc/llvm-project?view=revision=270688 http://reviews.llvm.org/D20283 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20088: Using AArch64TargetParser in clang
rengolin closed this revision. rengolin added a comment. Committed in r270688. Repository: rL LLVM http://reviews.llvm.org/D20088 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20089: Adding a TargetParser for AArch64
rengolin closed this revision. rengolin added a comment. Committed in r270687. Repository: rL LLVM http://reviews.llvm.org/D20089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270688 - [AArch64] Using new TargetParser in Clang
Author: rengolin Date: Wed May 25 07:02:58 2016 New Revision: 270688 URL: http://llvm.org/viewvc/llvm-project?rev=270688=rev Log: [AArch64] Using new TargetParser in Clang Using AArch64TargetParser in clang to avoid repetitive string parsing. Use TargetParser to do ARCH/CPU/ArchExt parsing instead of local implementation. Patch by Jojo Ma. Modified: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/Driver/Tools.cpp Modified: cfe/trunk/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=270688=270687=270688=diff == --- cfe/trunk/lib/Basic/Targets.cpp (original) +++ cfe/trunk/lib/Basic/Targets.cpp Wed May 25 07:02:58 2016 @@ -5665,14 +5665,10 @@ public: } bool setCPU(const std::string ) override { -bool CPUKnown = llvm::StringSwitch(Name) -.Case("generic", true) -.Cases("cortex-a53", "cortex-a57", "cortex-a72", - "cortex-a35", "exynos-m1", true) -.Case("cyclone", true) -.Case("kryo", true) -.Default(false); -return CPUKnown; +if (Name == "generic" || llvm::AArch64::parseCPUArch(Name) != llvm::ARM::AK_INVALID) + return true; + +return false; } void getTargetDefines(const LangOptions , Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270688=270687=270688=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Wed May 25 07:02:58 2016 @@ -2262,22 +2262,9 @@ static bool DecodeAArch64Features(const text.split(Split, StringRef("+"), -1, false); for (StringRef Feature : Split) { -const char *result = llvm::StringSwitch(Feature) - .Case("fp", "+fp-armv8") - .Case("simd", "+neon") - .Case("crc", "+crc") - .Case("crypto", "+crypto") - .Case("fp16", "+fullfp16") - .Case("profile", "+spe") - .Case("nofp", "-fp-armv8") - .Case("nosimd", "-neon") - .Case("nocrc", "-crc") - .Case("nocrypto", "-crypto") - .Case("nofp16", "-fullfp16") - .Case("noprofile", "-spe") - .Default(nullptr); -if (result) - Features.push_back(result); +const char *FeatureName = llvm::AArch64::getArchExtFeature(Feature); +if (FeatureName) + Features.push_back(FeatureName); else if (Feature == "neon" || Feature == "noneon") D.Diag(diag::err_drv_no_neon_modifier); else @@ -2292,20 +2279,16 @@ static bool DecodeAArch64Mcpu(const Driv std::vector ) { std::pairSplit = Mcpu.split("+"); CPU = Split.first; - if (CPU == "cortex-a53" || CPU == "cortex-a57" || - CPU == "cortex-a72" || CPU == "cortex-a35" || CPU == "exynos-m1" || - CPU == "kryo") { -Features.push_back("+neon"); -Features.push_back("+crc"); -Features.push_back("+crypto"); - } else if (CPU == "cyclone") { -Features.push_back("+neon"); -Features.push_back("+crypto"); - } else if (CPU == "generic") { + + if (CPU == "generic") { Features.push_back("+neon"); } else { -return false; - } +unsigned ArchKind = llvm::AArch64::parseCPUArch(CPU); +unsigned Extersion = llvm::AArch64::getDefaultExtensions(CPU,ArchKind); + +if (!llvm::AArch64::getExtensionFeatures(Extersion,Features)) + return false; + } if (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features)) return false; @@ -2317,20 +2300,13 @@ static bool getAArch64ArchFeaturesFromMarch(const Driver , StringRef March, const ArgList , std::vector ) { + unsigned ArchKind; std::string MarchLowerCase = March.lower(); std::pair Split = StringRef(MarchLowerCase).split("+"); - if (Split.first == "armv8-a" || Split.first == "armv8a") { -// ok, no additional features. - } else if (Split.first == "armv8.1-a" || Split.first == "armv8.1a") { -Features.push_back("+v8.1a"); - } else if (Split.first == "armv8.2-a" || Split.first == "armv8.2a" ) { -Features.push_back("+v8.2a"); - } else { -return false; - } - - if (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features)) + ArchKind = llvm::AArch64::parseArch(Split.first); + if (ArchKind == llvm::ARM::AK_INVALID || !llvm::AArch64::getArchFeatures(ArchKind, Features) || + (Split.second.size() && !DecodeAArch64Features(D,
Re: [PATCH] D20089: Adding a TargetParser for AArch64
rengolin accepted this revision. rengolin added a comment. This revision is now accepted and ready to land. In http://reviews.llvm.org/D20089#438937, @jmolloy wrote: > As far as I'm concerned, if you're happy I'm happy. You know this area more > than me. Ok, I'll go ahead and commit this, and we can follow the development from there. I'll open a bug in bugzilla to move this design to a class based once we have moved all AArch64 users to the parser. Thanks! --renato Repository: rL LLVM http://reviews.llvm.org/D20089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20088: Using AArch64TargetParser in clang
rengolin accepted this revision. rengolin added a comment. This revision is now accepted and ready to land. Looks great, thanks Jojo! Repository: rL LLVM http://reviews.llvm.org/D20088 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0
Anastasia marked 2 inline comments as done. Comment at: lib/Sema/SemaChecking.cpp:81 @@ +80,3 @@ +static bool checkBlockArgs(Sema , Expr *BlockArg) { + const BlockPointerType *BPT = cast(BlockArg->getType()); + ArrayRef Params = bader wrote: > There should be some check before cast. > Here is the code snippet that will crash the compiler: > > extern queue_t get_default_queue(); > extern int get_global_id(int); > extern ndrange_t get_ndrange(); > typedef void (^MyBlock)(local void*, local int*); > > const MyBlock myBlock = (MyBlock)^(local int *p1, local int *p2) { > int id = get_global_id(0); > p1[id] += p2[id]; > }; > > void kernel f2(global int* a, global int* b) { > enqueue_kernel(get_default_queue(), 0, get_ndrange(), myBlock, 2U, 1U); > } > Good spot! Thanks! I have added this case to the tests! Comment at: test/CodeGenOpenCL/cl20-device-side-enqueue.cl:19 @@ +18,3 @@ + // CHECK: [[NDR:%[0-9]+]] = load %opencl.ndrange_t*, %opencl.ndrange_t** %ndrange + // CHECK: [[BL:%[0-9]+]] = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 addrspace(1)*, i32 addrspace(1)*, i32 }>* %block to void ()* + // CHECK: [[BL_I8:%[0-9]+]] = bitcast void ()* [[BL]] to i8* bader wrote: > This check is failing on my machine: > > test\CodeGenOpenCL\cl20-device-side-enqueue.cl:19:12: error: expected > string not found in input > // CHECK: [[BL:%[0-9]+]] = bitcast <{ i8*, i32, i32, i8*, > %struct.__block_descriptor*, i32 addrspace(1)*, i32 addrspace(1)*, i32 }>* > %block to void ()* > :47:60: note: scanning from here > %3 = load %opencl.ndrange_t*, %opencl.ndrange_t** %ndrange, align 4 > :67:2: note: possible intended match here > %7 = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i32 > addrspace(1)*, i32, i32 addrspace(1)* }>* %block to void ()* > > It looks like the order of captured arguments is different from expected? Is > the order specified or test shouldn't check it? It seems that capture order is enforced by the order in which the parser parses statements, and it isn't really enforced anywhere by ObjC implementation. Their tests only contain 1 capture or captures of the same type, so this issue couldn't be caught. I am changing the test now, but I have no idea why the parsing order is different though. If you tell me your revision, I could try to see if I can reproduce this locally. http://reviews.llvm.org/D20249 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0
Anastasia updated this revision to Diff 58403. Anastasia marked an inline comment as done. Anastasia added a comment. Updates from Alexey's comments: - Use canonical type while casting to block. - Added failing case to Sema tests. - Modified CodeGen tests due to captures ordering issue. http://reviews.llvm.org/D20249 Files: include/clang/Basic/Builtins.def include/clang/Basic/Builtins.h include/clang/Basic/DiagnosticSemaKinds.td lib/Basic/Builtins.cpp lib/CodeGen/CGBuiltin.cpp lib/Sema/SemaChecking.cpp test/CodeGenOpenCL/cl20-device-side-enqueue.cl test/SemaOpenCL/cl20-device-side-enqueue.cl test/SemaOpenCL/clang-builtin-version.cl test/SemaOpenCL/to_addr_builtin.cl Index: test/SemaOpenCL/to_addr_builtin.cl === --- test/SemaOpenCL/to_addr_builtin.cl +++ test/SemaOpenCL/to_addr_builtin.cl @@ -10,43 +10,44 @@ glob = to_global(glob, loc); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}} + // expected-warning@-2{{implicit declaration of function 'to_global' is invalid in C99}} + // expected-warning@-3{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}} #else - // expected-error@-4{{invalid number of arguments to function: 'to_global'}} + // expected-error@-5{{invalid number of arguments to function: 'to_global'}} #endif int x; glob = to_global(x); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}} + // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}} #else // expected-error@-4{{invalid argument x to function: 'to_global', expecting a generic pointer argument}} #endif glob = to_global(con); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}} + // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}} #else // expected-error@-4{{invalid argument con to function: 'to_global', expecting a generic pointer argument}} #endif glob = to_global(con_typedef); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}} + // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}} #else // expected-error@-4{{invalid argument con_typedef to function: 'to_global', expecting a generic pointer argument}} #endif loc = to_global(glob); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}} + // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__local int *' from 'int'}} #else // expected-error@-4{{assigning '__global int *' to '__local int *' changes address space of pointer}} #endif global char *glob_c = to_global(loc); #if __OPENCL_C_VERSION__ < CL_VERSION_2_0 - // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}} + // expected-warning@-2{{incompatible integer to pointer conversion initializing '__global char *' with an expression of type 'int'}} #else // expected-warning@-4{{incompatible pointer types initializing '__global char *' with an expression of type '__global int *'}} #endif Index: test/SemaOpenCL/clang-builtin-version.cl === --- /dev/null +++ test/SemaOpenCL/clang-builtin-version.cl @@ -0,0 +1,44 @@ +// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 100 + +// Confirm CL2.0 Clang builtins are not available in earlier versions + +kernel void dse_builtins() { + int tmp; + enqueue_kernel(tmp, tmp, tmp, ^(void) { // expected-warning{{implicit declaration of function 'enqueue_kernel' is invalid in C99}} +return; + }); + unsigned size = get_kernel_work_group_size(^(void) { // expected-warning{{implicit declaration of function 'get_kernel_work_group_size' is invalid in C99}} +return; + }); + size = get_kernel_preferred_work_group_size_multiple(^(void) { // expected-warning{{implicit declaration of function 'get_kernel_preferred_work_group_size_multiple' is invalid in C99}} +return; + }); +} + +void pipe_builtins() { + int tmp; + + read_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'read_pipe' is invalid in C99}} + write_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'write_pipe' is invalid in C99}} + + reserve_read_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'reserve_read_pipe' is invalid in C99}} + reserve_write_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'reserve_write_pipe' is invalid in C99}} + + work_group_reserve_read_pipe(tmp, tmp); // expected-warning{{implicit declaration of
Re: [PATCH] D18953: [ms][dll] #26935 Defining a dllimport function should cause it to be exported
This revision was automatically updated to reflect the committed changes. Closed by commit rL270686: [ms][dll] #26935 Defining a dllimport function should cause it to be exported (authored by dzobnin). Changed prior to commit: http://reviews.llvm.org/D18953?vs=58233=58401#toc Repository: rL LLVM http://reviews.llvm.org/D18953 Files: cfe/trunk/include/clang/Basic/DiagnosticGroups.td cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/test/CodeGen/dllimport.c cfe/trunk/test/CodeGenCXX/dllimport-members.cpp cfe/trunk/test/CodeGenCXX/dllimport.cpp cfe/trunk/test/Sema/dllimport.c cfe/trunk/test/SemaCXX/dllimport.cpp Index: cfe/trunk/test/SemaCXX/dllimport.cpp === --- cfe/trunk/test/SemaCXX/dllimport.cpp +++ cfe/trunk/test/SemaCXX/dllimport.cpp @@ -44,17 +44,49 @@ int __declspec(dllimport) GlobalInit2 = 1; // expected-error{{definition of dllimport data}} // Declare, then reject definition. -__declspec(dllimport) extern int ExternGlobalDeclInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} -int ExternGlobalDeclInit = 1; // expected-warning{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} +#ifdef GNU +// expected-note@+2{{previous attribute is here}} +#endif +__declspec(dllimport) extern int ExternGlobalDeclInit; // expected-note{{previous declaration is here}} +#ifdef MS +// expected-warning@+4{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} +#else +// expected-warning@+2{{'ExternGlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} +#endif +int ExternGlobalDeclInit = 1; -__declspec(dllimport) int GlobalDeclInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} -int GlobalDeclInit = 1; // expected-warning{{'GlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} +#ifdef GNU +// expected-note@+2{{previous attribute is here}} +#endif +__declspec(dllimport) int GlobalDeclInit; // expected-note{{previous declaration is here}} +#ifdef MS +// expected-warning@+4{{'GlobalDeclInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} +#else +// expected-warning@+2{{'GlobalDeclInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} +#endif +int GlobalDeclInit = 1; -int *__attribute__((dllimport)) GlobalDeclChunkAttrInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} -int *GlobalDeclChunkAttrInit = 0; // expected-warning{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} +#ifdef GNU +// expected-note@+2{{previous attribute is here}} +#endif +int *__attribute__((dllimport)) GlobalDeclChunkAttrInit; // expected-note{{previous declaration is here}} +#ifdef MS +// expected-warning@+4{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} +#else +// expected-warning@+2{{'GlobalDeclChunkAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} +#endif +int *GlobalDeclChunkAttrInit = 0; -int GlobalDeclAttrInit __attribute__((dllimport)); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} -int GlobalDeclAttrInit = 1; // expected-warning{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} +#ifdef GNU +// expected-note@+2{{previous attribute is here}} +#endif +int GlobalDeclAttrInit __attribute__((dllimport)); // expected-note{{previous declaration is here}} +#ifdef MS +// expected-warning@+4{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} +#else +// expected-warning@+2{{'GlobalDeclAttrInit' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} +#endif +int GlobalDeclAttrInit = 1; // Redeclarations __declspec(dllimport) extern int GlobalRedecl1; @@ -69,8 +101,6 @@ int GlobalRedecl2c __attribute__((dllimport)); int GlobalRedecl2c __attribute__((dllimport)); -// NB: MSVC issues a warning and makes GlobalRedecl3 dllexport. We follow GCC -// and drop the dllimport with a warning. __declspec(dllimport) extern int GlobalRedecl3; // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} extern int GlobalRedecl3; // expected-warning{{'GlobalRedecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} @@ -135,11 +165,31 @@ template int __declspec(dllimport) VarTmplInit2 = 1; // expected-error{{definition of dllimport data}} // Declare, then reject definition. -template __declspec(dllimport) extern int ExternVarTmplDeclInit; // expected-note{{previous declaration is here}} expected-note{{previous attribute
r270686 - [ms][dll] #26935 Defining a dllimport function should cause it to be exported
Author: dzobnin Date: Wed May 25 06:32:42 2016 New Revision: 270686 URL: http://llvm.org/viewvc/llvm-project?rev=270686=rev Log: [ms][dll] #26935 Defining a dllimport function should cause it to be exported If we have some function with dllimport attribute and then we have the function definition in the same module but without dllimport attribute we should add dllexport attribute to this function definition. The same should be done for variables. Example: struct __declspec(dllimport) C3 { ~C3(); }; C3::~C3() {;} // we should export this definition. Patch by Andrew V. Tischenko Differential revision: http://reviews.llvm.org/D18953 Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/test/CodeGen/dllimport.c cfe/trunk/test/CodeGenCXX/dllimport-members.cpp cfe/trunk/test/CodeGenCXX/dllimport.cpp cfe/trunk/test/Sema/dllimport.c cfe/trunk/test/SemaCXX/dllimport.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=270686=270685=270686=diff == --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed May 25 06:32:42 2016 @@ -772,6 +772,7 @@ def MicrosoftEnumValue : DiagGroup<"micr def MicrosoftDefaultArgRedefinition : DiagGroup<"microsoft-default-arg-redefinition">; def MicrosoftTemplate : DiagGroup<"microsoft-template">; +def MicrosoftInconsistentDllImport : DiagGroup<"inconsistent-dllimport">; def MicrosoftRedeclareStatic : DiagGroup<"microsoft-redeclare-static">; def MicrosoftEnumForwardReference : DiagGroup<"microsoft-enum-forward-reference">; @@ -798,7 +799,8 @@ def Microsoft : DiagGroup<"microsoft", MicrosoftRedeclareStatic, MicrosoftEnumForwardReference, MicrosoftGoto, MicrosoftFlexibleArray, MicrosoftExtraQualification, MicrosoftCast, MicrosoftConstInit, MicrosoftVoidPseudoDtor, MicrosoftAnonTag, - MicrosoftCommentPaste, MicrosoftEndOfFile]>; + MicrosoftCommentPaste, MicrosoftEndOfFile, + MicrosoftInconsistentDllImport]>; def ClangClPch : DiagGroup<"clang-cl-pch">; Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=270686=270685=270686=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed May 25 06:32:42 2016 @@ -2359,7 +2359,10 @@ def err_attribute_aligned_too_great : Er "requested alignment must be %0 bytes or smaller">; def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning< "%q0 redeclared without %1 attribute: previous %1 ignored">, - InGroup>; + InGroup; +def warn_redeclaration_without_import_attribute : Warning< + "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">, + InGroup; def warn_dllimport_dropped_from_inline_function : Warning< "%q0 redeclared inline; %1 attribute ignored">, InGroup; Modified: cfe/trunk/lib/Sema/SemaDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=270686=270685=270686=diff == --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed May 25 06:32:42 2016 @@ -5559,9 +5559,13 @@ static void checkAttributesAfterMerging( static void checkDLLAttributeRedeclaration(Sema , NamedDecl *OldDecl, NamedDecl *NewDecl, - bool IsSpecialization) { - if (TemplateDecl *OldTD = dyn_cast(OldDecl)) + bool IsSpecialization, + bool IsDefinition) { + if (TemplateDecl *OldTD = dyn_cast(OldDecl)) { OldDecl = OldTD->getTemplatedDecl(); +if (!IsSpecialization) + IsDefinition = false; + } if (TemplateDecl *NewTD = dyn_cast(NewDecl)) NewDecl = NewTD->getTemplatedDecl(); @@ -5617,14 +5621,17 @@ static void checkDLLAttributeRedeclarati // A redeclaration is not allowed to drop a dllimport attribute, the only // exceptions being inline function definitions, local extern declarations, - // and qualified friend declarations. - // NB: MSVC converts such a declaration to dllexport. + // qualified friend declarations or special MSVC extension: in the last case, + // the declaration is treated as if it were marked dllexport. bool IsInline = false, IsStaticDataMember = false, IsQualifiedFriend = false; - if (const auto *VD = dyn_cast(NewDecl)) + bool IsMicrosoft =
Re: [PATCH] D20614: Remove trailing spaces in x86 intrinsic headers
m_zuckerman added a comment. First thanks I don't see any problem with the patch. but if you can please add full svn diff from clang. svn diff --diff-cmd=diff -x -U99 > x.patch Repository: rL LLVM http://reviews.llvm.org/D20614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19105: Changes in clang after running http://reviews.llvm.org/D18821
deadalnix requested changes to this revision. This revision now requires changes to proceed. Comment at: include/llvm-c/Core.h:604 @@ -603,3 +603,3 @@ */ -LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, +bool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, char **ErrorMessage); Please keep LLVMBool in the C API. ABI change are a NO NO. http://reviews.llvm.org/D19105 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains
Hi, On Wed, May 25, 2016 at 1:32 PM, Simon Atanasyanwrote: > Hi, > > Thanks for the information. One more question. Does the following folder > exist? > > /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2 > Yes : :/ # ls /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2 mips-img-linux-gnu ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains
Hi, Thanks for the information. One more question. Does the following folder exist? /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2 On Wed, May 25, 2016 at 9:55 AM, Ismail Donmezwrote: > On Tue, May 24, 2016 at 4:18 PM, Simon Atanasyan wrote: >> /home/abuild/rpmbuild/BUILD/llvm/stage2/bin/clang -no-canonical-prefixes \ >> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/mips-img-v2.cpp \ >> -### -o >> /home/abuild/rpmbuild/BUILD/llvm/stage2/tools/clang/test/Driver/Output/mips-img-v2.cpp.tmp.o >> \ >> --target=mips-img-linux-gnu \ >> >> --gcc-toolchain=/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree >> \ >> -EB -mips32r6 -mhard-float -mabi=32 > > Here is the output: > > openSUSE Linux clang version 3.9.0 (trunk 270535) (based on LLVM 3.9.0svn) > Target: mips-img-linux-gnu > Thread model: posix > InstalledDir: /home/abuild/rpmbuild/BUILD/llvm/stage2/bin > "/home/abuild/rpmbuild/BUILD/llvm/stage2/bin/clang" "-cc1" "-triple" > "mips-img-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free" > "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" > "mips-img-v2.cpp" "-mrelocation-model" "static" "-mthread-model" > "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose" > "-mconstructor-aliases" "-fuse-init-array" "-target-cpu" "mips32r6" > "-target-abi" "o32" "-mfloat-abi" "hard" "-dwarf-column-info" > "-debugger-tuning=gdb" "-resource-dir" > "/home/abuild/rpmbuild/BUILD/llvm/stage2/bin/../lib64/clang/3.9.0" > "-internal-isystem" > "/home/abuild/rpmbuild/BUILD/llvm/stage2/bin/../include/c++/v1" > "-internal-isystem" > "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/usr/local/include" > "-internal-isystem" > "/home/abuild/rpmbuild/BUILD/llvm/stage2/bin/../lib64/clang/3.9.0/include" > "-internal-externc-isystem" > "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/lib/../usr/include" -- Simon Atanasyan ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20617: [X86][SSE] _mm_store1_ps/_mm_store1_pd should require an aligned pointer
RKSimon created this revision. RKSimon added reviewers: craig.topper, spatel, andreadb. RKSimon added a subscriber: cfe-commits. RKSimon set the repository for this revision to rL LLVM. According to the gcc headers, intel intrinsics docs and msdn codegen the _mm_store1_ps/_mm_store1_pd (and their _mm_store_ps1/_mm_store_pd1 analogues) should require an aligned pointer - the clang headers are the only implementation I can find that assume non-aligned stores (by storing with _mm_storeu_ps/_mm_storeu_pd). This patch raises the alignment requirements to match the other implementations by calling _mm_store_ps/_mm_store_pd instead. I've also added the missing _mm_store_pd1 intrinsic (which maps to _mm_store1_pd like _mm_store_ps1 does to _mm_store1_ps). As a followup I'll update the llvm fast-isel tests to match this codegen. Repository: rL LLVM http://reviews.llvm.org/D20617 Files: lib/Headers/emmintrin.h lib/Headers/xmmintrin.h test/CodeGen/sse-builtins.c test/CodeGen/sse2-builtins.c Index: test/CodeGen/sse2-builtins.c === --- test/CodeGen/sse2-builtins.c +++ test/CodeGen/sse2-builtins.c @@ -1205,6 +1205,13 @@ _mm_store_pd(A, B); } +void test_mm_store_pd1(double* x, __m128d y) { + // CHECK-LABEL: test_mm_store_pd1 + // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> zeroinitializer + // CHECK: store <2 x double> %{{.*}}, <2 x double>* {{.*}}, align 16 + _mm_store_pd1(x, y); +} + void test_mm_store_sd(double* A, __m128d B) { // CHECK-LABEL: test_mm_store_sd // CHECK: extractelement <2 x double> %{{.*}}, i32 0 @@ -1220,9 +1227,8 @@ void test_mm_store1_pd(double* x, __m128d y) { // CHECK-LABEL: test_mm_store1_pd - // CHECK: extractelement <2 x double> %{{.*}}, i32 0 - // CHECK: store {{.*}} double* {{.*}}, align 1{{$}} - // CHECK: store {{.*}} double* {{.*}}, align 1{{$}} + // CHECK: shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x i32> zeroinitializer + // CHECK: store <2 x double> %{{.*}}, <2 x double>* {{.*}}, align 16 _mm_store1_pd(x, y); } Index: test/CodeGen/sse-builtins.c === --- test/CodeGen/sse-builtins.c +++ test/CodeGen/sse-builtins.c @@ -651,7 +651,7 @@ void test_mm_store_ps1(float* x, __m128 y) { // CHECK-LABEL: test_mm_store_ps1 // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> zeroinitializer - // CHECK: call void @llvm.x86.sse.storeu.ps(i8* %{{.*}}, <4 x float> %{{.*}}) + // CHECK: store <4 x float> %{{.*}}, <4 x float>* {{.*}}, align 16 _mm_store_ps1(x, y); } @@ -665,7 +665,7 @@ void test_mm_store1_ps(float* x, __m128 y) { // CHECK-LABEL: test_mm_store1_ps // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> zeroinitializer - // CHECK: call void @llvm.x86.sse.storeu.ps(i8* %{{.*}}, <4 x float> %{{.*}}) + // CHECK: store <4 x float> %{{.*}}, <4 x float>* {{.*}}, align 16 _mm_store1_ps(x, y); } Index: lib/Headers/xmmintrin.h === --- lib/Headers/xmmintrin.h +++ lib/Headers/xmmintrin.h @@ -1590,22 +1590,22 @@ } static __inline__ void __DEFAULT_FN_ATTRS -_mm_store1_ps(float *__p, __m128 __a) +_mm_store_ps(float *__p, __m128 __a) { - __a = __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 0, 0, 0); - _mm_storeu_ps(__p, __a); + *(__m128 *)__p = __a; } static __inline__ void __DEFAULT_FN_ATTRS -_mm_store_ps1(float *__p, __m128 __a) +_mm_store1_ps(float *__p, __m128 __a) { -return _mm_store1_ps(__p, __a); + __a = __builtin_shufflevector((__v4sf)__a, (__v4sf)__a, 0, 0, 0, 0); + _mm_store_ps(__p, __a); } static __inline__ void __DEFAULT_FN_ATTRS -_mm_store_ps(float *__p, __m128 __a) +_mm_store_ps1(float *__p, __m128 __a) { - *(__m128 *)__p = __a; + return _mm_store1_ps(__p, __a); } static __inline__ void __DEFAULT_FN_ATTRS Index: lib/Headers/emmintrin.h === --- lib/Headers/emmintrin.h +++ lib/Headers/emmintrin.h @@ -582,19 +582,22 @@ } static __inline__ void __DEFAULT_FN_ATTRS +_mm_store_pd(double *__dp, __m128d __a) +{ + *(__m128d *)__dp = __a; +} + +static __inline__ void __DEFAULT_FN_ATTRS _mm_store1_pd(double *__dp, __m128d __a) { - struct __mm_store1_pd_struct { -double __u[2]; - } __attribute__((__packed__, __may_alias__)); - ((struct __mm_store1_pd_struct*)__dp)->__u[0] = __a[0]; - ((struct __mm_store1_pd_struct*)__dp)->__u[1] = __a[0]; + __a = __builtin_shufflevector((__v2df)__a, (__v2df)__a, 0, 0); + _mm_store_pd(__dp, __a); } static __inline__ void __DEFAULT_FN_ATTRS -_mm_store_pd(double *__dp, __m128d __a) +_mm_store_pd1(double *__dp, __m128d __a) { - *(__m128d *)__dp = __a; + return _mm_store1_pd(__dp, __a); } static __inline__ void __DEFAULT_FN_ATTRS ___
Re: [PATCH] D16948: [libcxx] Filesystem TS -- Complete
EricWF added a comment. In http://reviews.llvm.org/D16948#438880, @rmaprath wrote: > Looks like I've completely missed this patch somehow. Will try to find some > time (or someone) to have a look at it from an embedded-systems / ARM point > of view asap. > > Great work!!! Thanks! Even just attempting to run the tests is greatly appreciated. Writing portable tests is next to impossible so there are going to be kinks to iron out for each platform. http://reviews.llvm.org/D16948 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19105: Changes in clang after running http://reviews.llvm.org/D18821
Prazek added inline comments. Comment at: include/llvm-c/Core.h:604 @@ -603,3 +603,3 @@ */ -LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, +bool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename, char **ErrorMessage); deadalnix wrote: > Please keep LLVMBool in the C API. ABI change are a NO NO. As I said in my comment, I won't commit most of the changes. This review is only to show what check has found. http://reviews.llvm.org/D19105 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20089: Adding a TargetParser for AArch64
jmolloy added a comment. As far as I'm concerned, if you're happy I'm happy. You know this area more than me. Repository: rL LLVM http://reviews.llvm.org/D20089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20089: Adding a TargetParser for AArch64
rengolin added a comment. LGTM. James? Bradley? Tim? Repository: rL LLVM http://reviews.llvm.org/D20089 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r270682 - [clang-tidy] Fix typo in test file name.
Author: d0k Date: Wed May 25 04:44:35 2016 New Revision: 270682 URL: http://llvm.org/viewvc/llvm-project?rev=270682=rev Log: [clang-tidy] Fix typo in test file name. polo Added: clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-macro-header.cpp - copied, changed from r270599, clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp Removed: clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp Copied: clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-macro-header.cpp (from r270599, clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp) URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-macro-header.cpp?p2=clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-macro-header.cpp=clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp=270599=270682=270682=diff == (empty) Removed: clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp?rev=270681=auto == --- clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/modernize-pass-by-value-marco-header.cpp (removed) @@ -1,16 +0,0 @@ -// RUN: %check_clang_tidy %s modernize-pass-by-value %t -- -- -std=c++11 -isystem %S/Inputs/Headers - -// CHECK-FIXES: #include - -#define HEADER <./a.h> -#include HEADER - -struct A { -}; - -struct B { - B(const A ) : a(a) {} -// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: pass by value and use std::move [modernize-pass-by-value] -// CHECK-FIXES: B(A a) : a(std::move(a)) {} - A a; -}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270679 - [X86][SSE] Updated _mm_store_ps1 test to match _mm_store1_ps
Author: rksimon Date: Wed May 25 04:20:08 2016 New Revision: 270679 URL: http://llvm.org/viewvc/llvm-project?rev=270679=rev Log: [X86][SSE] Updated _mm_store_ps1 test to match _mm_store1_ps Modified: cfe/trunk/test/CodeGen/sse-builtins.c Modified: cfe/trunk/test/CodeGen/sse-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sse-builtins.c?rev=270679=270678=270679=diff == --- cfe/trunk/test/CodeGen/sse-builtins.c (original) +++ cfe/trunk/test/CodeGen/sse-builtins.c Wed May 25 04:20:08 2016 @@ -651,7 +651,7 @@ void test_mm_store_ps(float* x, __m128 y void test_mm_store_ps1(float* x, __m128 y) { // CHECK-LABEL: test_mm_store_ps1 // CHECK: shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> zeroinitializer - // CHECK: store <4 x float> %{{.*}}, <4 x float>* {{.*}}, align 16 + // CHECK: call void @llvm.x86.sse.storeu.ps(i8* %{{.*}}, <4 x float> %{{.*}}) _mm_store_ps1(x, y); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types
bader added a subscriber: bader. bader added a comment. In http://reviews.llvm.org/D20602#438667, @rsmith wrote: > I'm not suggesting it be treated as invalid. This extension is part of at > least OpenCL 2.1, but it's not part of OpenCL 1.0. `ext_vector_type` is > Clang's implementation of the OpenCL vector type. Therefore if the user asks > us to support OpenCL 1.0, we should give them a warning if they use this > syntax. > > If we're not building an OpenCL source file, then yes, this is our extension > and it makes sense for it to be available unconditionally (without a warning). To avoid confusion, I'd like to note that rgba selector was first introduced in OpenCL C++ kernel language, which is currently in provisional state and will be part of OpenCL version 2.2. https://www.khronos.org/registry/cl/specs/opencl-2.2-cplusplus.pdf (page 18). OpenCL version 2.1 uses OpenCL C 2.0 kernel language, which doesn't support rgba selector. https://www.khronos.org/registry/cl/ - latest versions of OpenCL specs. http://reviews.llvm.org/D20602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20614: Remove trailing spaces in x86 intrinsic headers
kromanova created this revision. kromanova added a reviewer: m_zuckerman. kromanova added a subscriber: cfe-commits. kromanova set the repository for this revision to rL LLVM. Clean up: remove trailing spaces in x86 intrinsic headers. Repository: rL LLVM http://reviews.llvm.org/D20614 Files: __wmmintrin_aes.h __wmmintrin_pclmul.h avx512fintrin.h avx512vldqintrin.h mwaitxintrin.h pmmintrin.h Index: pmmintrin.h === --- pmmintrin.h +++ pmmintrin.h @@ -31,9 +31,9 @@ __attribute__((__always_inline__, __nodebug__, __target__("sse3"))) /// \brief Loads data from an unaligned memory location to elements in a 128-bit -///vector. If the address of the data is not 16-byte aligned, the -///instruction may read two adjacent aligned blocks of memory to retrieve -///the requested data. +///vector. If the address of the data is not 16-byte aligned, the +///instruction may read two adjacent aligned blocks of memory to retrieve +///the requested data. /// /// \headerfile /// @@ -75,14 +75,14 @@ /// This intrinsic corresponds to the \c VHADDPS instruction. /// /// \param __a -///A 128-bit vector of [4 x float] containing one of the source operands. -///The horizontal sums of the values are stored in the lower bits of the +///A 128-bit vector of [4 x float] containing one of the source operands. +///The horizontal sums of the values are stored in the lower bits of the ///destination. /// \param __b -///A 128-bit vector of [4 x float] containing one of the source operands. -///The horizontal sums of the values are stored in the upper bits of the +///A 128-bit vector of [4 x float] containing one of the source operands. +///The horizontal sums of the values are stored in the upper bits of the ///destination. -/// \returns A 128-bit vector of [4 x float] containing the horizontal sums of +/// \returns A 128-bit vector of [4 x float] containing the horizontal sums of ///both operands. static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_hadd_ps(__m128 __a, __m128 __b) @@ -98,14 +98,14 @@ /// This intrinsic corresponds to the \c VHSUBPS instruction. /// /// \param __a -///A 128-bit vector of [4 x float] containing one of the source operands. -///The horizontal differences between the values are stored in the lower +///A 128-bit vector of [4 x float] containing one of the source operands. +///The horizontal differences between the values are stored in the lower ///bits of the destination. /// \param __b -///A 128-bit vector of [4 x float] containing one of the source operands. -///The horizontal differences between the values are stored in the upper +///A 128-bit vector of [4 x float] containing one of the source operands. +///The horizontal differences between the values are stored in the upper ///bits of the destination. -/// \returns A 128-bit vector of [4 x float] containing the horizontal +/// \returns A 128-bit vector of [4 x float] containing the horizontal ///differences of both operands. static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_hsub_ps(__m128 __a, __m128 __b) @@ -168,7 +168,7 @@ ///A 128-bit vector of [2 x double] containing the left source operand. /// \param __b ///A 128-bit vector of [2 x double] containing the right source operand. -/// \returns A 128-bit vector of [2 x double] containing the alternating sums +/// \returns A 128-bit vector of [2 x double] containing the alternating sums ///and differences of both operands. static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_addsub_pd(__m128d __a, __m128d __b) @@ -176,7 +176,7 @@ return __builtin_ia32_addsubpd((__v2df)__a, (__v2df)__b); } -/// \brief Horizontally adds the pairs of values contained in two 128-bit +/// \brief Horizontally adds the pairs of values contained in two 128-bit ///vectors of [2 x double]. /// /// \headerfile @@ -184,12 +184,12 @@ /// This intrinsic corresponds to the \c VHADDPD instruction. /// /// \param __a -///A 128-bit vector of [2 x double] containing one of the source operands. -///The horizontal sum of the values is stored in the lower bits of the +///A 128-bit vector of [2 x double] containing one of the source operands. +///The horizontal sum of the values is stored in the lower bits of the ///destination. /// \param __b -///A 128-bit vector of [2 x double] containing one of the source operands. -///The horizontal sum of the values is stored in the upper bits of the +///A 128-bit vector of [2 x double] containing one of the source operands. +///The horizontal sum of the values is stored in the upper bits of the ///destination. /// \returns A 128-bit vector of [2 x double] containing the horizontal sums of ///both operands. @@ -207,14 +207,14 @@ /// This intrinsic corresponds to the \c VHSUBPD instruction. /// ///
Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains
On Tue, May 24, 2016 at 4:18 PM, Simon Atanasyanwrote: > /home/abuild/rpmbuild/BUILD/llvm/stage2/bin/clang -no-canonical-prefixes \ > /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/mips-img-v2.cpp \ > -### -o > /home/abuild/rpmbuild/BUILD/llvm/stage2/tools/clang/test/Driver/Output/mips-img-v2.cpp.tmp.o > \ > --target=mips-img-linux-gnu \ > > --gcc-toolchain=/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree > \ > -EB -mips32r6 -mhard-float -mabi=32 Here is the output: openSUSE Linux clang version 3.9.0 (trunk 270535) (based on LLVM 3.9.0svn) Target: mips-img-linux-gnu Thread model: posix InstalledDir: /home/abuild/rpmbuild/BUILD/llvm/stage2/bin "/home/abuild/rpmbuild/BUILD/llvm/stage2/bin/clang" "-cc1" "-triple" "mips-img-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "mips-img-v2.cpp" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-fuse-init-array" "-target-cpu" "mips32r6" "-target-abi" "o32" "-mfloat-abi" "hard" "-dwarf-column-info" "-debugger-tuning=gdb" "-resource-dir" "/home/abuild/rpmbuild/BUILD/llvm/stage2/bin/../lib64/clang/3.9.0" "-internal-isystem" "/home/abuild/rpmbuild/BUILD/llvm/stage2/bin/../include/c++/v1" "-internal-isystem" "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/usr/local/include" "-internal-isystem" "/home/abuild/rpmbuild/BUILD/llvm/stage2/bin/../lib64/clang/3.9.0/include" "-internal-externc-isystem" "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/lib/../usr/include" "-internal-externc-isystem" "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/include" "-internal-externc-isystem" "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir" "/home/abuild" "-ferror-limit" "19" "-fmessage-length" "130" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-o" "/tmp/mips-img-v2-677094.o" "-x" "c++" "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/mips-img-v2.cpp" "/usr/bin/ld" "-z" "relro" "--sysroot=/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard" "--build-id" "--enable-new-dtags" "--eh-frame-hdr" "-m" "elf32btsmip" "-dynamic-linker" "/lib/ld-linux-mipsn8.so.1" "-o" "/home/abuild/rpmbuild/BUILD/llvm/stage2/tools/clang/test/Driver/Output/mips-img-v2.cpp.tmp.o" "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/usr/lib/../lib/crt1.o" "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/usr/lib/../lib/crti.o" "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/mips-r6-hard/lib/crtbegin.o" "-L/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/lib/mips-r6-hard/lib" "-L/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/mips-r6-hard/lib" "-L/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/lib/../lib/mips-r6-hard" "-L/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/lib/../lib" "-L/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/usr/lib/../lib" "-L/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/lib/mips-r6-hard" "-L/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/lib" "-L/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../sysroot/mips-r6-hard/usr/lib" "/tmp/mips-img-v2-677094.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/mips-r6-hard/lib/crtend.o"
Re: [PATCH] D16948: [libcxx] Filesystem TS -- Complete
rmaprath added a subscriber: rmaprath. rmaprath added a comment. Looks like I've completely missed this patch somehow. Will try to find some time (or someone) to have a look at it from an embedded-systems / ARM point of view asap. Great work!!! http://reviews.llvm.org/D16948 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20574: [libcxxabi] Allow explicit pthread opt-in
rmaprath accepted this revision. rmaprath added a comment. This revision is now accepted and ready to land. LGTM. (I don't have powers to accept libcxx patches in general, but this patch is quite small and related to something I plugged in, so, I think it's OK in this instance) http://reviews.llvm.org/D20574 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20573: [libcxx] Allow explicit pthread opt-in
rmaprath accepted this revision. rmaprath added a comment. This revision is now accepted and ready to land. LGTM. (I don't have powers to accept libcxx patches in general, but this patch is quite small and related to something I plugged in, so, I think it's OK in this instance) http://reviews.llvm.org/D20573 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits