[PATCH] D71300: [clangd] Deduplicate refs from index for cross-file rename.

2019-12-11 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

thanks for the fast review.




Comment at: clang-tools-extra/clangd/unittests/RenameTests.cpp:34
+// Covnert a Range to a Ref.
+std::pair toRef(const clangd::Range &Range,
+  llvm::StringRef Path) {

ilya-biryukov wrote:
> - Returning both storage and `Ref` is quite a complicated interface. Could we 
> rely on the clients to pass strings with URIs instead? It's not a lot of code 
> to create URIs.
> - I think the function name might end up a little confusing when reading the 
> code using it (it certainly did for me). Could we rename it to 
> `refWithRange`? That seems to describe what this function is doing more 
> accurately.
agree, this is a good point. thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71300/new/

https://reviews.llvm.org/D71300



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71300: [clangd] Deduplicate refs from index for cross-file rename.

2019-12-11 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 233262.
hokein marked an inline comment as done.
hokein added a comment.

address review comment -- simplify the unittest code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71300/new/

https://reviews.llvm.org/D71300

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/refactor/Rename.h
  clang-tools-extra/clangd/unittests/RenameTests.cpp

Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -30,6 +30,18 @@
 using testing::UnorderedElementsAre;
 using testing::UnorderedElementsAreArray;
 
+// Covnert a Range to a Ref.
+Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
+  Ref Result;
+  Result.Kind = RefKind::Reference;
+  Result.Location.Start.setLine(Range.start.line);
+  Result.Location.Start.setColumn(Range.start.character);
+  Result.Location.End.setLine(Range.end.line);
+  Result.Location.End.setColumn(Range.end.character);
+  Result.Location.FileURI = URI.c_str();
+  return Result;
+}
+
 // Build a RefSlab from all marked ranges in the annotation. The ranges are
 // assumed to associate with the given SymbolName.
 std::unique_ptr buildRefSlab(const Annotations &Code,
@@ -40,17 +52,9 @@
   TU.HeaderCode = Code.code();
   auto Symbols = TU.headerSymbols();
   const auto &SymbolID = findSymbol(Symbols, SymbolName).ID;
-  for (const auto &Range : Code.ranges()) {
-Ref R;
-R.Kind = RefKind::Reference;
-R.Location.Start.setLine(Range.start.line);
-R.Location.Start.setColumn(Range.start.character);
-R.Location.End.setLine(Range.end.line);
-R.Location.End.setColumn(Range.end.character);
-auto U = URI::create(Path).toString();
-R.Location.FileURI = U.c_str();
-Builder.insert(SymbolID, R);
-  }
+  std::string PathURI = URI::create(Path).toString();
+  for (const auto &Range : Code.ranges())
+Builder.insert(SymbolID, refWithRange(Range, PathURI));
 
   return std::make_unique(std::move(Builder).build());
 }
@@ -664,6 +668,54 @@
   testing::HasSubstr("too many occurrences"));
 }
 
+TEST(CrossFileRenameTests, DeduplicateRefsFromIndex) {
+  auto MainCode = Annotations("int [[^x]] = 2;");
+  auto MainFilePath = testPath("main.cc");
+  auto BarCode = Annotations("int [[x]];");
+  auto BarPath = testPath("bar.cc");
+  auto TU = TestTU::withCode(MainCode.code());
+  // Set a file "bar.cc" on disk.
+  TU.AdditionalFiles["bar.cc"] = BarCode.code();
+  auto AST = TU.build();
+  std::string BarPathURI = URI::create(BarPath).toString();
+  Ref XRefInBarCC = refWithRange(BarCode.range(), BarPathURI);
+  // The index will return duplicated refs, our code should be robost to handle
+  // it.
+  class DuplicatedXRefIndex : public SymbolIndex {
+  public:
+DuplicatedXRefIndex(const Ref &ReturnedRef) : ReturnedRef(ReturnedRef) {}
+bool refs(const RefsRequest &Req,
+  llvm::function_ref Callback) const override {
+  // Return two duplicated refs.
+  Callback(ReturnedRef);
+  Callback(ReturnedRef);
+  return false;
+}
+
+bool fuzzyFind(const FuzzyFindRequest &,
+   llvm::function_ref) const override {
+  return false;
+}
+void lookup(const LookupRequest &,
+llvm::function_ref) const override {}
+
+void relations(const RelationsRequest &,
+   llvm::function_ref)
+const override {}
+size_t estimateMemoryUsage() const override { return 0; }
+Ref ReturnedRef;
+  } DIndex(XRefInBarCC);
+  llvm::StringRef NewName = "newName";
+  auto Results = rename({MainCode.point(), NewName, AST, MainFilePath, &DIndex,
+ /*CrossFile=*/true});
+  ASSERT_TRUE(bool(Results)) << Results.takeError();
+  EXPECT_THAT(
+  applyEdits(std::move(*Results)),
+  UnorderedElementsAre(
+  Pair(Eq(BarPath), Eq(expectedResult(BarCode, NewName))),
+  Pair(Eq(MainFilePath), Eq(expectedResult(MainCode, NewName);
+}
+
 TEST(CrossFileRenameTests, WithUpToDateIndex) {
   MockCompilationDatabase CDB;
   CDB.ExtraClangFlags = {"-xc++"};
Index: clang-tools-extra/clangd/refactor/Rename.h
===
--- clang-tools-extra/clangd/refactor/Rename.h
+++ clang-tools-extra/clangd/refactor/Rename.h
@@ -51,6 +51,7 @@
 /// Generates rename edits that replaces all given occurrences with the
 /// NewName.
 /// Exposed for testing only.
+/// REQUIRED: Occurrences is sorted and doesn't have duplicated ranges.
 llvm::Expected buildRenameEdit(llvm::StringRef AbsFilePath,
  llvm::StringRef InitialCode,
  std::vector Occurrences,
@@ -65,6 +66,7 @@
 ///
 /// The API assumes that Indexed contains only named occurrences (each
 ///

[PATCH] D71300: [clangd] Deduplicate refs from index for cross-file rename.

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60688 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71300/new/

https://reviews.llvm.org/D71300



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71284: [clangd] Consider () part of the FunctionDecl, not the FunctionTypeLoc

2019-12-11 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet accepted this revision.
kadircet added inline comments.
This revision is now accepted and ready to land.



Comment at: clang-tools-extra/clangd/Selection.cpp:578
 
   // Returns the range of tokens that this node will claim directly, and
   // is not available to the node's children.

comment needs to be updated



Comment at: clang-tools-extra/clangd/unittests/SelectionTests.cpp:253
+  {"[[^void]] foo(int);", "BuiltinTypeLoc"},
+  {"[[void foo^(int)]];", "FunctionDecl"},
+  {"[[^void foo^(int)]];", "FunctionDecl"},

could you also add  case for closing paren (possibly with a trailing `const` 
attribute ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71284/new/

https://reviews.llvm.org/D71284



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang] bc24014 - [c++20] Implement P1185R2 (as modified by P2002R0).

2019-12-11 Thread Yvan Roux via cfe-commits
Hi Richard,

ARM bots are broken after this commit, logs are available here:

http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/12109/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Acxx2a-three-way-comparison.cpp

Thanks,
Yvan

On Wed, 11 Dec 2019 at 02:24, Richard Smith via cfe-commits
 wrote:
>
>
> Author: Richard Smith
> Date: 2019-12-10T17:24:27-08:00
> New Revision: bc24014b9765a454cb5214f4871451a41ffb7d29
>
> URL: 
> https://github.com/llvm/llvm-project/commit/bc24014b9765a454cb5214f4871451a41ffb7d29
> DIFF: 
> https://github.com/llvm/llvm-project/commit/bc24014b9765a454cb5214f4871451a41ffb7d29.diff
>
> LOG: [c++20] Implement P1185R2 (as modified by P2002R0).
>
> For each defaulted operator<=> in a class that doesn't explicitly
> declare any operator==, also inject a matching implicit defaulted
> operator==.
>
> Added:
> clang/test/CXX/class/class.compare/class.compare.default/p4.cpp
>
> Modified:
> clang/include/clang/Basic/DiagnosticSemaKinds.td
> clang/include/clang/Sema/Sema.h
> clang/include/clang/Sema/Template.h
> clang/lib/Frontend/FrontendActions.cpp
> clang/lib/Sema/SemaDeclCXX.cpp
> clang/lib/Sema/SemaOverload.cpp
> clang/lib/Sema/SemaTemplateInstantiate.cpp
> clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
> clang/test/CodeGenCXX/cxx2a-three-way-comparison.cpp
>
> Removed:
>
>
>
> 
> diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
> b/clang/include/clang/Basic/DiagnosticSemaKinds.td
> index aeeff2b9a76e..a5f35996cfdc 100644
> --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
> +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
> @@ -3840,6 +3840,7 @@ def select_ovl_candidate_kind : TextSubstitution<
>  "constructor (the implicit move constructor)|"
>  "function (the implicit copy assignment operator)|"
>  "function (the implicit move assignment operator)|"
> +"function (the implicit 'operator==' for this 'operator<=>)'|"
>  "inherited constructor}0%select{| template| %2}1">;
>
>  def note_ovl_candidate : Note<
> @@ -8207,7 +8208,8 @@ def warn_defaulted_comparison_deleted : Warning<
>"explicitly defaulted %sub{select_defaulted_comparison_kind}0 is 
> implicitly "
>"deleted">, InGroup;
>  def err_non_first_default_compare_deletes : Error<
> -  "defaulting this %sub{select_defaulted_comparison_kind}0 "
> +  "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
> +  "the corresponding implicit 'operator==' for this defaulted 
> 'operator<=>'}0 "
>"would delete it after its first declaration">;
>  def note_defaulted_comparison_union : Note<
>"defaulted %0 is implicitly deleted because "
> @@ -8237,14 +8239,19 @@ def note_defaulted_comparison_cannot_deduce : Note<
>  def note_defaulted_comparison_cannot_deduce_callee : Note<
>"selected 'operator<=>' for %select{|member|base class}0 %1 declared 
> here">;
>  def err_incorrect_defaulted_comparison_constexpr : Error<
> -  "defaulted definition of %sub{select_defaulted_comparison_kind}0 "
> -  "cannot be declared %select{constexpr|consteval}1 because it invokes "
> -  "a non-constexpr comparison function">;
> +  "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
> +  "three-way comparison operator}0 "
> +  "cannot be declared %select{constexpr|consteval}2 because "
> +  "%select{it|the corresponding implicit 'operator=='}0 "
> +  "invokes a non-constexpr comparison function">;
>  def note_defaulted_comparison_not_constexpr : Note<
>"non-constexpr comparison function would be used to compare "
>"%select{|member %1|base class %1}0">;
>  def note_defaulted_comparison_not_constexpr_here : Note<
>"non-constexpr comparison function declared here">;
> +def note_in_declaration_of_implicit_equality_comparison : Note<
> +  "while declaring the corresponding implicit 'operator==' "
> +  "for this defaulted 'operator<=>'">;
>
>  def ext_implicit_exception_spec_mismatch : ExtWarn<
>"function previously declared with an %select{explicit|implicit}0 
> exception "
>
> diff  --git a/clang/include/clang/Sema/Sema.h 
> b/clang/include/clang/Sema/Sema.h
> index 1cdaab3dc28c..5a1ee507218c 100644
> --- a/clang/include/clang/Sema/Sema.h
> +++ b/clang/include/clang/Sema/Sema.h
> @@ -6524,6 +6524,8 @@ class Sema final {
>
>bool CheckExplicitlyDefaultedComparison(Scope *S, FunctionDecl *MD,
>DefaultedComparisonKind DCK);
> +  void DeclareImplicitEqualityComparison(CXXRecordDecl *RD,
> + FunctionDecl *Spaceship);
>void DefineDefaultedComparison(SourceLocation Loc, FunctionDecl *FD,
>   DefaultedComparisonKind DCK);
>
> @@ -7838,6 +7840,10 @@ class Sema final {
>/// We are declaring an implicit special member function.
>DeclaringSpecialMember,
>
> +  /// We are declaring an implicit 'op

[PATCH] D71300: [clangd] Deduplicate refs from index for cross-file rename.

2019-12-11 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71300/new/

https://reviews.llvm.org/D71300



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71329: [CodeComplete] Fix a crash in preferred type and signature help

2019-12-11 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision.
ilya-biryukov added a reviewer: kadircet.
Herald added a project: clang.
sammccall accepted this revision.
This revision is now accepted and ready to land.

Null type pointers could be dereferenced in some cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71329

Files:
  clang/lib/Parse/ParseExprCXX.cpp
  clang/unittests/Sema/CodeCompleteTest.cpp


Index: clang/unittests/Sema/CodeCompleteTest.cpp
===
--- clang/unittests/Sema/CodeCompleteTest.cpp
+++ clang/unittests/Sema/CodeCompleteTest.cpp
@@ -481,4 +481,12 @@
   )cpp";
   EXPECT_THAT(collectPreferredTypes(Code), Each("vector"));
 }
+
+TEST(PreferredTypeTest, NoCrashOnInvalidFunctionCasts) {
+  StringRef Code = R"cpp(
+auto x = decltype(&1)(^);
+auto y = new decltype(&1)(^);
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE"));
+}
 } // namespace
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -1862,9 +1862,11 @@
 CommaLocsTy CommaLocs;
 
 auto RunSignatureHelp = [&]() {
-  QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-  getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
-  DS.getEndLoc(), Exprs, T.getOpenLocation());
+  QualType PreferredType;
+  if (TypeRep)
+PreferredType = Actions.ProduceConstructorSignatureHelp(
+getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
+DS.getEndLoc(), Exprs, T.getOpenLocation());
   CalledSignatureHelp = true;
   return PreferredType;
 };
@@ -3038,9 +3040,10 @@
   auto RunSignatureHelp = [&]() {
 ParsedType TypeRep =
 Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
+assert(TypeRep && "invalid types should be handled by that point");
 QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
-DeclaratorInfo.getEndLoc(), ConstructorArgs, ConstructorLParen);
+  getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
+  DeclaratorInfo.getEndLoc(), ConstructorArgs, ConstructorLParen);
 CalledSignatureHelp = true;
 return PreferredType;
   };


Index: clang/unittests/Sema/CodeCompleteTest.cpp
===
--- clang/unittests/Sema/CodeCompleteTest.cpp
+++ clang/unittests/Sema/CodeCompleteTest.cpp
@@ -481,4 +481,12 @@
   )cpp";
   EXPECT_THAT(collectPreferredTypes(Code), Each("vector"));
 }
+
+TEST(PreferredTypeTest, NoCrashOnInvalidFunctionCasts) {
+  StringRef Code = R"cpp(
+auto x = decltype(&1)(^);
+auto y = new decltype(&1)(^);
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE"));
+}
 } // namespace
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -1862,9 +1862,11 @@
 CommaLocsTy CommaLocs;
 
 auto RunSignatureHelp = [&]() {
-  QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-  getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
-  DS.getEndLoc(), Exprs, T.getOpenLocation());
+  QualType PreferredType;
+  if (TypeRep)
+PreferredType = Actions.ProduceConstructorSignatureHelp(
+getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
+DS.getEndLoc(), Exprs, T.getOpenLocation());
   CalledSignatureHelp = true;
   return PreferredType;
 };
@@ -3038,9 +3040,10 @@
   auto RunSignatureHelp = [&]() {
 ParsedType TypeRep =
 Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
+assert(TypeRep && "invalid types should be handled by that point");
 QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
-DeclaratorInfo.getEndLoc(), ConstructorArgs, ConstructorLParen);
+  getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
+  DeclaratorInfo.getEndLoc(), ConstructorArgs, ConstructorLParen);
 CalledSignatureHelp = true;
 return PreferredType;
   };
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71248: [clangd] Introduce paragraph, the first part of new rendering structs

2019-12-11 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

Main thing here is I'm fairly sure that code blocks shouldn't be chunks in a 
paragraph (or I'm misunderstanding what a paragraph is)




Comment at: clang-tools-extra/clangd/FormattedString.cpp:95
+// Concatanates whitespace blocks into a single ` `.
+std::string canonicalizeSpaces(std::string Input) {
+  // Goes over the string and preserves only a single ` ` for any whitespace

is this equivalent to
```
SmallVector Words;
llvm::SplitString(Input, Words);
return llvm::join(Input, " ");
```
?

(That would trim leading/trailing whitespace, but I suspect we actually want 
that)



Comment at: clang-tools-extra/clangd/FormattedString.cpp:176
   std::string R;
-  for (const auto &C : Chunks) {
+  auto EnsureWhitespace = [&R]() {
+// Adds a space for nicer rendering.

Can we simplify the whitespace model? A lot of this is hacks around code 
blocks, which shouldn't really be here.

What about:
 - the contents of each chunk never have leading/trailing ws (it's stripped 
when adding)
 - there's always a space between consecutive chunks



Comment at: clang-tools-extra/clangd/FormattedString.h:24
 
 /// A structured string representation that could be converted to markdown or
 /// plaintext upon requrest.

I don't think this comment captures what this class is about now. (Rewriting 
the class but leaving the comment intact is suspicious!)

Comment should allude to how blocks make up a document - a RenderableBlock 
holds rich text and knows how to lay it out. Blocks can be stacked to form a 
document, etc.



Comment at: clang-tools-extra/clangd/FormattedString.h:26
 /// plaintext upon requrest.
-class FormattedString {
+class RenderableBlock {
 public:

nit: I wouldn't bother with both "renderable" prefix and the `markup` 
namespace, up to you



Comment at: clang-tools-extra/clangd/FormattedString.h:28
 public:
+  virtual std::string renderAsMarkdown() const = 0;
+  virtual std::string renderAsPlainText() const = 0;

Or just asMarkdown, up to you



Comment at: clang-tools-extra/clangd/FormattedString.h:28
 public:
+  virtual std::string renderAsMarkdown() const = 0;
+  virtual std::string renderAsPlainText() const = 0;

sammccall wrote:
> Or just asMarkdown, up to you
are you sure we want to create all the temporary strings?
Consider `void renderMarkdown(llvm::raw_ostream&)`, and keep `std::string 
asMarkdown()` on `Document`



Comment at: clang-tools-extra/clangd/FormattedString.h:30
+  virtual std::string renderAsPlainText() const = 0;
+
+  virtual ~RenderableBlock() = default;

renderfortests has gone. What's the plan for testing Hover rendering? (i.e. 
HoverInfo -> Document)
I guess asserting the plain text and markdown might be enough...

(Did we remove *all* the tests for `present()`in D70911, and I didn't notice? 
We should restore some based on synthetic HoverInfo)



Comment at: clang-tools-extra/clangd/FormattedString.h:35
+/// Represents parts of the markup that can contain strings, like inline code,
+/// code block or plain text.
+/// Only CodeBlocks guarantees conservation of new lines within text. One must

A code block doesn't go in a paragraph, as it's a block itself.

"A paragraph contains a logical line of rich text. It may be wrapped for 
display"



Comment at: clang-tools-extra/clangd/FormattedString.h:46
+
   /// Append an inline block of C++ code. This translates to the ` block in
   /// markdown.

nit: while here, I do think `inline block` is misleading - this corresponds to 
display: inline, not display:inline-block. "inline span"?



Comment at: clang-tools-extra/clangd/FormattedString.h:48
   /// markdown.
-  void appendInlineCode(std::string Code);
+  Paragraph &appendInlineCode(std::string Code);
 

just appendCode?



Comment at: clang-tools-extra/clangd/FormattedString.h:69
 
+/// A semantical representation for formattable strings. Allows rendering into
+/// markdown and plaintext.

semantic -> format-agnostic? This doesn't capture semantics.

formattable strings -> rich text, or structured text?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71248/new/

https://reviews.llvm.org/D71248



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71329: [CodeComplete] Fix a crash in preferred type and signature help

2019-12-11 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 233268.
ilya-biryukov added a comment.

- Rename the test, tweak assert comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71329/new/

https://reviews.llvm.org/D71329

Files:
  clang/lib/Parse/ParseExprCXX.cpp
  clang/unittests/Sema/CodeCompleteTest.cpp


Index: clang/unittests/Sema/CodeCompleteTest.cpp
===
--- clang/unittests/Sema/CodeCompleteTest.cpp
+++ clang/unittests/Sema/CodeCompleteTest.cpp
@@ -481,4 +481,12 @@
   )cpp";
   EXPECT_THAT(collectPreferredTypes(Code), Each("vector"));
 }
+
+TEST(PreferredTypeTest, NoCrashOnInvalidTypes) {
+  StringRef Code = R"cpp(
+auto x = decltype(&1)(^);
+auto y = new decltype(&1)(^);
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE"));
+}
 } // namespace
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -1862,9 +1862,11 @@
 CommaLocsTy CommaLocs;
 
 auto RunSignatureHelp = [&]() {
-  QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-  getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
-  DS.getEndLoc(), Exprs, T.getOpenLocation());
+  QualType PreferredType;
+  if (TypeRep)
+PreferredType = Actions.ProduceConstructorSignatureHelp(
+getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
+DS.getEndLoc(), Exprs, T.getOpenLocation());
   CalledSignatureHelp = true;
   return PreferredType;
 };
@@ -3038,6 +3040,7 @@
   auto RunSignatureHelp = [&]() {
 ParsedType TypeRep =
 Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
+assert(TypeRep && "invalid types should be handled before");
 QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
 getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
 DeclaratorInfo.getEndLoc(), ConstructorArgs, ConstructorLParen);


Index: clang/unittests/Sema/CodeCompleteTest.cpp
===
--- clang/unittests/Sema/CodeCompleteTest.cpp
+++ clang/unittests/Sema/CodeCompleteTest.cpp
@@ -481,4 +481,12 @@
   )cpp";
   EXPECT_THAT(collectPreferredTypes(Code), Each("vector"));
 }
+
+TEST(PreferredTypeTest, NoCrashOnInvalidTypes) {
+  StringRef Code = R"cpp(
+auto x = decltype(&1)(^);
+auto y = new decltype(&1)(^);
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE"));
+}
 } // namespace
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -1862,9 +1862,11 @@
 CommaLocsTy CommaLocs;
 
 auto RunSignatureHelp = [&]() {
-  QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-  getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
-  DS.getEndLoc(), Exprs, T.getOpenLocation());
+  QualType PreferredType;
+  if (TypeRep)
+PreferredType = Actions.ProduceConstructorSignatureHelp(
+getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
+DS.getEndLoc(), Exprs, T.getOpenLocation());
   CalledSignatureHelp = true;
   return PreferredType;
 };
@@ -3038,6 +3040,7 @@
   auto RunSignatureHelp = [&]() {
 ParsedType TypeRep =
 Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
+assert(TypeRep && "invalid types should be handled before");
 QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
 getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
 DeclaratorInfo.getEndLoc(), ConstructorArgs, ConstructorLParen);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] f7c8ace - [CodeComplete] Fix a crash in preferred type and signature help

2019-12-11 Thread Ilya Biryukov via cfe-commits

Author: Ilya Biryukov
Date: 2019-12-11T09:43:28+01:00
New Revision: f7c8ace4a52acecff7cd6ab61cbeaf677da1dd86

URL: 
https://github.com/llvm/llvm-project/commit/f7c8ace4a52acecff7cd6ab61cbeaf677da1dd86
DIFF: 
https://github.com/llvm/llvm-project/commit/f7c8ace4a52acecff7cd6ab61cbeaf677da1dd86.diff

LOG: [CodeComplete] Fix a crash in preferred type and signature help

Summary: Null type pointers could be dereferenced in some cases.

Reviewers: kadircet, sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71329

Added: 


Modified: 
clang/lib/Parse/ParseExprCXX.cpp
clang/unittests/Sema/CodeCompleteTest.cpp

Removed: 




diff  --git a/clang/lib/Parse/ParseExprCXX.cpp 
b/clang/lib/Parse/ParseExprCXX.cpp
index 7dfe71fb9ebc..fecd70b17e5b 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -1862,9 +1862,11 @@ Parser::ParseCXXTypeConstructExpression(const DeclSpec 
&DS) {
 CommaLocsTy CommaLocs;
 
 auto RunSignatureHelp = [&]() {
-  QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-  getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
-  DS.getEndLoc(), Exprs, T.getOpenLocation());
+  QualType PreferredType;
+  if (TypeRep)
+PreferredType = Actions.ProduceConstructorSignatureHelp(
+getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
+DS.getEndLoc(), Exprs, T.getOpenLocation());
   CalledSignatureHelp = true;
   return PreferredType;
 };
@@ -3038,6 +3040,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, 
SourceLocation Start) {
   auto RunSignatureHelp = [&]() {
 ParsedType TypeRep =
 Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
+assert(TypeRep && "invalid types should be handled before");
 QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
 getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
 DeclaratorInfo.getEndLoc(), ConstructorArgs, ConstructorLParen);

diff  --git a/clang/unittests/Sema/CodeCompleteTest.cpp 
b/clang/unittests/Sema/CodeCompleteTest.cpp
index ab1792ba6376..a9441a679cac 100644
--- a/clang/unittests/Sema/CodeCompleteTest.cpp
+++ b/clang/unittests/Sema/CodeCompleteTest.cpp
@@ -481,4 +481,12 @@ TEST(PreferredTypeTest, FunctionArguments) {
   )cpp";
   EXPECT_THAT(collectPreferredTypes(Code), Each("vector"));
 }
+
+TEST(PreferredTypeTest, NoCrashOnInvalidTypes) {
+  StringRef Code = R"cpp(
+auto x = decltype(&1)(^);
+auto y = new decltype(&1)(^);
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE"));
+}
 } // namespace



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71329: [CodeComplete] Fix a crash in preferred type and signature help

2019-12-11 Thread Ilya Biryukov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf7c8ace4a52a: [CodeComplete] Fix a crash in preferred type 
and signature help (authored by ilya-biryukov).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71329/new/

https://reviews.llvm.org/D71329

Files:
  clang/lib/Parse/ParseExprCXX.cpp
  clang/unittests/Sema/CodeCompleteTest.cpp


Index: clang/unittests/Sema/CodeCompleteTest.cpp
===
--- clang/unittests/Sema/CodeCompleteTest.cpp
+++ clang/unittests/Sema/CodeCompleteTest.cpp
@@ -481,4 +481,12 @@
   )cpp";
   EXPECT_THAT(collectPreferredTypes(Code), Each("vector"));
 }
+
+TEST(PreferredTypeTest, NoCrashOnInvalidTypes) {
+  StringRef Code = R"cpp(
+auto x = decltype(&1)(^);
+auto y = new decltype(&1)(^);
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE"));
+}
 } // namespace
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -1862,9 +1862,11 @@
 CommaLocsTy CommaLocs;
 
 auto RunSignatureHelp = [&]() {
-  QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-  getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
-  DS.getEndLoc(), Exprs, T.getOpenLocation());
+  QualType PreferredType;
+  if (TypeRep)
+PreferredType = Actions.ProduceConstructorSignatureHelp(
+getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
+DS.getEndLoc(), Exprs, T.getOpenLocation());
   CalledSignatureHelp = true;
   return PreferredType;
 };
@@ -3038,6 +3040,7 @@
   auto RunSignatureHelp = [&]() {
 ParsedType TypeRep =
 Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
+assert(TypeRep && "invalid types should be handled before");
 QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
 getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
 DeclaratorInfo.getEndLoc(), ConstructorArgs, ConstructorLParen);


Index: clang/unittests/Sema/CodeCompleteTest.cpp
===
--- clang/unittests/Sema/CodeCompleteTest.cpp
+++ clang/unittests/Sema/CodeCompleteTest.cpp
@@ -481,4 +481,12 @@
   )cpp";
   EXPECT_THAT(collectPreferredTypes(Code), Each("vector"));
 }
+
+TEST(PreferredTypeTest, NoCrashOnInvalidTypes) {
+  StringRef Code = R"cpp(
+auto x = decltype(&1)(^);
+auto y = new decltype(&1)(^);
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE"));
+}
 } // namespace
Index: clang/lib/Parse/ParseExprCXX.cpp
===
--- clang/lib/Parse/ParseExprCXX.cpp
+++ clang/lib/Parse/ParseExprCXX.cpp
@@ -1862,9 +1862,11 @@
 CommaLocsTy CommaLocs;
 
 auto RunSignatureHelp = [&]() {
-  QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
-  getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
-  DS.getEndLoc(), Exprs, T.getOpenLocation());
+  QualType PreferredType;
+  if (TypeRep)
+PreferredType = Actions.ProduceConstructorSignatureHelp(
+getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
+DS.getEndLoc(), Exprs, T.getOpenLocation());
   CalledSignatureHelp = true;
   return PreferredType;
 };
@@ -3038,6 +3040,7 @@
   auto RunSignatureHelp = [&]() {
 ParsedType TypeRep =
 Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
+assert(TypeRep && "invalid types should be handled before");
 QualType PreferredType = Actions.ProduceConstructorSignatureHelp(
 getCurScope(), TypeRep.get()->getCanonicalTypeInternal(),
 DeclaratorInfo.getEndLoc(), ConstructorArgs, ConstructorLParen);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69778: Make -fmodules-codegen and -fmodules-debuginfo work also with precompiled headers

2019-12-11 Thread Luboš Luňák via Phabricator via cfe-commits
llunak added a comment.

In D69778#1776472 , @dblaikie wrote:

> I guess one aspect is that -building-pch-with-obj seems like it duplicates 
> the fmodules-codegen concept (both basically are a flag passed during pcm/pch 
> build time that says "I promise to build an object file from this pcm/pch, so 
> rely on that assumption when building other things that depend on the 
> pcm/pch) - if I'd noticed the -building-pch-with-obj going in I would've made 
> the point then.


Is that described somewhere? There's no mention of modules codegen anywhere 
under clang/docs. I was under the impression that modules created the codegen 
part directly in the .pcm in ELF (or whatever) format.

> But yeah, that's out of scope for this patch, but might be something that'd 
> be good to look into to try to merge these features/codepaths more.

Note that AFAICT the -building-pch-with-obj flag is pretty much internal, used 
only by the MSVC-like PCH creation, so presumably this could be still unified 
more without any real harm. And I think I could do the work if it'd be agreed 
that this would be a good thing.

As for this patch itself, could you please also review 
https://reviews.llvm.org/D69585 and https://reviews.llvm.org/D69779 ? I have 
not really tried this patch without the first one, so I'm a bit hesitant to 
merge it alone, and I quickly ran into the problem fixed by the second patch, 
so I'd prefer to merge them all three together if possible.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69778/new/

https://reviews.llvm.org/D69778



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71329: [CodeComplete] Fix a crash in preferred type and signature help

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60699 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71329/new/

https://reviews.llvm.org/D71329



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71193: [clang] Turn -fno-builtin flag into an IR Attribute

2019-12-11 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet updated this revision to Diff 233272.
gchatelet marked 3 inline comments as done.
gchatelet added a comment.

- Address comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71193/new/

https://reviews.llvm.org/D71193

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/test/CodeGen/libcalls-fno-builtin.c
  clang/test/CodeGen/memccpy-libcall.c

Index: clang/test/CodeGen/memccpy-libcall.c
===
--- clang/test/CodeGen/memccpy-libcall.c
+++ clang/test/CodeGen/memccpy-libcall.c
@@ -9,4 +9,4 @@
   memccpy(d, s, c, n);
 }
 
-// CHECK: attributes #2 = { nobuiltin }
+// CHECK: attributes #2 = { nobuiltin "no-builtin-memccpy" }
Index: clang/test/CodeGen/libcalls-fno-builtin.c
===
--- clang/test/CodeGen/libcalls-fno-builtin.c
+++ clang/test/CodeGen/libcalls-fno-builtin.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -S -emit-llvm -fno-builtin -o - %s | FileCheck %s
+// RUN: %clang_cc1 -S -emit-llvm -fno-builtin -o - %s | FileCheck --check-prefixes=GLOBAL,CHECK %s
 // RUN: %clang_cc1 -S -emit-llvm -fno-builtin-ceil -fno-builtin-copysign -fno-builtin-cos \
 // RUN:  -fno-builtin-fabs -fno-builtin-floor -fno-builtin-strcat -fno-builtin-strncat \
 // RUN:  -fno-builtin-strchr -fno-builtin-strrchr -fno-builtin-strcmp -fno-builtin-strncmp \
@@ -6,7 +6,7 @@
 // RUN:  -fno-builtin-strpbrk -fno-builtin-strspn -fno-builtin-strtod -fno-builtin-strtof \
 // RUN:  -fno-builtin-strtold -fno-builtin-strtol -fno-builtin-strtoll -fno-builtin-strtoul \
 // RUN:  -fno-builtin-strtoull -fno-builtin-fread -fno-builtin-fwrite -fno-builtin-fopen \
-// RUN:  -o - %s | FileCheck %s
+// RUN:  -o - %s | FileCheck --check-prefixes=INDIVIDUAL,CHECK %s
 // RUN: %clang_cc1 -S -O3 -fno-builtin -o - %s | FileCheck --check-prefix=ASM %s
 // RUN: %clang_cc1 -S -O3 -fno-builtin-ceil -o - %s | FileCheck --check-prefix=ASM-INDIV %s
 
@@ -56,108 +56,109 @@
 
 double t2(double x, double y) { return copysign(x,y); }
 // CHECK-LABEL: t2
-// CHECK: call{{.*}}@copysign{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@copysign{{.*}} #2
 
 double t3(double x) { return cos(x); }
 // CHECK-LABEL: t3
-// CHECK: call{{.*}}@cos{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@cos{{.*}} #2
 
 double t4(double x) { return fabs(x); }
 // CHECK-LABEL: t4
-// CHECK: call{{.*}}@fabs{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@fabs{{.*}} #2
 
 double t5(double x) { return floor(x); }
 // CHECK-LABEL: t5
-// CHECK: call{{.*}}@floor{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@floor{{.*}} #2
 
 char *t6(char *x) { return strcat(x, ""); }
 // CHECK-LABEL: t6
-// CHECK: call{{.*}}@strcat{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strcat{{.*}} #2
 
 char *t7(char *x) { return strncat(x, "", 1); }
 // CHECK-LABEL: t7
-// CHECK: call{{.*}}@strncat{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strncat{{.*}} #2
 
 char *t8(void) { return strchr("hello, world", 'w'); }
 // CHECK-LABEL: t8
-// CHECK: call{{.*}}@strchr{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strchr{{.*}} #2
 
 char *t9(void) { return strrchr("hello, world", 'w'); }
 // CHECK-LABEL: t9
-// CHECK: call{{.*}}@strrchr{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strrchr{{.*}} #2
 
 int t10(void) { return strcmp("foo", "bar"); }
 // CHECK-LABEL: t10
-// CHECK: call{{.*}}@strcmp{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strcmp{{.*}} #2
 
 int t11(void) { return strncmp("foo", "bar", 3); }
 // CHECK-LABEL: t11
-// CHECK: call{{.*}}@strncmp{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strncmp{{.*}} #2
 
 char *t12(char *x) { return strcpy(x, "foo"); }
 // CHECK-LABEL: t12
-// CHECK: call{{.*}}@strcpy{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strcpy{{.*}} #2
 
 char *t13(char *x) { return stpcpy(x, "foo"); }
 // CHECK-LABEL: t13
-// CHECK: call{{.*}}@stpcpy{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@stpcpy{{.*}} #2
 
 char *t14(char *x) { return strncpy(x, "foo", 3); }
 // CHECK-LABEL: t14
-// CHECK: call{{.*}}@strncpy{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strncpy{{.*}} #2
 
 size_t t15(void) { return strlen("foo"); }
 // CHECK-LABEL: t15
-// CHECK: call{{.*}}@strlen{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strlen{{.*}} #2
 
 char *t16(char *x) { return strpbrk(x, ""); }
 // CHECK-LABEL: t16
-// CHECK: call{{.*}}@strpbrk{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strpbrk{{.*}} #2
 
 size_t t17(char *x) { return strspn(x, ""); }
 // CHECK-LABEL: t17
-// CHECK: call{{.*}}@strspn{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strspn{{.*}} #2
 
 double t18(char **x) { return strtod("123.4", x); }
 // CHECK-LABEL: t18
-// CHECK: call{{.*}}@strtod{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strtod{{.*}} #2
 
 float t19(char **x) { return strtof("123.4", x); }
 // CHECK-LABEL: t19
-// CHECK: call{{.*}}@strtof{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strtof{{.*}} #2
 
 long double t20(char **x) { return strtold("123.4", x); }
 // CHECK-LABEL: t20
-// CHECK: call{{.*}}@strtold{{.*}} [[ATTR]]
+// CHECK: call{{.*}}@strtold{{.*}} #2
 
 long int t21(char **x) { return strtol("1234", x, 10); 

[clang] 21bc895 - [DWARF5][SplitDwarf] Set default state for -fsplit-dwarf-inlining to be false.

2019-12-11 Thread Alexey Lapshin via cfe-commits

Author: Alexey Lapshin
Date: 2019-12-11T12:18:46+03:00
New Revision: 21bc8958668a4dc21de8328ef856ddcf38a97da7

URL: 
https://github.com/llvm/llvm-project/commit/21bc8958668a4dc21de8328ef856ddcf38a97da7
DIFF: 
https://github.com/llvm/llvm-project/commit/21bc8958668a4dc21de8328ef856ddcf38a97da7.diff

LOG: [DWARF5][SplitDwarf] Set default state for -fsplit-dwarf-inlining to be 
false.

The -fsplit-dwarf-inlining option does not conform to DWARF5 standard.
It creates children for Skeleton compilation unit. We need default behavior
to be DWARF5 compatible. Thus set default state for -fsplit-dwarf-inlining
into "false".

Differential Revision: https://reviews.llvm.org/D71304

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/split-debug.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index b4621a0fcc81..4960f3e42485 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3539,7 +3539,7 @@ static void RenderDebugOptions(const ToolChain &TC, const 
Driver &D,
 
   bool SplitDWARFInlining =
   Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
-   options::OPT_fno_split_dwarf_inlining, true);
+   options::OPT_fno_split_dwarf_inlining, false);
 
   Args.ClaimAllArgs(options::OPT_g_Group);
 

diff  --git a/clang/test/Driver/split-debug.c b/clang/test/Driver/split-debug.c
index 860aebb526fc..d40207d5ae3b 100644
--- a/clang/test/Driver/split-debug.c
+++ b/clang/test/Driver/split-debug.c
@@ -61,6 +61,9 @@
 // CHECK-GMLT-WITH-SPLIT: "-split-dwarf-file"
 // CHECK-GMLT-WITH-SPLIT: "-split-dwarf-output"
 
+// RUN: %clang -target x86_64-unknown-linux-gnu -g -S -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-NOINLINE-WITHOUT-SPLIT < %t %s
+//
 // RUN: %clang -target x86_64-unknown-linux-gnu -g -fno-split-dwarf-inlining 
-S -### %s 2> %t
 // RUN: FileCheck -check-prefix=CHECK-NOINLINE-WITHOUT-SPLIT < %t %s
 //
@@ -79,7 +82,7 @@
 // CHECK-SPLIT-WITH-NOINL: "-debug-info-kind=limited"
 // CHECK-SPLIT-WITH-NOINL: "-split-dwarf-output"
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -S -### %s 
2> %t
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt 
-fsplit-dwarf-inlining -S -### %s 2> %t
 // RUN: FileCheck -check-prefix=CHECK-GMLT-OVER-SPLIT < %t %s
 //
 // CHECK-GMLT-OVER-SPLIT: "-debug-info-kind=line-tables-only"



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71304: [DWARF5][SplitDwarf] Set default state for -fsplit-dwarf-inlining to be false.

2019-12-11 Thread Alexey Lapshin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG21bc8958668a: [DWARF5][SplitDwarf] Set default state for 
-fsplit-dwarf-inlining to be false. (authored by avl).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71304/new/

https://reviews.llvm.org/D71304

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/split-debug.c


Index: clang/test/Driver/split-debug.c
===
--- clang/test/Driver/split-debug.c
+++ clang/test/Driver/split-debug.c
@@ -61,6 +61,9 @@
 // CHECK-GMLT-WITH-SPLIT: "-split-dwarf-file"
 // CHECK-GMLT-WITH-SPLIT: "-split-dwarf-output"
 
+// RUN: %clang -target x86_64-unknown-linux-gnu -g -S -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-NOINLINE-WITHOUT-SPLIT < %t %s
+//
 // RUN: %clang -target x86_64-unknown-linux-gnu -g -fno-split-dwarf-inlining 
-S -### %s 2> %t
 // RUN: FileCheck -check-prefix=CHECK-NOINLINE-WITHOUT-SPLIT < %t %s
 //
@@ -79,7 +82,7 @@
 // CHECK-SPLIT-WITH-NOINL: "-debug-info-kind=limited"
 // CHECK-SPLIT-WITH-NOINL: "-split-dwarf-output"
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -S -### %s 
2> %t
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt 
-fsplit-dwarf-inlining -S -### %s 2> %t
 // RUN: FileCheck -check-prefix=CHECK-GMLT-OVER-SPLIT < %t %s
 //
 // CHECK-GMLT-OVER-SPLIT: "-debug-info-kind=line-tables-only"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3539,7 +3539,7 @@
 
   bool SplitDWARFInlining =
   Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
-   options::OPT_fno_split_dwarf_inlining, true);
+   options::OPT_fno_split_dwarf_inlining, false);
 
   Args.ClaimAllArgs(options::OPT_g_Group);
 


Index: clang/test/Driver/split-debug.c
===
--- clang/test/Driver/split-debug.c
+++ clang/test/Driver/split-debug.c
@@ -61,6 +61,9 @@
 // CHECK-GMLT-WITH-SPLIT: "-split-dwarf-file"
 // CHECK-GMLT-WITH-SPLIT: "-split-dwarf-output"
 
+// RUN: %clang -target x86_64-unknown-linux-gnu -g -S -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-NOINLINE-WITHOUT-SPLIT < %t %s
+//
 // RUN: %clang -target x86_64-unknown-linux-gnu -g -fno-split-dwarf-inlining -S -### %s 2> %t
 // RUN: FileCheck -check-prefix=CHECK-NOINLINE-WITHOUT-SPLIT < %t %s
 //
@@ -79,7 +82,7 @@
 // CHECK-SPLIT-WITH-NOINL: "-debug-info-kind=limited"
 // CHECK-SPLIT-WITH-NOINL: "-split-dwarf-output"
 
-// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -S -### %s 2> %t
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -fsplit-dwarf-inlining -S -### %s 2> %t
 // RUN: FileCheck -check-prefix=CHECK-GMLT-OVER-SPLIT < %t %s
 //
 // CHECK-GMLT-OVER-SPLIT: "-debug-info-kind=line-tables-only"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3539,7 +3539,7 @@
 
   bool SplitDWARFInlining =
   Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
-   options::OPT_fno_split_dwarf_inlining, true);
+   options::OPT_fno_split_dwarf_inlining, false);
 
   Args.ClaimAllArgs(options::OPT_g_Group);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71065: [ARM][MVE] Add intrinsics for immediate shifts.

2019-12-11 Thread Dave Green via Phabricator via cfe-commits
dmgreen accepted this revision.
dmgreen added a comment.

One of the advantages to smaller patches I guess :)

It's probably difficult to tell if this will cause problems again without 
trying it and see if any of the buildbots complain. Lets give it a try and see. 
Just keep an eye on them, we annoyingly don't get any of the failure emails 
that we should.




Comment at: clang/utils/TableGen/MveEmitter.cpp:675
   }
   Sep = ", ";
 }

This Sep isn't needed any more?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71065/new/

https://reviews.llvm.org/D71065



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71300: [clangd] Deduplicate refs from index for cross-file rename.

2019-12-11 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf0004aad5565: [clangd] Deduplicate refs from index for 
cross-file rename. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71300/new/

https://reviews.llvm.org/D71300

Files:
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/refactor/Rename.h
  clang-tools-extra/clangd/unittests/RenameTests.cpp

Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -30,6 +30,18 @@
 using testing::UnorderedElementsAre;
 using testing::UnorderedElementsAreArray;
 
+// Covnert a Range to a Ref.
+Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
+  Ref Result;
+  Result.Kind = RefKind::Reference;
+  Result.Location.Start.setLine(Range.start.line);
+  Result.Location.Start.setColumn(Range.start.character);
+  Result.Location.End.setLine(Range.end.line);
+  Result.Location.End.setColumn(Range.end.character);
+  Result.Location.FileURI = URI.c_str();
+  return Result;
+}
+
 // Build a RefSlab from all marked ranges in the annotation. The ranges are
 // assumed to associate with the given SymbolName.
 std::unique_ptr buildRefSlab(const Annotations &Code,
@@ -40,17 +52,9 @@
   TU.HeaderCode = Code.code();
   auto Symbols = TU.headerSymbols();
   const auto &SymbolID = findSymbol(Symbols, SymbolName).ID;
-  for (const auto &Range : Code.ranges()) {
-Ref R;
-R.Kind = RefKind::Reference;
-R.Location.Start.setLine(Range.start.line);
-R.Location.Start.setColumn(Range.start.character);
-R.Location.End.setLine(Range.end.line);
-R.Location.End.setColumn(Range.end.character);
-auto U = URI::create(Path).toString();
-R.Location.FileURI = U.c_str();
-Builder.insert(SymbolID, R);
-  }
+  std::string PathURI = URI::create(Path).toString();
+  for (const auto &Range : Code.ranges())
+Builder.insert(SymbolID, refWithRange(Range, PathURI));
 
   return std::make_unique(std::move(Builder).build());
 }
@@ -664,6 +668,54 @@
   testing::HasSubstr("too many occurrences"));
 }
 
+TEST(CrossFileRenameTests, DeduplicateRefsFromIndex) {
+  auto MainCode = Annotations("int [[^x]] = 2;");
+  auto MainFilePath = testPath("main.cc");
+  auto BarCode = Annotations("int [[x]];");
+  auto BarPath = testPath("bar.cc");
+  auto TU = TestTU::withCode(MainCode.code());
+  // Set a file "bar.cc" on disk.
+  TU.AdditionalFiles["bar.cc"] = BarCode.code();
+  auto AST = TU.build();
+  std::string BarPathURI = URI::create(BarPath).toString();
+  Ref XRefInBarCC = refWithRange(BarCode.range(), BarPathURI);
+  // The index will return duplicated refs, our code should be robost to handle
+  // it.
+  class DuplicatedXRefIndex : public SymbolIndex {
+  public:
+DuplicatedXRefIndex(const Ref &ReturnedRef) : ReturnedRef(ReturnedRef) {}
+bool refs(const RefsRequest &Req,
+  llvm::function_ref Callback) const override {
+  // Return two duplicated refs.
+  Callback(ReturnedRef);
+  Callback(ReturnedRef);
+  return false;
+}
+
+bool fuzzyFind(const FuzzyFindRequest &,
+   llvm::function_ref) const override {
+  return false;
+}
+void lookup(const LookupRequest &,
+llvm::function_ref) const override {}
+
+void relations(const RelationsRequest &,
+   llvm::function_ref)
+const override {}
+size_t estimateMemoryUsage() const override { return 0; }
+Ref ReturnedRef;
+  } DIndex(XRefInBarCC);
+  llvm::StringRef NewName = "newName";
+  auto Results = rename({MainCode.point(), NewName, AST, MainFilePath, &DIndex,
+ /*CrossFile=*/true});
+  ASSERT_TRUE(bool(Results)) << Results.takeError();
+  EXPECT_THAT(
+  applyEdits(std::move(*Results)),
+  UnorderedElementsAre(
+  Pair(Eq(BarPath), Eq(expectedResult(BarCode, NewName))),
+  Pair(Eq(MainFilePath), Eq(expectedResult(MainCode, NewName);
+}
+
 TEST(CrossFileRenameTests, WithUpToDateIndex) {
   MockCompilationDatabase CDB;
   CDB.ExtraClangFlags = {"-xc++"};
Index: clang-tools-extra/clangd/refactor/Rename.h
===
--- clang-tools-extra/clangd/refactor/Rename.h
+++ clang-tools-extra/clangd/refactor/Rename.h
@@ -51,6 +51,7 @@
 /// Generates rename edits that replaces all given occurrences with the
 /// NewName.
 /// Exposed for testing only.
+/// REQUIRED: Occurrences is sorted and doesn't have duplicated ranges.
 llvm::Expected buildRenameEdit(llvm::StringRef AbsFilePath,
  llvm::StringRef InitialCode,
  std::vector Occurrences,
@@ -65,6 +66,7 @@
 ///
 /// The API assumes that Indexed contains only name

[clang-tools-extra] f0004aa - [clangd] Deduplicate refs from index for cross-file rename.

2019-12-11 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2019-12-11T10:52:13+01:00
New Revision: f0004aad5565d4b76d41a03549c5a80efc4212c7

URL: 
https://github.com/llvm/llvm-project/commit/f0004aad5565d4b76d41a03549c5a80efc4212c7
DIFF: 
https://github.com/llvm/llvm-project/commit/f0004aad5565d4b76d41a03549c5a80efc4212c7.diff

LOG: [clangd] Deduplicate refs from index for cross-file rename.

Summary:
If the index returns duplicated refs, it will trigger the assertion in
BuildRenameEdit (we expect the processing position is always larger the
the previous one, but it is not true if we have duplication), and also
breaks our heuristics.

This patch make the code robost enough to handle duplications, also
save some cost of redundnat llvm::sort.

Though clangd's index doesn't return duplications, our internal index
kythe will.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, mgrang, arphaman, kadircet, usaxena95, 
cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71300

Added: 


Modified: 
clang-tools-extra/clangd/refactor/Rename.cpp
clang-tools-extra/clangd/refactor/Rename.h
clang-tools-extra/clangd/unittests/RenameTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/refactor/Rename.cpp 
b/clang-tools-extra/clangd/refactor/Rename.cpp
index 103f59bc307c..8ca90afba69a 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -319,7 +319,12 @@ findOccurrencesOutsideFile(const NamedDecl &RenameDecl,
   RenameDecl.getQualifiedNameAsString()),
 llvm::inconvertibleErrorCode());
   }
-
+  // Sort and deduplicate the results, in case that index returns duplications.
+  for (auto &FileAndOccurrences : AffectedFiles) {
+auto &Ranges = FileAndOccurrences.getValue();
+llvm::sort(Ranges);
+Ranges.erase(std::unique(Ranges.begin(), Ranges.end()), Ranges.end());
+  }
   return AffectedFiles;
 }
 
@@ -514,7 +519,11 @@ llvm::Expected buildRenameEdit(llvm::StringRef 
AbsFilePath,
  llvm::StringRef InitialCode,
  std::vector Occurrences,
  llvm::StringRef NewName) {
-  llvm::sort(Occurrences);
+  assert(std::is_sorted(Occurrences.begin(), Occurrences.end()));
+  assert(std::unique(Occurrences.begin(), Occurrences.end()) ==
+ Occurrences.end() &&
+ "Occurrences must be unique");
+
   // These two always correspond to the same position.
   Position LastPos{0, 0};
   size_t LastOffset = 0;
@@ -574,9 +583,9 @@ llvm::Optional>
 adjustRenameRanges(llvm::StringRef DraftCode, llvm::StringRef Identifier,
std::vector Indexed, const LangOptions &LangOpts) {
   assert(!Indexed.empty());
+  assert(std::is_sorted(Indexed.begin(), Indexed.end()));
   std::vector Lexed =
   collectIdentifierRanges(Identifier, DraftCode, LangOpts);
-  llvm::sort(Indexed);
   llvm::sort(Lexed);
   return getMappedRanges(Indexed, Lexed);
 }

diff  --git a/clang-tools-extra/clangd/refactor/Rename.h 
b/clang-tools-extra/clangd/refactor/Rename.h
index 68821fa8a787..3cd69d468881 100644
--- a/clang-tools-extra/clangd/refactor/Rename.h
+++ b/clang-tools-extra/clangd/refactor/Rename.h
@@ -51,6 +51,7 @@ llvm::Expected rename(const RenameInputs &RInputs);
 /// Generates rename edits that replaces all given occurrences with the
 /// NewName.
 /// Exposed for testing only.
+/// REQUIRED: Occurrences is sorted and doesn't have duplicated ranges.
 llvm::Expected buildRenameEdit(llvm::StringRef AbsFilePath,
  llvm::StringRef InitialCode,
  std::vector Occurrences,
@@ -65,6 +66,7 @@ llvm::Expected buildRenameEdit(llvm::StringRef 
AbsFilePath,
 ///
 /// The API assumes that Indexed contains only named occurrences (each
 /// occurrence has the same length).
+/// REQUIRED: Indexed is sorted.
 llvm::Optional>
 adjustRenameRanges(llvm::StringRef DraftCode, llvm::StringRef Identifier,
std::vector Indexed, const LangOptions &LangOpts);

diff  --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp 
b/clang-tools-extra/clangd/unittests/RenameTests.cpp
index fc2b6fe62cb6..f253625ed032 100644
--- a/clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -30,6 +30,18 @@ using testing::IsEmpty;
 using testing::UnorderedElementsAre;
 using testing::UnorderedElementsAreArray;
 
+// Covnert a Range to a Ref.
+Ref refWithRange(const clangd::Range &Range, const std::string &URI) {
+  Ref Result;
+  Result.Kind = RefKind::Reference;
+  Result.Location.Start.setLine(Range.start.line);
+  Result.Location.Start.setColumn(Range.start.character);
+  Result.Location.End.setLine(Range.end.line);
+  Result.Location.End.setColumn(Range.end.character);
+  Result.Location.FileURI = URI.c_str();
+  return Resu

[PATCH] D71241: [OpenMP][WIP] Use overload centric declare variants

2019-12-11 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D71241#1778963 , @jdoerfert wrote:

> In D71241#1778736 , @ABataev wrote:
>
> > In D71241#1778717 , @jdoerfert 
> > wrote:
> >
> > > >> There is no evidence that this is more complicated. By all measures, 
> > > >> this is less complicated (see also below). It is also actually doing 
> > > >> the right thing when it comes to code emission. Take 
> > > >> https://godbolt.org/z/sJiP3B for example. The calls are wrong and the 
> > > >> definition of base is missing.
> > > > 
> > > > How did you measure it? I have a completely different opinion. Also, 
> > > > tried to reproduce the problem locally, could not reproduce. It seems 
> > > > to me, the output of the test misses several important things. You can 
> > > > check it yourself. `tgt_target_teams()` call uses `@.offload_maptypes` 
> > > > global var but it is not defined.
> > >
> > > Here is the link with the globals not hidden: https://godbolt.org/z/5etB5S
> > >  The base function is called both times but should not be called at all. 
> > > What is your local output and why does it differ?
> >
> >
> > On the host `base` is an alias for the `hst` function. On the device `base` 
> > has the body of `dev` function because NVPTX does nit support function 
> > aliases (10+ suppprts it, but LLVM does not support it yet). Try to change 
> > the bodies of dev and hst and you will see.
> >
> > I tried to keep original function names to improve debugging and make users 
> > less wonder why instead of `base` something else is called.
>
>
> How does that work with linking? Another translation unit can call both the 
> base and hst/dev function, right? I mean they both need to be present.


If hst or dev are needed, they are emitted too, independently. On the host, the 
variamt function is emitted and base function is set to be an alias of the 
variant function. On the device we just inherit the body of the variant 
function, but this variant function also can be emitted, if used independently.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71241/new/

https://reviews.llvm.org/D71241



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68213: [LTO] Support for embedding bitcode section during LTO

2019-12-11 Thread Josef Eisl via Phabricator via cfe-commits
zapster marked an inline comment as done.
zapster added inline comments.



Comment at: llvm/lib/LTO/LTOBackend.cpp:335
+   .Case("bitcode", EmbedBitcodeKind::Embed_Bitcode)
+   .Case("marker", EmbedBitcodeKind::Embed_Marker)
+   .Default(~0U);

steven_wu wrote:
> tejohnson wrote:
> > zapster wrote:
> > > tejohnson wrote:
> > > > Does this value make any sense since CmdArgs is always empty below?
> > > You are right. Currently, this option value is not utterly useful, but I 
> > > kept it for compatibility with clangs `-fembed-bitcode`. It seems the 
> > > marker section is needed (even if empty), otherwise certain tools will 
> > > complain (notably the MacOS linker). Ideally, we would have something 
> > > sensible to write into the section but I am not sure about reasonable 
> > > values. I was not able to find any information about consumers of these 
> > > commands. Pointers in that regard would be highly appreciated.
> > > 
> > > Anyhow, I lean toward keeping the options for compatibility with clang 
> > > and for making it simple to properly implement the `marker` case. That 
> > > said, I am perfectly fine with removing the option. In that case, I guess 
> > > I should get rid of `EmbedBitcodeKind` altogether and always insert the 
> > > bitcode and the marker, right?
> > > 
> > > On the other hand, we should maybe just consolidate the option (parsing) 
> > > with the clang option. Some thoughts about that in my inline comment 
> > > above.
> > It's unclear to me whether it is better to not provide the marker, and get 
> > a clear error, or put in an empty marker which may cause these tools to do 
> > the wrong thing. @steven_wu who might be able to provide some guidance 
> > about how this is used by the MacOS linker. Note that if someone is using 
> > MacOS to do their LTO linking, they won't even trigger this code, as that 
> > toolchain uses the old legacy LTO, which doesn't come here.
> > 
> > Presumably your tool doesn't use the marker section?
> I don't think marker is useful for this use case. I will suggest not to have 
> the `marker` LTO option unless we have the need. It is being tested by clang 
> and that is probably enough coverage for testing.
> 
> I don't think any users of the legacy interface express interests in using a 
> unified bitcode section so it is fine just to leave this out of the legacy C 
> interface.
> 
> 
> [...] if someone is using MacOS to do their LTO linking, they won't even 
> trigger this code, as that toolchain uses the old legacy LTO

Right. I mixed up the case where the embedding logic was called from clang and 
from LTO. And of course, the MacOS linker does (unfortunately) not use this 
code.

> Presumably your tool doesn't use the marker section?

Nope, I don't need the marker section.

> I don't think marker is useful for this use case.

Right, makes sense. I'll update the review and make `-lto-embed-bitcode` a 
boolean option.

Thanks to both of you for the clarifications.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68213/new/

https://reviews.llvm.org/D68213



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68213: [LTO] Support for embedding bitcode section during LTO

2019-12-11 Thread Josef Eisl via Phabricator via cfe-commits
zapster updated this revision to Diff 233282.
zapster edited the summary of this revision.
zapster added a comment.

Made `-lto-embed-bitcode` a boolean option.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68213/new/

https://reviews.llvm.org/D68213

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/test/Frontend/x86-embed-bitcode.ll
  llvm/include/llvm/Bitcode/BitcodeWriter.h
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/test/LTO/X86/Inputs/start-lib1.ll
  llvm/test/LTO/X86/Inputs/start-lib2.ll
  llvm/test/LTO/X86/embed-bitcode.ll

Index: llvm/test/LTO/X86/embed-bitcode.ll
===
--- /dev/null
+++ llvm/test/LTO/X86/embed-bitcode.ll
@@ -0,0 +1,41 @@
+; RUN: llvm-as %s -o %t1.o
+; RUN: llvm-as %p/Inputs/start-lib1.ll -o %t2.o
+; RUN: llvm-as %p/Inputs/start-lib2.ll -o %t3.o
+
+; RUN: llvm-lto2 run -r %t1.o,_start,px -r %t2.o,foo,px -r %t3.o,bar,px -r %t2.o,bar,px -o %t3 %t1.o %t2.o %t3.o
+; RUN: llvm-readelf -S %t3.0 | FileCheck %s --implicit-check-not=.llvmbc
+
+; RUN: llvm-lto2 run -r %t1.o,_start,px -r %t2.o,foo,px -r %t3.o,bar,px -r %t2.o,bar,px -lto-embed-bitcode=0 -o %t3 %t1.o %t2.o %t3.o
+; RUN: llvm-readelf -S %t3.0 | FileCheck %s --implicit-check-not=.llvmbc
+
+; RUN: llvm-lto2 run -r %t1.o,_start,px -r %t2.o,foo,px -r %t3.o,bar,px -r %t2.o,bar,px -lto-embed-bitcode=false -o %t3 %t1.o %t2.o %t3.o
+; RUN: llvm-readelf -S %t3.0 | FileCheck %s --implicit-check-not=.llvmbc
+
+; RUN: llvm-lto2 run -r %t1.o,_start,px -r %t2.o,foo,px -r %t3.o,bar,px -r %t2.o,bar,px -lto-embed-bitcode -o %t3 %t1.o %t2.o %t3.o
+; RUN: llvm-readelf -S %t3.0 | FileCheck %s --check-prefix=CHECK-ELF
+; RUN: llvm-objcopy -O binary -j .llvmbc %t3.0 %t-embedded.bc
+; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefix=CHECK-LL
+
+; RUN: llvm-lto2 run -r %t1.o,_start,px -r %t2.o,foo,px -r %t3.o,bar,px -r %t2.o,bar,px -lto-embed-bitcode=1 -o %t3 %t1.o %t2.o %t3.o
+; RUN: llvm-readelf -S %t3.0 | FileCheck %s --check-prefix=CHECK-ELF
+; RUN: llvm-objcopy -O binary -j .llvmbc %t3.0 %t-embedded.bc
+; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefix=CHECK-LL
+
+; RUN: llvm-lto2 run -r %t1.o,_start,px -r %t2.o,foo,px -r %t3.o,bar,px -r %t2.o,bar,px -lto-embed-bitcode=true -o %t3 %t1.o %t2.o %t3.o
+; RUN: llvm-readelf -S %t3.0 | FileCheck %s --check-prefix=CHECK-ELF
+; RUN: llvm-objcopy -O binary -j .llvmbc %t3.0 %t-embedded.bc
+; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefix=CHECK-LL
+
+; CHECK-ELF: .text
+; CHECK-ELF: .llvmbc
+
+; CHECK-LL: @_start
+; CHECK-LL: @foo
+; CHECK-LL: @bar
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @_start() {
+  ret void
+}
Index: llvm/test/LTO/X86/Inputs/start-lib2.ll
===
--- /dev/null
+++ llvm/test/LTO/X86/Inputs/start-lib2.ll
@@ -0,0 +1,6 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @bar() {
+  ret void
+}
Index: llvm/test/LTO/X86/Inputs/start-lib1.ll
===
--- /dev/null
+++ llvm/test/LTO/X86/Inputs/start-lib1.ll
@@ -0,0 +1,8 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+declare void @bar()
+
+define void @foo() {
+  ret void
+}
Index: llvm/lib/LTO/LTOBackend.cpp
===
--- llvm/lib/LTO/LTOBackend.cpp
+++ llvm/lib/LTO/LTOBackend.cpp
@@ -34,6 +34,7 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Program.h"
+#include "llvm/Support/SmallVectorMemoryBuffer.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/ThreadPool.h"
 #include "llvm/Support/raw_ostream.h"
@@ -312,11 +313,29 @@
   return !Conf.PostOptModuleHook || Conf.PostOptModuleHook(Task, Mod);
 }
 
+static cl::opt EmbedBitcode("lto-embed-bitcode", cl::init(false),
+  cl::desc("Embed LLVM bitcode"));
+
+static void EmitBitcodeSection(Module &M, Config &Conf) {
+  if (!EmbedBitcode)
+return;
+  SmallVector Buffer;
+  raw_svector_ostream OS(Buffer);
+  WriteBitcodeToFile(M, OS);
+
+  std::unique_ptr Buf(
+  new SmallVectorMemoryBuffer(std::move(Buffer)));
+  llvm::EmbedBitcodeInModule(M, Buf->getMemBufferRef(), /*EmbedBitcode*/ true,
+ /*EmbedMarker*/ false, /*CmdArgs*/ nullptr);
+}
+
 void codegen(Config &Conf, TargetMachine *TM, AddStreamFn AddStream,
  unsigned Task, Module &Mod) {
   if (Conf.PreCodeGenModuleHook && !Conf.PreCodeGenModuleHook(Task, Mod))
 return;
 
+  EmitBitcodeSection(Mod, Conf);
+
   std::unique_ptr DwoOut;
   SmallString<1024> DwoFile(Conf.SplitDwarfOutput);
   if (!Conf.DwoDir.empty()) {
Index: llvm/lib/Bitcode/Writer/BitcodeWrit

[clang] bd0f271 - [ARM][MVE] Add intrinsics for immediate shifts. (reland)

2019-12-11 Thread Simon Tatham via cfe-commits

Author: Simon Tatham
Date: 2019-12-11T10:10:09Z
New Revision: bd0f271c9e55ab69b45258e4922869099ed18307

URL: 
https://github.com/llvm/llvm-project/commit/bd0f271c9e55ab69b45258e4922869099ed18307
DIFF: 
https://github.com/llvm/llvm-project/commit/bd0f271c9e55ab69b45258e4922869099ed18307.diff

LOG: [ARM][MVE] Add intrinsics for immediate shifts. (reland)

This adds the family of `vshlq_n` and `vshrq_n` ACLE intrinsics, which
shift every lane of a vector left or right by a compile-time
immediate. They mostly work by expanding to the IR `shl`, `lshr` and
`ashr` operations, with their second operand being a vector splat of
the immediate.

There's a fiddly special case, though. ACLE specifies that the
immediate in `vshrq_n` can take values up to //and including// the bit
size of the vector lane. But LLVM IR thinks that shifting right by the
full size of the lane is UB, and feels free to replace the `lshr` with
an `undef` half way through the optimization pipeline. Hence, to keep
this legal in source code, I have to detect it at codegen time.
Logical (unsigned) right shifts by the element size are handled by
simply emitting the zero vector; arithmetic ones are converted into a
shift of one bit less, which will always give the same output.

In order to do that check, I also had to enhance the tablegen
MveEmitter so that it can cope with converting a builtin function's
operand into a bare integer to pass to a code-generating subfunction.
Previously the only bare integers it knew how to handle were flags
generated from within `arm_mve.td`.

Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard

Reviewed By: dmgreen, MarkMurrayARM

Subscribers: echristo, hokein, rdhindsa, kristof.beyls, hiraditya, cfe-commits, 
llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D71065

Added: 
clang/test/CodeGen/arm-mve-intrinsics/vector-shift-imm.c
llvm/test/CodeGen/Thumb2/mve-intrinsics/vector-shift-imm.ll

Modified: 
clang/include/clang/Basic/arm_mve.td
clang/include/clang/Basic/arm_mve_defs.td
clang/lib/CodeGen/CGBuiltin.cpp
clang/utils/TableGen/MveEmitter.cpp
llvm/include/llvm/IR/IntrinsicsARM.td
llvm/lib/Target/ARM/ARMInstrMVE.td

Removed: 




diff  --git a/clang/include/clang/Basic/arm_mve.td 
b/clang/include/clang/Basic/arm_mve.td
index 618a087d6275..9b6053e57861 100644
--- a/clang/include/clang/Basic/arm_mve.td
+++ b/clang/include/clang/Basic/arm_mve.td
@@ -609,6 +609,33 @@ defm vstrhq: scatter_offset_both;
 defm vstrwq: scatter_offset_both;
 defm vstrdq: scatter_offset_both;
 
+multiclass PredicatedImmediateVectorShift<
+Immediate immtype, string predIntrName, list unsignedFlag = []> {
+  foreach predIntr = [IRInt] in {
+def _m_n: Intrinsic;
+def _x_n: Intrinsic;
+  }
+}
+
+let params = T.Int in {
+  def vshlq_n: Intrinsic;
+  defm vshlq: PredicatedImmediateVectorShift;
+
+  let pnt = PNT_NType in {
+def vshrq_n: Intrinsic;
+defm vshrq: PredicatedImmediateVectorShift;
+  }
+}
+
 // Base class for the scalar shift intrinsics.
 class ScalarShift:
   Intrinsic 
{

diff  --git a/clang/include/clang/Basic/arm_mve_defs.td 
b/clang/include/clang/Basic/arm_mve_defs.td
index 1d72cc45796c..6bc9b35f0fc4 100644
--- a/clang/include/clang/Basic/arm_mve_defs.td
+++ b/clang/include/clang/Basic/arm_mve_defs.td
@@ -66,6 +66,10 @@ def xor: IRBuilder<"CreateXor">;
 def sub: IRBuilder<"CreateSub">;
 def shl: IRBuilder<"CreateShl">;
 def lshr: IRBuilder<"CreateLShr">;
+def immshr: CGHelperFn<"MVEImmediateShr"> {
+  let special_params = [IRBuilderIntParam<1, "unsigned">,
+IRBuilderIntParam<2, "bool">];
+}
 def fadd: IRBuilder<"CreateFAdd">;
 def fmul: IRBuilder<"CreateFMul">;
 def fsub: IRBuilder<"CreateFSub">;
@@ -318,8 +322,8 @@ def imm_simd_vmvn : Immediate {
 //
 // imm_0toNm1 is the same but with the range offset by 1, i.e. 0 to N-1
 // inclusive.
-def imm_1toN : Immediate>;
-def imm_0toNm1 : Immediate>;
+def imm_1toN : Immediate>;
+def imm_0toNm1 : Immediate>;
 
 // imm_lane has to be the index of a vector lane in the main vector type, i.e
 // it can range from 0 to (128 / size of scalar)-1 inclusive. (e.g. vgetq_lane)

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 68c956a98637..8a53739626e1 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -6916,6 +6916,15 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned 
BuiltinID,
   }
 }
 
+template
+static Integer GetIntegerConstantValue(const Expr *E, ASTContext &Context) {
+  llvm::APSInt IntVal;
+  bool IsConst = E->isIntegerConstantExpr(IntVal, Context);
+  assert(IsConst && "Sema should have checked this was a constant");
+  (void)IsConst;
+  return IntVal.getExtValue();
+}
+
 static llvm::Value *SignOrZeroExtend(CGBuilderTy &Builder, llvm::Value *V,
  llvm::Type *T, bool Unsigned) {
   // He

[PATCH] D71065: [ARM][MVE] Add intrinsics for immediate shifts.

2019-12-11 Thread Simon Tatham via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbd0f271c9e55: [ARM][MVE] Add intrinsics for immediate 
shifts. (reland) (authored by simon_tatham).

Changed prior to commit:
  https://reviews.llvm.org/D71065?vs=233025&id=233287#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71065/new/

https://reviews.llvm.org/D71065

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/include/clang/Basic/arm_mve_defs.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/arm-mve-intrinsics/vector-shift-imm.c
  clang/utils/TableGen/MveEmitter.cpp
  llvm/include/llvm/IR/IntrinsicsARM.td
  llvm/lib/Target/ARM/ARMInstrMVE.td
  llvm/test/CodeGen/Thumb2/mve-intrinsics/vector-shift-imm.ll

Index: llvm/test/CodeGen/Thumb2/mve-intrinsics/vector-shift-imm.ll
===
--- /dev/null
+++ llvm/test/CodeGen/Thumb2/mve-intrinsics/vector-shift-imm.ll
@@ -0,0 +1,398 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=thumbv8.1m.main -mattr=+mve -verify-machineinstrs -o - %s | FileCheck %s
+
+define arm_aapcs_vfpcc <16 x i8> @test_vshlq_n_s8(<16 x i8> %a) {
+; CHECK-LABEL: test_vshlq_n_s8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshl.i8 q0, q0, #5
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shl <16 x i8> %a, 
+  ret <16 x i8> %0
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vshlq_n_s16(<8 x i16> %a) {
+; CHECK-LABEL: test_vshlq_n_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshl.i16 q0, q0, #5
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shl <8 x i16> %a, 
+  ret <8 x i16> %0
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vshlq_n_s32(<4 x i32> %a) {
+; CHECK-LABEL: test_vshlq_n_s32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshl.i32 q0, q0, #18
+; CHECK-NEXT:bx lr
+entry:
+  %0 = shl <4 x i32> %a, 
+  ret <4 x i32> %0
+}
+
+define arm_aapcs_vfpcc <16 x i8> @test_vshrq_n_s8(<16 x i8> %a) {
+; CHECK-LABEL: test_vshrq_n_s8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.s8 q0, q0, #4
+; CHECK-NEXT:bx lr
+entry:
+  %0 = ashr <16 x i8> %a, 
+  ret <16 x i8> %0
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vshrq_n_s16(<8 x i16> %a) {
+; CHECK-LABEL: test_vshrq_n_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.s16 q0, q0, #10
+; CHECK-NEXT:bx lr
+entry:
+  %0 = ashr <8 x i16> %a, 
+  ret <8 x i16> %0
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vshrq_n_s32(<4 x i32> %a) {
+; CHECK-LABEL: test_vshrq_n_s32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.s32 q0, q0, #19
+; CHECK-NEXT:bx lr
+entry:
+  %0 = ashr <4 x i32> %a, 
+  ret <4 x i32> %0
+}
+
+define arm_aapcs_vfpcc <16 x i8> @test_vshrq_n_u8(<16 x i8> %a) {
+; CHECK-LABEL: test_vshrq_n_u8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.u8 q0, q0, #1
+; CHECK-NEXT:bx lr
+entry:
+  %0 = lshr <16 x i8> %a, 
+  ret <16 x i8> %0
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vshrq_n_u16(<8 x i16> %a) {
+; CHECK-LABEL: test_vshrq_n_u16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.u16 q0, q0, #10
+; CHECK-NEXT:bx lr
+entry:
+  %0 = lshr <8 x i16> %a, 
+  ret <8 x i16> %0
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vshrq_n_u32(<4 x i32> %a) {
+; CHECK-LABEL: test_vshrq_n_u32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vshr.u32 q0, q0, #10
+; CHECK-NEXT:bx lr
+entry:
+  %0 = lshr <4 x i32> %a, 
+  ret <4 x i32> %0
+}
+
+define arm_aapcs_vfpcc <16 x i8> @test_vshlq_m_n_s8(<16 x i8> %inactive, <16 x i8> %a, i16 zeroext %p) {
+; CHECK-LABEL: test_vshlq_m_n_s8:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmsr p0, r0
+; CHECK-NEXT:vpst
+; CHECK-NEXT:vshlt.i8 q0, q1, #6
+; CHECK-NEXT:bx lr
+entry:
+  %0 = zext i16 %p to i32
+  %1 = tail call <16 x i1> @llvm.arm.mve.pred.i2v.v16i1(i32 %0)
+  %2 = tail call <16 x i8> @llvm.arm.mve.shl.imm.predicated.v16i8.v16i1(<16 x i8> %a, i32 6, <16 x i1> %1, <16 x i8> %inactive)
+  ret <16 x i8> %2
+}
+
+define arm_aapcs_vfpcc <8 x i16> @test_vshlq_m_n_s16(<8 x i16> %inactive, <8 x i16> %a, i16 zeroext %p) {
+; CHECK-LABEL: test_vshlq_m_n_s16:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmsr p0, r0
+; CHECK-NEXT:vpst
+; CHECK-NEXT:vshlt.i16 q0, q1, #13
+; CHECK-NEXT:bx lr
+entry:
+  %0 = zext i16 %p to i32
+  %1 = tail call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 %0)
+  %2 = tail call <8 x i16> @llvm.arm.mve.shl.imm.predicated.v8i16.v8i1(<8 x i16> %a, i32 13, <8 x i1> %1, <8 x i16> %inactive)
+  ret <8 x i16> %2
+}
+
+define arm_aapcs_vfpcc <4 x i32> @test_vshlq_m_n_s32(<4 x i32> %inactive, <4 x i32> %a, i16 zeroext %p) {
+; CHECK-LABEL: test_vshlq_m_n_s32:
+; CHECK:   @ %bb.0: @ %entry
+; CHECK-NEXT:vmsr p0, r0
+; CHECK-NEXT:vpst
+; CHECK-NEXT:vshlt.i32 q0, q1, #0
+; CHECK-NEXT:bx lr
+entry:
+  %0 = zext i16 %p to i32
+  %1 = tail call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 %0)
+  %2 = tail

[PATCH] D71133: [OpenCL] Add ExtVectorElementExpr constant evaluation (PR42387)

2019-12-11 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh marked an inline comment as done.
svenvh added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:7057
+
+if (Val.isVector()) {
+  SmallVector Indices;

Anastasia wrote:
> can Val not be vector at this point?
Yes, for example when evaluating `const int2 fromConstexprFunc = 
addOne(int2(2));` from the included test case we get an LValue (that won't be 
folded by the code below).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71133/new/

https://reviews.llvm.org/D71133



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71241: [OpenMP][WIP] Use overload centric declare variants

2019-12-11 Thread Jon Chesterfield via Phabricator via cfe-commits
JonChesterfield added a comment.

Lowering in sema or in codegen seems a standard phase ordering choice. There 
will be pros and cons to both.

I think prior art leans towards sema. Variants are loosely equivalent to tag 
dispatching or constexpr if, both handled before lowering the AST to IR.

Writing the dispatch lowering on IR should make it easier to call from a 
Fortran front end. I'm in favour of minimising work done on the clang AST on 
general principles.

Given we have two implementations, each at different points in the pipeline, it 
might be constructive to each write down why you each choose said point. I 
suspect the rationale is hidden by the implementation details.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71241/new/

https://reviews.llvm.org/D71241



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71197: llvm premerge: clang format test

2019-12-11 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

Unit tests: fail - 60594 tests passed, 30 failed and 726 were skipped.

  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_cons/path.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/assign.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/refresh.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/replace_filename.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_size.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_type_obs.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/hard_link_count.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_iterator/directory_iterator_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/increment.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_exists/exists.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_block_file/is_block_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_char_file/is_character_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_directory/is_directory.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_empty/is_empty.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_fifo/is_fifo.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_other/is_other.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_regular_file/is_regular_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_socket/is_socket.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_symlink/is_symlink.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_last_write_time/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove/remove.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove_all/remove_all.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_status/status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_symlink_status/symlink_status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_temp_dir_path/temp_directory_path.pass.cpp
  failed: lld.COFF/thinlto-emit-imports.ll
  failed: lld.ELF/lto/thinlto-cant-write-index.ll
  failed: lld.ELF/lto/thinlto-emit-imports.ll

clang-format: fail.
Please format your changes with clang-format by running `git-clang-format 
HEAD^` or apply this patch 
.

Build artifacts : test-results.xml 
, clang-format.patch 
, CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71197/new/

https://reviews.llvm.org/D71197



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71241: [OpenMP][WIP] Use overload centric declare variants

2019-12-11 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D71241#1779168 , @JonChesterfield 
wrote:

> Lowering in sema or in codegen seems a standard phase ordering choice. There 
> will be pros and cons to both.
>
> I think prior art leans towards sema. Variants are loosely equivalent to tag 
> dispatching or constexpr if, both handled before lowering the AST to IR.


It is not quite so. Constexprs are not evaluated in sema. You can dump the ast 
and you will find all these constexprs in their original form. They are 
evaluated by the interpreter in place where it is required. But AST remains 
unaffected.

> Writing the dispatch lowering on IR should make it easier to call from a 
> Fortran front end. I'm in favour of minimising work done on the clang AST on 
> general principles.
> 
> Given we have two implementations, each at different points in the pipeline, 
> it might be constructive to each write down why you each choose said point. I 
> suspect the rationale is hidden by the implementation details.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71241/new/

https://reviews.llvm.org/D71241



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71197: llvm premerge: clang format test

2019-12-11 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

{icon times-circle color=red} Unit tests: fail.60594 tests passed, 30 failed 
and 726 were skipped.

  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_cons/path.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/assign.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/refresh.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/replace_filename.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_size.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_type_obs.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/hard_link_count.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_iterator/directory_iterator_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/increment.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_exists/exists.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_block_file/is_block_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_char_file/is_character_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_directory/is_directory.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_empty/is_empty.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_fifo/is_fifo.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_other/is_other.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_regular_file/is_regular_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_socket/is_socket.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_symlink/is_symlink.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_last_write_time/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove/remove.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove_all/remove_all.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_status/status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_symlink_status/symlink_status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_temp_dir_path/temp_directory_path.pass.cpp
  failed: lld.COFF/thinlto-emit-imports.ll
  failed: lld.ELF/lto/thinlto-cant-write-index.ll
  failed: lld.ELF/lto/thinlto-emit-imports.ll

{icon times-circle color=red} clang-format: fail.Please format your changes 
with clang-format by running `git-clang-format HEAD^` or apply this patch 
.

Build artifacts : test-results.xml 
, clang-format.patch 
, CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71197/new/

https://reviews.llvm.org/D71197



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71197: llvm premerge: clang format test

2019-12-11 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov added a comment.

{icon times-circle color=red} Unit tests: fail. 60594 tests passed, 30 failed 
and 726 were skipped.

  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_cons/path.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/assign.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/refresh.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_mods/replace_filename.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_size.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/file_type_obs.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/hard_link_count.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_entry/directory_entry_obs/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_directory_iterator/directory_iterator_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/ctor.pass.cpp
  failed: 
libc++.std/input_output/filesystems/class_rec_dir_itr/rec_dir_itr_members/increment.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_exists/exists.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_block_file/is_block_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_char_file/is_character_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_directory/is_directory.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_empty/is_empty.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_fifo/is_fifo.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_other/is_other.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_regular_file/is_regular_file.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_socket/is_socket.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_is_symlink/is_symlink.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_last_write_time/last_write_time.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove/remove.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_remove_all/remove_all.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_status/status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_symlink_status/symlink_status.pass.cpp
  failed: 
libc++.std/input_output/filesystems/fs_op_funcs/fs_op_temp_dir_path/temp_directory_path.pass.cpp
  failed: lld.COFF/thinlto-emit-imports.ll
  failed: lld.ELF/lto/thinlto-cant-write-index.ll
  failed: lld.ELF/lto/thinlto-emit-imports.ll

{icon times-circle color=red} clang-format: fail. Please format your changes 
with clang-format by running `git-clang-format HEAD^` or apply this patch 
.

Build artifacts : test-results.xml 
, clang-format.patch 
, CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71197/new/

https://reviews.llvm.org/D71197



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70524: Support DebugInfo generation for auto return type for C++ functions.

2019-12-11 Thread Awanish Pandey via Phabricator via cfe-commits
awpandey updated this revision to Diff 233289.
awpandey added a comment.

@dblaikie . I have removed the redundant test case. What else should I do in 
this patch?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70524/new/

https://reviews.llvm.org/D70524

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGenCXX/debug-info-auto-return.cpp

Index: clang/test/CodeGenCXX/debug-info-auto-return.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/debug-info-auto-return.cpp
@@ -0,0 +1,18 @@
+//  Test for debug info for C++11 auto return member functions
+// RUN: %clang_cc1 -dwarf-version=5  -emit-llvm -triple x86_64-linux-gnu %s -o - \
+// RUN:   -O0 -disable-llvm-passes \
+// RUN:   -debug-info-kind=standalone \
+// RUN: | FileCheck %s
+
+// CHECK: !DISubprogram(name: "findMax",{{.*}}, type: ![[t:[0-9]+]],{{.*}}
+
+// CHECK: ![[t:[0-9]+]] = !DISubroutineType(types: ![[t1:[0-9]+]])
+// CHECK-NEXT: ![[t1:[0-9]+]] = !{![[t2:[0-9]+]], {{.*}}
+// CHECK-NEXT: ![[t2:[0-9]+]] = !DIBasicType(tag: DW_TAG_unspecified_type, name: "auto")
+
+struct myClass {
+  auto findMax();
+};
+
+auto myClass::findMax() {
+}
Index: clang/lib/CodeGen/CGDebugInfo.h
===
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -165,6 +165,7 @@
   /// ivars and property accessors.
   llvm::DIType *CreateType(const BuiltinType *Ty);
   llvm::DIType *CreateType(const ComplexType *Ty);
+  llvm::DIType *CreateType(const AutoType *Ty);
   llvm::DIType *CreateQualifiedType(QualType Ty, llvm::DIFile *Fg);
   llvm::DIType *CreateType(const TypedefType *Ty, llvm::DIFile *Fg);
   llvm::DIType *CreateType(const TemplateSpecializationType *Ty,
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -810,6 +810,10 @@
   return DBuilder.createBasicType(BTName, Size, Encoding);
 }
 
+llvm::DIType *CGDebugInfo::CreateType(const AutoType *Ty) {
+  return DBuilder.createUnspecifiedType("auto");
+}
+
 llvm::DIType *CGDebugInfo::CreateType(const ComplexType *Ty) {
   // Bit size and offset of the type.
   llvm::dwarf::TypeKind Encoding = llvm::dwarf::DW_ATE_complex_float;
@@ -2860,7 +2864,8 @@
   return DBuilder.createTempMacroFile(Parent, Line, FName);
 }
 
-static QualType UnwrapTypeForDebugInfo(QualType T, const ASTContext &C) {
+static QualType UnwrapTypeForDebugInfo(QualType T, const ASTContext &C,
+   int dwarfVersion) {
   Qualifiers Quals;
   do {
 Qualifiers InnerQuals = T.getLocalQualifiers();
@@ -2907,6 +2912,10 @@
   T = cast(T)->getReplacementType();
   break;
 case Type::Auto:
+  if (dwarfVersion >= 5) {
+return C.getQualifiedType(T.getTypePtr(), Quals);
+  }
+  LLVM_FALLTHROUGH;
 case Type::DeducedTemplateSpecialization: {
   QualType DT = cast(T)->getDeducedType();
   assert(!DT.isNull() && "Undeduced types shouldn't reach here.");
@@ -2928,7 +2937,8 @@
 llvm::DIType *CGDebugInfo::getTypeOrNull(QualType Ty) {
 
   // Unwrap the type as needed for debug information.
-  Ty = UnwrapTypeForDebugInfo(Ty, CGM.getContext());
+  Ty = UnwrapTypeForDebugInfo(Ty, CGM.getContext(),
+  CGM.getCodeGenOpts().DwarfVersion);
 
   auto It = TypeCache.find(Ty.getAsOpaquePtr());
   if (It != TypeCache.end()) {
@@ -2969,7 +2979,8 @@
   });
 
   // Unwrap the type as needed for debug information.
-  Ty = UnwrapTypeForDebugInfo(Ty, CGM.getContext());
+  Ty = UnwrapTypeForDebugInfo(Ty, CGM.getContext(),
+  CGM.getCodeGenOpts().DwarfVersion);
 
   if (auto *T = getTypeOrNull(Ty))
 return T;
@@ -3083,6 +3094,9 @@
 return CreateType(cast(Ty), Unit);
 
   case Type::Auto:
+if (CGM.getCodeGenOpts().DwarfVersion >= 5)
+  return CreateType(cast(Ty));
+
   case Type::Attributed:
   case Type::Adjusted:
   case Type::Decayed:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 0216854 - [Clang] Pragma vectorize_width() implies vectorize(enable)

2019-12-11 Thread Sjoerd Meijer via cfe-commits

Author: Sjoerd Meijer
Date: 2019-12-11T10:37:40Z
New Revision: 021685491727e023aeae9ca272a2d6cd727e20e4

URL: 
https://github.com/llvm/llvm-project/commit/021685491727e023aeae9ca272a2d6cd727e20e4
DIFF: 
https://github.com/llvm/llvm-project/commit/021685491727e023aeae9ca272a2d6cd727e20e4.diff

LOG: [Clang] Pragma vectorize_width() implies vectorize(enable)

Let's try this again; this has been reverted/recommited a few times. Last time
this got reverted because for this loop:

  void a() {
#pragma clang loop vectorize(disable)
for (;;)
  ;
  }

vectorisation was incorrectly enabled and the vectorize.enable metadata was set
due to a logic error. But with this fixed, we now imply vectorisation when:

1) vectorisation is enabled, which means: VectorizeWidth > 1,
2) and don't want to add it when it is disabled or enabled, otherwise we would
   be incorrectly setting it or duplicating the metadata, respectively.

This should fix PR27643.

Differential Revision: https://reviews.llvm.org/D69628

Added: 
clang/test/CodeGenCXX/pragma-loop-pr27643.cpp

Modified: 
clang/lib/CodeGen/CGLoopInfo.cpp
clang/test/CodeGenCXX/pragma-loop.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGLoopInfo.cpp 
b/clang/lib/CodeGen/CGLoopInfo.cpp
index 6822c6286fef..e4b184eb8798 100644
--- a/clang/lib/CodeGen/CGLoopInfo.cpp
+++ b/clang/lib/CodeGen/CGLoopInfo.cpp
@@ -286,17 +286,18 @@ LoopInfo::createLoopVectorizeMetadata(const 
LoopAttributes &Attrs,
 Args.push_back(MDNode::get(Ctx, Vals));
   }
 
-  // Setting vectorize.enable
+  // vectorize.enable is set if:
+  // 1) loop hint vectorize.enable is set, or
+  // 2) it is implied when vectorize.predicate is set, or
+  // 3) it is implied when vectorize.width is set.
   if (Attrs.VectorizeEnable != LoopAttributes::Unspecified ||
-  IsVectorPredicateEnabled) {
-Metadata *Vals[] = {
-MDString::get(Ctx, "llvm.loop.vectorize.enable"),
-ConstantAsMetadata::get(ConstantInt::get(
-llvm::Type::getInt1Ty(Ctx),
-IsVectorPredicateEnabled
-? true
-: (Attrs.VectorizeEnable == LoopAttributes::Enable)))};
-Args.push_back(MDNode::get(Ctx, Vals));
+  IsVectorPredicateEnabled ||
+  Attrs.VectorizeWidth > 1 ) {
+bool AttrVal = Attrs.VectorizeEnable != LoopAttributes::Disable;
+Args.push_back(
+MDNode::get(Ctx, {MDString::get(Ctx, "llvm.loop.vectorize.enable"),
+  ConstantAsMetadata::get(ConstantInt::get(
+  llvm::Type::getInt1Ty(Ctx), AttrVal))}));
   }
 
   if (FollowupHasTransforms)

diff  --git a/clang/test/CodeGenCXX/pragma-loop-pr27643.cpp 
b/clang/test/CodeGenCXX/pragma-loop-pr27643.cpp
new file mode 100644
index ..87a225081faa
--- /dev/null
+++ b/clang/test/CodeGenCXX/pragma-loop-pr27643.cpp
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | 
FileCheck %s
+
+void loop1(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}loop1{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP1:.*]]
+
+  #pragma clang loop vectorize(enable) vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Here, vectorize.enable should be set, obviously, but also check that
+// metadata isn't added twice.
+void loop2(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}loop2{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP2:.*]]
+
+  #pragma clang loop vectorize(enable) vectorize_width(2)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Test that we do *not* imply vectorize.enable.
+void loop3(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}loop3{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP3:.*]]
+
+  #pragma clang loop vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Test that we *do* imply vectorize.enable.
+void loop4(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}loop4{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP4:.*]]
+
+  #pragma clang loop vectorize_width(2)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// CHECK: ![[LOOP1]] = distinct !{![[LOOP1]], ![[VEC_WIDTH_1:.*]], 
![[VEC_ENABLE:.*]]}
+// CHECK: ![[VEC_WIDTH_1]] = !{!"llvm.loop.vectorize.width", i32 1}
+// CHECK: ![[VEC_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}
+
+// CHECK: ![[LOOP2]] = distinct !{![[LOOP2]], ![[VEC_WIDTH_2:.*]], 
![[VEC_ENABLE]]}
+// CHECK: ![[VEC_WIDTH_2]] = !{!"llvm.loop.vectorize.width", i32 2}
+
+// CHECK: ![[LOOP3]] = distinct !{![[LOOP3]], ![[VEC_WIDTH_1]]}
+
+// CHECK: ![[LOOP4]] = distinct !{![[LOOP4]], ![[VEC_WIDTH_2]], 
![[VEC_ENABLE]]}

diff  --git a/clang/test/CodeGenCXX/pragma-loop.cpp 
b/clang/test/CodeGenCXX/pragma-loop.cpp
index 32075f965cd7..d730f30621a4 100644
--- a/clang/test/CodeGenCXX/pragma-loop.cpp
+++ b/clang/test/CodeGenCXX/pragma-loop.cpp
@@ -161,20 +161,20 @@ voi

[PATCH] D69628: [Clang] Pragma vectorize_width() implies vectorize(enable), take 3

2019-12-11 Thread Sjoerd Meijer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG021685491727: [Clang] Pragma vectorize_width() implies 
vectorize(enable) (authored by SjoerdMeijer).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69628/new/

https://reviews.llvm.org/D69628

Files:
  clang/lib/CodeGen/CGLoopInfo.cpp
  clang/test/CodeGenCXX/pragma-loop-pr27643.cpp
  clang/test/CodeGenCXX/pragma-loop.cpp

Index: clang/test/CodeGenCXX/pragma-loop.cpp
===
--- clang/test/CodeGenCXX/pragma-loop.cpp
+++ clang/test/CodeGenCXX/pragma-loop.cpp
@@ -161,20 +161,20 @@
 // CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[UNROLL_FULL:.*]]}
 // CHECK: ![[UNROLL_FULL]] = !{!"llvm.loop.unroll.full"}
 
-// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[WIDTH_8:.*]], ![[INTERLEAVE_4:.*]]}
+// CHECK: ![[LOOP_2]] = distinct !{![[LOOP_2]], ![[UNROLL_DISABLE:.*]], ![[DISTRIBUTE_DISABLE:.*]], ![[WIDTH_8:.*]], ![[INTERLEAVE_4:.*]], ![[VECTORIZE_ENABLE:.*]]}
 // CHECK: ![[UNROLL_DISABLE]] = !{!"llvm.loop.unroll.disable"}
 // CHECK: ![[DISTRIBUTE_DISABLE]] = !{!"llvm.loop.distribute.enable", i1 false}
 // CHECK: ![[WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8}
 // CHECK: ![[INTERLEAVE_4]] = !{!"llvm.loop.interleave.count", i32 4}
+// CHECK: ![[VECTORIZE_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}
 
-// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[INTERLEAVE_4:.*]], ![[INTENABLE_1:.*]], ![[FOLLOWUP_VECTOR_3:.*]]}
-// CHECK: ![[INTENABLE_1]] = !{!"llvm.loop.vectorize.enable", i1 true}
+// CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[INTERLEAVE_4:.*]], ![[VECTORIZE_ENABLE]], ![[FOLLOWUP_VECTOR_3:.*]]}
 // CHECK: ![[FOLLOWUP_VECTOR_3]] = !{!"llvm.loop.vectorize.followup_all", ![[AFTER_VECTOR_3:.*]]}
 // CHECK: ![[AFTER_VECTOR_3]] = distinct !{![[AFTER_VECTOR_3]], ![[ISVECTORIZED:.*]], ![[UNROLL_8:.*]]}
 // CHECK: ![[ISVECTORIZED]] = !{!"llvm.loop.isvectorized"}
 // CHECK: ![[UNROLL_8]] = !{!"llvm.loop.unroll.count", i32 8}
 
-// CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[WIDTH_2:.*]], ![[INTERLEAVE_2:.*]]}
+// CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[WIDTH_2:.*]], ![[INTERLEAVE_2:.*]], ![[VECTORIZE_ENABLE]]}
 // CHECK: ![[WIDTH_2]] = !{!"llvm.loop.vectorize.width", i32 2}
 // CHECK: ![[INTERLEAVE_2]] = !{!"llvm.loop.interleave.count", i32 2}
 
@@ -185,7 +185,7 @@
 // CHECK: ![[FOLLOWUP_VECTOR_6]] = !{!"llvm.loop.vectorize.followup_all", ![[AFTER_VECTOR_6:.*]]}
 // CHECK: ![[AFTER_VECTOR_6]] = distinct !{![[AFTER_VECTOR_6]], ![[ISVECTORIZED:.*]], ![[UNROLL_8:.*]]}
 
-// CHECK: ![[LOOP_7]] = distinct !{![[LOOP_7]], ![[WIDTH_5:.*]]}
+// CHECK: ![[LOOP_7]] = distinct !{![[LOOP_7]], ![[WIDTH_5:.*]], ![[VECTORIZE_ENABLE]]}
 // CHECK: ![[WIDTH_5]] = !{!"llvm.loop.vectorize.width", i32 5}
 
 // CHECK: ![[LOOP_8]] = distinct !{![[LOOP_8]], ![[WIDTH_5:.*]]}
@@ -207,11 +207,11 @@
 // CHECK: ![[AFTER_VECTOR_12]] = distinct !{![[AFTER_VECTOR_12]], ![[ISVECTORIZED:.*]], ![[UNROLL_24:.*]]}
 // CHECK: ![[UNROLL_24]] = !{!"llvm.loop.unroll.count", i32 24}
 
-// CHECK: ![[LOOP_13]] = distinct !{![[LOOP_13]], ![[WIDTH_8:.*]], ![[INTERLEAVE_16:.*]], ![[FOLLOWUP_VECTOR_13:.*]]}
+// CHECK: ![[LOOP_13]] = distinct !{![[LOOP_13]], ![[WIDTH_8:.*]], ![[INTERLEAVE_16:.*]], ![[VECTORIZE_ENABLE]], ![[FOLLOWUP_VECTOR_13:.*]]}
 // CHECK: ![[INTERLEAVE_16]] = !{!"llvm.loop.interleave.count", i32 16}
 // CHECK: ![[FOLLOWUP_VECTOR_13]] = !{!"llvm.loop.vectorize.followup_all", ![[AFTER_VECTOR_13:.*]]}
 // CHECK: ![[AFTER_VECTOR_13]] = distinct !{![[AFTER_VECTOR_13]], ![[ISVECTORIZED:.*]], ![[UNROLL_32:.*]]}
 // CHECK: ![[UNROLL_32]] = !{!"llvm.loop.unroll.count", i32 32}
 
-// CHECK: ![[LOOP_14]] = distinct !{![[LOOP_14]], ![[WIDTH_10:.*]]}
+// CHECK: ![[LOOP_14]] = distinct !{![[LOOP_14]], ![[WIDTH_10:.*]], ![[VECTORIZE_ENABLE]]}
 // CHECK: ![[WIDTH_10]] = !{!"llvm.loop.vectorize.width", i32 10}
Index: clang/test/CodeGenCXX/pragma-loop-pr27643.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/pragma-loop-pr27643.cpp
@@ -0,0 +1,52 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | FileCheck %s
+
+void loop1(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}loop1{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP1:.*]]
+
+  #pragma clang loop vectorize(enable) vectorize_width(1)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Here, vectorize.enable should be set, obviously, but also check that
+// metadata isn't added twice.
+void loop2(int *List, int Length) {
+// CHECK-LABEL: @{{.*}}loop2{{.*}}(
+// CHECK: br label {{.*}}, !llvm.loop ![[LOOP2:.*]]
+
+  #pragma clang loop vectorize(enable) vectorize_width(2)
+  for (int i = 0; i < Length; i++)
+List[i] = i * 2;
+}
+
+// Test that we do *not* imply vectorize.enable.
+void l

[PATCH] D71335: [ARM][MVE] Factor out an IntrinsicMX multiclass.

2019-12-11 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham created this revision.
simon_tatham added reviewers: MarkMurrayARM, miyuki.
Herald added subscribers: cfe-commits, dmgreen, kristof.beyls.
Herald added a project: clang.

The ACLE intrinsics for MVE contain a lot of pairs of functions with
`_m` and `_x` in the name, wrapping a predicated MVE instruction which
only partially overwrites its output register. They have the common
pattern that the `_m` variant takes an initial argument called
'inactive', of the same type as the return value, supplying the input
value of the output register, so that lanes disabled by the
predication will be taken from that parameter; the `_x` variant omits
that initial argument, and simply sets it to undef.

That common pattern is simple enough to wrap into a multiclass, which
should save a lot of effort in setting up all the rest of the `_x`
variants. In this commit I introduce `multiclass IntrinsicMX` in
`arm_mve_defs.td`, and convert existing generation of m/x pairs to use
it.

In the `PredicatedImmediateVectorShift` multiclass, this has allowed
me to remove an annoying temporary definition of `predIntr`, which I
needed to reuse between the m/x variants, and also to `!con` together
some subsections of its argument list. But now `!con` lets you leave
some operator nodes as `?` (D71195 ), //and// 
the m/x variants are
defined together, I can get away with referring to that complicated
expression only once, at the tiny cost of having to change the type of
the `unsignedFlag` multiclass.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71335

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/include/clang/Basic/arm_mve_defs.td


Index: clang/include/clang/Basic/arm_mve_defs.td
===
--- clang/include/clang/Basic/arm_mve_defs.td
+++ clang/include/clang/Basic/arm_mve_defs.td
@@ -432,6 +432,30 @@
   string basename = basename_;
 }
 
+// A wrapper to define both _m and _x versions of a predicated
+// intrinsic.
+multiclass IntrinsicMX {
+  // The _m variant takes an initial parameter called $inactive, which
+  // provides the input value of the output register, i.e. all the
+  // inactive lanes in the predicated operation take their values from
+  // this.
+  def "_m" # nameSuffix:
+ Intrinsic;
+
+  // The _x variant leaves off that parameter, and simply uses an
+  // undef value of the same type.
+  def "_x" # nameSuffix:
+ Intrinsic {
+// Allow overriding of the polymorphic name type, because
+// sometimes the _m and _x variants polymorph differently
+// (typically because the type of the inactive parameter can be
+// used as a disambiguator if it's present).
+let pnt = pnt_x;
+  }
+}
+
 // 
-
 // Convenience lists of parameter types. 'T' is just a container record, so you
 // can define a typical intrinsic with 'let Params = T.Usual', or similar,
Index: clang/include/clang/Basic/arm_mve.td
===
--- clang/include/clang/Basic/arm_mve.td
+++ clang/include/clang/Basic/arm_mve.td
@@ -610,17 +610,10 @@
 defm vstrdq: scatter_offset_both;
 
 multiclass PredicatedImmediateVectorShift<
-Immediate immtype, string predIntrName, list unsignedFlag = []> {
-  foreach predIntr = [IRInt] in {
-def _m_n: Intrinsic;
-def _x_n: Intrinsic;
-  }
+Immediate immtype, string predIntrName, dag unsignedFlag = (?)> {
+  defm "": IntrinsicMX $v, $sh),
+  unsignedFlag, (? $pred, $inactive)), "_n">;
 }
 
 let params = T.Int in {
@@ -632,7 +625,7 @@
 def vshrq_n: Intrinsic;
 defm vshrq: PredicatedImmediateVectorShift;
+ (? (unsignedflag Scalar))>;
   }
 }
 
@@ -713,25 +706,17 @@
 multiclass VectorComplexAddPred {
   def "" : Intrinsic not_halving, angle, $a, $b)>;
-  def _m : Intrinsic
not_halving, angle, $inactive, $a, $b, $pred)>;
-  def _x : Intrinsic
-   not_halving, angle, (undef Vector), $a, $b, $pred)>;
 }
 
 multiclass VectorComplexMulPred {
   def "" : Intrinsic angle, $a, $b)>;
-  def _m : Intrinsic angle, $inactive, $a, $b,
   $pred)>;
-  def _x : Intrinsic angle, (undef Vector), $a,
-  $b, $pred)>;
 }
 
 multiclass VectorComplexMLAPred {


Index: clang/include/clang/Basic/arm_mve_defs.td
===
--- clang/include/clang/Basic/arm_mve_defs.td
+++ clang/include/clang/Basic/arm_mve_defs.td
@@ -432,6 +432,30 @@
   string basename = basename_;
 }
 
+// A wrapper to define both _m and _x versions of a predicated
+// intrinsic.
+multiclass IntrinsicMX {
+  // The _m variant takes an initial parameter called $inactive, which
+  // provides the input value of the output register, i.e. all the
+  // inactive lanes in the predicated operation take their values from
+  // this.
+  def "_m" # nameSuffix:
+ Intrinsic;
+
+  //

[PATCH] D71335: [ARM][MVE] Factor out an IntrinsicMX multiclass.

2019-12-11 Thread Simon Tatham via Phabricator via cfe-commits
simon_tatham updated this revision to Diff 233297.
simon_tatham added a comment.

Refactored further to remove the `PredicatedImmediateVectorShift`
multiclass completely: the amount of useful content remaining in it
now doesn't seem to justify its existence.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71335/new/

https://reviews.llvm.org/D71335

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/include/clang/Basic/arm_mve_defs.td

Index: clang/include/clang/Basic/arm_mve_defs.td
===
--- clang/include/clang/Basic/arm_mve_defs.td
+++ clang/include/clang/Basic/arm_mve_defs.td
@@ -432,6 +432,30 @@
   string basename = basename_;
 }
 
+// A wrapper to define both _m and _x versions of a predicated
+// intrinsic.
+multiclass IntrinsicMX {
+  // The _m variant takes an initial parameter called $inactive, which
+  // provides the input value of the output register, i.e. all the
+  // inactive lanes in the predicated operation take their values from
+  // this.
+  def "_m" # nameSuffix:
+ Intrinsic;
+
+  // The _x variant leaves off that parameter, and simply uses an
+  // undef value of the same type.
+  def "_x" # nameSuffix:
+ Intrinsic {
+// Allow overriding of the polymorphic name type, because
+// sometimes the _m and _x variants polymorph differently
+// (typically because the type of the inactive parameter can be
+// used as a disambiguator if it's present).
+let pnt = pnt_x;
+  }
+}
+
 // -
 // Convenience lists of parameter types. 'T' is just a container record, so you
 // can define a typical intrinsic with 'let Params = T.Usual', or similar,
Index: clang/include/clang/Basic/arm_mve.td
===
--- clang/include/clang/Basic/arm_mve.td
+++ clang/include/clang/Basic/arm_mve.td
@@ -609,30 +609,21 @@
 defm vstrwq: scatter_offset_both;
 defm vstrdq: scatter_offset_both;
 
-multiclass PredicatedImmediateVectorShift<
-Immediate immtype, string predIntrName, list unsignedFlag = []> {
-  foreach predIntr = [IRInt] in {
-def _m_n: Intrinsic;
-def _x_n: Intrinsic;
-  }
-}
-
 let params = T.Int in {
   def vshlq_n: Intrinsic;
-  defm vshlq: PredicatedImmediateVectorShift;
+  defm vshlq: IntrinsicMX
+   $v, $sh, $pred, $inactive), "_n">;
 
   let pnt = PNT_NType in {
 def vshrq_n: Intrinsic;
-defm vshrq: PredicatedImmediateVectorShift;
+defm vshrq: IntrinsicMX
+ $v, $sh, (unsignedflag Scalar), $pred, $inactive), "_n">;
   }
 }
 
@@ -713,25 +704,17 @@
 multiclass VectorComplexAddPred {
   def "" : Intrinsic not_halving, angle, $a, $b)>;
-  def _m : Intrinsic
not_halving, angle, $inactive, $a, $b, $pred)>;
-  def _x : Intrinsic
-   not_halving, angle, (undef Vector), $a, $b, $pred)>;
 }
 
 multiclass VectorComplexMulPred {
   def "" : Intrinsic angle, $a, $b)>;
-  def _m : Intrinsic angle, $inactive, $a, $b,
   $pred)>;
-  def _x : Intrinsic angle, (undef Vector), $a,
-  $b, $pred)>;
 }
 
 multiclass VectorComplexMLAPred {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71000: [AArch64][SVE] Implement intrinsics for non-temporal loads & stores

2019-12-11 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin updated this revision to Diff 233298.
kmclaughlin marked an inline comment as done.
kmclaughlin added a comment.

- Changed 'Offset' value used by getMaskedLoad & getMaskedStore to scalar type


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71000/new/

https://reviews.llvm.org/D71000

Files:
  llvm/include/llvm/IR/IntrinsicsAArch64.td
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-stores.ll

Index: llvm/test/CodeGen/AArch64/sve-intrinsics-stores.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-stores.ll
@@ -0,0 +1,95 @@
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
+
+;
+; STNT1B
+;
+
+define void @stnt1b_i8( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1b_i8:
+; CHECK: stnt1b { z0.b }, p0, [x0, #0]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv16i8( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+;
+; STNT1H
+;
+
+define void @stnt1h_i16( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1h_i16:
+; CHECK: stnt1h { z0.h }, p0, [x0, #0, lsl #1]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv8i16( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+define void @stnt1h_f16( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1h_f16:
+; CHECK: stnt1h { z0.h }, p0, [x0, #0, lsl #1]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv8f16( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+;
+; STNT1W
+;
+
+define void @stnt1w_i32( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1w_i32:
+; CHECK: stnt1w { z0.s }, p0, [x0, #0, lsl #2]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv4i32( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+define void @stnt1w_f32( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1w_f32:
+; CHECK: stnt1w { z0.s }, p0, [x0, #0, lsl #2]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv4f32( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+;
+; STNT1D
+;
+
+define void @stnt1d_i64( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1d_i64:
+; CHECK: stnt1d { z0.d }, p0, [x0, #0, lsl #3]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv2i64( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+define void @stnt1d_f64( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1d_f64:
+; CHECK: stnt1d { z0.d }, p0, [x0, #0, lsl #3]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv2f64( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+declare void @llvm.aarch64.sve.stnt1.nxv16i8(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv8i16(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv4i32(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv2i64(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv8f16(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv4f32(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv2f64(, , *)
Index: llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll
@@ -0,0 +1,88 @@
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
+
+;
+; LDNT1B
+;
+
+define  @ldnt1b_i8( %pred, * %addr) {
+; CHECK-LABEL: ldnt1b_i8:
+; CHECK: ldnt1b { z0.b }, p0/z, [x0, #0]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ldnt1.nxv16i8( %pred,
+ * %addr)
+  ret  %res
+}
+
+;
+; LDNT1H
+;
+
+define  @ldnt1h_i16( %pred, * %addr) {
+; CHECK-LABEL: ldnt1h_i16:
+; CHECK: ldnt1h { z0.h }, p0/z, [x0, #0, lsl #1]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ldnt1.nxv8i16( %pred,
+ * %addr)
+  ret  %res
+}
+
+define  @ldnt1h_f16( %pred, * %addr) {
+; CHECK-LABEL: ldnt1h_f16:
+; CHECK: ldnt1h { z0.h }, p0/z, [x0, #0, lsl #1]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ldnt1.nxv8f16( %pred,
+  * %addr)
+  ret  %res
+}
+
+;
+; LDNT1W
+;
+
+define  @ldnt1w_i32( %pred, * %addr) {
+; CHECK-LABEL: ldnt1w_i32:
+; CHECK: ldnt1w { z0.s }, p0/z, [x0, #0, lsl #2]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve

[PATCH] D71339: [VE,#2] Clang toolchain for SX-Aurora

2019-12-11 Thread Simon Moll via Phabricator via cfe-commits
simoll created this revision.
Herald added subscribers: llvm-commits, cfe-commits, tschuett, jdoerfert, jfb, 
dexonsmith, fedor.sergeev, hiraditya, krytarowski, mgorny.
Herald added projects: clang, LLVM.

This is patch #2 in the patch series for the VE backend for NEC-SX Aurora.
This patch builds on the scalar code generation patch of 
https://reviews.llvm.org/D71338

This patch implements the VE toolchain for clang.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71339

Files:
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/VE.cpp
  clang/lib/Basic/Targets/VE.h
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Arch/VE.cpp
  clang/lib/Driver/ToolChains/Arch/VE.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Clang.h
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Driver/ToolChains/VE.cpp
  clang/lib/Driver/ToolChains/VE.h
  clang/lib/Frontend/CompilerInvocation.cpp
  llvm/CODE_OWNERS.TXT
  llvm/include/llvm/ADT/Triple.h
  llvm/include/llvm/BinaryFormat/ELF.h
  llvm/include/llvm/CodeGen/Passes.h
  llvm/include/llvm/IR/CallingConv.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/llvm/IR/IntrinsicsVE.td
  llvm/lib/CodeGen/SjLjEHPrepare.cpp
  llvm/lib/CodeGen/TargetPassConfig.cpp
  llvm/lib/Support/Triple.cpp
  llvm/lib/Target/LLVMBuild.txt
  llvm/lib/Target/VE/AsmParser/CMakeLists.txt
  llvm/lib/Target/VE/AsmParser/LLVMBuild.txt
  llvm/lib/Target/VE/AsmParser/VEAsmParser.cpp
  llvm/lib/Target/VE/CMakeLists.txt
  llvm/lib/Target/VE/InstPrinter/CMakeLists.txt
  llvm/lib/Target/VE/InstPrinter/LLVMBuild.txt
  llvm/lib/Target/VE/InstPrinter/VEInstPrinter.cpp
  llvm/lib/Target/VE/InstPrinter/VEInstPrinter.h
  llvm/lib/Target/VE/LLVMBuild.txt
  llvm/lib/Target/VE/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/VE/MCTargetDesc/LLVMBuild.txt
  llvm/lib/Target/VE/MCTargetDesc/VEFixupKinds.h
  llvm/lib/Target/VE/MCTargetDesc/VEMCAsmInfo.cpp
  llvm/lib/Target/VE/MCTargetDesc/VEMCAsmInfo.h
  llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp
  llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.h
  llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.cpp
  llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.h
  llvm/lib/Target/VE/MCTargetDesc/VETargetStreamer.cpp
  llvm/lib/Target/VE/MCTargetDesc/VETargetStreamer.h
  llvm/lib/Target/VE/TargetInfo/CMakeLists.txt
  llvm/lib/Target/VE/TargetInfo/LLVMBuild.txt
  llvm/lib/Target/VE/TargetInfo/VETargetInfo.cpp
  llvm/lib/Target/VE/VE.h
  llvm/lib/Target/VE/VE.td
  llvm/lib/Target/VE/VEAsmPrinter.cpp
  llvm/lib/Target/VE/VECallingConv.td
  llvm/lib/Target/VE/VEFrameLowering.cpp
  llvm/lib/Target/VE/VEFrameLowering.h
  llvm/lib/Target/VE/VEISelDAGToDAG.cpp
  llvm/lib/Target/VE/VEISelLowering.cpp
  llvm/lib/Target/VE/VEISelLowering.h
  llvm/lib/Target/VE/VEInstrBuilder.h
  llvm/lib/Target/VE/VEInstrFormats.td
  llvm/lib/Target/VE/VEInstrInfo.cpp
  llvm/lib/Target/VE/VEInstrInfo.h
  llvm/lib/Target/VE/VEInstrInfo.td
  llvm/lib/Target/VE/VEMCInstLower.cpp
  llvm/lib/Target/VE/VEMachineFunctionInfo.cpp
  llvm/lib/Target/VE/VEMachineFunctionInfo.h
  llvm/lib/Target/VE/VERegisterInfo.cpp
  llvm/lib/Target/VE/VERegisterInfo.h
  llvm/lib/Target/VE/VERegisterInfo.td
  llvm/lib/Target/VE/VESchedule.td
  llvm/lib/Target/VE/VESubtarget.cpp
  llvm/lib/Target/VE/VESubtarget.h
  llvm/lib/Target/VE/VETargetMachine.cpp
  llvm/lib/Target/VE/VETargetMachine.h
  llvm/lib/Target/VE/VETargetTransformInfo.h
  llvm/test/CodeGen/VE/add.ll
  llvm/test/CodeGen/VE/addition.ll
  llvm/test/CodeGen/VE/alloca.ll
  llvm/test/CodeGen/VE/atomic.ll
  llvm/test/CodeGen/VE/atomic_unaligned.ll
  llvm/test/CodeGen/VE/bitcast.ll
  llvm/test/CodeGen/VE/bitreverse.ll
  llvm/test/CodeGen/VE/branch1.ll
  llvm/test/CodeGen/VE/branch2.ll
  llvm/test/CodeGen/VE/bswap.ll
  llvm/test/CodeGen/VE/builtin_sjlj.ll
  llvm/test/CodeGen/VE/call.ll
  llvm/test/CodeGen/VE/callstruct.ll
  llvm/test/CodeGen/VE/cast.ll
  llvm/test/CodeGen/VE/constant.ll
  llvm/test/CodeGen/VE/ctlz.ll
  llvm/test/CodeGen/VE/ctpop.ll
  llvm/test/CodeGen/VE/cttz.ll
  llvm/test/CodeGen/VE/div.ll
  llvm/test/CodeGen/VE/extload.ll
  llvm/test/CodeGen/VE/faddd.ll
  llvm/test/CodeGen/VE/fp_add.ll
  llvm/test/CodeGen/VE/fp_div.ll
  llvm/test/CodeGen/VE/fp_mul.ll
  llvm/test/CodeGen/VE/fp_sub.ll
  llvm/test/CodeGen/VE/fp_to_int.ll
  llvm/test/CodeGen/VE/func-epilogue.ll
  llvm/test/CodeGen/VE/func-prologue.ll
  llvm/test/CodeGen/VE/function_prologue_epilogue.ll
  llvm/test/CodeGen/VE/int_to_fp.ll
  llvm/test/CodeGen/VE/left_shift.ll
  llvm/test/CodeGen/VE/lit.local.cfg
  llvm/test/CodeGen/VE/load-align1.ll
  llvm/test/CodeGen/VE/load-align2.ll
  llvm/test/CodeGen/VE/load-align4.ll
  llvm/test/CodeGen/VE/load-align8.ll
  llvm/test/CodeGen/VE/load.ll
  llvm/test/CodeGen/VE/loadstoreq.ll
  llvm/test/CodeGen/VE/localvar.ll
  llvm/test/CodeGen/VE/math

[PATCH] D71286: [SYCL] Add support for auxiliary triple specification to Frontend

2019-12-11 Thread Alexey Bader via Phabricator via cfe-commits
bader updated this revision to Diff 233303.
bader added a comment.

Added LIT test.

If it's okay, I'll add similar test for OpenMP device compiler to 
clang/test/OpenMP directory.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71286/new/

https://reviews.llvm.org/D71286

Files:
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Frontend/sycl-aux-triple.cpp


Index: clang/test/Frontend/sycl-aux-triple.cpp
===
--- /dev/null
+++ clang/test/Frontend/sycl-aux-triple.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 %s -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM 
| FileCheck %s
+// RUN: %clang_cc1 %s -fsycl-is-device -triple spir -aux-triple 
x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
+
+// CHECK-NOT:#define __x86_64__ 1
+// CHECK-SYCL:#define __x86_64__ 1
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -1124,7 +1124,8 @@
   if (InitOpts.UsePredefines) {
 // FIXME: This will create multiple definitions for most of the predefined
 // macros. This is not the right way to handle this.
-if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo())
+if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice || LangOpts.SYCLIsDevice) &&
+PP.getAuxTargetInfo())
   InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts,
  PP.getPreprocessorOpts(), Builder);
 
Index: clang/lib/Frontend/CompilerInstance.cpp
===
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -917,8 +917,9 @@
   if (!hasTarget())
 return false;
 
-  // Create TargetInfo for the other side of CUDA and OpenMP compilation.
-  if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice) &&
+  // Create TargetInfo for the other side of CUDA/OpenMP/SYCL compilation.
+  if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice ||
+   getLangOpts().SYCLIsDevice) &&
   !getFrontendOpts().AuxTriple.empty()) {
 auto TO = std::make_shared();
 TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);


Index: clang/test/Frontend/sycl-aux-triple.cpp
===
--- /dev/null
+++ clang/test/Frontend/sycl-aux-triple.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 %s -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck %s
+// RUN: %clang_cc1 %s -fsycl-is-device -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
+
+// CHECK-NOT:#define __x86_64__ 1
+// CHECK-SYCL:#define __x86_64__ 1
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -1124,7 +1124,8 @@
   if (InitOpts.UsePredefines) {
 // FIXME: This will create multiple definitions for most of the predefined
 // macros. This is not the right way to handle this.
-if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo())
+if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice || LangOpts.SYCLIsDevice) &&
+PP.getAuxTargetInfo())
   InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts,
  PP.getPreprocessorOpts(), Builder);
 
Index: clang/lib/Frontend/CompilerInstance.cpp
===
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -917,8 +917,9 @@
   if (!hasTarget())
 return false;
 
-  // Create TargetInfo for the other side of CUDA and OpenMP compilation.
-  if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice) &&
+  // Create TargetInfo for the other side of CUDA/OpenMP/SYCL compilation.
+  if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice ||
+   getLangOpts().SYCLIsDevice) &&
   !getFrontendOpts().AuxTriple.empty()) {
 auto TO = std::make_shared();
 TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71340: [VE,#3] Runtime libraries

2019-12-11 Thread Simon Moll via Phabricator via cfe-commits
simoll created this revision.
Herald added subscribers: llvm-commits, openmp-commits, libcxx-commits, 
Sanitizers, cfe-commits, jdoerfert, s.egerton, jfb, dexonsmith, christof, 
simoncook, fedor.sergeev, aheejin, hiraditya, krytarowski, mgorny.
Herald added a reviewer: jdoerfert.
Herald added projects: clang, Sanitizers, libc++, OpenMP, LLVM.

This is patch #3 in the patch series for the VE backend for NEC-SX Aurora.
This patch builds on the Clang VE toolchain patch of 
https://reviews.llvm.org/D71339

This patch implements the following libraries for the VE target:

- libunwind
- libcxx
- libcxxabi
- openmp (w/o offloading)
- compiler-rt


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71340

Files:
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/VE.cpp
  clang/lib/Basic/Targets/VE.h
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Arch/VE.cpp
  clang/lib/Driver/ToolChains/Arch/VE.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Clang.h
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Driver/ToolChains/VE.cpp
  clang/lib/Driver/ToolChains/VE.h
  clang/lib/Frontend/CompilerInvocation.cpp
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  compiler-rt/cmake/base-config-ix.cmake
  compiler-rt/cmake/builtin-config-ix.cmake
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/builtins/CMakeLists.txt
  compiler-rt/lib/builtins/ve/llvm_grow_stack.S
  libcxx/src/filesystem/operations.cpp
  libcxxabi/cmake/config-ix.cmake
  libunwind/include/__libunwind_config.h
  libunwind/include/libunwind.h
  libunwind/src/Registers.hpp
  libunwind/src/Unwind-sjlj.c
  libunwind/src/libunwind.cpp
  llvm/CODE_OWNERS.TXT
  llvm/include/llvm/ADT/Triple.h
  llvm/include/llvm/BinaryFormat/ELF.h
  llvm/include/llvm/CodeGen/Passes.h
  llvm/include/llvm/IR/CallingConv.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/llvm/IR/IntrinsicsVE.td
  llvm/lib/CodeGen/SjLjEHPrepare.cpp
  llvm/lib/CodeGen/TargetPassConfig.cpp
  llvm/lib/Support/Triple.cpp
  llvm/lib/Target/LLVMBuild.txt
  llvm/lib/Target/VE/AsmParser/CMakeLists.txt
  llvm/lib/Target/VE/AsmParser/LLVMBuild.txt
  llvm/lib/Target/VE/AsmParser/VEAsmParser.cpp
  llvm/lib/Target/VE/CMakeLists.txt
  llvm/lib/Target/VE/InstPrinter/CMakeLists.txt
  llvm/lib/Target/VE/InstPrinter/LLVMBuild.txt
  llvm/lib/Target/VE/InstPrinter/VEInstPrinter.cpp
  llvm/lib/Target/VE/InstPrinter/VEInstPrinter.h
  llvm/lib/Target/VE/LLVMBuild.txt
  llvm/lib/Target/VE/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/VE/MCTargetDesc/LLVMBuild.txt
  llvm/lib/Target/VE/MCTargetDesc/VEFixupKinds.h
  llvm/lib/Target/VE/MCTargetDesc/VEMCAsmInfo.cpp
  llvm/lib/Target/VE/MCTargetDesc/VEMCAsmInfo.h
  llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp
  llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.h
  llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.cpp
  llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.h
  llvm/lib/Target/VE/MCTargetDesc/VETargetStreamer.cpp
  llvm/lib/Target/VE/MCTargetDesc/VETargetStreamer.h
  llvm/lib/Target/VE/TargetInfo/CMakeLists.txt
  llvm/lib/Target/VE/TargetInfo/LLVMBuild.txt
  llvm/lib/Target/VE/TargetInfo/VETargetInfo.cpp
  llvm/lib/Target/VE/VE.h
  llvm/lib/Target/VE/VE.td
  llvm/lib/Target/VE/VEAsmPrinter.cpp
  llvm/lib/Target/VE/VECallingConv.td
  llvm/lib/Target/VE/VEFrameLowering.cpp
  llvm/lib/Target/VE/VEFrameLowering.h
  llvm/lib/Target/VE/VEISelDAGToDAG.cpp
  llvm/lib/Target/VE/VEISelLowering.cpp
  llvm/lib/Target/VE/VEISelLowering.h
  llvm/lib/Target/VE/VEInstrBuilder.h
  llvm/lib/Target/VE/VEInstrFormats.td
  llvm/lib/Target/VE/VEInstrInfo.cpp
  llvm/lib/Target/VE/VEInstrInfo.h
  llvm/lib/Target/VE/VEInstrInfo.td
  llvm/lib/Target/VE/VEMCInstLower.cpp
  llvm/lib/Target/VE/VEMachineFunctionInfo.cpp
  llvm/lib/Target/VE/VEMachineFunctionInfo.h
  llvm/lib/Target/VE/VERegisterInfo.cpp
  llvm/lib/Target/VE/VERegisterInfo.h
  llvm/lib/Target/VE/VERegisterInfo.td
  llvm/lib/Target/VE/VESchedule.td
  llvm/lib/Target/VE/VESubtarget.cpp
  llvm/lib/Target/VE/VESubtarget.h
  llvm/lib/Target/VE/VETargetMachine.cpp
  llvm/lib/Target/VE/VETargetMachine.h
  llvm/lib/Target/VE/VETargetTransformInfo.h
  llvm/test/CodeGen/VE/add.ll
  llvm/test/CodeGen/VE/addition.ll
  llvm/test/CodeGen/VE/alloca.ll
  llvm/test/CodeGen/VE/atomic.ll
  llvm/test/CodeGen/VE/atomic_unaligned.ll
  llvm/test/CodeGen/VE/bitcast.ll
  llvm/test/CodeGen/VE/bitreverse.ll
  llvm/test/CodeGen/VE/branch1.ll
  llvm/test/CodeGen/VE/branch2.ll
  llvm/test/CodeGen/VE/bswap.ll
  llvm/test/CodeGen/VE/builtin_sjlj.ll
  llvm/test/CodeGen/VE/call.ll
  llvm/test/CodeGen/VE/callstruct.ll
  llvm/test/CodeGen/VE/cast.ll
  llvm/test/CodeGen/VE/constant.ll
  llvm/test/CodeGen/VE/ctlz.ll
  llvm/test/CodeGen/VE/ctpop.ll
  llvm/test/CodeGen/VE/cttz.ll
  llvm/test/CodeGen/VE/div.ll
  llvm/test/CodeGen/VE/extload.ll
  l

[PATCH] D71335: [ARM][MVE] Factor out an IntrinsicMX multiclass.

2019-12-11 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki accepted this revision.
miyuki added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71335/new/

https://reviews.llvm.org/D71335



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71247: [clangd] Rename constructors and destructors in cross-file case

2019-12-11 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev planned changes to this revision.
kbobyrev added a comment.

Need to address the comments.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71247/new/

https://reviews.llvm.org/D71247



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71000: [AArch64][SVE] Implement intrinsics for non-temporal loads & stores

2019-12-11 Thread Kerry McLaughlin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3f5bf35f868d: [AArch64][SVE] Implement intrinsics for 
non-temporal loads & stores (authored by kmclaughlin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71000/new/

https://reviews.llvm.org/D71000

Files:
  llvm/include/llvm/IR/IntrinsicsAArch64.td
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-stores.ll

Index: llvm/test/CodeGen/AArch64/sve-intrinsics-stores.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-stores.ll
@@ -0,0 +1,95 @@
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
+
+;
+; STNT1B
+;
+
+define void @stnt1b_i8( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1b_i8:
+; CHECK: stnt1b { z0.b }, p0, [x0, #0]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv16i8( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+;
+; STNT1H
+;
+
+define void @stnt1h_i16( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1h_i16:
+; CHECK: stnt1h { z0.h }, p0, [x0, #0, lsl #1]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv8i16( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+define void @stnt1h_f16( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1h_f16:
+; CHECK: stnt1h { z0.h }, p0, [x0, #0, lsl #1]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv8f16( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+;
+; STNT1W
+;
+
+define void @stnt1w_i32( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1w_i32:
+; CHECK: stnt1w { z0.s }, p0, [x0, #0, lsl #2]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv4i32( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+define void @stnt1w_f32( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1w_f32:
+; CHECK: stnt1w { z0.s }, p0, [x0, #0, lsl #2]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv4f32( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+;
+; STNT1D
+;
+
+define void @stnt1d_i64( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1d_i64:
+; CHECK: stnt1d { z0.d }, p0, [x0, #0, lsl #3]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv2i64( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+define void @stnt1d_f64( %data,  %pred, * %addr) {
+; CHECK-LABEL: stnt1d_f64:
+; CHECK: stnt1d { z0.d }, p0, [x0, #0, lsl #3]
+; CHECK-NEXT: ret
+  call void @llvm.aarch64.sve.stnt1.nxv2f64( %data,
+ %pred,
+* %addr)
+  ret void
+}
+
+declare void @llvm.aarch64.sve.stnt1.nxv16i8(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv8i16(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv4i32(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv2i64(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv8f16(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv4f32(, , *)
+declare void @llvm.aarch64.sve.stnt1.nxv2f64(, , *)
Index: llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll
@@ -0,0 +1,88 @@
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
+
+;
+; LDNT1B
+;
+
+define  @ldnt1b_i8( %pred, * %addr) {
+; CHECK-LABEL: ldnt1b_i8:
+; CHECK: ldnt1b { z0.b }, p0/z, [x0, #0]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ldnt1.nxv16i8( %pred,
+ * %addr)
+  ret  %res
+}
+
+;
+; LDNT1H
+;
+
+define  @ldnt1h_i16( %pred, * %addr) {
+; CHECK-LABEL: ldnt1h_i16:
+; CHECK: ldnt1h { z0.h }, p0/z, [x0, #0, lsl #1]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ldnt1.nxv8i16( %pred,
+ * %addr)
+  ret  %res
+}
+
+define  @ldnt1h_f16( %pred, * %addr) {
+; CHECK-LABEL: ldnt1h_f16:
+; CHECK: ldnt1h { z0.h }, p0/z, [x0, #0, lsl #1]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ldnt1.nxv8f16( %pred,
+  * %addr)
+  ret  %res
+}
+
+;
+; LDNT1W
+;
+
+define  @ldnt1w_i32( %pred, * %addr) {
+; CHECK-LABEL: ldnt1w_i32:
+; CHECK: ldnt1w { z0.s }, p0/z, [x0, #0, lsl #2]
+; CHECK-NEXT: r

[PATCH] D71286: [SYCL] Add support for auxiliary triple specification to Frontend

2019-12-11 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71286/new/

https://reviews.llvm.org/D71286



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71335: [ARM][MVE] Factor out an IntrinsicMX multiclass.

2019-12-11 Thread Mark Murray via Phabricator via cfe-commits
MarkMurrayARM accepted this revision.
MarkMurrayARM added a comment.

*LIKE*


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71335/new/

https://reviews.llvm.org/D71335



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71286: [SYCL] Add support for auxiliary triple specification to Frontend

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60675 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71286/new/

https://reviews.llvm.org/D71286



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] 170ee64 - [clang-tidy] Link shared library clangTidyOpenMPModule to library LLVMFrontendOpenMP

2019-12-11 Thread Adam Balogh via cfe-commits

Author: Adam Balogh
Date: 2019-12-11T12:37:22+01:00
New Revision: 170ee645f4d147103f93927c37a304c759c669dd

URL: 
https://github.com/llvm/llvm-project/commit/170ee645f4d147103f93927c37a304c759c669dd
DIFF: 
https://github.com/llvm/llvm-project/commit/170ee645f4d147103f93927c37a304c759c669dd.diff

LOG: [clang-tidy] Link shared library clangTidyOpenMPModule to library 
LLVMFrontendOpenMP

Building shared libs was broken, it is fixed now.

Added: 


Modified: 
clang-tools-extra/clang-tidy/openmp/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/openmp/CMakeLists.txt 
b/clang-tools-extra/clang-tidy/openmp/CMakeLists.txt
index bbd65f290364..c3c691bfb53d 100644
--- a/clang-tools-extra/clang-tidy/openmp/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/openmp/CMakeLists.txt
@@ -11,4 +11,5 @@ add_clang_library(clangTidyOpenMPModule
   clangBasic
   clangTidy
   clangTidyUtils
+  LLVMFrontendOpenMP
   )



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71197: llvm premerge: clang format test

2019-12-11 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov updated this revision to Diff 233310.
goncharov added a comment.

trigger the build


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71197/new/

https://reviews.llvm.org/D71197

Files:
  clang/tools/clang-check/ClangCheck.cpp
  clang/tools/clang-diff/ClangDiff.cpp
  clang/tools/clang-fuzzer/ClangFuzzer.cpp
  clang/tools/clang-refactor/ClangRefactor.cpp


Index: clang/tools/clang-refactor/ClangRefactor.cpp
===
--- clang/tools/clang-refactor/ClangRefactor.cpp
+++ clang/tools/clang-refactor/ClangRefactor.cpp
@@ -90,7 +90,6 @@
   TestSourceSelectionArgument(TestSelectionRangesInFile TestSelections)
   : TestSelections(std::move(TestSelections)) {}
 
-  void print(raw_ostream &OS) override { TestSelections.dump(OS); }
 
   std::unique_ptr
   createCustomConsumer() override {
@@ -104,6 +103,9 @@
 return TestSelections.foreachRange(SM, Callback);
   }
 
+  void print(raw_ostream &OS) override {
+  TestSelections.dump(OS);
+  }
 private:
   TestSelectionRangesInFile TestSelections;
 };
Index: clang/tools/clang-fuzzer/ClangFuzzer.cpp
===
--- clang/tools/clang-fuzzer/ClangFuzzer.cpp
+++ clang/tools/clang-fuzzer/ClangFuzzer.cpp
@@ -15,11 +15,11 @@
 #include "handle-cxx/handle_cxx.h"
 
 using namespace clang_fuzzer;
-
-extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; }
-
 extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
   std::string s((const char *)data, size);
   HandleCXX(s, "./test.cc", {"-O2"});
   return 0;
 }
+
+extern "C" int LLVMFuzzerInitialize(   int *argc,
+   char ***argv) { return 0 ; }
Index: clang/tools/clang-diff/ClangDiff.cpp
===
--- clang/tools/clang-diff/ClangDiff.cpp
+++ clang/tools/clang-diff/ClangDiff.cpp
@@ -32,12 +32,10 @@
 cl::desc("Print the internal representation of the AST as JSON."),
 cl::init(false), cl::cat(ClangDiffCategory));
 
-static cl::opt PrintMatches("dump-matches",
-  cl::desc("Print the matched nodes."),
-  cl::init(false), cl::cat(ClangDiffCategory));
+static cl::opt PrintMatches("dump-matches", cl::desc("Print the matched 
nodes."), cl::init(false), cl::cat(ClangDiffCategory));
 
 static cl::opt HtmlDiff("html",
-  cl::desc("Output a side-by-side diff in HTML."),
+ cl::desc("Output a side-by-side diff in HTML."),
   cl::init(false), cl::cat(ClangDiffCategory));
 
 static cl::opt SourcePath(cl::Positional, cl::desc(""),
@@ -77,7 +75,10 @@
   std::make_unique(
   std::move(Compilations));
   AdjustingCompilations->appendArgumentsAdjuster(
-  getInsertArgumentAdjuster(ArgsBefore, ArgumentInsertPosition::BEGIN));
+
+  getInsertArgumentAdjuster(ArgsBefore   ,
+
+  ArgumentInsertPosition::BEGIN));
   AdjustingCompilations->appendArgumentsAdjuster(
   getInsertArgumentAdjuster(ArgsAfter, ArgumentInsertPosition::END));
   Compilations = std::move(AdjustingCompilations);
Index: clang/tools/clang-check/ClangCheck.cpp
===
--- clang/tools/clang-check/ClangCheck.cpp
+++ clang/tools/clang-check/ClangCheck.cpp
@@ -52,7 +52,7 @@
 );
 
 static cl::OptionCategory ClangCheckCategory("clang-check options");
-static const opt::OptTable &Options = getDriverOptTable();
+staticconst opt::OptTable &Options = getDriverOptTable();
 static cl::opt
 ASTDump("ast-dump",
 cl::desc(Options.getOptionHelpText(options::OPT_ast_dump)),


Index: clang/tools/clang-refactor/ClangRefactor.cpp
===
--- clang/tools/clang-refactor/ClangRefactor.cpp
+++ clang/tools/clang-refactor/ClangRefactor.cpp
@@ -90,7 +90,6 @@
   TestSourceSelectionArgument(TestSelectionRangesInFile TestSelections)
   : TestSelections(std::move(TestSelections)) {}
 
-  void print(raw_ostream &OS) override { TestSelections.dump(OS); }
 
   std::unique_ptr
   createCustomConsumer() override {
@@ -104,6 +103,9 @@
 return TestSelections.foreachRange(SM, Callback);
   }
 
+  void print(raw_ostream &OS) override {
+  TestSelections.dump(OS);
+  }
 private:
   TestSelectionRangesInFile TestSelections;
 };
Index: clang/tools/clang-fuzzer/ClangFuzzer.cpp
===
--- clang/tools/clang-fuzzer/ClangFuzzer.cpp
+++ clang/tools/clang-fuzzer/ClangFuzzer.cpp
@@ -15,11 +15,11 @@
 #include "handle-cxx/handle_cxx.h"
 
 using namespace clang_fuzzer;
-
-extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; }
-
 extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
   std::string s((const char *)data, size)

[clang] d290424 - [ARM][MVE] Factor out an IntrinsicMX multiclass.

2019-12-11 Thread Simon Tatham via cfe-commits

Author: Simon Tatham
Date: 2019-12-11T12:07:26Z
New Revision: d290424731ede31fd5fd75b929df8fe0adb547c7

URL: 
https://github.com/llvm/llvm-project/commit/d290424731ede31fd5fd75b929df8fe0adb547c7
DIFF: 
https://github.com/llvm/llvm-project/commit/d290424731ede31fd5fd75b929df8fe0adb547c7.diff

LOG: [ARM][MVE] Factor out an IntrinsicMX multiclass.

Summary:
The ACLE intrinsics for MVE contain a lot of pairs of functions with
`_m` and `_x` in the name, wrapping a predicated MVE instruction which
only partially overwrites its output register. They have the common
pattern that the `_m` variant takes an initial argument called
'inactive', of the same type as the return value, supplying the input
value of the output register, so that lanes disabled by the
predication will be taken from that parameter; the `_x` variant omits
that initial argument, and simply sets it to undef.

That common pattern is simple enough to wrap into a multiclass, which
should save a lot of effort in setting up all the rest of the `_x`
variants. In this commit I introduce `multiclass IntrinsicMX` in
`arm_mve_defs.td`, and convert existing generation of m/x pairs to use
it.

This allows me to remove the `PredicatedImmediateVectorShift`
multiclass (from D71065) completely, because the new multiclass makes
it so much simpler that it's not worth bothering to define it at all.

Reviewers: MarkMurrayARM, miyuki

Reviewed By: MarkMurrayARM, miyuki

Subscribers: kristof.beyls, dmgreen, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71335

Added: 


Modified: 
clang/include/clang/Basic/arm_mve.td
clang/include/clang/Basic/arm_mve_defs.td

Removed: 




diff  --git a/clang/include/clang/Basic/arm_mve.td 
b/clang/include/clang/Basic/arm_mve.td
index 9b6053e57861..7ed3c04c58db 100644
--- a/clang/include/clang/Basic/arm_mve.td
+++ b/clang/include/clang/Basic/arm_mve.td
@@ -609,30 +609,21 @@ defm vstrhq: scatter_offset_both;
 defm vstrwq: scatter_offset_both;
 defm vstrdq: scatter_offset_both;
 
-multiclass PredicatedImmediateVectorShift<
-Immediate immtype, string predIntrName, list unsignedFlag = []> {
-  foreach predIntr = [IRInt] in {
-def _m_n: Intrinsic;
-def _x_n: Intrinsic;
-  }
-}
-
 let params = T.Int in {
   def vshlq_n: Intrinsic;
-  defm vshlq: PredicatedImmediateVectorShift;
+  defm vshlq: IntrinsicMX
+   $v, $sh, $pred, $inactive), "_n">;
 
   let pnt = PNT_NType in {
 def vshrq_n: Intrinsic;
-defm vshrq: PredicatedImmediateVectorShift;
+defm vshrq: IntrinsicMX
+ $v, $sh, (unsignedflag Scalar), $pred, $inactive), "_n">;
   }
 }
 
@@ -713,25 +704,17 @@ def vadciq_m: Intrinsic {
   def "" : Intrinsic not_halving, angle, $a, $b)>;
-  def _m : Intrinsic
not_halving, angle, $inactive, $a, $b, $pred)>;
-  def _x : Intrinsic
-   not_halving, angle, (undef Vector), $a, $b, $pred)>;
 }
 
 multiclass VectorComplexMulPred {
   def "" : Intrinsic angle, $a, $b)>;
-  def _m : Intrinsic angle, $inactive, $a, $b,
   $pred)>;
-  def _x : Intrinsic angle, (undef Vector), $a,
-  $b, $pred)>;
 }
 
 multiclass VectorComplexMLAPred {

diff  --git a/clang/include/clang/Basic/arm_mve_defs.td 
b/clang/include/clang/Basic/arm_mve_defs.td
index 6bc9b35f0fc4..3e22e44607ca 100644
--- a/clang/include/clang/Basic/arm_mve_defs.td
+++ b/clang/include/clang/Basic/arm_mve_defs.td
@@ -432,6 +432,30 @@ class NameOverride {
   string basename = basename_;
 }
 
+// A wrapper to define both _m and _x versions of a predicated
+// intrinsic.
+multiclass IntrinsicMX {
+  // The _m variant takes an initial parameter called $inactive, which
+  // provides the input value of the output register, i.e. all the
+  // inactive lanes in the predicated operation take their values from
+  // this.
+  def "_m" # nameSuffix:
+ Intrinsic;
+
+  // The _x variant leaves off that parameter, and simply uses an
+  // undef value of the same type.
+  def "_x" # nameSuffix:
+ Intrinsic {
+// Allow overriding of the polymorphic name type, because
+// sometimes the _m and _x variants polymorph 
diff erently
+// (typically because the type of the inactive parameter can be
+// used as a disambiguator if it's present).
+let pnt = pnt_x;
+  }
+}
+
 // 
-
 // Convenience lists of parameter types. 'T' is just a container record, so you
 // can define a typical intrinsic with 'let Params = T.Usual', or similar,



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71335: [ARM][MVE] Factor out an IntrinsicMX multiclass.

2019-12-11 Thread Simon Tatham via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd290424731ed: [ARM][MVE] Factor out an IntrinsicMX 
multiclass. (authored by simon_tatham).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71335/new/

https://reviews.llvm.org/D71335

Files:
  clang/include/clang/Basic/arm_mve.td
  clang/include/clang/Basic/arm_mve_defs.td

Index: clang/include/clang/Basic/arm_mve_defs.td
===
--- clang/include/clang/Basic/arm_mve_defs.td
+++ clang/include/clang/Basic/arm_mve_defs.td
@@ -432,6 +432,30 @@
   string basename = basename_;
 }
 
+// A wrapper to define both _m and _x versions of a predicated
+// intrinsic.
+multiclass IntrinsicMX {
+  // The _m variant takes an initial parameter called $inactive, which
+  // provides the input value of the output register, i.e. all the
+  // inactive lanes in the predicated operation take their values from
+  // this.
+  def "_m" # nameSuffix:
+ Intrinsic;
+
+  // The _x variant leaves off that parameter, and simply uses an
+  // undef value of the same type.
+  def "_x" # nameSuffix:
+ Intrinsic {
+// Allow overriding of the polymorphic name type, because
+// sometimes the _m and _x variants polymorph differently
+// (typically because the type of the inactive parameter can be
+// used as a disambiguator if it's present).
+let pnt = pnt_x;
+  }
+}
+
 // -
 // Convenience lists of parameter types. 'T' is just a container record, so you
 // can define a typical intrinsic with 'let Params = T.Usual', or similar,
Index: clang/include/clang/Basic/arm_mve.td
===
--- clang/include/clang/Basic/arm_mve.td
+++ clang/include/clang/Basic/arm_mve.td
@@ -609,30 +609,21 @@
 defm vstrwq: scatter_offset_both;
 defm vstrdq: scatter_offset_both;
 
-multiclass PredicatedImmediateVectorShift<
-Immediate immtype, string predIntrName, list unsignedFlag = []> {
-  foreach predIntr = [IRInt] in {
-def _m_n: Intrinsic;
-def _x_n: Intrinsic;
-  }
-}
-
 let params = T.Int in {
   def vshlq_n: Intrinsic;
-  defm vshlq: PredicatedImmediateVectorShift;
+  defm vshlq: IntrinsicMX
+   $v, $sh, $pred, $inactive), "_n">;
 
   let pnt = PNT_NType in {
 def vshrq_n: Intrinsic;
-defm vshrq: PredicatedImmediateVectorShift;
+defm vshrq: IntrinsicMX
+ $v, $sh, (unsignedflag Scalar), $pred, $inactive), "_n">;
   }
 }
 
@@ -713,25 +704,17 @@
 multiclass VectorComplexAddPred {
   def "" : Intrinsic not_halving, angle, $a, $b)>;
-  def _m : Intrinsic
not_halving, angle, $inactive, $a, $b, $pred)>;
-  def _x : Intrinsic
-   not_halving, angle, (undef Vector), $a, $b, $pred)>;
 }
 
 multiclass VectorComplexMulPred {
   def "" : Intrinsic angle, $a, $b)>;
-  def _m : Intrinsic angle, $inactive, $a, $b,
   $pred)>;
-  def _x : Intrinsic angle, (undef Vector), $a,
-  $b, $pred)>;
 }
 
 multiclass VectorComplexMLAPred {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71345: [clangd] Fall back to selecting token-before-cursor if token-after-cursor fails.

2019-12-11 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, 
MaskRay, ilya-biryukov.
Herald added a project: clang.
sammccall planned changes to this revision.
sammccall added a comment.

This needs tests, but wanted to share the ideas.


The problem:

LSP specifies that Positions are between characters. Therefore when a position
(or an empty range) is used to target elements of the source code, there is an
ambiguity - should we look left or right of the cursor?

Until now, SelectionTree resolved this to the right except in trivial cases
(where there's whitespace, semicolon, or eof on the right).
This meant that it's unable to e.g. out-line `int foo^()` today.

Complicating this, LSP notwithstanding the cursor is *on* a character in many
editors (mostly terminal-based). In these cases there's no ambiguity - we must
"look right" - but there's also no way to tell in LSP.

(Several features currently resolve this by using getBeginningOfIdentifier,
which tries to rewind and supports end-of-identifier. But this relies on
raw lexing and is limited and buggy).

Precedent: well - most other languages aren't so full of densely packed symbols
that we might want to target. Bias-towards-identifier works well enough.
MS C++ for vscode seems to mostly use bias-toward-identifier too.
The problem with this solution is it doesn't provide any way to target some
things such as the constructor call in Foo^(bar());

Presented solution:

When an ambiguous selection is found, we generate *both* possible selection
trees. We try to run the feature on the rightward tree first, and then on the
leftward tree if it fails.

This is basically do-what-I-mean, the main downside is the need to do this on
a feature-by-feature basis (because each feature knows what "fail" means).
The most complicated instance of this is Tweaks, where the preferred selection
may vary tweak-by-tweak.

Wrinkles:

While production behavior is pretty consistent, this introduces some
inconsistency in testing, depending whether the interface we're testing is
inside or outside the "retry" wrapper.

In particular, for many features like Hover, the unit tests will show production
behavior, while for Tweaks the harness would have to run the loop itself if
we want this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71345

Files:
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/Selection.cpp
  clang-tools-extra/clangd/Selection.h
  clang-tools-extra/clangd/SemanticSelection.cpp
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/refactor/Tweak.cpp
  clang-tools-extra/clangd/refactor/Tweak.h
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang-tools-extra/clangd/unittests/SelectionTests.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.cpp
  clang/include/clang/Tooling/Syntax/Tokens.h
  clang/lib/Tooling/Syntax/Tokens.cpp

Index: clang/lib/Tooling/Syntax/Tokens.cpp
===
--- clang/lib/Tooling/Syntax/Tokens.cpp
+++ clang/lib/Tooling/Syntax/Tokens.cpp
@@ -647,3 +647,18 @@
   }
   return OS.str();
 }
+
+llvm::ArrayRef
+syntax::spelledTokensTouching(SourceLocation Loc,
+  const syntax::TokenBuffer &Tokens) {
+  assert(Loc.isFileID());
+  llvm::ArrayRef All =
+  Tokens.spelledTokens(Tokens.sourceManager().getFileID(Loc));
+  // SourceLocation < SourceLocation is OK for one file ID.
+  auto *Right = llvm::partition_point(All, [&](const syntax::Token &Tok) {
+return Tok.location() < Loc;
+  });
+  bool AcceptRight = Right != All.end() && !(Loc < Right->location());
+  bool AcceptLeft = Right != All.begin() && (Right - 1)->endLocation() == Loc;
+  return llvm::makeArrayRef(Right - int(AcceptLeft), Right + int(AcceptRight));
+}
Index: clang/include/clang/Tooling/Syntax/Tokens.h
===
--- clang/include/clang/Tooling/Syntax/Tokens.h
+++ clang/include/clang/Tooling/Syntax/Tokens.h
@@ -309,6 +309,11 @@
   const SourceManager *SourceMgr;
 };
 
+/// Return the spelled tokens that overlap or touch spelling location Loc.
+/// This always returns 0-2 tokens.
+llvm::ArrayRef
+spelledTokensTouching(SourceLocation Loc, const syntax::TokenBuffer &Tokens);
+
 /// Lex the text buffer, corresponding to \p FID, in raw mode and record the
 /// resulting spelled tokens. Does minimal post-processing on raw identifiers,
 /// setting the appropriate token kind (instead of the raw_identifier reported
Index: clang-tools-extra/clangd/unittests/TweakTesting.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTesting.cpp
+++ clang-tools-extra/clangd/unittests/TweakTesting.cpp
@@ -76,7 +76,10 @@
   TU.ExtraArgs = ExtraArgs;
   TU.Addi

[PATCH] D71345: [clangd] Fall back to selecting token-before-cursor if token-after-cursor fails.

2019-12-11 Thread Sam McCall via Phabricator via cfe-commits
sammccall planned changes to this revision.
sammccall added a comment.

This needs tests, but wanted to share the ideas.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71345/new/

https://reviews.llvm.org/D71345



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71284: [clangd] Consider () part of the FunctionDecl, not the FunctionTypeLoc

2019-12-11 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

D71345  is a different approach that would 
solve this problem and others (at higher cost).
I don't think we should land both, so let's park this until we decide on the 
fate of that patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71284/new/

https://reviews.llvm.org/D71284



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71208: CodeGen: Allow annotations on globals in non-zero address space

2019-12-11 Thread Nicolai Hähnle via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf21c081b78ec: CodeGen: Allow annotations on globals in 
non-zero address space (authored by nhaehnle).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71208/new/

https://reviews.llvm.org/D71208

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGen/annotations-global.c


Index: clang/test/CodeGen/annotations-global.c
===
--- clang/test/CodeGen/annotations-global.c
+++ clang/test/CodeGen/annotations-global.c
@@ -3,6 +3,7 @@
 // RUN: FileCheck --check-prefix=A %s < %t1
 // RUN: FileCheck --check-prefix=BAR %s < %t1
 // RUN: FileCheck --check-prefix=FOOS %s < %t1
+// RUN: FileCheck --check-prefix=ADDRSPACE %s < %t1
 // END.
 
 static __attribute((annotate("sfoo_0"))) __attribute((annotate("sfoo_1"))) 
char sfoo;
@@ -14,17 +15,19 @@
   sfoo = 0;
 }
 
+__attribute((address_space(1))) __attribute__((annotate("addrspace1_ann"))) 
char addrspace1_var;
+
 // FOOS: target triple
 // FOOS: private unnamed_addr constant [7 x i8] c"sfoo_{{.}}\00", section 
"llvm.metadata"
 // FOOS: private unnamed_addr constant [7 x i8] c"sfoo_{{.}}\00", section 
"llvm.metadata"
 // FOOS-NOT: sfoo_
-// FOOS: @llvm.global.annotations = appending global [10 x { i8*, i8*, i8*, 
i32 }] {{.*}}i8* @sfoo{{.*}}i8* @sfoo{{.*}}, section "llvm.metadata"
+// FOOS: @llvm.global.annotations = appending global [11 x { i8*, i8*, i8*, 
i32 }] {{.*}}i8* @sfoo{{.*}}i8* @sfoo{{.*}}, section "llvm.metadata"
 
 // FOO: target triple
 // FOO: private unnamed_addr constant [6 x i8] c"foo_{{.}}\00", section 
"llvm.metadata"
 // FOO: private unnamed_addr constant [6 x i8] c"foo_{{.}}\00", section 
"llvm.metadata"
 // FOO-NOT: foo_
-// FOO: @llvm.global.annotations = appending global [10 x { i8*, i8*, i8*, i32 
}] {{.*}}i8* @foo{{.*}}i8* @foo{{.*}}, section "llvm.metadata"
+// FOO: @llvm.global.annotations = appending global [11 x { i8*, i8*, i8*, i32 
}] {{.*}}i8* @foo{{.*}}i8* @foo{{.*}}, section "llvm.metadata"
 
 // A: target triple
 // A: private unnamed_addr constant [8 x i8] c"ann_a_{{.}}\00", section 
"llvm.metadata"
@@ -32,10 +35,13 @@
 // A: private unnamed_addr constant [8 x i8] c"ann_a_{{.}}\00", section 
"llvm.metadata"
 // A: private unnamed_addr constant [8 x i8] c"ann_a_{{.}}\00", section 
"llvm.metadata"
 // A-NOT: ann_a_
-// A: @llvm.global.annotations = appending global [10 x { i8*, i8*, i8*, i32 
}] {{.*}}i8* bitcast (void (i8*)* @a to i8*){{.*}}i8* bitcast (void (i8*)* @a 
to i8*){{.*}}i8* bitcast (void (i8*)* @a to i8*){{.*}}i8* bitcast (void (i8*)* 
@a to i8*){{.*}}, section "llvm.metadata"
+// A: @llvm.global.annotations = appending global [11 x { i8*, i8*, i8*, i32 
}] {{.*}}i8* bitcast (void (i8*)* @a to i8*){{.*}}i8* bitcast (void (i8*)* @a 
to i8*){{.*}}i8* bitcast (void (i8*)* @a to i8*){{.*}}i8* bitcast (void (i8*)* 
@a to i8*){{.*}}, section "llvm.metadata"
 
 // BAR: target triple
 // BAR: private unnamed_addr constant [6 x i8] c"bar_{{.}}\00", section 
"llvm.metadata"
 // BAR: private unnamed_addr constant [6 x i8] c"bar_{{.}}\00", section 
"llvm.metadata"
 // BAR-NOT: bar_
-// BAR: @llvm.global.annotations = appending global [10 x { i8*, i8*, i8*, i32 
}] {{.*}}i8* @a.bar{{.*}}i8* @a.bar{{.*}}, section "llvm.metadata"
+// BAR: @llvm.global.annotations = appending global [11 x { i8*, i8*, i8*, i32 
}] {{.*}}i8* @a.bar{{.*}}i8* @a.bar{{.*}}, section "llvm.metadata"
+
+// ADDRSPACE: target triple
+// ADDRSPACE: @llvm.global.annotations = appending global {{.*}} addrspacecast 
(i8 addrspace(1)* @addrspace1_var to i8*), {{.*}}
Index: clang/lib/CodeGen/CodeGenModule.cpp
===
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -2212,9 +2212,15 @@
  *UnitGV = EmitAnnotationUnit(L),
  *LineNoCst = EmitAnnotationLineNo(L);
 
+  llvm::Constant *ASZeroGV = GV;
+  if (GV->getAddressSpace() != 0) {
+ASZeroGV = llvm::ConstantExpr::getAddrSpaceCast(
+   GV, GV->getValueType()->getPointerTo(0));
+  }
+
   // Create the ConstantStruct for the global annotation.
   llvm::Constant *Fields[4] = {
-llvm::ConstantExpr::getBitCast(GV, Int8PtrTy),
+llvm::ConstantExpr::getBitCast(ASZeroGV, Int8PtrTy),
 llvm::ConstantExpr::getBitCast(AnnoGV, Int8PtrTy),
 llvm::ConstantExpr::getBitCast(UnitGV, Int8PtrTy),
 LineNoCst


Index: clang/test/CodeGen/annotations-global.c
===
--- clang/test/CodeGen/annotations-global.c
+++ clang/test/CodeGen/annotations-global.c
@@ -3,6 +3,7 @@
 // RUN: FileCheck --check-prefix=A %s < %t1
 // RUN: FileCheck --check-prefix=BAR %s < %t1
 // RUN: FileCheck --check-prefix=FOOS %s < %t1
+// RUN: FileCheck --check-prefix=ADDRSPACE %s < %t1
 // END.
 
 static __attribute((annotate("sfoo_0"))) __attri

[PATCH] D71339: [VE,#2] Clang toolchain for SX-Aurora

2019-12-11 Thread Simon Moll via Phabricator via cfe-commits
simoll added a comment.

To clarify: this patch is not intended to be committed as-is but gives an 
overview of the required changes. It's the a patch of a series for the VE 
backend  and includes all the earlier 
patches.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71339/new/

https://reviews.llvm.org/D71339



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71340: [VE,#3] Runtime libraries

2019-12-11 Thread Simon Moll via Phabricator via cfe-commits
simoll added a comment.

To clarify: this patch is not intended to be committed as-is but gives an 
overview of the required changes. It's the a patch of a series for the VE 
backend  and includes all the earlier 
patches.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71340/new/

https://reviews.llvm.org/D71340



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] cb30ad7 - [SYCL] Add support for auxiliary triple specification to Frontend

2019-12-11 Thread Alexey Bader via cfe-commits

Author: Alexey Bader
Date: 2019-12-11T12:40:43+03:00
New Revision: cb30ad728f0b791c72a6a1399f36ebc60ad5

URL: 
https://github.com/llvm/llvm-project/commit/cb30ad728f0b791c72a6a1399f36ebc60ad5
DIFF: 
https://github.com/llvm/llvm-project/commit/cb30ad728f0b791c72a6a1399f36ebc60ad5.diff

LOG: [SYCL] Add support for auxiliary triple specification to Frontend

Summary:
Add host predefined macros to compilation for SYCL device, which is
required for pre-processing host specific includes (e.g. system
headers).

Reviewers: ABataev, jdoerfert

Subscribers: ebevhan, Anastasia, cfe-commits, keryell, Naghasan, Fznamznon

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71286

Signed-off-by: Alexey Bader 

Added: 
clang/test/Frontend/sycl-aux-triple.cpp

Modified: 
clang/lib/Frontend/CompilerInstance.cpp
clang/lib/Frontend/InitPreprocessor.cpp

Removed: 




diff  --git a/clang/lib/Frontend/CompilerInstance.cpp 
b/clang/lib/Frontend/CompilerInstance.cpp
index b69dc4f854ff..05ecc3f447cc 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -917,8 +917,9 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) {
   if (!hasTarget())
 return false;
 
-  // Create TargetInfo for the other side of CUDA and OpenMP compilation.
-  if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice) &&
+  // Create TargetInfo for the other side of CUDA/OpenMP/SYCL compilation.
+  if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice ||
+   getLangOpts().SYCLIsDevice) &&
   !getFrontendOpts().AuxTriple.empty()) {
 auto TO = std::make_shared();
 TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);

diff  --git a/clang/lib/Frontend/InitPreprocessor.cpp 
b/clang/lib/Frontend/InitPreprocessor.cpp
index c27c33c530f6..b1c7aed0d44e 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -1124,7 +1124,8 @@ void clang::InitializePreprocessor(
   if (InitOpts.UsePredefines) {
 // FIXME: This will create multiple definitions for most of the predefined
 // macros. This is not the right way to handle this.
-if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo())
+if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice || LangOpts.SYCLIsDevice) &&
+PP.getAuxTargetInfo())
   InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts,
  PP.getPreprocessorOpts(), Builder);
 

diff  --git a/clang/test/Frontend/sycl-aux-triple.cpp 
b/clang/test/Frontend/sycl-aux-triple.cpp
new file mode 100644
index ..38b6a24fb3ce
--- /dev/null
+++ b/clang/test/Frontend/sycl-aux-triple.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 %s -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM 
| FileCheck %s
+// RUN: %clang_cc1 %s -fsycl-is-device -triple spir -aux-triple 
x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
+
+// CHECK-NOT:#define __x86_64__ 1
+// CHECK-SYCL:#define __x86_64__ 1



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71286: [SYCL] Add support for auxiliary triple specification to Frontend

2019-12-11 Thread Alexey Bader via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcb30ad728f0b: [SYCL] Add support for auxiliary triple 
specification to Frontend (authored by bader).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71286/new/

https://reviews.llvm.org/D71286

Files:
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Frontend/sycl-aux-triple.cpp


Index: clang/test/Frontend/sycl-aux-triple.cpp
===
--- /dev/null
+++ clang/test/Frontend/sycl-aux-triple.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 %s -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM 
| FileCheck %s
+// RUN: %clang_cc1 %s -fsycl-is-device -triple spir -aux-triple 
x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
+
+// CHECK-NOT:#define __x86_64__ 1
+// CHECK-SYCL:#define __x86_64__ 1
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -1124,7 +1124,8 @@
   if (InitOpts.UsePredefines) {
 // FIXME: This will create multiple definitions for most of the predefined
 // macros. This is not the right way to handle this.
-if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo())
+if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice || LangOpts.SYCLIsDevice) &&
+PP.getAuxTargetInfo())
   InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts,
  PP.getPreprocessorOpts(), Builder);
 
Index: clang/lib/Frontend/CompilerInstance.cpp
===
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -917,8 +917,9 @@
   if (!hasTarget())
 return false;
 
-  // Create TargetInfo for the other side of CUDA and OpenMP compilation.
-  if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice) &&
+  // Create TargetInfo for the other side of CUDA/OpenMP/SYCL compilation.
+  if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice ||
+   getLangOpts().SYCLIsDevice) &&
   !getFrontendOpts().AuxTriple.empty()) {
 auto TO = std::make_shared();
 TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);


Index: clang/test/Frontend/sycl-aux-triple.cpp
===
--- /dev/null
+++ clang/test/Frontend/sycl-aux-triple.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 %s -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck %s
+// RUN: %clang_cc1 %s -fsycl-is-device -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
+
+// CHECK-NOT:#define __x86_64__ 1
+// CHECK-SYCL:#define __x86_64__ 1
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -1124,7 +1124,8 @@
   if (InitOpts.UsePredefines) {
 // FIXME: This will create multiple definitions for most of the predefined
 // macros. This is not the right way to handle this.
-if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo())
+if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice || LangOpts.SYCLIsDevice) &&
+PP.getAuxTargetInfo())
   InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts,
  PP.getPreprocessorOpts(), Builder);
 
Index: clang/lib/Frontend/CompilerInstance.cpp
===
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -917,8 +917,9 @@
   if (!hasTarget())
 return false;
 
-  // Create TargetInfo for the other side of CUDA and OpenMP compilation.
-  if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice) &&
+  // Create TargetInfo for the other side of CUDA/OpenMP/SYCL compilation.
+  if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice ||
+   getLangOpts().SYCLIsDevice) &&
   !getFrontendOpts().AuxTriple.empty()) {
 auto TO = std::make_shared();
 TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69979: clang: Guess at some platform FTZ/DAZ default settings

2019-12-11 Thread Sanjay Patel via Phabricator via cfe-commits
spatel added inline comments.



Comment at: clang/test/Driver/default-denormal-fp-math.c:7
+// crtfastmath enables ftz and daz
+// RUN: %clang -### -target x86_64-unknown-linux-gnu -ffast-math 
--sysroot=%S/Inputs/basic_linux_tree -c %s -v 2>&1 | FileCheck 
-check-prefix=CHECK-ZEROSIGN %s
+

The prefix should be PRESERVE_SIGN to match the flag?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69979/new/

https://reviews.llvm.org/D69979



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71197: llvm premerge: clang format test

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60624 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71197/new/

https://reviews.llvm.org/D71197



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71197: llvm premerge: clang format test

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

Build result: pass - 60624 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71197/new/

https://reviews.llvm.org/D71197



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71347: Add TimeTraceScope constructor without detail arg to simplify code where no detail required

2019-12-11 Thread Russell Gallop via Phabricator via cfe-commits
russell.gallop created this revision.
russell.gallop added a reviewer: anton-afanasyev.
Herald added subscribers: cfe-commits, arphaman, hiraditya.
Herald added projects: clang, LLVM.

Also don't write out detail when it is empty, which reduces size of generated 
traces.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71347

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/Parse/ParseAST.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Serialization/GlobalModuleIndex.cpp
  clang/tools/driver/cc1_main.cpp
  llvm/include/llvm/Support/TimeProfiler.h
  llvm/lib/Support/TimeProfiler.cpp

Index: llvm/lib/Support/TimeProfiler.cpp
===
--- llvm/lib/Support/TimeProfiler.cpp
+++ llvm/lib/Support/TimeProfiler.cpp
@@ -123,7 +123,9 @@
 J.attribute("ts", StartUs);
 J.attribute("dur", DurUs);
 J.attribute("name", E.Name);
-J.attributeObject("args", [&] { J.attribute("detail", E.Detail); });
+if (!E.Detail.empty()) {
+  J.attributeObject("args", [&] { J.attribute("detail", E.Detail); });
+}
   });
 }
 
Index: llvm/include/llvm/Support/TimeProfiler.h
===
--- llvm/include/llvm/Support/TimeProfiler.h
+++ llvm/include/llvm/Support/TimeProfiler.h
@@ -58,6 +58,10 @@
   TimeTraceScope(TimeTraceScope &&) = delete;
   TimeTraceScope &operator=(TimeTraceScope &&) = delete;
 
+  TimeTraceScope(StringRef Name) {
+if (TimeTraceProfilerInstance != nullptr)
+  timeTraceProfilerBegin(Name, StringRef(""));
+  }
   TimeTraceScope(StringRef Name, StringRef Detail) {
 if (TimeTraceProfilerInstance != nullptr)
   timeTraceProfilerBegin(Name, Detail);
Index: clang/tools/driver/cc1_main.cpp
===
--- clang/tools/driver/cc1_main.cpp
+++ clang/tools/driver/cc1_main.cpp
@@ -246,7 +246,7 @@
 
   // Execute the frontend actions.
   {
-llvm::TimeTraceScope TimeScope("ExecuteCompiler", StringRef(""));
+llvm::TimeTraceScope TimeScope("ExecuteCompiler");
 Success = ExecuteCompilerInvocation(Clang.get());
   }
 
Index: clang/lib/Serialization/GlobalModuleIndex.cpp
===
--- clang/lib/Serialization/GlobalModuleIndex.cpp
+++ clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -134,7 +134,7 @@
"' failed: " + toString(std::move(Err)));
   };
 
-  llvm::TimeTraceScope TimeScope("Module LoadIndex", StringRef(""));
+  llvm::TimeTraceScope TimeScope("Module LoadIndex");
   // Read the global index.
   bool InGlobalIndexBlock = false;
   bool Done = false;
@@ -770,7 +770,7 @@
   }
 
   using namespace llvm;
-  llvm::TimeTraceScope TimeScope("Module WriteIndex", StringRef(""));
+  llvm::TimeTraceScope TimeScope("Module WriteIndex");
 
   // Emit the file header.
   Stream.Emit((unsigned)'B', 8);
Index: clang/lib/Sema/Sema.cpp
===
--- clang/lib/Sema/Sema.cpp
+++ clang/lib/Sema/Sema.cpp
@@ -924,8 +924,7 @@
   }
 
   {
-llvm::TimeTraceScope TimeScope("PerformPendingInstantiations",
-   StringRef(""));
+llvm::TimeTraceScope TimeScope("PerformPendingInstantiations");
 PerformPendingInstantiations();
   }
 
Index: clang/lib/Parse/ParseAST.cpp
===
--- clang/lib/Parse/ParseAST.cpp
+++ clang/lib/Parse/ParseAST.cpp
@@ -151,7 +151,7 @@
   bool HaveLexer = S.getPreprocessor().getCurrentLexer();
 
   if (HaveLexer) {
-llvm::TimeTraceScope TimeScope("Frontend", StringRef(""));
+llvm::TimeTraceScope TimeScope("Frontend");
 P.Initialize();
 Parser::DeclGroupPtrTy ADecl;
 for (bool AtEOF = P.ParseFirstTopLevelDecl(ADecl); !AtEOF;
Index: clang/lib/CodeGen/CodeGenAction.cpp
===
--- clang/lib/CodeGen/CodeGenAction.cpp
+++ clang/lib/CodeGen/CodeGenAction.cpp
@@ -249,7 +249,7 @@
 
 void HandleTranslationUnit(ASTContext &C) override {
   {
-llvm::TimeTraceScope TimeScope("Frontend", StringRef(""));
+llvm::TimeTraceScope TimeScope("Frontend");
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
 if (FrontendTimesIsEnabled) {
   LLVMIRGenerationRefCount += 1;
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -896,7 +896,7 @@
 
   {
 PrettyStackTraceString CrashInfo("Per-function optimization");
-llvm::TimeTraceScope TimeScope("PerFunctionPasses", StringRef(""));
+llvm::TimeTraceScope TimeScope("PerFunctionPasses");
 
 PerFunctionPasses.doInitialization();
 for (Function &F : *TheModule)
@@ -907,13 +907,13 @@
 

[PATCH] D71320: [IR] Split out target specific intrinsic enums into separate headers

2019-12-11 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: llvm/include/llvm/Analysis/TargetTransformInfo.h:759
 Type *Ty) const;
-  int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
-Type *Ty) const;
+  int getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
+  Type *Ty) const;

For the sake of anyone downstream, it would be better to rename both overloads.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71320/new/

https://reviews.llvm.org/D71320



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71320: [IR] Split out target specific intrinsic enums into separate headers

2019-12-11 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Amazing!




Comment at: llvm/utils/TableGen/IntrinsicEmitter.cpp:161
 if (Ints[i].EnumName.size() < 40)
-  OS << std::string(40-Ints[i].EnumName.size(), ' ');
+  OS << std::string(40 - Ints[i].EnumName.size(), ' ');
 OS << " // " << Ints[i].Name << "\n";

`OS.indent(40 - Ints[i].EnumName.size());`



Comment at: llvm/utils/TableGen/IntrinsicEmitter.cpp:166
+  // Emit num_intrinsics into the target neutral enum.
+  if (IntrinsicPrefix == "") {
+OS << "num_intrinsics = " << (Ints.size() + 1) << "\n";

`IntrinsicPrefix.empty()`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71320/new/

https://reviews.llvm.org/D71320



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71320: [IR] Split out target specific intrinsic enums into separate headers

2019-12-11 Thread Reid Kleckner via Phabricator via cfe-commits
rnk marked an inline comment as done.
rnk added inline comments.



Comment at: llvm/include/llvm/Analysis/TargetTransformInfo.h:759
 Type *Ty) const;
-  int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
-Type *Ty) const;
+  int getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
+  Type *Ty) const;

efriedma wrote:
> For the sake of anyone downstream, it would be better to rename both 
> overloads.
Hm, true, when I wrote this, I think I found a way to do it such that the 
compiler told me about all the incorrect call sites. I forget the details, 
though, I did it over Thanksgiving.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71320/new/

https://reviews.llvm.org/D71320



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71320: [IR] Split out target specific intrinsic enums into separate headers

2019-12-11 Thread Reid Kleckner via Phabricator via cfe-commits
rnk created this revision.
rnk added reviewers: efriedma, echristo.
Herald added subscribers: cfe-commits, luismarques, apazos, sameer.abuasal, 
pzheng, s.egerton, lenary, dmgreen, Petar.Avramovic, jsji, jocewei, PkmX, 
the_o, brucehoult, MartinMosbeck, rogfer01, atanasyan, edward-jones, zzheng, 
MaskRay, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, kbarton, 
aheejin, hiraditya, jgravelle-google, sbc100, aprantl, mgorny, nhaehnle, 
jvesely, nemanjai, sdardis, dschuff, arsenm, jholewinski.
Herald added projects: clang, LLVM.

This has two main effects:

- Optimizes debug info size by saving 221.86 MB of obj file size in a Windows 
optimized+debug build of 'all'. This is 3.03% of 7,332.7MB of object file size.
- Incremental step towards decoupling target intrinsics.

The enums are still compact, so adding and removing a single
target-specific intrinsic will trigger a rebuild of all of LLVM.
Assigning distinct target id spaces is potential future work.

Part of PR34259

Depends on D71318 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71320

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGException.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  llvm/include/llvm/Analysis/TargetTransformInfo.h
  llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
  llvm/include/llvm/Analysis/VectorUtils.h
  llvm/include/llvm/IR/CMakeLists.txt
  llvm/include/llvm/IR/CallSite.h
  llvm/include/llvm/IR/Function.h
  llvm/include/llvm/IR/GlobalValue.h
  llvm/include/llvm/IR/InstrTypes.h
  llvm/include/llvm/IR/Intrinsics.h
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/Analysis/MemoryLocation.cpp
  llvm/lib/Analysis/TargetTransformInfo.cpp
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  llvm/lib/CodeGen/TypePromotion.cpp
  llvm/lib/CodeGen/WasmEHPrepare.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/IR/Function.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
  llvm/lib/Target/AArch64/AArch64StackTagging.cpp
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
  llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
  llvm/lib/Target/AMDGPU/AMDGPU.h
  llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
  llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
  llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
  llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMInstructionSelector.cpp
  llvm/lib/Target/ARM/ARMParallelDSP.cpp
  llvm/lib/Target/ARM/MVETailPredication.cpp
  llvm/lib/Target/BPF/BPFISelDAGToDAG.cpp
  llvm/lib/Target/Hexagon/HexagonGenExtract.cpp
  llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
  llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
  llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
  llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp
  llvm/lib/Target/Hexagon/HexagonOptimizeSZextends.cpp
  llvm/lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp
  llvm/lib/Target/Lanai/LanaiTargetTransformInfo.h
  llvm/lib/Target/Mips/MipsInstructionSelector.cpp
  llvm/lib/Target/Mips/MipsLegalizerInfo.cpp
  llvm/lib/Target/Mips/MipsSEISelDAGToDAG.cpp
  llvm/lib/Target/Mips/MipsSEISelLowering.cpp
  llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
  llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
  llvm/lib/Target/NVPTX/NVPTXImageOptimizer.cpp
  llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp
  llvm/lib/Target/NVPTX/NVVMIntrRange.cpp
  llvm/lib/Target/NVPTX/NVVMReflect.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
  llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
  llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
  llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
  llvm/lib/Target/SystemZ/SystemZTDC.cpp
  llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
  llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h
  llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/X86/X86FastISel.cpp
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/lib/Target/X86/X86InstructionSelector.cpp
  llvm/lib/Target/X86/X86IntrinsicsInfo.h
  llvm/lib/Target/X86/X86TargetTransformInfo.cpp
  llvm/lib/Target/X86/X86TargetTransformInfo.h
  llvm/lib/Target/X86/X86WinEHState.cpp
  llvm/lib/Target/XCore/XCoreISelDAGToDAG.cpp
  llvm/lib/Target/XCore/XCoreISelLowering.cpp
  llvm/lib/Target/XCore/XCoreLowerThreadLocal.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
  llvm/lib/Transforms/Instrumentation/MemorySanitize

[PATCH] D71341: [VE,#4] Target vector intrinsics

2019-12-11 Thread Simon Moll via Phabricator via cfe-commits
simoll added a comment.

In D71341#1779419 , @nhaehnle wrote:

> As a general rule, I think it would be preferable for patches such as this 
> one to be split up further, especially when they touch common code. For 
> example, why does a patch by the name "Target  vector intrinsics" contain a 
> change to SjLjEHPrepare?


This patch is not intended to be committed as-is but gives an overview of the 
required changes. It's the a patch of a series for the VE backend 
 and includes all the earlier patches.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71341/new/

https://reviews.llvm.org/D71341



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71340: [VE,#3] Runtime libraries

2019-12-11 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

In D71340#1779446 , @simoll wrote:

> To clarify: this patch is not intended to be committed as-is but gives an 
> overview of the required changes. It's the a patch of a series for the VE 
> backend  and includes all the 
> earlier patches.


Could you please make it incremental, ie //**not**// include all earlier 
patches? It's impossible to look at the proposed changes right now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71340/new/

https://reviews.llvm.org/D71340



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71320: [IR] Split out target specific intrinsic enums into separate headers

2019-12-11 Thread Eric Christopher via Phabricator via cfe-commits
echristo accepted this revision.
echristo added a comment.

SGTM and thank you :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71320/new/

https://reviews.llvm.org/D71320



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71341: [VE,#4] Target vector intrinsics

2019-12-11 Thread Nicolai Hähnle via Phabricator via cfe-commits
nhaehnle added a comment.

As a general rule, I think it would be preferable for patches such as this one 
to be split up further, especially when they touch common code. For example, 
why does a patch by the name "Target  vector intrinsics" contain a change to 
SjLjEHPrepare?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71341/new/

https://reviews.llvm.org/D71341



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71341: [VE,#4] Target vector intrinsics

2019-12-11 Thread Simon Moll via Phabricator via cfe-commits
simoll created this revision.
Herald added subscribers: llvm-commits, openmp-commits, libcxx-commits, 
Sanitizers, cfe-commits, jdoerfert, s.egerton, jfb, arphaman, dexonsmith, 
christof, simoncook, fedor.sergeev, aheejin, hiraditya, krytarowski, mgorny, 
dschuff, qcolombet.
Herald added a reviewer: jdoerfert.
Herald added projects: clang, Sanitizers, libc++, OpenMP, LLVM.

This is patch #4 in the patch series for the VE backend for NEC-SX Aurora.
This patch builds on the runtime library patch of 
https://reviews.llvm.org/D71340

This patch implements vel intrinsics for SX-Aurora. These target-specific 
vector intrinsics are documented here 
.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71341

Files:
  clang/include/clang/Basic/BuiltinsVE.def
  clang/include/clang/Basic/BuiltinsVEVL.gen.def
  clang/include/clang/Basic/TargetBuiltins.h
  clang/include/clang/Driver/Options.td
  clang/include/clang/module.modulemap
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/VE.cpp
  clang/lib/Basic/Targets/VE.h
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Arch/VE.cpp
  clang/lib/Driver/ToolChains/Arch/VE.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Clang.h
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Driver/ToolChains/VE.cpp
  clang/lib/Driver/ToolChains/VE.h
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/velintrin.h
  clang/lib/Headers/velintrin_approx.h
  clang/lib/Headers/velintrin_gen.h
  clang/test/Driver/ve-features.c
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  compiler-rt/cmake/base-config-ix.cmake
  compiler-rt/cmake/builtin-config-ix.cmake
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/builtins/CMakeLists.txt
  compiler-rt/lib/builtins/ve/llvm_grow_stack.S
  libcxx/src/filesystem/operations.cpp
  libcxxabi/cmake/config-ix.cmake
  libunwind/include/__libunwind_config.h
  libunwind/include/libunwind.h
  libunwind/src/Registers.hpp
  libunwind/src/Unwind-sjlj.c
  libunwind/src/libunwind.cpp
  llvm/CODE_OWNERS.TXT
  llvm/docs/VE/VectorLength.rst
  llvm/include/llvm/ADT/Triple.h
  llvm/include/llvm/BinaryFormat/ELF.h
  llvm/include/llvm/CodeGen/Passes.h
  llvm/include/llvm/CodeGen/ValueTypes.h
  llvm/include/llvm/CodeGen/ValueTypes.td
  llvm/include/llvm/IR/CallingConv.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/llvm/IR/IntrinsicsVE.td
  llvm/include/llvm/IR/IntrinsicsVEVL.gen.td
  llvm/include/llvm/Support/MachineValueType.h
  llvm/lib/CodeGen/SjLjEHPrepare.cpp
  llvm/lib/CodeGen/TargetPassConfig.cpp
  llvm/lib/CodeGen/ValueTypes.cpp
  llvm/lib/IR/Function.cpp
  llvm/lib/Support/Triple.cpp
  llvm/lib/Target/LLVMBuild.txt
  llvm/lib/Target/VE/AsmParser/CMakeLists.txt
  llvm/lib/Target/VE/AsmParser/LLVMBuild.txt
  llvm/lib/Target/VE/AsmParser/VEAsmParser.cpp
  llvm/lib/Target/VE/CMakeLists.txt
  llvm/lib/Target/VE/InstPrinter/CMakeLists.txt
  llvm/lib/Target/VE/InstPrinter/LLVMBuild.txt
  llvm/lib/Target/VE/InstPrinter/VEInstPrinter.cpp
  llvm/lib/Target/VE/InstPrinter/VEInstPrinter.h
  llvm/lib/Target/VE/LLVMBuild.txt
  llvm/lib/Target/VE/LVLGen.cpp
  llvm/lib/Target/VE/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/VE/MCTargetDesc/LLVMBuild.txt
  llvm/lib/Target/VE/MCTargetDesc/VEFixupKinds.h
  llvm/lib/Target/VE/MCTargetDesc/VEMCAsmInfo.cpp
  llvm/lib/Target/VE/MCTargetDesc/VEMCAsmInfo.h
  llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp
  llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.h
  llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.cpp
  llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.h
  llvm/lib/Target/VE/MCTargetDesc/VETargetStreamer.cpp
  llvm/lib/Target/VE/MCTargetDesc/VETargetStreamer.h
  llvm/lib/Target/VE/TargetInfo/CMakeLists.txt
  llvm/lib/Target/VE/TargetInfo/LLVMBuild.txt
  llvm/lib/Target/VE/TargetInfo/VETargetInfo.cpp
  llvm/lib/Target/VE/VE.h
  llvm/lib/Target/VE/VE.td
  llvm/lib/Target/VE/VEAsmPrinter.cpp
  llvm/lib/Target/VE/VECallingConv.td
  llvm/lib/Target/VE/VEFrameLowering.cpp
  llvm/lib/Target/VE/VEFrameLowering.h
  llvm/lib/Target/VE/VEISelDAGToDAG.cpp
  llvm/lib/Target/VE/VEISelLowering.cpp
  llvm/lib/Target/VE/VEISelLowering.h
  llvm/lib/Target/VE/VEInstrBuilder.h
  llvm/lib/Target/VE/VEInstrFormats.td
  llvm/lib/Target/VE/VEInstrInfo.cpp
  llvm/lib/Target/VE/VEInstrInfo.h
  llvm/lib/Target/VE/VEInstrInfo.td
  llvm/lib/Target/VE/VEInstrIntrinsicVL.gen.td
  llvm/lib/Target/VE/VEInstrIntrinsicVL.td
  llvm/lib/Target/VE/VEInstrPatternsVec.td
  llvm/lib/Target/VE/VEInstrVec.td
  llvm/lib/Target/VE/VEInstrVecVL.gen.td
  llvm/lib/Target/VE/VEInstrVecVL.td
  llvm/lib/Target/VE/VEMCInstLower.cpp
  llvm/lib/Target/VE/VEMachineFunctionInfo.cpp
  llvm/lib/Target/VE/VEMachineFunctionInfo.h
  llvm/lib/Target/VE/VERegisterInfo.c

Re: [clang] 9c39663 - Only Remove implicit conversion for the target that support fp16

2019-12-11 Thread Tsung Chun Lin via cfe-commits
Hi,

This is a missing fix for
https://reviews.llvm.org/rGcefac9dfaac9c806433ad88cca85bd2f3ba1edad

Jim


Roman Lebedev  於 2019年12月10日 週二 下午7:16寫道:

> Is there a test missing?
>
> On Tue, Dec 10, 2019 at 2:11 PM Jim Lin via cfe-commits
>  wrote:
> >
> >
> > Author: Jim Lin
> > Date: 2019-12-10T19:15:11+08:00
> > New Revision: 9c3966379813c198129c57aa3ebecd68d6af1ebd
> >
> > URL:
> https://github.com/llvm/llvm-project/commit/9c3966379813c198129c57aa3ebecd68d6af1ebd
> > DIFF:
> https://github.com/llvm/llvm-project/commit/9c3966379813c198129c57aa3ebecd68d6af1ebd.diff
> >
> > LOG: Only Remove implicit conversion for the target that support fp16
> >
> > Remove implicit conversion that promotes half to double
> > for the target that support fp16. If the target doesn't
> > support fp16, fp16 will be converted to fp16 intrinsic.
> >
> > Added:
> >
> >
> > Modified:
> > clang/lib/Sema/SemaChecking.cpp
> >
> > Removed:
> >
> >
> >
> >
> 
> > diff  --git a/clang/lib/Sema/SemaChecking.cpp
> b/clang/lib/Sema/SemaChecking.cpp
> > index 2be9ecec..aff63aef2934 100644
> > --- a/clang/lib/Sema/SemaChecking.cpp
> > +++ b/clang/lib/Sema/SemaChecking.cpp
> > @@ -5822,7 +5822,8 @@ bool Sema::SemaBuiltinFPClassification(CallExpr
> *TheCall, unsigned NumArgs) {
> >  "promotion from float to either float, double, or long
> double is "
> >  "the only expected cast here");
> >  IgnoreCast = true;
> > -  } else if
> (CastArg->getType()->isSpecificBuiltinType(BuiltinType::Half)) {
> > +  } else if
> (CastArg->getType()->isSpecificBuiltinType(BuiltinType::Half) &&
> > +
>  !Context.getTargetInfo().useFP16ConversionIntrinsics()) {
> >  assert(
> >
> (Cast->getType()->isSpecificBuiltinType(BuiltinType::Double) ||
> >   Cast->getType()->isSpecificBuiltinType(BuiltinType::Float)
> ||
> >
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71347: Add TimeTraceScope constructor without detail arg to simplify code where no detail required

2019-12-11 Thread Anton Afanasyev via Phabricator via cfe-commits
anton-afanasyev accepted this revision.
anton-afanasyev added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71347/new/

https://reviews.llvm.org/D71347



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6e9c589 - [Analyzer] Iterator Modeling: Print Container Data and Iterator Positions when printing the Program State

2019-12-11 Thread Adam Balogh via cfe-commits

Author: Adam Balogh
Date: 2019-12-11T14:20:17+01:00
New Revision: 6e9c58946bfe8eed7308a3b57611e225ad67

URL: 
https://github.com/llvm/llvm-project/commit/6e9c58946bfe8eed7308a3b57611e225ad67
DIFF: 
https://github.com/llvm/llvm-project/commit/6e9c58946bfe8eed7308a3b57611e225ad67.diff

LOG: [Analyzer] Iterator Modeling: Print Container Data and Iterator Positions 
when printing the Program State

Debugging the Iterator Modeling checker or any of the iterator checkers
is difficult without being able to see the relations between the
iterator variables and their abstract positions, as well as the abstract
symbols denoting the begin and the end of the container.

This patch adds the checker-specific part of the Program State printing
to the Iterator Modeling checker.

Added: 


Modified: 
clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
clang/test/Analysis/iterator-modelling.cpp

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp 
b/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
index 9730de0e4cd3..0a7015e85e93 100644
--- a/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
@@ -121,6 +121,9 @@ class IteratorModeling
   void handleEraseAfter(CheckerContext &C, const SVal &Iter) const;
   void handleEraseAfter(CheckerContext &C, const SVal &Iter1,
 const SVal &Iter2) const;
+  void printState(raw_ostream &Out, ProgramStateRef State, const char *NL,
+  const char *Sep) const override;
+
 public:
   IteratorModeling() {}
 
@@ -1080,6 +1083,58 @@ void IteratorModeling::handleEraseAfter(CheckerContext 
&C, const SVal &Iter1,
   C.addTransition(State);
 }
 
+void IteratorModeling::printState(raw_ostream &Out, ProgramStateRef State,
+  const char *NL, const char *Sep) const {
+
+  auto ContMap = State->get();
+
+  if (!ContMap.isEmpty()) {
+Out << Sep << "Container Data :" << NL;
+for (const auto Cont : ContMap) {
+  Cont.first->dumpToStream(Out);
+  Out << " : [ ";
+  const auto CData = Cont.second;
+  if (CData.getBegin())
+CData.getBegin()->dumpToStream(Out);
+  else
+Out << "";
+  Out << " .. ";
+  if (CData.getEnd())
+CData.getEnd()->dumpToStream(Out);
+  else
+Out << "";
+  Out << " ]" << NL;
+}
+  }
+
+  auto SymbolMap = State->get();
+  auto RegionMap = State->get();
+
+  if (!SymbolMap.isEmpty() || !RegionMap.isEmpty()) {
+Out << Sep << "Iterator Positions :" << NL;
+for (const auto Sym : SymbolMap) {
+  Sym.first->dumpToStream(Out);
+  Out << " : ";
+  const auto Pos = Sym.second;
+  Out << (Pos.isValid() ? "Valid" : "Invalid") << " ; Container == ";
+  Pos.getContainer()->dumpToStream(Out);
+  Out<<" ; Offset == ";
+  Pos.getOffset()->dumpToStream(Out);
+}
+
+for (const auto Reg : RegionMap) {
+  Reg.first->dumpToStream(Out);
+  Out << " : ";
+  const auto Pos = Reg.second;
+  Out << (Pos.isValid() ? "Valid" : "Invalid") << " ; Container == ";
+  Pos.getContainer()->dumpToStream(Out);
+  Out<<" ; Offset == ";
+  Pos.getOffset()->dumpToStream(Out);
+}
+  }
+}
+
+
 namespace {
 
 const CXXRecordDecl *getCXXRecordDecl(ProgramStateRef State,

diff  --git a/clang/test/Analysis/iterator-modelling.cpp 
b/clang/test/Analysis/iterator-modelling.cpp
index 92427528e7c0..2cd7b349be81 100644
--- a/clang/test/Analysis/iterator-modelling.cpp
+++ b/clang/test/Analysis/iterator-modelling.cpp
@@ -1,6 +1,9 @@
 // RUN: %clang_analyze_cc1 -std=c++11 
-analyzer-checker=core,cplusplus,debug.DebugIteratorModeling,debug.ExprInspection
 -analyzer-config aggressive-binary-operation-simplification=true 
-analyzer-config c++-container-inlining=false %s -verify
+
 // RUN: %clang_analyze_cc1 -std=c++11 
-analyzer-checker=core,cplusplus,debug.DebugIteratorModeling,debug.ExprInspection
 -analyzer-config aggressive-binary-operation-simplification=true 
-analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify
 
+// RUN: %clang_analyze_cc1 -std=c++11 
-analyzer-checker=core,cplusplus,alpha.cplusplus.IteratorModeling,debug.ExprInspection
 -analyzer-config aggressive-binary-operation-simplification=true %s 2>&1 | 
FileCheck %s
+
 #include "Inputs/system-header-simulator-cxx.h"
 
 template 
@@ -1970,3 +1973,29 @@ void non_std_find(std::vector &V, int e) {
 clang_analyzer_iterator_position(first)); // 
expected-warning@-1{{FALSE}} expected-warning@-1 0-1{{TRUE}} FIXME: should only 
expect FALSE in every case
   }
 }
+
+void clang_analyzer_printState();
+
+void print_state(std::vector &V) {
+  const auto i0 = V.cbegin();
+  clang_analyzer_printState();
+
+// CHECK:  "checker_messages": [
+// CHECK-NEXT:   { "checker": "alpha.cplusplus.IteratorModeling", "messages": [
+// C

[PATCH] D70912: [Analyzer] Iterator Modeling: Print Container Data and Iterator Positions when printing the Program State

2019-12-11 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware closed this revision.
baloghadamsoftware added a comment.

Closed by commit: https://reviews.llvm.org/rG6e9c58946eee


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70912/new/

https://reviews.llvm.org/D70912



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71340: [VE,#3] Runtime libraries

2019-12-11 Thread Simon Moll via Phabricator via cfe-commits
simoll updated this revision to Diff 233328.
simoll added a comment.

Trimmed down to library changes only.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71340/new/

https://reviews.llvm.org/D71340

Files:
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake
  compiler-rt/cmake/base-config-ix.cmake
  compiler-rt/cmake/builtin-config-ix.cmake
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/builtins/CMakeLists.txt
  compiler-rt/lib/builtins/ve/llvm_grow_stack.S
  libcxx/src/filesystem/operations.cpp
  libcxxabi/cmake/config-ix.cmake
  libunwind/include/__libunwind_config.h
  libunwind/include/libunwind.h
  libunwind/src/Registers.hpp
  libunwind/src/Unwind-sjlj.c
  libunwind/src/libunwind.cpp
  openmp/CMakeLists.txt
  openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
  openmp/runtime/CMakeLists.txt
  openmp/runtime/cmake/LibompUtils.cmake
  openmp/runtime/src/kmp.h
  openmp/runtime/src/kmp_affinity.h
  openmp/runtime/src/kmp_csupport.cpp
  openmp/runtime/src/kmp_os.h
  openmp/runtime/src/kmp_platform.h
  openmp/runtime/src/kmp_runtime.cpp
  openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h
  openmp/runtime/src/z_Linux_asm.S

Index: openmp/runtime/src/z_Linux_asm.S
===
--- openmp/runtime/src/z_Linux_asm.S
+++ openmp/runtime/src/z_Linux_asm.S
@@ -1741,7 +1741,7 @@
 .size __kmp_unnamed_critical_addr,4
 #endif /* KMP_ARCH_ARM */
 
-#if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64
+#if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_VE
 .data
 .comm .gomp_critical_user_,32,8
 .data
Index: openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h
===
--- openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h
+++ openmp/runtime/src/thirdparty/ittnotify/ittnotify_config.h
@@ -165,6 +165,10 @@
 #  define ITT_ARCH_RISCV64  7
 #endif /* ITT_ARCH_RISCV64 */
 
+#ifndef ITT_ARCH_VE
+#  define ITT_ARCH_VE  8
+#endif /* ITT_ARCH_VE */
+
 #ifndef ITT_ARCH
 #  if defined _M_IX86 || defined __i386__
 #define ITT_ARCH ITT_ARCH_IA32
@@ -184,6 +188,8 @@
 #define ITT_ARCH ITT_ARCH_MIPS64
 #  elif defined __riscv && __riscv_xlen == 64
 #define ITT_ARCH ITT_ARCH_RISCV64
+#  elif defined __ve__
+#define ITT_ARCH ITT_ARCH_VE
 #  endif
 #endif
 
@@ -338,7 +344,8 @@
 }
 #elif ITT_ARCH == ITT_ARCH_ARM || ITT_ARCH == ITT_ARCH_PPC64 ||\
 ITT_ARCH == ITT_ARCH_AARCH64 || ITT_ARCH == ITT_ARCH_MIPS ||   \
-ITT_ARCH == ITT_ARCH_MIPS64 || ITT_ARCH == ITT_ARCH_RISCV64
+ITT_ARCH == ITT_ARCH_MIPS64 || ITT_ARCH == ITT_ARCH_RISCV64 || \
+ITT_ARCH == ITT_ARCH_VE
 #define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
 #endif /* ITT_ARCH==ITT_ARCH_IA64 */
 #ifndef ITT_SIMPLE_INIT
Index: openmp/runtime/src/kmp_runtime.cpp
===
--- openmp/runtime/src/kmp_runtime.cpp
+++ openmp/runtime/src/kmp_runtime.cpp
@@ -8105,7 +8105,7 @@
 int atomic_available = FAST_REDUCTION_ATOMIC_METHOD_GENERATED;
 
 #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 ||   \
-KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64
+KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 || KMP_ARCH_VE
 
 #if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \
 KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HURD
Index: openmp/runtime/src/kmp_platform.h
===
--- openmp/runtime/src/kmp_platform.h
+++ openmp/runtime/src/kmp_platform.h
@@ -99,6 +99,7 @@
 #define KMP_ARCH_MIPS 0
 #define KMP_ARCH_MIPS64 0
 #define KMP_ARCH_RISCV64 0
+#define KMP_ARCH_VE 0
 
 #if KMP_OS_WINDOWS
 #if defined(_M_AMD64) || defined(__x86_64)
@@ -139,6 +140,9 @@
 #elif defined __riscv && __riscv_xlen == 64
 #undef KMP_ARCH_RISCV64
 #define KMP_ARCH_RISCV64 1
+#elif defined __ve__
+#undef KMP_ARCH_VE
+#define KMP_ARCH_VE 1
 #endif
 #endif
 
@@ -203,7 +207,8 @@
 // TODO: Fixme - This is clever, but really fugly
 #if (1 !=  \
  KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 +  \
- KMP_ARCH_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64 + KMP_ARCH_RISCV64)
+ KMP_ARCH_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64 + KMP_ARCH_RISCV64 +   \
+ KMP_ARCH_VE)
 #error Unknown or unsupported architecture
 #endif
 
Index: openmp/runtime/src/kmp_os.h
===
--- openmp/runtime/src/kmp_os.h
+++ openmp/runtime/src/kmp_os.h
@@ -166,7 +166,7 @@
 #if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS
 #define KMP_SIZE_T_SPEC KMP_UINT32_SPEC
 #elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \
-KMP_ARCH_MIPS

[PATCH] D70613: Add method to ignore invisible AST nodes

2019-12-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70613/new/

https://reviews.llvm.org/D70613



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] bb9254c - Removing an unused selection field from a diagnostic; NFC.

2019-12-11 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2019-12-11T08:48:55-05:00
New Revision: bb9254c00757ec376cde435676d27b14ee0c582f

URL: 
https://github.com/llvm/llvm-project/commit/bb9254c00757ec376cde435676d27b14ee0c582f
DIFF: 
https://github.com/llvm/llvm-project/commit/bb9254c00757ec376cde435676d27b14ee0c582f.diff

LOG: Removing an unused selection field from a diagnostic; NFC.

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticParseKinds.td

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 8643e1b867f7..63221d8758fc 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -63,7 +63,7 @@ def warn_null_statement : Warning<
 
 def warn_misleading_indentation : Warning<
   "misleading indentation; statement is not part of "
-  "the previous '%select{if|else|for|while|else if}0'">,
+  "the previous '%select{if|else|for|while}0'">,
   InGroup, DefaultIgnore;
 def note_previous_statement : Note<
   "previous statement is here">;



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71339: [VE,#2] Clang toolchain for SX-Aurora

2019-12-11 Thread Simon Moll via Phabricator via cfe-commits
simoll updated this revision to Diff 26.
simoll added a comment.

Trimmed to Clang changes only


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71339/new/

https://reviews.llvm.org/D71339

Files:
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Basic/Targets.cpp
  clang/lib/Basic/Targets/VE.cpp
  clang/lib/Basic/Targets/VE.h
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/Arch/VE.cpp
  clang/lib/Driver/ToolChains/Arch/VE.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Clang.h
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Driver/ToolChains/VE.cpp
  clang/lib/Driver/ToolChains/VE.h
  clang/lib/Frontend/CompilerInvocation.cpp

Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2980,7 +2980,8 @@
  Arch != llvm::Triple::x86;
 emitError |= (DefaultCC == LangOptions::DCC_VectorCall ||
   DefaultCC == LangOptions::DCC_RegCall) &&
- !(Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64);
+ !(Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64 ||
+   Arch == llvm::Triple::ve);
 if (emitError)
   Diags.Report(diag::err_drv_argument_not_allowed_with)
   << A->getSpelling() << T.getTriple();
Index: clang/lib/Driver/ToolChains/VE.h
===
--- /dev/null
+++ clang/lib/Driver/ToolChains/VE.h
@@ -0,0 +1,66 @@
+//===--- VE.h - VE ToolChain Implementations *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_VE_H
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_VE_H
+
+#include "Linux.h"
+#include "clang/Driver/ToolChain.h"
+
+namespace clang {
+namespace driver {
+namespace toolchains {
+
+class LLVM_LIBRARY_VISIBILITY VEToolChain : public Linux {
+public:
+  VEToolChain(const Driver &D, const llvm::Triple &Triple,
+  const llvm::opt::ArgList &Args);
+
+protected:
+  Tool *buildAssembler() const override;
+  Tool *buildLinker() const override;
+
+public:
+  bool isPICDefault() const override;
+  bool isPIEDefault() const override;
+  bool isPICDefaultForced() const override;
+  bool SupportsProfiling() const override;
+  bool hasBlocksRuntime() const override;
+  void
+  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args) const override;
+  void
+  addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args,
+Action::OffloadKind DeviceOffloadKind) const override;
+  void AddClangCXXStdlibIncludeArgs(
+  const llvm::opt::ArgList &DriverArgs,
+  llvm::opt::ArgStringList &CC1Args) const override;
+  void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
+   llvm::opt::ArgStringList &CmdArgs) const override;
+
+  llvm::ExceptionHandling
+  GetExceptionModel(const llvm::opt::ArgList &Args) const override;
+
+  CXXStdlibType
+  GetCXXStdlibType(const llvm::opt::ArgList &Args) const override {
+return ToolChain::CST_Libcxx;
+  }
+
+  RuntimeLibType GetDefaultRuntimeLibType() const override {
+return ToolChain::RLT_CompilerRT;
+  }
+
+  const char *getDefaultLinker() const override { return "nld"; }
+};
+
+} // end namespace toolchains
+} // end namespace driver
+} // end namespace clang
+
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_VE_H
Index: clang/lib/Driver/ToolChains/VE.cpp
===
--- /dev/null
+++ clang/lib/Driver/ToolChains/VE.cpp
@@ -0,0 +1,151 @@
+//===--- VE.cpp - VE ToolChain Implementations --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "VE.h"
+#include "CommonArgs.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/Options.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include  // ::getenv
+
+using namespace clang::driver;
+using namespace clang::driver::toolchains;
+using namesp

[PATCH] D71272: [OpenCL] Pretty print __private addr space

2019-12-11 Thread Alexey Bader via Phabricator via cfe-commits
bader added a subscriber: AlexeySotkin.
bader added a comment.

LGTM, but I'd like someone who works on OpenCL front-end to approve.
+@AlexeySotkin


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71272/new/

https://reviews.llvm.org/D71272



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70568: [Support] Possibly use exception handler in the Crash Recovery Context in the same way as global exceptions

2019-12-11 Thread Hans Wennborg via Phabricator via cfe-commits
hans added inline comments.



Comment at: clang/lib/Lex/Pragma.cpp:1108
   DebugOverflowStack();
-} else if (II->isStr("handle_crash")) {
-  llvm::CrashRecoveryContext *CRC 
=llvm::CrashRecoveryContext::GetCurrent();

This was added in http://llvm.org/r111449 and looks like it was just a 
debugging aid. Perhaps you could just remove it in a separate change (that is, 
without waiting for the rest of this change).



Comment at: llvm/include/llvm/Support/CrashRecoveryContext.h:103
+
+  /// Selects whether handling of exceptions should be done in the same way as
+  /// for global exceptions. When this is active, a crash would print the

The exception terminology only really applies on Windows. Maybe "Selects 
whether handling of failures should be done in the same way as for regular 
crashes. When this is active, ...".



Comment at: llvm/include/llvm/Support/Signals.h:115
+  /// - create a core/mini dump of the exception context whenever possible
+  void CleanupOnSignal(uintptr_t ExceptContext);
 } // End sys namespace

What is ExceptContext and what does CleanupOnSignal do with it?



Comment at: llvm/lib/Support/CrashRecoveryContext.cpp:65
 
-  void HandleCrash() {
+  void HandleCrash(int RetCode, uintptr_t ExceptContext) {
 // Eliminate the current context entry, to avoid re-entering in case the

It would be good to have a comment that explains the RetCode and ExceptContext 
parameters.



Comment at: llvm/lib/Support/CrashRecoveryContext.cpp:95
 
+static void Install() {
+  if (gCrashRecoveryEnabledCount <= 0)

Style nit: function names should start with lower-case letter. (The current 
code is not very consistent, but at least for new names we should try.)


Also, could this just just be part of (un)installExceptionOrSignalHandlers()? 
It Seems like it's essentially just doing some extra checks around calls to 
those, and it seems unfortunate to have both "install()" and 
"installExceptionOrSignalHandlers()", but one should not be called directly etc.


And on a higher level, it worries me that the set of possible states 
(enabled/disabled, installed/uninstalled) is so large. I guess this is because 
CrashRecoveryContexts can be nested and enabled individually?

Could we use asserts to make it clearer what states should be possible? For 
example, in Install() you do "if (gCrashRecoveryEnabledCount <= 0) return". Why 
would we even hit this code if there are no enabled contexts? Etc.



Comment at: llvm/lib/Support/CrashRecoveryContext.cpp:152
 
-void CrashRecoveryContext::Enable() {
-  std::lock_guard L(*gCrashRecoveryContextMutex);
-  // FIXME: Shouldn't this be a refcount or something?
-  if (gCrashRecoveryEnabled)
-return;
-  gCrashRecoveryEnabled = true;
-  installExceptionOrSignalHandlers();
-}
+void CrashRecoveryContext::Enable() { ++gCrashRecoveryEnabledCount; }
 

Don't we need to install it here?



Comment at: llvm/lib/Support/CrashRecoveryContext.cpp:200
+// occur inside the __except evaluation block
+static inline int ExceptionFilter(bool DumpStackAndCleanup,
+  _EXCEPTION_POINTERS *Except) {

I guess the "inline" is not necessary?



Comment at: llvm/lib/Support/Unix/Signals.inc:212
 static const int IntSigs[] = {
-  SIGHUP, SIGINT, SIGTERM, SIGUSR2
+  SIGHUP, SIGINT, SIGTERM, SIGUSR2, SIGPIPE
 };

This seems unrelated? Could it be done in a separate patch?



Comment at: llvm/lib/Support/Unix/Signals.inc:356
+
+  if (!llvm::is_contained(IntSigs, Sig))
+llvm::sys::RunSignalHandlers();

Isn't this redundant with the llvm::is_contained check above, after which we 
return?



Comment at: llvm/unittests/Support/CrashRecoveryTest.cpp:110
+  EXPECT_FALSE(CRC.RunSafely(nullDeref));
+  llvm::CrashRecoveryContext::Disable();
+  // refcount = 1

Isn't this a pretty surprising API, that after calling Disable(), it's still 
enabled?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70568/new/

https://reviews.llvm.org/D70568



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 855d21a - [Analyzer] Iterator Checkers: Replace `UnknownVal` in comparison result by a conjured value

2019-12-11 Thread Adam Balogh via cfe-commits

Author: Adam Balogh
Date: 2019-12-11T15:24:06+01:00
New Revision: 855d21a03ae841b7c6c980e92f67bd5b65287fa6

URL: 
https://github.com/llvm/llvm-project/commit/855d21a03ae841b7c6c980e92f67bd5b65287fa6
DIFF: 
https://github.com/llvm/llvm-project/commit/855d21a03ae841b7c6c980e92f67bd5b65287fa6.diff

LOG: [Analyzer] Iterator Checkers: Replace `UnknownVal` in comparison result by 
a conjured value

Sometimes the return value of a comparison operator call is
`UnkownVal`. Since no assumptions can be made on `UnknownVal`,
this leeds to keeping impossible execution paths in the
exploded graph resulting in poor performance and false
positives. To overcome this we replace unknown results of
iterator comparisons by conjured symbols.

Differential Revision: https://reviews.llvm.org/D70244

Added: 


Modified: 
clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
clang/test/Analysis/invalidated-iterator.cpp
clang/test/Analysis/iterator-modelling.cpp

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp 
b/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
index 0a7015e85e93..ab4e8112d677 100644
--- a/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
@@ -87,7 +87,7 @@ class IteratorModeling
 : public Checker,
  check::Bind, check::LiveSymbols, check::DeadSymbols> {
 
-  void handleComparison(CheckerContext &C, const Expr *CE, const SVal &RetVal,
+  void handleComparison(CheckerContext &C, const Expr *CE, SVal RetVal,
 const SVal &LVal, const SVal &RVal,
 OverloadedOperatorKind Op) const;
   void processComparison(CheckerContext &C, ProgramStateRef State,
@@ -499,9 +499,9 @@ void IteratorModeling::checkDeadSymbols(SymbolReaper &SR,
 }
 
 void IteratorModeling::handleComparison(CheckerContext &C, const Expr *CE,
-const SVal &RetVal, const SVal &LVal,
-const SVal &RVal,
-OverloadedOperatorKind Op) const {
+   SVal RetVal, const SVal &LVal,
+   const SVal &RVal,
+   OverloadedOperatorKind Op) const {
   // Record the operands and the operator of the comparison for the next
   // evalAssume, if the result is a symbolic expression. If it is a concrete
   // value (only one branch is possible), then transfer the state between
@@ -538,6 +538,16 @@ void IteratorModeling::handleComparison(CheckerContext &C, 
const Expr *CE,
 RPos = getIteratorPosition(State, RVal);
   }
 
+  // We cannot make assumpotions on `UnknownVal`. Let us conjure a symbol
+  // instead.
+  if (RetVal.isUnknown()) {
+auto &SymMgr = C.getSymbolManager();
+auto *LCtx = C.getLocationContext();
+RetVal = nonloc::SymbolVal(SymMgr.conjureSymbol(
+CE, LCtx, C.getASTContext().BoolTy, C.blockCount()));
+State = State->BindExpr(CE, LCtx, RetVal);
+  }
+
   processComparison(C, State, LPos->getOffset(), RPos->getOffset(), RetVal, 
Op);
 }
 
@@ -559,7 +569,7 @@ void IteratorModeling::processComparison(CheckerContext &C,
   const auto ConditionVal = RetVal.getAs();
   if (!ConditionVal)
 return;
-  
+
   if (auto StateTrue = relateSymbols(State, Sym1, Sym2, Op == OO_EqualEqual)) {
 StateTrue = StateTrue->assume(*ConditionVal, true);
 C.addTransition(StateTrue);

diff  --git a/clang/test/Analysis/invalidated-iterator.cpp 
b/clang/test/Analysis/invalidated-iterator.cpp
index 4505aedd4e36..a9ccc3b75834 100644
--- a/clang/test/Analysis/invalidated-iterator.cpp
+++ b/clang/test/Analysis/invalidated-iterator.cpp
@@ -120,4 +120,3 @@ void assignment(std::vector &V) {
   V.erase(i);
   auto j = V.cbegin(); // no-warning
 }
-

diff  --git a/clang/test/Analysis/iterator-modelling.cpp 
b/clang/test/Analysis/iterator-modelling.cpp
index 2cd7b349be81..3c981b27bbbf 100644
--- a/clang/test/Analysis/iterator-modelling.cpp
+++ b/clang/test/Analysis/iterator-modelling.cpp
@@ -1969,8 +1969,8 @@ void non_std_find(std::vector &V, int e) {
   clang_analyzer_eval(clang_analyzer_container_end(V) ==
   clang_analyzer_iterator_position(first)); // 
expected-warning@-1{{FALSE}} expected-warning@-1{{TRUE}}
   if (V.end() != first) {
-  clang_analyzer_eval(clang_analyzer_container_end(V) ==
-clang_analyzer_iterator_position(first)); // 
expected-warning@-1{{FALSE}} expected-warning@-1 0-1{{TRUE}} FIXME: should only 
expect FALSE in every case
+clang_analyzer_eval(clang_analyzer_container_end(V) ==
+clang_analyzer_iterator_position(first)); // 
expected-warning@-1{{FALSE}}
   }
 }
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
htt

[PATCH] D70244: [Analyzer] Iterator Checkers: Replace `UnknownVal` in comparison result by a conjured value

2019-12-11 Thread Balogh, Ádám via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG855d21a03ae8: [Analyzer] Iterator Checkers: Replace 
`UnknownVal` in comparison result by a… (authored by baloghadamsoftware).

Changed prior to commit:
  https://reviews.llvm.org/D70244?vs=229313&id=233347#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70244/new/

https://reviews.llvm.org/D70244

Files:
  clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
  clang/test/Analysis/invalidated-iterator.cpp
  clang/test/Analysis/iterator-modelling.cpp


Index: clang/test/Analysis/iterator-modelling.cpp
===
--- clang/test/Analysis/iterator-modelling.cpp
+++ clang/test/Analysis/iterator-modelling.cpp
@@ -1969,8 +1969,8 @@
   clang_analyzer_eval(clang_analyzer_container_end(V) ==
   clang_analyzer_iterator_position(first)); // 
expected-warning@-1{{FALSE}} expected-warning@-1{{TRUE}}
   if (V.end() != first) {
-  clang_analyzer_eval(clang_analyzer_container_end(V) ==
-clang_analyzer_iterator_position(first)); // 
expected-warning@-1{{FALSE}} expected-warning@-1 0-1{{TRUE}} FIXME: should only 
expect FALSE in every case
+clang_analyzer_eval(clang_analyzer_container_end(V) ==
+clang_analyzer_iterator_position(first)); // 
expected-warning@-1{{FALSE}}
   }
 }
 
Index: clang/test/Analysis/invalidated-iterator.cpp
===
--- clang/test/Analysis/invalidated-iterator.cpp
+++ clang/test/Analysis/invalidated-iterator.cpp
@@ -120,4 +120,3 @@
   V.erase(i);
   auto j = V.cbegin(); // no-warning
 }
-
Index: clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
+++ clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
@@ -87,7 +87,7 @@
 : public Checker,
  check::Bind, check::LiveSymbols, check::DeadSymbols> {
 
-  void handleComparison(CheckerContext &C, const Expr *CE, const SVal &RetVal,
+  void handleComparison(CheckerContext &C, const Expr *CE, SVal RetVal,
 const SVal &LVal, const SVal &RVal,
 OverloadedOperatorKind Op) const;
   void processComparison(CheckerContext &C, ProgramStateRef State,
@@ -499,9 +499,9 @@
 }
 
 void IteratorModeling::handleComparison(CheckerContext &C, const Expr *CE,
-const SVal &RetVal, const SVal &LVal,
-const SVal &RVal,
-OverloadedOperatorKind Op) const {
+   SVal RetVal, const SVal &LVal,
+   const SVal &RVal,
+   OverloadedOperatorKind Op) const {
   // Record the operands and the operator of the comparison for the next
   // evalAssume, if the result is a symbolic expression. If it is a concrete
   // value (only one branch is possible), then transfer the state between
@@ -538,6 +538,16 @@
 RPos = getIteratorPosition(State, RVal);
   }
 
+  // We cannot make assumpotions on `UnknownVal`. Let us conjure a symbol
+  // instead.
+  if (RetVal.isUnknown()) {
+auto &SymMgr = C.getSymbolManager();
+auto *LCtx = C.getLocationContext();
+RetVal = nonloc::SymbolVal(SymMgr.conjureSymbol(
+CE, LCtx, C.getASTContext().BoolTy, C.blockCount()));
+State = State->BindExpr(CE, LCtx, RetVal);
+  }
+
   processComparison(C, State, LPos->getOffset(), RPos->getOffset(), RetVal, 
Op);
 }
 
@@ -559,7 +569,7 @@
   const auto ConditionVal = RetVal.getAs();
   if (!ConditionVal)
 return;
-  
+
   if (auto StateTrue = relateSymbols(State, Sym1, Sym2, Op == OO_EqualEqual)) {
 StateTrue = StateTrue->assume(*ConditionVal, true);
 C.addTransition(StateTrue);


Index: clang/test/Analysis/iterator-modelling.cpp
===
--- clang/test/Analysis/iterator-modelling.cpp
+++ clang/test/Analysis/iterator-modelling.cpp
@@ -1969,8 +1969,8 @@
   clang_analyzer_eval(clang_analyzer_container_end(V) ==
   clang_analyzer_iterator_position(first)); // expected-warning@-1{{FALSE}} expected-warning@-1{{TRUE}}
   if (V.end() != first) {
-  clang_analyzer_eval(clang_analyzer_container_end(V) ==
-clang_analyzer_iterator_position(first)); // expected-warning@-1{{FALSE}} expected-warning@-1 0-1{{TRUE}} FIXME: should only expect FALSE in every case
+clang_analyzer_eval(clang_analyzer_container_end(V) ==
+clang_analyzer_iterator_position(first)); // expected-warning@-1{{FALSE}}
   }
 }
 
Index: clang/test/Analysis/invalidated-iterator.cpp
===
---

[clang] df494f7 - [Support] Add TimeTraceScope constructor without detail arg

2019-12-11 Thread Russell Gallop via cfe-commits

Author: Russell Gallop
Date: 2019-12-11T14:32:21Z
New Revision: df494f7512b0ecebdf3d7be97695a1b6278c0336

URL: 
https://github.com/llvm/llvm-project/commit/df494f7512b0ecebdf3d7be97695a1b6278c0336
DIFF: 
https://github.com/llvm/llvm-project/commit/df494f7512b0ecebdf3d7be97695a1b6278c0336.diff

LOG: [Support] Add TimeTraceScope constructor without detail arg

This simplifies code where no extra details are required
Also don't write out detail when it is empty.

Differential Revision: https://reviews.llvm.org/D71347

Added: 


Modified: 
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CodeGenAction.cpp
clang/lib/Parse/ParseAST.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Serialization/GlobalModuleIndex.cpp
clang/tools/driver/cc1_main.cpp
llvm/include/llvm/Support/TimeProfiler.h
llvm/lib/Support/TimeProfiler.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index a2261660eab8..c54d15dcdd58 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -896,7 +896,7 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
 
   {
 PrettyStackTraceString CrashInfo("Per-function optimization");
-llvm::TimeTraceScope TimeScope("PerFunctionPasses", StringRef(""));
+llvm::TimeTraceScope TimeScope("PerFunctionPasses");
 
 PerFunctionPasses.doInitialization();
 for (Function &F : *TheModule)
@@ -907,13 +907,13 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction 
Action,
 
   {
 PrettyStackTraceString CrashInfo("Per-module optimization passes");
-llvm::TimeTraceScope TimeScope("PerModulePasses", StringRef(""));
+llvm::TimeTraceScope TimeScope("PerModulePasses");
 PerModulePasses.run(*TheModule);
   }
 
   {
 PrettyStackTraceString CrashInfo("Code generation");
-llvm::TimeTraceScope TimeScope("CodeGenPasses", StringRef(""));
+llvm::TimeTraceScope TimeScope("CodeGenPasses");
 CodeGenPasses.run(*TheModule);
   }
 
@@ -1499,7 +1499,7 @@ void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
   BackendAction Action,
   std::unique_ptr OS) {
 
-  llvm::TimeTraceScope TimeScope("Backend", StringRef(""));
+  llvm::TimeTraceScope TimeScope("Backend");
 
   std::unique_ptr EmptyModule;
   if (!CGOpts.ThinLTOIndexFile.empty()) {

diff  --git a/clang/lib/CodeGen/CodeGenAction.cpp 
b/clang/lib/CodeGen/CodeGenAction.cpp
index 1fa1f621b353..7f3f358d3d98 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -249,7 +249,7 @@ namespace clang {
 
 void HandleTranslationUnit(ASTContext &C) override {
   {
-llvm::TimeTraceScope TimeScope("Frontend", StringRef(""));
+llvm::TimeTraceScope TimeScope("Frontend");
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
 if (FrontendTimesIsEnabled) {
   LLVMIRGenerationRefCount += 1;

diff  --git a/clang/lib/Parse/ParseAST.cpp b/clang/lib/Parse/ParseAST.cpp
index 3efd893e499c..01510e8caf3b 100644
--- a/clang/lib/Parse/ParseAST.cpp
+++ b/clang/lib/Parse/ParseAST.cpp
@@ -151,7 +151,7 @@ void clang::ParseAST(Sema &S, bool PrintStats, bool 
SkipFunctionBodies) {
   bool HaveLexer = S.getPreprocessor().getCurrentLexer();
 
   if (HaveLexer) {
-llvm::TimeTraceScope TimeScope("Frontend", StringRef(""));
+llvm::TimeTraceScope TimeScope("Frontend");
 P.Initialize();
 Parser::DeclGroupPtrTy ADecl;
 for (bool AtEOF = P.ParseFirstTopLevelDecl(ADecl); !AtEOF;

diff  --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 8d5972970fb7..c5bf6fea3f3a 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -924,8 +924,7 @@ void Sema::ActOnEndOfTranslationUnitFragment(TUFragmentKind 
Kind) {
   }
 
   {
-llvm::TimeTraceScope TimeScope("PerformPendingInstantiations",
-   StringRef(""));
+llvm::TimeTraceScope TimeScope("PerformPendingInstantiations");
 PerformPendingInstantiations();
   }
 

diff  --git a/clang/lib/Serialization/GlobalModuleIndex.cpp 
b/clang/lib/Serialization/GlobalModuleIndex.cpp
index dddee771da34..89a1c6cb8e69 100644
--- a/clang/lib/Serialization/GlobalModuleIndex.cpp
+++ b/clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -134,7 +134,7 @@ 
GlobalModuleIndex::GlobalModuleIndex(std::unique_ptr Buffer,
"' failed: " + toString(std::move(Err)));
   };
 
-  llvm::TimeTraceScope TimeScope("Module LoadIndex", StringRef(""));
+  llvm::TimeTraceScope TimeScope("Module LoadIndex");
   // Read the global index.
   bool InGlobalIndexBlock = false;
   bool Done = false;
@@ -770,7 +770,7 @@ bool 
GlobalModuleIndexBuilder::writeIndex(llvm::BitstreamWriter &Stream) {
   }
 
   using namespace llvm;
-  llvm::TimeTraceScope TimeScope("Module WriteIndex", StringRef(""));
+  llvm::TimeTraceScope Time

[PATCH] D69825: [Clang][Driver] Re-use the calling process instead of creating a new process for the cc1 invocation

2019-12-11 Thread Hans Wennborg via Phabricator via cfe-commits
hans marked an inline comment as done.
hans added a comment.

I'm basically happy with this, just some minor comments.




Comment at: clang/lib/Driver/Job.cpp:376
+   CrashReportInfo *CrashInfo) const {
+  OS << " Running the following in ExecuteCC1Tool():\n";
+  Command::Print(OS, Terminator, Quote, CrashInfo);

I think this gets printed by "clang -###" so maybe just print something short 
here. Perhaps just an "(in-process)" prefix? Then we don't need to change so 
many test expectations also.



Comment at: clang/lib/Driver/Job.cpp:394
+
+  llvm::CrashRecoveryContext::Enable();
+

Do we need to disable afterwards?



Comment at: clang/tools/driver/driver.cpp:313
+  llvm::cl::ResetAllOptionOccurrences();
+  StringRef Tool = argv[1] + 4;
   void *GetExecutablePathVP = (void *)(intptr_t) GetExecutablePath;

aganea wrote:
> hans wrote:
> > This feels a little risky to me. Do we still need to rely on argv[1], now 
> > that we have a nice CC1Command abstraction?
> Risky in what way? What would you suggest? The contents of `argv` are exactly 
> the same in both cases: when called from the CC1Command, or explicitly from 
> the command-line.
You're right, I suppose the code was already doing this.



Comment at: clang/tools/driver/driver.cpp:267
+
+  StringRef SpawnCC1Str = ::getenv("CLANG_SPAWN_CC1");
+  if (!SpawnCC1Str.empty()) {

Maybe just do the "!!" thing like for the environment variables above? It's not 
pretty, but at least that would be consistent, and it avoids the problem of 
deciding what values mean "on" and what mean "off".


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69825/new/

https://reviews.llvm.org/D69825



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71347: Add TimeTraceScope constructor without detail arg to simplify code where no detail required

2019-12-11 Thread Russell Gallop via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdf494f7512b0: [Support] Add TimeTraceScope constructor 
without detail arg (authored by russell.gallop).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71347/new/

https://reviews.llvm.org/D71347

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CodeGenAction.cpp
  clang/lib/Parse/ParseAST.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Serialization/GlobalModuleIndex.cpp
  clang/tools/driver/cc1_main.cpp
  llvm/include/llvm/Support/TimeProfiler.h
  llvm/lib/Support/TimeProfiler.cpp

Index: llvm/lib/Support/TimeProfiler.cpp
===
--- llvm/lib/Support/TimeProfiler.cpp
+++ llvm/lib/Support/TimeProfiler.cpp
@@ -123,7 +123,9 @@
 J.attribute("ts", StartUs);
 J.attribute("dur", DurUs);
 J.attribute("name", E.Name);
-J.attributeObject("args", [&] { J.attribute("detail", E.Detail); });
+if (!E.Detail.empty()) {
+  J.attributeObject("args", [&] { J.attribute("detail", E.Detail); });
+}
   });
 }
 
Index: llvm/include/llvm/Support/TimeProfiler.h
===
--- llvm/include/llvm/Support/TimeProfiler.h
+++ llvm/include/llvm/Support/TimeProfiler.h
@@ -58,6 +58,10 @@
   TimeTraceScope(TimeTraceScope &&) = delete;
   TimeTraceScope &operator=(TimeTraceScope &&) = delete;
 
+  TimeTraceScope(StringRef Name) {
+if (TimeTraceProfilerInstance != nullptr)
+  timeTraceProfilerBegin(Name, StringRef(""));
+  }
   TimeTraceScope(StringRef Name, StringRef Detail) {
 if (TimeTraceProfilerInstance != nullptr)
   timeTraceProfilerBegin(Name, Detail);
Index: clang/tools/driver/cc1_main.cpp
===
--- clang/tools/driver/cc1_main.cpp
+++ clang/tools/driver/cc1_main.cpp
@@ -246,7 +246,7 @@
 
   // Execute the frontend actions.
   {
-llvm::TimeTraceScope TimeScope("ExecuteCompiler", StringRef(""));
+llvm::TimeTraceScope TimeScope("ExecuteCompiler");
 Success = ExecuteCompilerInvocation(Clang.get());
   }
 
Index: clang/lib/Serialization/GlobalModuleIndex.cpp
===
--- clang/lib/Serialization/GlobalModuleIndex.cpp
+++ clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -134,7 +134,7 @@
"' failed: " + toString(std::move(Err)));
   };
 
-  llvm::TimeTraceScope TimeScope("Module LoadIndex", StringRef(""));
+  llvm::TimeTraceScope TimeScope("Module LoadIndex");
   // Read the global index.
   bool InGlobalIndexBlock = false;
   bool Done = false;
@@ -770,7 +770,7 @@
   }
 
   using namespace llvm;
-  llvm::TimeTraceScope TimeScope("Module WriteIndex", StringRef(""));
+  llvm::TimeTraceScope TimeScope("Module WriteIndex");
 
   // Emit the file header.
   Stream.Emit((unsigned)'B', 8);
Index: clang/lib/Sema/Sema.cpp
===
--- clang/lib/Sema/Sema.cpp
+++ clang/lib/Sema/Sema.cpp
@@ -924,8 +924,7 @@
   }
 
   {
-llvm::TimeTraceScope TimeScope("PerformPendingInstantiations",
-   StringRef(""));
+llvm::TimeTraceScope TimeScope("PerformPendingInstantiations");
 PerformPendingInstantiations();
   }
 
Index: clang/lib/Parse/ParseAST.cpp
===
--- clang/lib/Parse/ParseAST.cpp
+++ clang/lib/Parse/ParseAST.cpp
@@ -151,7 +151,7 @@
   bool HaveLexer = S.getPreprocessor().getCurrentLexer();
 
   if (HaveLexer) {
-llvm::TimeTraceScope TimeScope("Frontend", StringRef(""));
+llvm::TimeTraceScope TimeScope("Frontend");
 P.Initialize();
 Parser::DeclGroupPtrTy ADecl;
 for (bool AtEOF = P.ParseFirstTopLevelDecl(ADecl); !AtEOF;
Index: clang/lib/CodeGen/CodeGenAction.cpp
===
--- clang/lib/CodeGen/CodeGenAction.cpp
+++ clang/lib/CodeGen/CodeGenAction.cpp
@@ -249,7 +249,7 @@
 
 void HandleTranslationUnit(ASTContext &C) override {
   {
-llvm::TimeTraceScope TimeScope("Frontend", StringRef(""));
+llvm::TimeTraceScope TimeScope("Frontend");
 PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
 if (FrontendTimesIsEnabled) {
   LLVMIRGenerationRefCount += 1;
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -896,7 +896,7 @@
 
   {
 PrettyStackTraceString CrashInfo("Per-function optimization");
-llvm::TimeTraceScope TimeScope("PerFunctionPasses", StringRef(""));
+llvm::TimeTraceScope TimeScope("PerFunctionPasses");
 
 PerFunctionPasses.doInitialization();
 for (Function &F : *TheModule)
@@ -907,13 +907,13 @@
 
   {
   

[PATCH] D71197: llvm premerge: clang format test

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon check-circle color=green} Unit tests: pass. 60624 tests passed, 0 failed 
and 726 were skipped.

{icon times-circle color=red} clang-format: fail. Please format your changes 
with clang-format by running `git-clang-format HEAD^` or apply this patch 
.

Build artifacts 
: 
console-log.txt 
,
 CMakeCache.txt 
,
 clang-format.patch 
,
 test-results.xml 
,
 diff.json 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71197/new/

https://reviews.llvm.org/D71197



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-11 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added reviewers: ilya-biryukov, kbobyrev.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Useful when positions are used to target nodes, with before/after ambiguity.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71356

Files:
  clang/include/clang/Tooling/Syntax/Tokens.h
  clang/lib/Tooling/Syntax/Tokens.cpp
  clang/unittests/Tooling/Syntax/TokensTest.cpp

Index: clang/unittests/Tooling/Syntax/TokensTest.cpp
===
--- clang/unittests/Tooling/Syntax/TokensTest.cpp
+++ clang/unittests/Tooling/Syntax/TokensTest.cpp
@@ -793,4 +793,45 @@
 ActualMacroRanges.push_back(Expansion->range(SM));
   EXPECT_EQ(ExpectedMacroRanges, ActualMacroRanges);
 }
+
+TEST_F(TokenBufferTest, Touching) {
+  llvm::Annotations Code("^i^nt^ ^a^b^=^1;^");
+  recordTokens(Code.code());
+
+  auto Touching = [&](int Index) {
+SourceLocation Loc = SourceMgr->getComposedLoc(SourceMgr->getMainFileID(),
+   Code.points()[Index]);
+return spelledTokensTouching(Loc, Buffer);
+  };
+  auto Identifier = [&](int Index) {
+SourceLocation Loc = SourceMgr->getComposedLoc(SourceMgr->getMainFileID(),
+   Code.points()[Index]);
+const syntax::Token *Tok = spelledIdentifierTouching(Loc, Buffer);
+return Tok ? Tok->text(*SourceMgr) : "";
+  };
+
+  EXPECT_THAT(Touching(0), SameRange(findSpelled("int")));
+  EXPECT_EQ(Identifier(0), "");
+  EXPECT_THAT(Touching(1), SameRange(findSpelled("int")));
+  EXPECT_EQ(Identifier(1), "");
+  EXPECT_THAT(Touching(2), SameRange(findSpelled("int")));
+  EXPECT_EQ(Identifier(2), "");
+
+  EXPECT_THAT(Touching(3), SameRange(findSpelled("ab")));
+  EXPECT_EQ(Identifier(3), "ab");
+  EXPECT_THAT(Touching(4), SameRange(findSpelled("ab")));
+  EXPECT_EQ(Identifier(4), "ab");
+
+  EXPECT_THAT(Touching(5), SameRange(findSpelled("ab =")));
+  EXPECT_EQ(Identifier(5), "ab");
+
+  EXPECT_THAT(Touching(6), SameRange(findSpelled("= 1")));
+  EXPECT_EQ(Identifier(6), "");
+
+  EXPECT_THAT(Touching(7), SameRange(findSpelled(";")));
+  EXPECT_EQ(Identifier(7), "");
+
+  ASSERT_EQ(Code.points().size(), 8u);
+}
+
 } // namespace
Index: clang/lib/Tooling/Syntax/Tokens.cpp
===
--- clang/lib/Tooling/Syntax/Tokens.cpp
+++ clang/lib/Tooling/Syntax/Tokens.cpp
@@ -248,6 +248,29 @@
   return E;
 }
 
+llvm::ArrayRef
+syntax::spelledTokensTouching(SourceLocation Loc,
+  const syntax::TokenBuffer &Tokens) {
+  assert(Loc.isFileID());
+  llvm::ArrayRef All =
+  Tokens.spelledTokens(Tokens.sourceManager().getFileID(Loc));
+  // SourceLocation < SourceLocation is OK for one file ID.
+  auto *Right = llvm::partition_point(
+  All, [&](const syntax::Token &Tok) { return Tok.location() < Loc; });
+  bool AcceptRight = Right != All.end() && !(Loc < Right->location());
+  bool AcceptLeft = Right != All.begin() && !((Right - 1)->endLocation() < Loc);
+  return llvm::makeArrayRef(Right - int(AcceptLeft), Right + int(AcceptRight));
+}
+
+const syntax::Token *
+syntax::spelledIdentifierTouching(SourceLocation Loc,
+  const syntax::TokenBuffer &Tokens) {
+  for (const syntax::Token &Tok : spelledTokensTouching(Loc, Tokens))
+if (Tok.kind() == tok::identifier)
+  return &Tok;
+  return nullptr;
+}
+
 std::vector
 TokenBuffer::macroExpansions(FileID FID) const {
   auto FileIt = Files.find(FID);
Index: clang/include/clang/Tooling/Syntax/Tokens.h
===
--- clang/include/clang/Tooling/Syntax/Tokens.h
+++ clang/include/clang/Tooling/Syntax/Tokens.h
@@ -309,6 +309,17 @@
   const SourceManager *SourceMgr;
 };
 
+/// The spelled tokens that overlap or touch a spelling location Loc.
+/// This always returns 0-2 tokens.
+llvm::ArrayRef
+spelledTokensTouching(SourceLocation Loc, const syntax::TokenBuffer &Tokens);
+
+/// The identifier token that overlaps or touches a spelling location Loc.
+/// If there is none, returns nullptr.
+const syntax::Token *
+spelledIdentifierTouching(SourceLocation Loc,
+  const syntax::TokenBuffer &Tokens);
+
 /// Lex the text buffer, corresponding to \p FID, in raw mode and record the
 /// resulting spelled tokens. Does minimal post-processing on raw identifiers,
 /// setting the appropriate token kind (instead of the raw_identifier reported
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70401: [WIP][RISCV] Implement ilp32e ABI

2019-12-11 Thread Sam Elliott via Phabricator via cfe-commits
lenary added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:1525
   unsigned TwoXLenInBytes = (2 * XLen) / 8;
   if (!IsFixed && ArgFlags.getOrigAlign() == TwoXLenInBytes &&
   DL.getTypeAllocSize(OrigTy) == TwoXLenInBytes) {

shiva0217 wrote:
> The variadic argument for ilp32e doesn't need to align to even register. We 
> could also add a test line in vararg.ll.
I'm not sure I agree with this interpretation of the psABI. The [[ 
https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#ilp32e-calling-convention
 | ILP32E Section ]] makes no exception for variadic arguments, and the base 
calling convention is only defined in relation to `XLEN`, not in terms of stack 
alignment.

I will add a test to `vararg.ll` so the behaviour is at least tested. 



Comment at: llvm/test/CodeGen/RISCV/callee-saved-fpr64s.ll:11
+; This test currently fails because the machine code does not validate:
+; RUN: not llc -mtriple=riscv32 -mattr=+d -target-abi ilp32e 
-verify-machineinstrs < %s
+; It will need FileCheck %s -check-prefix=ILP32-LP64-NO-D

lenary wrote:
> shiva0217 wrote:
> > shiva0217 wrote:
> > > Jim wrote:
> > > > shiva0217 wrote:
> > > > > lenary wrote:
> > > > > > @shiva0217 I think this test is failing because of the base pointer 
> > > > > > patch, but I'm not sure. Can you look at the issue? It thinks that 
> > > > > > x8 gets killed by a store (which I don't think should be using x8), 
> > > > > > and therefore x8 is not live when we come to the epilog. It's a 
> > > > > > super confusing issue.
> > > > > Hi @lenary, it seems that hasBP() return false in this case, the 
> > > > > issue trigger by register allocation allocating x8 which should be 
> > > > > preserved. I'm not sure why it will happen, I try to write a simple C 
> > > > > code to reproduce the case but fail to do that. Could you obtain the 
> > > > > C code for the test case?
> > > > It seems that RISCVRegisterInfo::getReservedRegs doesn't add x8(fp) 
> > > > into reserved registers (TFI->hasFP(MF) return false), then x8 is a 
> > > > candidate register for register allocation. After register allocation, 
> > > > some of fpr64 splitted into stack that makes stack need to be realign 
> > > > (MaxAlignment(8) > StackAlignment(4)), therefore x8 should be used as 
> > > > frame pointer (TFI->hasFP(MF) return true). In emitting epilogue, 
> > > > instructions for fp adjustment is inserted.
> > > With the investigation from @Jim, here is the simple C could reproduce 
> > > the case.
> > >   extern double var;
> > >   extern void callee();
> > >   void test(){
> > > double val = var;
> > > callee();
> > > var = val;
> > >   }
> > > Thanks, @Jim 
> > There're might be few ways to fix the issue:
> > 1. hasFP() return true for ilp32e ABI with feature D
> > 2. hasFP() return true for ilp32e ABI with feature D and there's is a 
> > virtual register with f64 type.
> > 3. Not allow  ilp32e ABI with feature D.
> > Given that most of the targets supported double float instructions have 
> > stack alignment at least eight bytes to avoid frequently realignment. Would 
> > it more reasonable to have a new embedded ABI with stack alignment at least 
> > eight bytes to support feature D?
> @Jim, @shiva0217, thank you very much for tracking down this bug, and 
> providing a small testcase, that's very helpful.
> 
> We talked about this on the call this week, and I indicated I was going to go 
> with a solution as close to 2 as I could.
> 
> I have since started an investigation (which I hoped would be quicker than it 
> is) of what happens if we implement `canRealignStackFrame` to check if FP is 
> unused, and this also seems to solve the problem. I'm doing some deeper 
> checks (which require implementing parts of the backend around MIR that I 
> haven't looked at before), but I think this might be a better solution? I'll 
> keep this patch updated on when I upload the fix for stack realignment to 
> cover this case. In the case that this fix isn't enough, I'll look to 
> implement solution 2.
> 
> In any case, it's evident that allocating a spill slot for a register that 
> has higher spill alignment than the stack slot, is the kernel of the problem, 
> and this may arise again depending on how we choose to implement other 
> extensions.
> 
> 
I couldn't find a reasonable way to check for a virtual (or physical) register 
of type fp64, without iterating over all the instructions in a function, which 
I'd prefer not to do.

So Instead I have implemented option 1 in `hasFP`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70401/new/

https://reviews.llvm.org/D70401



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71062: [ARM][MVE] Add vector reduction intrinsics with two vector operands

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon check-circle color=green} Unit tests: pass. 60714 tests passed, 0 failed 
and 726 were skipped.

{icon times-circle color=red} clang-format: fail. Please format your changes 
with clang-format by running `git-clang-format HEAD^` or apply this patch 
.

Build artifacts 
: 
console-log.txt 
,
 CMakeCache.txt 
,
 clang-format.patch 
,
 test-results.xml 
,
 diff.json 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71062/new/

https://reviews.llvm.org/D71062



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon check-circle color=green} Unit tests: pass. 60699 tests passed, 0 failed 
and 726 were skipped.

{icon times-circle color=red} clang-format: fail. Please format your changes 
with clang-format by running `git-clang-format HEAD^` or apply this patch 
.

Build artifacts 
: 
console-log.txt 
,
 CMakeCache.txt 
,
 clang-format.patch 
,
 test-results.xml 
,
 diff.json 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71356/new/

https://reviews.llvm.org/D71356



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71356: [Tooling/Syntax] Helpers to find spelled tokens touching a location.

2019-12-11 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added inline comments.



Comment at: clang/include/clang/Tooling/Syntax/Tokens.h:320
+const syntax::Token *
+spelledIdentifierTouching(SourceLocation Loc,
+  const syntax::TokenBuffer &Tokens);

Maybe `llvm::Optional<>` here?



Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:254
+  const syntax::TokenBuffer &Tokens) {
+  assert(Loc.isFileID());
+  llvm::ArrayRef All =

Nit: maybe mention this requirement in the header comment?



Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:257
+  Tokens.spelledTokens(Tokens.sourceManager().getFileID(Loc));
+  // SourceLocation < SourceLocation is OK for one file ID.
+  auto *Right = llvm::partition_point(

Nit: "Comparing SourceLocations within one file using operator less/< is a 
valid operation"? Can't come up with something better, but this is slightly 
hard to understand.



Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:262
+  bool AcceptLeft = Right != All.begin() && !((Right - 1)->endLocation() < 
Loc);
+  return llvm::makeArrayRef(Right - int(AcceptLeft), Right + int(AcceptRight));
+}

Nit: static casts here or in variable declarations?



Comment at: clang/lib/Tooling/Syntax/Tokens.cpp:267
+syntax::spelledIdentifierTouching(SourceLocation Loc,
+  const syntax::TokenBuffer &Tokens) {
+  for (const syntax::Token &Tok : spelledTokensTouching(Loc, Tokens))

The formatting looks weird here, does it come from Clang-Format?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71356/new/

https://reviews.llvm.org/D71356



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71239: [clang-format] Fix ObjC keywords following try/catch getting split.

2019-12-11 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1849
+  } while (FormatTok->is(tok::comment));
+}
 if (!(FormatTok->isOneOf(tok::kw_catch, Keywords.kw___except,

Bigcheese wrote:
> MyDeveloperDay wrote:
> > can you use `FormatTok->getNextNonComment()`?
> No, `Next` has not been setup at this point, so it will always return 
> `nullptr`.
There is something about what we are doing here which doesn't feel correct...If 
you look in FormatTokenLexer why are we not doing something similar here for 
@try and @catch as we are doing for @"ABC" (see below tryMergeNSStringLiteral)

The FormatTokenLexer can merge together a number of tokens into a new single 
token and combined text, after that nothing can split that token, meaning the 
`@` and `try` will never become separated and will simply be treated as a "@try"

This can be useful because you can set the new setKind() to be "tok::try" after 
which `@try` will behave just like a normal `try` for all rules without the 
constant need to keep checking if the previous token is an `@`

```
bool FormatTokenLexer::tryMergeNSStringLiteral() {
  if (Tokens.size() < 2)
return false;
  auto &At = *(Tokens.end() - 2);
  auto &String = *(Tokens.end() - 1);
  if (!At->is(tok::at) || !String->is(tok::string_literal))
return false;
  At->Tok.setKind(tok::string_literal);
  At->TokenText = StringRef(At->TokenText.begin(),
String->TokenText.end() - At->TokenText.begin());
  At->ColumnWidth += String->ColumnWidth;
  At->Type = TT_ObjCStringLiteral;
  Tokens.erase(Tokens.end() - 1);
  return true;
}
```




Comment at: clang/unittests/Format/FormatTestObjC.cpp:200
+   "} @catch (NSException *e) {\n"
+   "}\n");
   verifyFormat("DEBUG({\n"

Bigcheese wrote:
> MyDeveloperDay wrote:
> > Nit: Could you not keep the original test? just add a new testcase? I get 
> > uncomfortable about changing tests no matter how trivial
> Is there something special about clang-format that causes this concern? I'm 
> all for testing separate things separately, but the additions to this test 
> are testing the same leaf lines of code.
as you are scanning back, I'd like to know we haven't broken the previous tests 
behaviour.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71239/new/

https://reviews.llvm.org/D71239



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71241: [OpenMP][WIP] Use overload centric declare variants

2019-12-11 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

Here is the example that does not work with the proposed solution but works 
with the existing one:

  static void cpu() { asm("nop"); }
  
  #pragma omp declare variant(cpu) match(device = {kind(cpu)})
  static __attribute__((used)) void wrong_asm() {
asm ("xxx");
  }

The existing solution has some problems with the delayed error messages too, 
but they are very easy to fix.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71241/new/

https://reviews.llvm.org/D71241



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71345: [clangd] Fall back to selecting token-before-cursor if token-after-cursor fails.

2019-12-11 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 233364.
sammccall added a comment.

Make tweaktests do the fallback dance so that they test how the feature 
actually works.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71345/new/

https://reviews.llvm.org/D71345

Files:
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/Selection.cpp
  clang-tools-extra/clangd/Selection.h
  clang-tools-extra/clangd/SemanticSelection.cpp
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/refactor/Tweak.cpp
  clang-tools-extra/clangd/refactor/Tweak.h
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang-tools-extra/clangd/unittests/SelectionTests.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.cpp
  clang-tools-extra/clangd/unittests/TweakTests.cpp

Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -1903,7 +1903,7 @@
   // Basic check for function body and signature.
   EXPECT_AVAILABLE(R"cpp(
 class Bar {
-  [[void [[f^o^o]]() [[{ return; }
+  [[void [[f^o^o^]]() [[{ return; }
 };
 
 void foo();
Index: clang-tools-extra/clangd/unittests/TweakTesting.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTesting.cpp
+++ clang-tools-extra/clangd/unittests/TweakTesting.cpp
@@ -63,12 +63,30 @@
   cantFail(positionToOffset(A.code(), SelectionRng.end))};
 }
 
+// Prepare and apply the specified tweak based on the selection in Input.
+// Returns None if and only if prepare() failed.
+llvm::Optional> 
+applyTweak(ParsedAST &AST, const Annotations &Input, StringRef TweakID,
+const SymbolIndex *Index) {
+  auto Range = rangeOrPoint(Input);
+  for (auto &Selection : SelectionTree::create(
+   AST.getASTContext(), AST.getTokens(), Range.first, Range.second)) {
+Tweak::Selection S(Index, AST, Range.first, Range.second,
+   std::move(Selection));
+auto T = prepareTweak(TweakID, S);
+if (T)
+  return (*T)->apply(S);
+else
+  consumeError(T.takeError());
+  }
+  return llvm::None;
+}
+
 MATCHER_P7(TweakIsAvailable, TweakID, Ctx, Header, ExtraArgs, ExtraFiles, Index,
FileName,
(TweakID + (negation ? " is unavailable" : " is available")).str()) {
   std::string WrappedCode = wrap(Ctx, arg);
   Annotations Input(WrappedCode);
-  auto Selection = rangeOrPoint(Input);
   TestTU TU;
   TU.Filename = FileName;
   TU.HeaderCode = Header;
@@ -76,12 +94,11 @@
   TU.ExtraArgs = ExtraArgs;
   TU.AdditionalFiles = std::move(ExtraFiles);
   ParsedAST AST = TU.build();
-  Tweak::Selection S(Index, AST, Selection.first, Selection.second);
-  auto PrepareResult = prepareTweak(TweakID, S);
-  if (PrepareResult)
-return true;
-  llvm::consumeError(PrepareResult.takeError());
-  return false;
+  auto Result = applyTweak(AST, Input, TweakID, Index);
+  // We only care if prepare() succeeded, but must handle Errors.
+  if (Result && !*Result)
+consumeError(Result->takeError());
+  return Result.hasValue();
 }
 
 } // namespace
@@ -90,8 +107,6 @@
  llvm::StringMap *EditedFiles) const {
   std::string WrappedCode = wrap(Context, MarkedCode);
   Annotations Input(WrappedCode);
-  auto Selection = rangeOrPoint(Input);
-
   TestTU TU;
   TU.Filename = FileName;
   TU.HeaderCode = Header;
@@ -99,23 +114,20 @@
   TU.Code = Input.code();
   TU.ExtraArgs = ExtraArgs;
   ParsedAST AST = TU.build();
-  Tweak::Selection S(Index.get(), AST, Selection.first, Selection.second);
 
-  auto T = prepareTweak(TweakID, S);
-  if (!T) {
-llvm::consumeError(T.takeError());
-return "unavailable";
-  }
-  llvm::Expected Result = (*T)->apply(S);
+  auto Result = applyTweak(AST, Input, TweakID, Index.get());
   if (!Result)
-return "fail: " + llvm::toString(Result.takeError());
-  if (Result->ShowMessage)
-return "message:\n" + *Result->ShowMessage;
-  if (Result->ApplyEdits.empty())
+return "unavailable";
+  if (!*Result)
+return "fail: " + llvm::toString(Result->takeError());
+  const auto &Effect = **Result;
+  if ((*Result)->ShowMessage)
+return "message:\n" + *Effect.ShowMessage;
+  if (Effect.ApplyEdits.empty())
 return "no effect";
 
   std::string EditedMainFile;
-  for (auto &It : Result->ApplyEdits) {
+  for (auto &It : Effect.ApplyEdits) {
 auto NewText = It.second.apply();
 if (!NewText)
   return "bad edits: " + llvm::toString(NewText.takeError());
Index: clang-tools-extra/clangd/unittests/SelectionTests.cpp
===
--- clang-tools-extra/clangd/unittests/Sele

[PATCH] D71345: [clangd] Fall back to selecting token-before-cursor if token-after-cursor fails.

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon check-circle color=green} clang-format: pass.

Build artifacts 
: 
console-log.txt 
,
 CMakeCache.txt 
,
 diff.json 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71345/new/

https://reviews.llvm.org/D71345



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71197: llvm premerge: clang format test

2019-12-11 Thread Mikhail Goncharov via Phabricator via cfe-commits
goncharov updated this revision to Diff 233370.
goncharov added a comment.

wrong imports order


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71197/new/

https://reviews.llvm.org/D71197

Files:
  clang/tools/clang-check/ClangCheck.cpp
  clang/tools/clang-diff/ClangDiff.cpp
  clang/tools/clang-fuzzer/ClangFuzzer.cpp
  clang/tools/clang-refactor/ClangRefactor.cpp

Index: clang/tools/clang-refactor/ClangRefactor.cpp
===
--- clang/tools/clang-refactor/ClangRefactor.cpp
+++ clang/tools/clang-refactor/ClangRefactor.cpp
@@ -90,7 +90,6 @@
   TestSourceSelectionArgument(TestSelectionRangesInFile TestSelections)
   : TestSelections(std::move(TestSelections)) {}
 
-  void print(raw_ostream &OS) override { TestSelections.dump(OS); }
 
   std::unique_ptr
   createCustomConsumer() override {
@@ -104,6 +103,9 @@
 return TestSelections.foreachRange(SM, Callback);
   }
 
+  void print(raw_ostream &OS) override {
+  TestSelections.dump(OS);
+  }
 private:
   TestSelectionRangesInFile TestSelections;
 };
Index: clang/tools/clang-fuzzer/ClangFuzzer.cpp
===
--- clang/tools/clang-fuzzer/ClangFuzzer.cpp
+++ clang/tools/clang-fuzzer/ClangFuzzer.cpp
@@ -15,11 +15,11 @@
 #include "handle-cxx/handle_cxx.h"
 
 using namespace clang_fuzzer;
-
-extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; }
-
 extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
   std::string s((const char *)data, size);
   HandleCXX(s, "./test.cc", {"-O2"});
   return 0;
 }
+
+extern "C" int LLVMFuzzerInitialize(   int *argc,
+   char ***argv) { return 0 ; }
Index: clang/tools/clang-diff/ClangDiff.cpp
===
--- clang/tools/clang-diff/ClangDiff.cpp
+++ clang/tools/clang-diff/ClangDiff.cpp
@@ -32,12 +32,10 @@
 cl::desc("Print the internal representation of the AST as JSON."),
 cl::init(false), cl::cat(ClangDiffCategory));
 
-static cl::opt PrintMatches("dump-matches",
-  cl::desc("Print the matched nodes."),
-  cl::init(false), cl::cat(ClangDiffCategory));
+static cl::opt PrintMatches("dump-matches", cl::desc("Print the matched nodes."), cl::init(false), cl::cat(ClangDiffCategory));
 
 static cl::opt HtmlDiff("html",
-  cl::desc("Output a side-by-side diff in HTML."),
+ cl::desc("Output a side-by-side diff in HTML."),
   cl::init(false), cl::cat(ClangDiffCategory));
 
 static cl::opt SourcePath(cl::Positional, cl::desc(""),
@@ -77,7 +75,10 @@
   std::make_unique(
   std::move(Compilations));
   AdjustingCompilations->appendArgumentsAdjuster(
-  getInsertArgumentAdjuster(ArgsBefore, ArgumentInsertPosition::BEGIN));
+
+  getInsertArgumentAdjuster(ArgsBefore   ,
+
+  ArgumentInsertPosition::BEGIN));
   AdjustingCompilations->appendArgumentsAdjuster(
   getInsertArgumentAdjuster(ArgsAfter, ArgumentInsertPosition::END));
   Compilations = std::move(AdjustingCompilations);
Index: clang/tools/clang-check/ClangCheck.cpp
===
--- clang/tools/clang-check/ClangCheck.cpp
+++ clang/tools/clang-check/ClangCheck.cpp
@@ -17,10 +17,10 @@
 
 #include "clang/AST/ASTConsumer.h"
 #include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
-#include "clang/Driver/Options.h"
 #include "clang/Frontend/ASTConsumers.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Rewrite/Frontend/FixItRewriter.h"
+#include "clang/Driver/Options.h"
 #include "clang/Rewrite/Frontend/FrontendActions.h"
 #include "clang/StaticAnalyzer/Frontend/FrontendActions.h"
 #include "clang/Tooling/CommonOptionsParser.h"
@@ -28,8 +28,8 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Option/OptTable.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/Signals.h"
 #include "llvm/Support/TargetSelect.h"
+#include "llvm/Support/Signals.h"
 
 using namespace clang::driver;
 using namespace clang::tooling;
@@ -52,7 +52,7 @@
 );
 
 static cl::OptionCategory ClangCheckCategory("clang-check options");
-static const opt::OptTable &Options = getDriverOptTable();
+staticconst opt::OptTable &Options = getDriverOptTable();
 static cl::opt
 ASTDump("ast-dump",
 cl::desc(Options.getOptionHelpText(options::OPT_ast_dump)),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71213: [Alignment][NFC] CreateMemSet use MaybeAlign

2019-12-11 Thread Jay Foad via Phabricator via cfe-commits
foad added a comment.

@gchatelet in general would it be possible to make changes like this in a 
backwards-compatible way, or in two stages without a "flag day" change? We have 
out-of-tree users of CreateMemSet and it's awkward to change them all at 
exactly the same time as we merge in this change from upstream llvm, and we 
have had the same problem with other MaybeAlign changes recently. I realise 
that LLVM doesn't make any official promises about API stability.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71213/new/

https://reviews.llvm.org/D71213



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D71197: llvm premerge: clang format test

2019-12-11 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment.

{icon check-circle color=green} Unit tests: pass. 60624 tests passed, 0 failed 
and 726 were skipped.

{icon times-circle color=red} clang-format: fail. Please format your changes 
with clang-format by running `git-clang-format HEAD^` or apply this patch 
.

Build artifacts 
: 
console-log.txt 
,
 CMakeCache.txt 
,
 clang-format.patch 
,
 test-results.xml 
,
 diff.json 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71197/new/

https://reviews.llvm.org/D71197



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70973: [OPENMP50]Treat context selectors as expressions, not just strings.

2019-12-11 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 233372.
ABataev added a comment.

Rebase + moved function for best variant to FunctionDecl.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70973/new/

https://reviews.llvm.org/D70973

Files:
  clang/include/clang/AST/Decl.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/OpenMPKinds.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Decl.cpp
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/OpenMP/declare_variant_ast_print.c
  clang/test/OpenMP/declare_variant_ast_print.cpp
  clang/test/OpenMP/declare_variant_device_kind_codegen.cpp
  clang/test/OpenMP/declare_variant_implementation_vendor_codegen.cpp
  clang/test/OpenMP/declare_variant_messages.c
  clang/test/OpenMP/declare_variant_messages.cpp
  clang/test/OpenMP/declare_variant_mixed_codegen.cpp

Index: clang/test/OpenMP/declare_variant_mixed_codegen.cpp
===
--- clang/test/OpenMP/declare_variant_mixed_codegen.cpp
+++ clang/test/OpenMP/declare_variant_mixed_codegen.cpp
@@ -1,7 +1,8 @@
 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - -fsanitize-address-use-after-scope | FileCheck %s
-// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-linux -fexceptions -fcxx-exceptions -emit-pch -o %t -fopenmp-version=50 %s
-// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-linux -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -fopenmp-version=50 | FileCheck %s
-// expected-no-diagnostics
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-linux -fexceptions -fcxx-exceptions -emit-pch -o %t -fopenmp-version=50 %s
+// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-linux -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t %s -emit-llvm -o - -fopenmp-version=50 | FileCheck %s
+
+// expected-warning@141 {{unknown 'ccpu' device kind trait in the 'device' context selector set, expected one of 'host', 'nohost', 'cpu', 'gpu' or 'fpga', set ignored}}
 
 // CHECK-NOT: ret i32 {{1|4|81|84}}
 // CHECK-DAG: @_Z3barv = {{.*}}alias i32 (), i32 ()* @_Z3foov
@@ -39,17 +40,17 @@
 int bar() { return 1; }
 
 int bazzz();
-#pragma omp declare variant(bazzz) match(implementation = {vendor(llvm)}, device={kind(host)})
+#pragma omp declare variant(bazzz) match(implementation = {vendor(llvm)}, device={kind("host")})
 int baz() { return 1; }
 
 int test();
-#pragma omp declare variant(test) match(implementation = {vendor(llvm)}, device={kind(cpu)})
+#pragma omp declare variant(test) match(implementation = {vendor("llvm")}, device={kind(cpu)})
 int call() { return 1; }
 
 static int stat_unused_no_emit() { return 1; }
 static int stat_unused_();
 #pragma omp declare variant(stat_unused_) match(implementation = {vendor(llvm)}, device={kind(cpu)})
-#pragma omp declare variant(stat_unused_no_emit) match(implementation = {vendor(xxx)}, device={kind(gpu)})
+#pragma omp declare variant(stat_unused_) match(implementation = {vendor("llvm")}, device={kind("cpu")})
 static int stat_unused() { return 1; }
 
 static int stat_used_();
@@ -137,6 +138,9 @@
 #pragma omp declare variant(fn_variant2) match(implementation = {vendor(llvm)}, device={kind(fpga)})
 int fn2() { return 87; }
 
+#pragma omp declare variant(fn_variant2) match(device = {kind("ccpu")})
+int wrong_kind() { return 87; }
+
 #pragma omp declare variant(stat_unused_no_emit) match(implementation = {vendor(xxx)}, device={kind(gpu)})
 template 
 static T stat_unused_T() { return 88; }
Index: clang/test/OpenMP/declare_variant_messages.cpp
===
--- clang/test/OpenMP/declare_variant_messages.cpp
+++ clang/test/OpenMP/declare_variant_messages.cpp
@@ -30,25 +30,25 @@
 #pragma omp declare variant(foofoo ) match(xxx = {vvv} xxx) // expected-error {{expected ','}} expected-error {{expected '=' after 'xxx' context selector set name on 'omp declare variant' directive}} expected-error {{context selector set 'xxx' is used already in the same 'omp declare variant' directive}} expected-note {{previously context selector set 'xxx' used here}}
 #pragma omp declare variant(foofoo ) match(xxx = {vvv}) xxx // expected-warning {{extra tokens at the end of '#pragma omp declare variant' are ignored}}
 #pragma omp declare variant(foofoo ) match(implementation={xxx}) // expected-warning {{unknown context selector in 'implementation' context selector set of 'omp declare variant' directive, ignored}}
-#pragma omp declare variant(foofoo ) match(implementation={vendor}) // expected-error {{expected '(' after 'vendor'}} expected-erro

[PATCH] D62731: Add support for options -frounding-math, -ftrapping-math, -ffp-model=, and -ffp-exception-behavior=, : Specify floating point behavior

2019-12-11 Thread Melanie Blower via Phabricator via cfe-commits
mibintc added a comment.

In D62731#1778597 , @michele.scandale 
wrote:

> >> I've noticed you removed the change for `CompilerInvocation.cpp` about the 
> >> initialization of the codegen option `NoTrappingMath`. Was that an 
> >> accident?


Thanks again Michele.  I'd like to get rid of Opts.NoTrappingMath, but I 
haven't been bold enough yet. NoTrappingMath is not expressive enough because 
it can hold only 2 values, whereas the Exception behavior can be ignore, strict 
or maytrap. So I'd get rid of that Opts field, and the only place where I see 
it actually being used is in llvm/lib/Target/ARM/ARMAsmPrinter.cpp and the 
change in this patch doesn't seem to affect the ARM logic so I think if I got 
rid of it, it would be OK. All the other instances of the string are in llvm 
test cases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62731/new/

https://reviews.llvm.org/D62731



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   3   >