[PATCH] D74692: [clang-tidy][bugprone-use-after-move] Warn on std::move for consts

2020-04-21 Thread Zinovy Nis via Phabricator via cfe-commits
zinovy.nis added a comment.

One more gentle ping)


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

https://reviews.llvm.org/D74692



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


[PATCH] D78521: [clangd] Extend dexp to support remote index

2020-04-21 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 259167.
kbobyrev added a comment.

Resolve a couple of FIXMEs. The patch is review-ready now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78521

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/index/Serialization.h
  clang-tools-extra/clangd/index/YAMLSerialization.cpp
  clang-tools-extra/clangd/index/dex/dexp/CMakeLists.txt
  clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
  clang-tools-extra/clangd/index/remote/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/Index.cpp
  clang-tools-extra/clangd/index/remote/Index.h
  clang-tools-extra/clangd/index/remote/Index.proto
  clang-tools-extra/clangd/index/remote/Marshalling.cpp
  clang-tools-extra/clangd/index/remote/Marshalling.h
  clang-tools-extra/clangd/index/remote/client/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/client/Client.cpp
  clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/server/Server.cpp
  llvm/cmake/modules/FindGRPC.cmake

Index: llvm/cmake/modules/FindGRPC.cmake
===
--- llvm/cmake/modules/FindGRPC.cmake
+++ llvm/cmake/modules/FindGRPC.cmake
@@ -23,11 +23,11 @@
   find_program(PROTOC protoc)
 endif()
 
-# Proto headers are generated in ${CMAKE_CURRENT_BINARY_DIR}.
+# Proto headers are generated in ${GeneratedFilesLocation}.
 # Libraries that use these headers should adjust the include path.
 # FIXME(kirillbobyrev): Allow optional generation of gRPC code and give callers
 # control over it via additional parameters.
-function(generate_grpc_protos LibraryName ProtoFile)
+function(generate_grpc_protos LibraryName ProtoFile GeneratedFilesLocation)
   get_filename_component(ProtoSourceAbsolutePath "${CMAKE_CURRENT_SOURCE_DIR}/${ProtoFile}" ABSOLUTE)
   get_filename_component(ProtoSourcePath ${ProtoSourceAbsolutePath} PATH)
 
@@ -35,6 +35,7 @@
   set(GeneratedProtoHeader "${CMAKE_CURRENT_BINARY_DIR}/Index.pb.h")
   set(GeneratedGRPCSource "${CMAKE_CURRENT_BINARY_DIR}/Index.grpc.pb.cc")
   set(GeneratedGRPCHeader "${CMAKE_CURRENT_BINARY_DIR}/Index.grpc.pb.h")
+  set(${GeneratedFilesLocation} ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
   add_custom_command(
 OUTPUT "${GeneratedProtoSource}" "${GeneratedProtoHeader}" "${GeneratedGRPCSource}" "${GeneratedGRPCHeader}"
 COMMAND ${PROTOC}
Index: clang-tools-extra/clangd/index/remote/server/Server.cpp
===
--- clang-tools-extra/clangd/index/remote/server/Server.cpp
+++ clang-tools-extra/clangd/index/remote/server/Server.cpp
@@ -8,6 +8,7 @@
 
 #include "index/Index.h"
 #include "index/Serialization.h"
+#include "index/remote/Marshalling.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/LineEditor/LineEditor.h"
@@ -23,6 +24,7 @@
 
 namespace clang {
 namespace clangd {
+namespace remote {
 namespace {
 
 static const std::string Overview = R"(
@@ -47,24 +49,51 @@
 
 private:
   grpc::Status Lookup(grpc::ServerContext *Context,
-  const remote::LookupRequest *Request,
-  grpc::ServerWriter *Reply) override {
-llvm::outs() << "Lookup of symbol with ID " << Request->id() << '\n';
-LookupRequest Req;
-auto SID = SymbolID::fromStr(Request->id());
-if (!SID) {
-  llvm::outs() << llvm::toString(SID.takeError()) << "\n";
-  return grpc::Status::CANCELLED;
+  const LookupRequest *Request,
+  grpc::ServerWriter *Reply) override {
+clangd::LookupRequest Req;
+for (const auto &ID : Request->ids()) {
+  auto SID = SymbolID::fromStr(StringRef(ID));
+  if (!SID)
+return grpc::Status::CANCELLED;
+  Req.IDs.insert(*SID);
 }
-Req.IDs.insert(*SID);
-Index->lookup(Req, [&](const Symbol &Sym) {
-  remote::LookupReply NextSymbol;
-  NextSymbol.set_symbol_yaml(toYAML(Sym));
+Index->lookup(Req, [&](const clangd::Symbol &Sym) {
+  remote::Symbol NextSymbol;
+  NextSymbol.set_yaml_serializatiton(toYAML(Sym));
   Reply->Write(NextSymbol);
 });
 return grpc::Status::OK;
   }
 
+  grpc::Status FuzzyFind(grpc::ServerContext *Context,
+ const FuzzyFindRequest *Request,
+ FuzzyFindReply *Reply) override {
+const auto Req = fromProtobuf(Request);
+bool HasMore = Index->fuzzyFind(Req, [&](const clangd::Symbol &Sym) {
+  auto *NextSymbol = Reply->add_symbols();
+  NextSymbol->set_yaml_serializatiton(toYAML(Sym));
+});
+Reply->set_has_more(HasMore);
+return grpc::Status::OK;
+  }
+
+  grpc::Status Refs(grpc::ServerContext *Context, const RefsRequest *Request,
+RefsReply *Reply) override {
+clangd::RefsRequest Req;
+for (const auto &ID : Request->ids()) {
+  auto SID = Sy

[PATCH] D76451: [clangd] Enable textual fallback for go-to-definition on dependent names

2020-04-21 Thread Nathan Ridge via Phabricator via cfe-commits
nridge updated this revision to Diff 259160.
nridge added a comment.

Rebase on top of D75479 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76451

Files:
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/XRefs.h
  clang-tools-extra/clangd/unittests/XRefsTests.cpp

Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -663,14 +663,42 @@
 int myFunction(int);
 // Not triggered for token which survived preprocessing.
 int var = m^yFunction();
-  )cpp",
+  )cpp"};
+
+  for (const char *Test : Tests) {
+Annotations T(Test);
+llvm::Optional WantDecl;
+if (!T.ranges().empty())
+  WantDecl = T.range();
+
+auto TU = TestTU::withCode(T.code());
+
+auto AST = TU.build();
+auto Index = TU.index();
+auto Word = SpelledWord::touching(
+cantFail(sourceLocationInMainFile(AST.getSourceManager(), T.point())),
+AST.getTokens(), AST.getLangOpts());
+ASSERT_TRUE(Word);
+auto Results = locateSymbolTextually(
+*Word, AST, Index.get(), testPath(TU.Filename), /*IsDependent=*/false);
+
+if (!WantDecl) {
+  EXPECT_THAT(Results, IsEmpty()) << Test;
+} else {
+  ASSERT_THAT(Results, ::testing::SizeIs(1)) << Test;
+  EXPECT_EQ(Results[0].PreferredDeclaration.range, *WantDecl) << Test;
+}
+  }
+} // namespace
+
+TEST(LocateSymbol, TextualDependent) {
+  const char *Tests[] = {
   R"cpp(// Dependent type
 struct Foo {
-  void uniqueMethodName();
+  void [[uniqueMethodName]]();
 };
 template 
 void f(T t) {
-  // Not triggered for token which survived preprocessing.
   t->u^niqueMethodName();
 }
   )cpp"};
@@ -685,15 +713,10 @@
 
 auto AST = TU.build();
 auto Index = TU.index();
-auto Word = SpelledWord::touching(
-cantFail(sourceLocationInMainFile(AST.getSourceManager(), T.point())),
-AST.getTokens(), AST.getLangOpts());
-if (!Word) {
-  ADD_FAILURE() << "No word touching point!" << Test;
-  continue;
-}
-auto Results =
-locateSymbolTextually(*Word, AST, Index.get(), testPath(TU.Filename));
+// Need to use locateSymbolAt() since we are testing an
+// interaction between locateASTReferent() and
+// locateSymbolNamedTextuallyAt().
+auto Results = locateSymbolAt(AST, T.point(), Index.get());
 
 if (!WantDecl) {
   EXPECT_THAT(Results, IsEmpty()) << Test;
@@ -786,19 +809,18 @@
 struct Bar {
   void $BarLoc[[uniqueMethodName]]();
 };
-// Will call u^niqueMethodName() on t.
 template 
-void f(T t);
+void f(T t) {
+  t.u^niqueMethodName();
+}
   )cpp");
   auto TU = TestTU::withCode(T.code());
   auto AST = TU.build();
   auto Index = TU.index();
-  auto Word = SpelledWord::touching(
-  cantFail(sourceLocationInMainFile(AST.getSourceManager(), T.point())),
-  AST.getTokens(), AST.getLangOpts());
-  ASSERT_TRUE(Word);
-  auto Results =
-  locateSymbolTextually(*Word, AST, Index.get(), testPath(TU.Filename));
+  // Need to use locateSymbolAt() since we are testing an
+  // interaction between locateASTReferent() and
+  // locateSymbolNamedTextuallyAt().
+  auto Results = locateSymbolAt(AST, T.point(), Index.get());
   EXPECT_THAT(Results,
   UnorderedElementsAre(Sym("uniqueMethodName", T.range("FooLoc")),
Sym("uniqueMethodName", T.range("BarLoc";
Index: clang-tools-extra/clangd/XRefs.h
===
--- clang-tools-extra/clangd/XRefs.h
+++ clang-tools-extra/clangd/XRefs.h
@@ -62,8 +62,8 @@
 // (This is for internal use by locateSymbolAt, and is exposed for testing).
 std::vector
 locateSymbolTextually(const SpelledWord &Word, ParsedAST &AST,
-  const SymbolIndex *Index,
-  const std::string &MainFilePath);
+  const SymbolIndex *Index, const std::string &MainFilePath,
+  bool IsDependent);
 
 // Try to find a proximate occurrence of `Word` as an identifier, which can be
 // used to resolve it.
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -22,6 +22,7 @@
 #include "index/Relation.h"
 #include "index/SymbolLocation.h"
 #include "clang/AST/ASTContext.h"
+#include "clang/AST/ASTTypeTraits.h"
 #include "clang/AST/Attr.h"
 #include "clang/AST/Attrs.inc"
 #include "clang/AST/Decl.h"
@@ -139,19 +140,31 @@
   return Merged.CanonicalDeclaration;
 }
 
-std::vect

[PATCH] D76932: [AIX] emit .extern and .weak directive linkage

2020-04-21 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast accepted this revision.
hubert.reinterpretcast added a comment.

LGTM with minor comment.




Comment at: llvm/test/CodeGen/PowerPC/aix-extern-weak.ll:8
+; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
+; RUN: -mattr=-altivec < %s | FileCheck  %s
+

Please fix the two consecutive spaces.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76932



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


LLVM buildmaster will be updated and restarted soon

2020-04-21 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted in about half hour.

Thanks

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


[PATCH] D78252: [AArch64] FMLA/FMLS patterns improvement.

2020-04-21 Thread Ahmed Bougacha via Phabricator via cfe-commits
ab added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64InstrFormats.td:8058
+  def : Pat<(v8f16 (OpNode (v8f16 V128:$Rd), (v8f16 V128:$Rn),
+   (AArch64duplane16 (v8f16 V128:$Rm),
+   VectorIndexH:$idx))),

Should this be V128_lo?  I don't think this is encodable for Rm in V16-V31  
(same in the other indexed f16 variants I think)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78252



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


[PATCH] D78598: [clangd] Remove vscode plugin: now https://github.com/clangd/vscode-clangd

2020-04-21 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

Is there an easy wasy to transplant patches written against the old repo, into 
the new one?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78598



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


[PATCH] D62368: Add support for Hygon Dhyana processor

2020-04-21 Thread Jinke Fan via Phabricator via cfe-commits
fanjinke updated this revision to Diff 259150.
fanjinke edited the summary of this revision.
fanjinke added a comment.

1,Update patch base on lastest commit e90fb82f0f760703c14eafbad96c08b6019a2f0f 
.
2,Format the patch with “git clang-format-6.0 HEAD~1“.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62368

Files:
  clang/lib/Headers/cpuid.h
  compiler-rt/lib/scudo/scudo_utils.cpp
  compiler-rt/lib/scudo/standalone/checksum.cpp


Index: compiler-rt/lib/scudo/standalone/checksum.cpp
===
--- compiler-rt/lib/scudo/standalone/checksum.cpp
+++ compiler-rt/lib/scudo/standalone/checksum.cpp
@@ -31,6 +31,13 @@
 #define bit_SSE4_2 bit_SSE42 // clang and gcc have different defines.
 #endif
 
+#ifndef signature_HYGON_ebx // They are not defined in the gcc.
+/* HYGON:   "HygonGenuine" */
+#define signature_HYGON_ebx 0x6f677948
+#define signature_HYGON_edx 0x6e65476e
+#define signature_HYGON_ecx 0x656e6975
+#endif
+
 bool hasHardwareCRC32() {
   u32 Eax, Ebx = 0, Ecx = 0, Edx = 0;
   __get_cpuid(0, &Eax, &Ebx, &Ecx, &Edx);
@@ -39,7 +46,10 @@
(Ecx == signature_INTEL_ecx);
   const bool IsAMD = (Ebx == signature_AMD_ebx) && (Edx == signature_AMD_edx) 
&&
  (Ecx == signature_AMD_ecx);
-  if (!IsIntel && !IsAMD)
+  const bool IsHygon = (Ebx == signature_HYGON_ebx) &&
+   (Edx == signature_HYGON_edx) &&
+   (Ecx == signature_HYGON_ecx);
+  if (!IsIntel && !IsAMD && !IsHygon)
 return false;
   __get_cpuid(1, &Eax, &Ebx, &Ecx, &Edx);
   return !!(Ecx & bit_SSE4_2);
Index: compiler-rt/lib/scudo/scudo_utils.cpp
===
--- compiler-rt/lib/scudo/scudo_utils.cpp
+++ compiler-rt/lib/scudo/scudo_utils.cpp
@@ -62,6 +62,14 @@
 # ifndef bit_SSE4_2
 #  define bit_SSE4_2 bit_SSE42  // clang and gcc have different defines.
 # endif
+
+#ifndef signature_HYGON_ebx // They are not defined in the gcc.
+/* HYGON:   "HygonGenuine" */
+#define signature_HYGON_ebx 0x6f677948
+#define signature_HYGON_edx 0x6e65476e
+#define signature_HYGON_ecx 0x656e6975
+#endif
+
 bool hasHardwareCRC32() {
   u32 Eax, Ebx, Ecx, Edx;
   __get_cpuid(0, &Eax, &Ebx, &Ecx, &Edx);
@@ -71,7 +79,10 @@
   const bool IsAMD = (Ebx == signature_AMD_ebx) &&
  (Edx == signature_AMD_edx) &&
  (Ecx == signature_AMD_ecx);
-  if (!IsIntel && !IsAMD)
+  const bool IsHygon = (Ebx == signature_HYGON_ebx) &&
+   (Edx == signature_HYGON_edx) &&
+   (Ecx == signature_HYGON_ecx);
+  if (!IsIntel && !IsAMD && !IsHygon)
 return false;
   __get_cpuid(1, &Eax, &Ebx, &Ecx, &Edx);
   return !!(Ecx & bit_SSE4_2);
Index: clang/lib/Headers/cpuid.h
===
--- clang/lib/Headers/cpuid.h
+++ clang/lib/Headers/cpuid.h
@@ -24,6 +24,10 @@
 #define signature_CYRIX_ebx 0x69727943
 #define signature_CYRIX_edx 0x736e4978
 #define signature_CYRIX_ecx 0x64616574
+/* HYGON:   "HygonGenuine" */
+#define signature_HYGON_ebx 0x6f677948
+#define signature_HYGON_edx 0x6e65476e
+#define signature_HYGON_ecx 0x656e6975
 /* INTEL:   "GenuineIntel" */
 #define signature_INTEL_ebx 0x756e6547
 #define signature_INTEL_edx 0x49656e69


Index: compiler-rt/lib/scudo/standalone/checksum.cpp
===
--- compiler-rt/lib/scudo/standalone/checksum.cpp
+++ compiler-rt/lib/scudo/standalone/checksum.cpp
@@ -31,6 +31,13 @@
 #define bit_SSE4_2 bit_SSE42 // clang and gcc have different defines.
 #endif
 
+#ifndef signature_HYGON_ebx // They are not defined in the gcc.
+/* HYGON:   "HygonGenuine" */
+#define signature_HYGON_ebx 0x6f677948
+#define signature_HYGON_edx 0x6e65476e
+#define signature_HYGON_ecx 0x656e6975
+#endif
+
 bool hasHardwareCRC32() {
   u32 Eax, Ebx = 0, Ecx = 0, Edx = 0;
   __get_cpuid(0, &Eax, &Ebx, &Ecx, &Edx);
@@ -39,7 +46,10 @@
(Ecx == signature_INTEL_ecx);
   const bool IsAMD = (Ebx == signature_AMD_ebx) && (Edx == signature_AMD_edx) &&
  (Ecx == signature_AMD_ecx);
-  if (!IsIntel && !IsAMD)
+  const bool IsHygon = (Ebx == signature_HYGON_ebx) &&
+   (Edx == signature_HYGON_edx) &&
+   (Ecx == signature_HYGON_ecx);
+  if (!IsIntel && !IsAMD && !IsHygon)
 return false;
   __get_cpuid(1, &Eax, &Ebx, &Ecx, &Edx);
   return !!(Ecx & bit_SSE4_2);
Index: compiler-rt/lib/scudo/scudo_utils.cpp
===
--- compiler-rt/lib/scudo/scudo_utils.cpp
+++ compiler-rt/lib/scudo/scudo_utils.cpp
@@ -62,6 +62,14 @@
 # ifndef bit_SSE4_2
 #  define bit_SSE4_2 bit_SSE42  // clang and gcc have different defines.
 # endif
+
+#i

[clang] 8d45d6e - [Frontend] Drop unneeded CC1 options

2020-04-21 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-04-21T19:59:28-07:00
New Revision: 8d45d6e39d5cfd1196b8601704ff8066b809e3c7

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

LOG: [Frontend] Drop unneeded CC1 options

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGenObjCXX/return.mm

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 889880cc86d6..2ec7269372b1 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2002,7 +2002,6 @@ def fno_unique_section_names : Flag <["-"], 
"fno-unique-section-names">,
   Group, Flags<[CC1Option]>;
 
 def fstrict_return : Flag<["-"], "fstrict-return">, Group,
-  Flags<[CC1Option]>,
   HelpText<"Always treat control flow paths that fall off the end of a "
"non-void function as unreachable">;
 def fno_strict_return : Flag<["-"], "fno-strict-return">, Group,
@@ -2015,15 +2014,13 @@ def fno_allow_editor_placeholders : Flag<["-"],
   "fno-allow-editor-placeholders">, Group;
 
 def fdebug_types_section: Flag <["-"], "fdebug-types-section">, Group,
-  Flags<[CC1Option]>, HelpText<"Place debug types in their own section (ELF 
Only)">;
-def fno_debug_types_section: Flag<["-"], "fno-debug-types-section">, 
Group,
-  Flags<[CC1Option]>;
+  HelpText<"Place debug types in their own section (ELF Only)">;
+def fno_debug_types_section: Flag<["-"], "fno-debug-types-section">, 
Group;
 def fdebug_ranges_base_address: Flag <["-"], "fdebug-ranges-base-address">, 
Group,
   Flags<[CC1Option]>, HelpText<"Use DWARF base address selection entries in 
debug_ranges">;
-def fno_debug_ranges_base_address: Flag <["-"], 
"fno-debug-ranges-base-address">, Group,
-  Flags<[CC1Option]>;
+def fno_debug_ranges_base_address: Flag <["-"], 
"fno-debug-ranges-base-address">, Group;
 def fsplit_dwarf_inlining: Flag <["-"], "fsplit-dwarf-inlining">, 
Group,
-  Flags<[CC1Option]>, HelpText<"Provide minimal debug info in the 
object/executable to facilitate online symbolication/stack traces in the 
absence of .dwo/.dwp files when using Split DWARF">;
+  HelpText<"Provide minimal debug info in the object/executable to facilitate 
online symbolication/stack traces in the absence of .dwo/.dwp files when using 
Split DWARF">;
 def fno_split_dwarf_inlining: Flag<["-"], "fno-split-dwarf-inlining">, 
Group,
   Flags<[CC1Option]>;
 def fdebug_default_version: Joined<["-"], "fdebug-default-version=">, 
Group,
@@ -2033,14 +2030,14 @@ def fdebug_prefix_map_EQ
 Flags<[CC1Option,CC1AsOption]>,
 HelpText<"remap file source paths in debug info">;
 def ffile_prefix_map_EQ
-  : Joined<["-"], "ffile-prefix-map=">, Group, Flags<[CC1Option]>,
+  : Joined<["-"], "ffile-prefix-map=">, Group,
 HelpText<"remap file source paths in debug info and predefined 
preprocessor macros">;
 def fmacro_prefix_map_EQ
   : Joined<["-"], "fmacro-prefix-map=">, Group, 
Flags<[CC1Option]>,
 HelpText<"remap file source paths in predefined preprocessor macros">;
 def fforce_dwarf_frame : Flag<["-"], "fforce-dwarf-frame">, Group, 
Flags<[CC1Option]>,
 HelpText<"Always emit a debug frame section">;
-def fno_force_dwarf_frame : Flag<["-"], "fno-force-dwarf-frame">, 
Group, Flags<[CC1Option]>,
+def fno_force_dwarf_frame : Flag<["-"], "fno-force-dwarf-frame">, 
Group,
 HelpText<"Don't always emit a debug frame section">;
 def g_Flag : Flag<["-"], "g">, Group,
   HelpText<"Generate source-level debug information">;
@@ -2106,9 +2103,9 @@ def gsplit_dwarf_EQ : Joined<["-"], "gsplit-dwarf=">, 
Group,
   HelpText<"Set DWARF fission mode to either 'split' or 'single'">,
   Values<"split,single">;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group, 
Flags<[CC1Option]>;
-def gno_gnu_pubnames : Flag<["-"], "gno-gnu-pubnames">, Group, 
Flags<[CC1Option]>;
+def gno_gnu_pubnames : Flag<["-"], "gno-gnu-pubnames">, Group;
 def gpubnames : Flag<["-"], "gpubnames">, Group, 
Flags<[CC1Option]>;
-def gno_pubnames : Flag<["-"], "gno-pubnames">, Group, 
Flags<[CC1Option]>;
+def gno_pubnames : Flag<["-"], "gno-pubnames">, Group;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
 def gmodules : Flag <["-"], "gmodules">, Group,
   HelpText<"Generate debug info with external references to clang modules"

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 6a988670eb02..b327fa902f67 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -766,9 +766,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList 
&Args, InputKind IK,
   Opts.DebugExplicitImport = Args.hasArg(OPT_dwarf_explicit_import);
   Opts.DebugFwdTemplateParams = Ar

[PATCH] D76038: PR45000: Let Sema::SubstParmVarDecl handle default args of lambdas in initializers

2020-04-21 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

The responses to the various testcases you posted look OK to me. The language 
rules aren't clear, and we can revisit this if they get clarified in a 
different direction, but treating lambdas in variable templates the same as 
function definitions seems reasonable for now.

In D76038#1991426 , @aaronpuchert 
wrote:

> Adding @ahatanak and @sepavloff since I'm effectively reverting D23096 
>  now.


This looks reasonable to me, but maybe ping @ahatanak (on email / IRC / 
wherever) to make sure this isn't breaking something we don't have a test for.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76038



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


[PATCH] D78232: [OPENMP50]Codegen for scan directive in simd loops.

2020-04-21 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: clang/lib/CodeGen/CGOpenMPRuntime.h:1351
+Exclusive,
+Unknown,
+  };

I think it is not `Unknown` but `None` (or similar) as we know that it is not a 
scan reduction.



Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:268
+  })) {
+  }
+}

What does this conditional do?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78232



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


[PATCH] D73290: [PowerPC] Add clang -msvr4-struct-return for 32-bit ELF

2020-04-21 Thread Justin Hibbits via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4ca2cad947d0: [PowerPC] Add clang -msvr4-struct-return for 
32-bit ELF (authored by jhibbits).

Changed prior to commit:
  https://reviews.llvm.org/D73290?vs=239982&id=259143#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73290

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/ppc32-struct-return.c
  clang/test/Driver/ppc-unsupported.c

Index: clang/test/Driver/ppc-unsupported.c
===
--- /dev/null
+++ clang/test/Driver/ppc-unsupported.c
@@ -0,0 +1,10 @@
+// REQUIRES: powerpc-registered-target
+// RUN: not %clang -target powerpc64-unknown-freebsd -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64-unknown-freebsd -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64le-unknown-linux -maix-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// RUN: not %clang -target powerpc64le-unknown-linux -msvr4-struct-return \
+// RUN:   -c %s 2>&1 | FileCheck %s
+// CHECK: unsupported option
Index: clang/test/CodeGen/ppc32-struct-return.c
===
--- /dev/null
+++ clang/test/CodeGen/ppc32-struct-return.c
@@ -0,0 +1,88 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -triple powerpc-unknown-freebsd \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
+// RUN: %clang_cc1 -triple powerpc-unknown-linux \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
+// RUN: %clang_cc1 -triple powerpc-unknown-linux -maix-struct-return \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
+// RUN: %clang_cc1 -triple powerpc-unknown-linux -msvr4-struct-return \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
+// RUN: %clang_cc1 -triple powerpc-unknown-netbsd \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
+// RUN: %clang_cc1 -triple powerpc-unknown-openbsd \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
+// RUN: %clang_cc1 -triple powerpc-unknown-openbsd -maix-struct-return \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-AIX
+// RUN: %clang_cc1 -triple powerpc-unknown-openbsd -msvr4-struct-return \
+// RUN:   -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-SVR4
+
+typedef struct {
+} Zero;
+typedef struct {
+  char c;
+} One;
+typedef struct {
+  short s;
+} Two;
+typedef struct {
+  char c[3];
+} Three;
+typedef struct {
+  float f;
+} Four; // svr4 to return i32, not float
+typedef struct {
+  char c[5];
+} Five;
+typedef struct {
+  short s[3];
+} Six;
+typedef struct {
+  char c[7];
+} Seven;
+typedef struct {
+  int i;
+  char c;
+} Eight; // padded for alignment
+typedef struct {
+  char c[9];
+} Nine;
+
+// CHECK-AIX-LABEL: define void @ret0(%struct.Zero* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define void @ret0()
+Zero ret0(void) { return (Zero){}; }
+
+// CHECK-AIX-LABEL: define void @ret1(%struct.One* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define i8 @ret1()
+One ret1(void) { return (One){'a'}; }
+
+// CHECK-AIX-LABEL: define void @ret2(%struct.Two* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define i16 @ret2()
+Two ret2(void) { return (Two){123}; }
+
+// CHECK-AIX-LABEL: define void @ret3(%struct.Three* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define i24 @ret3()
+Three ret3(void) { return (Three){"abc"}; }
+
+// CHECK-AIX-LABEL: define void @ret4(%struct.Four* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define i32 @ret4()
+Four ret4(void) { return (Four){0.4}; }
+
+// CHECK-AIX-LABEL: define void @ret5(%struct.Five* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define i40 @ret5()
+Five ret5(void) { return (Five){"abcde"}; }
+
+// CHECK-AIX-LABEL: define void @ret6(%struct.Six* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define i48 @ret6()
+Six ret6(void) { return (Six){12, 34, 56}; }
+
+// CHECK-AIX-LABEL: define void @ret7(%struct.Seven* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define i56 @ret7()
+Seven ret7(void) { return (Seven){"abcdefg"}; }
+
+// CHECK-AIX-LABEL: define void @ret8(%struct.Eight* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define i64 @ret8()
+Eight ret8(void) { return (Eight){123, 'a'}; }
+
+// CHECK-AIX-LABEL: define void @ret9(%struct.Nine* noalias sret {{[^,]*}})
+// CHECK-SVR4-LABEL: define void @ret9(%struct.Nine* noalias sret {{[^,]*}})
+Nine ret9(void) { return (Nine){"abcdefghi"}; }
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocat

[PATCH] D72893: [NewPassManager] Add assertions when getting statefull cached analysis.

2020-04-21 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added a comment.

Really like the approach now. Pretty minor code nits below only. =D




Comment at: llvm/include/llvm/Analysis/CGSCCPassManager.h:856-858
+auto *ResultFAMCP =
+&CGAM.getResult(*C, CG);
+ResultFAMCP->updateFAM(FAM);

Check that it doesn't hit an assert failure, but I think you can remove this 
one.



Comment at: llvm/include/llvm/IR/PassManager.h:812
+auto *RetRes = &static_cast(ResultConcept)->Result;
+if (calledFromProxy) {
+  PreservedAnalyses PA = PreservedAnalyses::none();

asbirlea wrote:
> chandlerc wrote:
> > Could this logic be moved into the callers that pass true here to avoid the 
> > need for a book parameter?
> I haven't addressed this. Yes, I can move the logic in to the caller but I 
> need to make the AnalysisManagerT::Invalidator constructor public.
> Is there another way to do this?
Ah, good point.

How about making this a `verifyNotInvalidated` method separate from 
`getCachedResult`? That still seems a bit cleaner to me than a bool parameter. 
What do you think?



Comment at: llvm/lib/Analysis/CGSCCPassManager.cpp:249-251
+  // Create a new empty Result. This needs to have the FunctionAnalysisManager
+  // inside through the updateFAM() API whenever the FAM's module proxy goes
   // away.

Don't fully understand this comments wording... Maybe something more along the 
lines of:

> We just return an empty result. The caller will use the `updateFAM` interface 
> to correctly register the relevant `FunctionAnalysisManager` based on the 
> context in which this proxy is run.



Comment at: llvm/lib/Analysis/CGSCCPassManager.cpp:341
+ FunctionAnalysisManager &FAM) {
+  auto *ResultFAMCP = &AM.getResult(C, G);
+  ResultFAMCP->updateFAM(FAM);

Omit the variable?



Comment at: llvm/lib/Analysis/CGSCCPassManager.cpp:406-411
   bool NeedFAMProxy =
   AM.getCachedResult(*OldC) != nullptr;
+  FunctionAnalysisManager *FAM = nullptr;
+  if (NeedFAMProxy)
+FAM =
+&AM.getResult(*OldC, 
G).getManager();

Can this be simplified to:

```
FunctionAnalysisManager *FAM = nullptr;
if (auto *FAMProxy = 
AM.getCachedResultgetManager();
```

And then use `FAM` being non-null below instead of the `NeedFAMProxy` bool?




Comment at: llvm/lib/Analysis/CGSCCPassManager.cpp:705
+  if (HasFunctionAnalysisProxy) {
+auto *ResultFAMCP =
+&AM.getResult(*C, G);

Could omit the variable?



Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:1172
 // re-use the exact same logic for updating the call graph to reflect the
 // change.
+// Inside the update, we also update the FunctionAnalysisManager in the

Add a blank line between the paragraphs?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72893



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


[clang] 4ca2cad - [PowerPC] Add clang -msvr4-struct-return for 32-bit ELF

2020-04-21 Thread Justin Hibbits via cfe-commits

Author: Justin Hibbits
Date: 2020-04-21T20:17:25-05:00
New Revision: 4ca2cad947d09ba0402f5b85d165aa7fcfbd9e3e

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

LOG: [PowerPC] Add clang -msvr4-struct-return for 32-bit ELF

Summary:

Change the default ABI to be compatible with GCC.  For 32-bit ELF
targets other than Linux, Clang now returns small structs in registers
r3/r4.  This affects FreeBSD, NetBSD, OpenBSD.  There is no change for
32-bit Linux, where Clang continues to return all structs in memory.

Add clang options -maix-struct-return (to return structs in memory) and
-msvr4-struct-return (to return structs in registers) to be compatible
with gcc.  These options are only for PPC32; reject them on PPC64 and
other targets.  The options are like -fpcc-struct-return and
-freg-struct-return for X86_32, and use similar code.

To actually return a struct in registers, coerce it to an integer of the
same size.  LLVM may optimize the code to remove unnecessary accesses to
memory, and will return i32 in r3 or i64 in r3:r4.

Fixes PR#40736

Patch by George Koehler!

Reviewed By: jhibbits, nemanjai
Differential Revision: https://reviews.llvm.org/D73290

Added: 
clang/test/CodeGen/ppc32-struct-return.c
clang/test/Driver/ppc-unsupported.c

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp

Removed: 




diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index e5a649702037..c7afcf7cf605 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -2973,6 +2973,11 @@ Enable MT ASE (MIPS only)
 
 PowerPC
 ---
+.. option:: -maix-struct-return
+
+Override the default ABI for 32-bit targets to return all structs in memory,
+as in the Power 32-bit ABI for Linux (2011), and on AIX and Darwin.
+
 .. option:: -maltivec, -mno-altivec
 
 .. option:: -mcmpb, -mno-cmpb
@@ -3009,6 +3014,11 @@ PowerPC
 
 .. option:: -mspe, -mno-spe
 
+.. option:: -msvr4-struct-return
+
+Override the default ABI for 32-bit targets to return small structs in
+registers, as in the System V ABI (1995).
+
 .. option:: -mvsx, -mno-vsx
 
 WebAssembly

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index fcfc3a387de8..889880cc86d6 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2510,6 +2510,12 @@ def mlongcall: Flag<["-"], "mlongcall">,
 Group;
 def mno_longcall : Flag<["-"], "mno-longcall">,
 Group;
+def maix_struct_return : Flag<["-"], "maix-struct-return">,
+  Group, Flags<[CC1Option]>,
+  HelpText<"Return all structs in memory (PPC32 only)">;
+def msvr4_struct_return : Flag<["-"], "msvr4-struct-return">,
+  Group, Flags<[CC1Option]>,
+  HelpText<"Return small structs in registers (PPC32 only)">;
 
 def mvx : Flag<["-"], "mvx">, Group;
 def mno_vx : Flag<["-"], "mno-vx">, Group;

diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index 22128534beda..0a5fb27ba015 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -4177,12 +4177,24 @@ namespace {
 /// PPC32_SVR4_ABIInfo - The 32-bit PowerPC ELF (SVR4) ABI information.
 class PPC32_SVR4_ABIInfo : public DefaultABIInfo {
   bool IsSoftFloatABI;
+  bool IsRetSmallStructInRegABI;
 
   CharUnits getParamTypeAlignment(QualType Ty) const;
 
 public:
-  PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT, bool SoftFloatABI)
-  : DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI) {}
+  PPC32_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT, bool SoftFloatABI,
+ bool RetSmallStructInRegABI)
+  : DefaultABIInfo(CGT), IsSoftFloatABI(SoftFloatABI),
+IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}
+
+  ABIArgInfo classifyReturnType(QualType RetTy) const;
+
+  void computeInfo(CGFunctionInfo &FI) const override {
+if (!getCXXABI().classifyReturnType(FI))
+  FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+for (auto &I : FI.arguments())
+  I.info = classifyArgumentType(I.type);
+  }
 
   Address EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
 QualType Ty) const override;
@@ -4190,8 +4202,13 @@ class PPC32_SVR4_ABIInfo : public DefaultABIInfo {
 
 class PPC32TargetCodeGenInfo : public TargetCodeGenInfo {
 public:
-  PPC32TargetCodeGenInfo(CodeGenTypes &CGT, bool SoftFloatABI)
-  : TargetCodeGenInfo(new PPC32_SVR4_ABIInfo(CGT, SoftFloatABI)) {}
+  PPC32TargetCodeGenInfo(CodeGenTypes &CGT, bool SoftFloatABI,
+ bool RetSmallStructInRegABI)
+  : TargetC

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-21 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In D77229#1995079 , 
@baloghadamsoftware wrote:

> My first attempt for a new special kind of region for parameters of functions 
> without definitions. Currently it causes more failed tests and assertions 
> than ignoring the problem of different `Decl`s. I will investigate these 
> problems tomorrow, but this path seems difficult.


Thank you!! I recommend a separate patch for this :) Yes it's a bit intrusive 
because you'll need to add support for the new region in the `RegionStore` but 
there's nothing extraordinary here as most of the time it'll be treated the 
same way as the old parameter region.




Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:438-442
+  Optional getReturnValueUnderConstruction(unsigned BlockCount) const;
+
+  Optional getArgObject(unsigned Index, unsigned BlockCount) const;
+
+  Optional getReturnObject(unsigned BlockCount) const;

I believe these functions don't need to be optional. There's always a parameter 
location and a location to return to (even if the latter is incorrect due to 
unimplemented construction context, it'll still be some dummy temporary region 
that you can use).



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1044
 
+class ParamWithoutVarRegion : public TypedValueRegion {
+  friend class MemRegionManager;

There should be only one way to express the parameter region. Let's call this 
one simply `ParamRegion` or something like that, and 
`assert(!isa(D))` in the constructor of `VarRegion`.



Comment at: 
clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1066
+  QualType getValueType() const override {
+return CallE->getType();
+  }

This should be the type of the parameter, not the return type of the call.



Comment at: clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp:235
 
 void IteratorModeling::checkBind(SVal Loc, SVal Val, const Stmt *S,
  CheckerContext &C) const {

Do you still need `checkBind` at all?



Comment at: clang/lib/StaticAnalyzer/Core/CallEvent.cpp:278-279
+
+const ConstructionContext
+*CallEvent::getConstructionContext(unsigned BlockCount) const {
+  const CFGBlock *Block;

This function obviously does not depend on `BlockCount`. You might as well 
always use `0` as `BlockCount`.

The ideal solution, of course, is for `CallEvent` to keep a `CFGElementRef` 
from the start.



Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:559
+  } else {
+os << "ParamWithoutVarRegion";
+  }

We could still dump `CallE->getID()` and `Index`.



Comment at: clang/lib/StaticAnalyzer/Core/MemRegion.cpp:1208
+  return getSubRegion(CE, Index,
+ getStackLocalsRegion(STC));
+}

StackArguments.


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

https://reviews.llvm.org/D77229



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


[PATCH] D78598: [clangd] Remove vscode plugin: now https://github.com/clangd/vscode-clangd

2020-04-21 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision.
sammccall added a reviewer: hokein.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, 
MaskRay, ilya-biryukov.
Herald added a project: clang.

Moving this out of the monorepo for consistency with other editor plugins.
There's no version lock with clangd itself, and we never ran tests with lit.

The first version from the new repo has been published.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78598

Files:
  clang-tools-extra/clangd/clients/clangd-vscode/.gitignore
  clang-tools-extra/clangd/clients/clangd-vscode/.vscode/launch.json
  clang-tools-extra/clangd/clients/clangd-vscode/.vscode/settings.json
  clang-tools-extra/clangd/clients/clangd-vscode/.vscode/tasks.json
  clang-tools-extra/clangd/clients/clangd-vscode/.vscodeignore
  clang-tools-extra/clangd/clients/clangd-vscode/DEVELOPING.md
  clang-tools-extra/clangd/clients/clangd-vscode/LICENSE
  clang-tools-extra/clangd/clients/clangd-vscode/README.md
  clang-tools-extra/clangd/clients/clangd-vscode/doc-assets/complete.png
  clang-tools-extra/clangd/clients/clangd-vscode/doc-assets/diagnostics.png
  clang-tools-extra/clangd/clients/clangd-vscode/doc-assets/extract.png
  clang-tools-extra/clangd/clients/clangd-vscode/doc-assets/format.png
  clang-tools-extra/clangd/clients/clangd-vscode/doc-assets/include.png
  clang-tools-extra/clangd/clients/clangd-vscode/doc-assets/symbolsearch.png
  clang-tools-extra/clangd/clients/clangd-vscode/doc-assets/xrefs.png
  clang-tools-extra/clangd/clients/clangd-vscode/icon.png
  clang-tools-extra/clangd/clients/clangd-vscode/package-lock.json
  clang-tools-extra/clangd/clients/clangd-vscode/package.json
  clang-tools-extra/clangd/clients/clangd-vscode/src/extension.ts
  clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
  clang-tools-extra/clangd/clients/clangd-vscode/test/assets/includeTheme.jsonc
  clang-tools-extra/clangd/clients/clangd-vscode/test/assets/simpleTheme.jsonc
  clang-tools-extra/clangd/clients/clangd-vscode/test/extension.test.ts
  clang-tools-extra/clangd/clients/clangd-vscode/test/index.ts
  clang-tools-extra/clangd/clients/clangd-vscode/test/runTest.ts
  
clang-tools-extra/clangd/clients/clangd-vscode/test/semantic-highlighting.test.ts
  clang-tools-extra/clangd/clients/clangd-vscode/tsconfig.json

Index: clang-tools-extra/clangd/clients/clangd-vscode/tsconfig.json
===
--- clang-tools-extra/clangd/clients/clangd-vscode/tsconfig.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
-"compilerOptions": {
-"module": "commonjs",
-"target": "es6",
-"outDir": "out",
-"lib": [
-"es6",
-"es2015.core",
-"es2015.collection",
-"es2015.generator",
-"es2015.iterable",
-"es2015.promise",
-"es2015.symbol",
-"es2016.array.include"
-],
-"sourceMap": true,
-"rootDir": ".",
-"alwaysStrict": true,
-"noEmitOnError": true,
-"noFallthroughCasesInSwitch": true,
-"noImplicitAny": true,
-"noImplicitReturns": true,
-"noImplicitThis": true
-},
-"exclude": [
-"node_modules",
-".vscode-test"
-]
-}
Index: clang-tools-extra/clangd/clients/clangd-vscode/test/semantic-highlighting.test.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/test/semantic-highlighting.test.ts
+++ /dev/null
@@ -1,174 +0,0 @@
-import * as assert from 'assert';
-import * as path from 'path';
-import * as vscode from 'vscode';
-
-import * as semanticHighlighting from '../src/semantic-highlighting';
-
-suite('SemanticHighlighting Tests', () => {
-  test('Parses arrays of textmate themes.', async () => {
-const themePath =
-path.join(__dirname, '../../test/assets/includeTheme.jsonc');
-const scopeColorRules =
-await semanticHighlighting.parseThemeFile(themePath);
-const getScopeRule = (scope: string) =>
-scopeColorRules.find((v) => v.scope === scope);
-assert.equal(scopeColorRules.length, 3);
-assert.deepEqual(getScopeRule('a'), {scope : 'a', foreground : '#fff'});
-assert.deepEqual(getScopeRule('b'), {scope : 'b', foreground : '#000'});
-assert.deepEqual(getScopeRule('c'), {scope : 'c', foreground : '#bcd'});
-  });
-  test('Decodes tokens correctly', () => {
-const testCases: string[] = [
-  'AAABAAA=', 'AAADAAkEAAEAAA==',
-  'AAADAAkEAAEAAAoAAQAA'
-];
-const expected = [
-  [ {character : 0, scopeIndex : 0, length : 1} ],
-  [
-{character : 0, scopeIndex : 9, length : 3},
-{character : 4, scopeIndex : 0, length : 1}
-  ],
-  [
-{character : 0, scopeIndex : 9, length : 3},
-{character : 4, scopeIndex : 0, length : 1},
-{character : 10, scopeIndex : 0, lengt

[PATCH] D77621: ADT: SmallVector size & capacity use word-size integers when elements are small.

2020-04-21 Thread Andrew via Phabricator via cfe-commits
browneee added a comment.

Thanks for the revert explanation and notes, nikic.

@dexonsmith what is your current thinking on going back to the original 
std::vector approach?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77621



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


[PATCH] D75591: [OpenMP] Add firstprivate as a default data-sharing attribute to clang

2020-04-21 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel added inline comments.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:2016-2023
+  if (DSAStack->getDefaultDSA() == DSA_firstprivate &&
+  VarsWithInheritedDSAType().count(D) == 0 &&
+  !DSAStack->hasExplicitDSA(
+  D, [](OpenMPClauseKind K) -> bool { return K == OMPC_firstprivate; },
+  Level, /*NotLastprivate=*/true) &&
+  Ty.getNonReferenceType()->isScalarType()) {
+IsByRef = false;

@ABataev Is this what you mean?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75591



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


[PATCH] D75591: [OpenMP] Add firstprivate as a default data-sharing attribute to clang

2020-04-21 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel updated this revision to Diff 259122.
atmnpatel added a comment.

Add capture by value for scalars.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75591

Files:
  clang-tools-extra/docs/clang-tidy/checks/openmp-use-default-none.rst
  clang-tools-extra/test/clang-tidy/checkers/openmp-use-default-none.cpp
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/ASTMatchers/Dynamic/Registry.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/distribute_parallel_for_default_messages.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/driver.c
  clang/test/OpenMP/parallel_default_messages.cpp
  clang/test/OpenMP/parallel_for_default_messages.cpp
  clang/test/OpenMP/parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_default_messages.cpp
  clang/test/OpenMP/parallel_sections_default_messages.cpp
  clang/test/OpenMP/target_parallel_default_messages.cpp
  clang/test/OpenMP/target_parallel_for_default_messages.cpp
  clang/test/OpenMP/target_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/target_teams_default_messages.cpp
  clang/test/OpenMP/target_teams_distribute_default_messages.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_default_messages.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/task_default_messages.cpp
  clang/test/OpenMP/task_messages.cpp
  clang/test/OpenMP/teams_default_messages.cpp
  clang/test/OpenMP/teams_distribute_default_messages.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_default_messages.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/teams_distribute_simd_default_messages.cpp
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersTest.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def

Index: llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
===
--- llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -543,6 +543,7 @@
 
 __OMP_DEFAULT_KIND(none)
 __OMP_DEFAULT_KIND(shared)
+__OMP_DEFAULT_KIND(firstprivate)
 __OMP_DEFAULT_KIND(unknown)
 
 #undef __OMP_DEFAULT_KIND
Index: clang/unittests/ASTMatchers/ASTMatchersTest.h
===
--- clang/unittests/ASTMatchers/ASTMatchersTest.h
+++ clang/unittests/ASTMatchers/ASTMatchersTest.h
@@ -314,6 +314,20 @@
   return matchesConditionally(Code, AMatcher, false, "-fopenmp=libomp");
 }
 
+template 
+testing::AssertionResult matchesWithOpenMP51(const std::string &Code,
+ const T &AMatcher) {
+  return matchesConditionally(Code, AMatcher, true,
+  {"-fopenmp=libomp", "-fopenmp-version=51"});
+}
+
+template 
+testing::AssertionResult notMatchesWithOpenMP51(const std::string &Code,
+const T &AMatcher) {
+  return matchesConditionally(Code, AMatcher, false,
+  {"-fopenmp=libomp", "-fopenmp-version=51"});
+}
+
 template 
 testing::AssertionResult
 matchAndVerifyResultConditionally(const std::string &Code, const T &AMatcher,
Index: clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -1843,11 +1843,18 @@
   EXPECT_TRUE(matchesWithOpenMP(Source3, Matcher));
 
   const std::string Source4 = R"(
+void x() {
+#pragma omp parallel default(firstprivate)
+;
+})";
+  EXPECT_TRUE(matchesWithOpenMP51(Source4, Matcher));
+
+  const std::string Source5 = R"(
 void x(int x) {
 #pragma omp parallel num_threads(x)
 ;
 })";
-  EXPECT_TRUE(notMatchesWithOpenMP(Source4, Matcher));
+  EXPECT_TRUE(notMatchesWithOpenMP(Source5, Matcher));
 }
 
 TEST(MatchFinderAPI, matchesDynamic) {
Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -2819,11 +2819,18 @@
   EXPECT_TRUE(matchesWithOpenMP(Source3, Matcher));
 
   const std::string Source4 = R"(
+void x() {
+#pragma omp parallel default(firstprivate)
+;
+})";
+  EXPECT_TRUE(matchesWithOpenMP51(Source4, Matcher));
+
+  const std::string Source5 = R"(
 void x(int x) {
 #pragma omp parallel num_threads(x)
 ;
 })";
-  EXPECT_TRUE(matchesWithOpenMP(Source4, Matcher));
+  EXPE

[PATCH] D75591: [OpenMP] Add firstprivate as a default data-sharing attribute to clang

2020-04-21 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel added inline comments.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:3211-3213
+  VD->getStorageClass() == SC_Static &&
+  (CanonicalVD->getDeclContext()->isNamespace() ||
+   !VD->isLocalVarDeclOrParm())) {

ABataev wrote:
> atmnpatel wrote:
> > ABataev wrote:
> > > atmnpatel wrote:
> > > > ABataev wrote:
> > > > > I think just `!VD->hasLocalStorage()` should be enough here. Shall it 
> > > > > work for static locals too or just for globals?
> > > > Just for globals.
> > > What about static data members?
> > The TR doesn't specify that static data members should inherit DSAs / have 
> > them explicitly defined.
> What about non-static globals? Your current check works only for something 
> like `static int var;`, but not `int var;`.
Sorry, I wasn't really clear with my earlier comment, I meant that just static 
global variables and static namespace variables need to have their DSA 
inherited/explicitly defined. So a global variable would become firstprivate 
implicitly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75591



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


[clang] d892eec - Reapply: Make header inclusion order from umbrella dirs deterministic

2020-04-21 Thread Bruno Cardoso Lopes via cfe-commits

Author: Bruno Cardoso Lopes
Date: 2020-04-21T15:45:54-07:00
New Revision: d892eec710caae84099f38fdb89d32ca15a23c1a

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

LOG: Reapply: Make header inclusion order from umbrella dirs deterministic

Sort the headers by name before adding the includes in
collectModuleHeaderIncludes. This makes the include order for building
umbrellas deterministic across different filesystems and also guarantees
that the ASTWriter always dump top headers in the same order.

There's currently no good way to test for this behavior.

This was first introduced in r289478 and reverted few times because of
ASANifed test failures on open source bots (both from LLVM and Swift).

Finally reproduced the problem in a Linux machine and use std::sort as a
fix, since we are not dealing with POD-like types.

rdar://problem/28116411

Added: 


Modified: 
clang/lib/Frontend/FrontendAction.cpp

Removed: 




diff  --git a/clang/lib/Frontend/FrontendAction.cpp 
b/clang/lib/Frontend/FrontendAction.cpp
index 6168057d115d..dc361b2fdd24 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -364,6 +364,7 @@ static std::error_code collectModuleHeaderIncludes(
 llvm::sys::path::native(UmbrellaDir.Entry->getName(), DirNative);
 
 llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem();
+SmallVector, 8> Headers;
 for (llvm::vfs::recursive_directory_iterator Dir(FS, DirNative, EC), End;
  Dir != End && !EC; Dir.increment(EC)) {
   // Check whether this entry has an extension typically associated with
@@ -394,13 +395,25 @@ static std::error_code collectModuleHeaderIncludes(
++It)
 llvm::sys::path::append(RelativeHeader, *It);
 
-  // Include this header as part of the umbrella directory.
-  Module->addTopHeader(*Header);
-  addHeaderInclude(RelativeHeader, Includes, LangOpts, Module->IsExternC);
+  std::string RelName = RelativeHeader.c_str();
+  Headers.push_back(std::make_pair(RelName, *Header));
 }
 
 if (EC)
   return EC;
+
+// Sort header paths and make the header inclusion order deterministic
+// across 
diff erent OSs and filesystems.
+llvm::sort(Headers.begin(), Headers.end(), [](
+  const std::pair &LHS,
+  const std::pair &RHS) {
+return LHS.first < RHS.first;
+});
+for (auto &H : Headers) {
+  // Include this header as part of the umbrella directory.
+  Module->addTopHeader(H.second);
+  addHeaderInclude(H.first, Includes, LangOpts, Module->IsExternC);
+}
   }
 
   // Recurse into submodules.



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


[PATCH] D78000: [ASTImporter] Fix handling of not defined FromRecord in ImportContext(...)

2020-04-21 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik updated this revision to Diff 259110.
shafik marked 2 inline comments as done.
shafik added a comment.

- Simplifying the changes in `ASTImporter::ImportContext`
- Removing `DC->setHasExternalLexicalStorage(true);` from unit test since we 
are checking `getExternalSource()`


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

https://reviews.llvm.org/D78000

Files:
  clang/lib/AST/ASTImporter.cpp
  clang/unittests/AST/ASTImporterTest.cpp
  
lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/TestImportBaseClassWhenClassHasDerivedMember.py
  
lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/main.cpp

Index: lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/main.cpp
===
--- /dev/null
+++ lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/main.cpp
@@ -0,0 +1,35 @@
+struct B {
+  int dump() const;
+};
+
+int B::dump() const { return 42; }
+
+// Derived class D obtains dump() method from base class B
+struct D : public B {
+  // Introduce a TypedefNameDecl
+  using Iterator = D *;
+};
+
+struct C {
+  // This will cause use to invoke VisitTypedefNameDecl(...) when Importing
+  // the DeclContext of C.
+  // We will invoke ImportContext(...) which should force the From Decl to
+  // be defined if it not already defined. We will then Import the definition
+  // to the To Decl.
+  // This will force processing of the base class of D which allows us to see
+  // base class methods such as dump().
+  D::Iterator iter;
+
+  bool f(D *DD) {
+return true; //%self.expect_expr("DD->dump()", result_type="int", result_value="42")
+  }
+};
+
+int main() {
+  C c;
+  D d;
+
+  c.f(&d);
+
+  return 0;
+}
Index: lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/TestImportBaseClassWhenClassHasDerivedMember.py
===
--- /dev/null
+++ lldb/test/API/commands/expression/import_base_class_when_class_has_derived_member/TestImportBaseClassWhenClassHasDerivedMember.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals())
Index: clang/unittests/AST/ASTImporterTest.cpp
===
--- clang/unittests/AST/ASTImporterTest.cpp
+++ clang/unittests/AST/ASTImporterTest.cpp
@@ -5922,6 +5922,70 @@
   EXPECT_TRUE(ToA);
 }
 
+struct ImportWithExternalSource : ASTImporterOptionSpecificTestBase {
+  ImportWithExternalSource() {
+Creator = [](ASTContext &ToContext, FileManager &ToFileManager,
+ ASTContext &FromContext, FileManager &FromFileManager,
+ bool MinimalImport,
+ const std::shared_ptr &SharedState) {
+  return new ASTImporter(ToContext, ToFileManager, FromContext,
+ FromFileManager, MinimalImport,
+ // We use the regular lookup.
+ /*SharedState=*/nullptr);
+};
+  }
+};
+
+/// An ExternalASTSource that keeps track of the tags is completed.
+struct SourceWithCompletedTagList : clang::ExternalASTSource {
+  std::vector &CompletedTags;
+  SourceWithCompletedTagList(std::vector &CompletedTags)
+  : CompletedTags(CompletedTags) {}
+  void CompleteType(TagDecl *Tag) override {
+auto *Record = cast(Tag);
+Record->startDefinition();
+Record->completeDefinition();
+CompletedTags.push_back(Tag);
+  }
+  void
+  FindExternalLexicalDecls(const DeclContext *DC,
+   llvm::function_ref IsKindWeWant,
+   SmallVectorImpl &Result) override {}
+};
+
+TEST_P(ImportWithExternalSource, CompleteRecordBeforeImporting) {
+  // Create an empty TU.
+  TranslationUnitDecl *FromTU = getTuDecl("", Lang_CXX, "input.cpp");
+
+  // Create and add the test ExternalASTSource.
+  std::vector CompletedTags;
+  IntrusiveRefCntPtr source =
+  new SourceWithCompletedTagList(CompletedTags);
+  clang::ASTContext &context = FromTU->getASTContext();
+  context.setExternalSource(std::move(source));
+
+  // Create a dummy class by hand with external lexical storage.
+  IdentifierInfo &Ident = context.Idents.get("test_class");
+  auto *Record = CXXRecordDecl::Create(
+  context, TTK_Class, FromTU, SourceLocation(), SourceLocation(), &Ident);
+  Record->setHasExternalLexicalStorage();
+  FromTU->addDecl(Record);
+
+  // Do a minimal import of the created class.
+  EXPECT_EQ(0U, CompletedTags.size());
+  Import(Record, Lang_CXX);
+  EXPECT_EQ(0U, CompletedTags.size());
+
+  // Import the definition of the created class.
+  llvm::Error err = findFromTU(Record)->Importer->ImportDefinition(Record);
+  EXPECT_FALSE((bool)err);
+  consumeError(std::move(err));
+
+  // Make sure the class was completed once.
+  EXPECT_EQ(1U, Complete

[PATCH] D77168: Add a flag to debug automatic variable initialization

2020-04-21 Thread Jian Cai via Phabricator via cfe-commits
jcai19 added a comment.

> I'd also like to see the pragma attribute approach, as well as byte-pattern 
> variability as I described. I don't think auto-narrowing is the only approach 
> we should push people towards.

Thank you for all the feedback. I agree,  the pragma attribute and the 
byte-pattern approach are versatile, and great to have along the proposed 
approach. Will work on that and iterate on this patch based on the feedback.

> Do you have an existing experience of using this flag in your build? What's 
> your strategy for using it?

Thank you for sharing your experience. It's great to know other people are 
facing similar challenges. I used this flag to debug an issue 
 while enabling 
-ftrivial-auto-var-init=pattern on ChromeOS kernel 4.14. I used a bisection 
tool that traced the issue into the file of interest, but I did not know which 
part of the code caused the issue. That file had many 

 small functions and local variables so it would be time consuming to manually 
fiddle with each variable to find out the root cause. On Linux kernel, it's 
easy to add build flags to each individual files, and ChromeOS provided a tool 
to update the OS on the test device,  so each time I increased the counter with 
the proposed option and rebuilt the kernel, I updated the test device with the 
new kernel to verify if the issue still reproduce.  Eventually it turned out 
some variable was used before [initialized](crrev.com/c/2020401). It seems your 
scenario is slightly different, in the sense you already know which portion of 
the code is problematic, in that case a pragma-driven approach should work 
perfectly.

> In our build, we always apply flags to the entire target, not individual 
> files, so to use the proposed flag, I'd have to modify the build to extract a 
> single file into a separate target in order to apply the flag only to that 
> file which seems comparatively intrusive to inserting the pragma. Is that 
> something you could comment on?

I am not familiar with Fuchsia build system, it does sound more complicated if 
you have to create a separate build target to just pass the flag. However, you 
will need this flag most likely when you run into an issue and you do not have 
much idea what might have been the cause, so I assume this will not happen that 
often :). And IMO the time saved from automating the bisect process should more 
than enough cover the extra effort for creating the build targets in those 
cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77168



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


[PATCH] D78563: [AIX] Port power alignment rules to clang

2020-04-21 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added inline comments.



Comment at: clang/include/clang/AST/RecordLayout.h:81
 
+  /// AIXOffsetAlignment - The special AIX Alignment for the object that
+  /// contains floating-point member or sub-member. This is for AIX-abi only.

AIX Alignment -> AIX alignment



Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:1013
+  UpdateAlignment(BaseAlign, UnpackedBaseAlign,
+  /*AIXOffsetAlignment : used by AIX-ABI*/
+  BaseAlign);

Consistent spelling as: AIX-abi?



Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:1853
 
+  // AIX abi has this special rule that in aggregates, the first member of
+  // floating point data type(or aggregate type contains floating point data

Consistent spelling as AIX-abi?



Comment at: clang/test/Layout/aix-double-struct-member.cpp:136
+// CHECK-NEXT:|  nvsize=12, nvalign=4]
+}; // namespace test4

jasonliu wrote:
> 1. I think we also want to test empty base class with a derived class 
> contains double as first. And also a non-empty base class with derived 
> contains double as first to show that it has effect on basic inheritance as 
> well.
> 2. We need one more test for seeing how pack align interact with AIX 
> alignment. 
We also want to test if MaxFieldAlignment could override the AIX alignment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78563



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


[PATCH] D73846: [PCH] make sure to not warn about unused macros from -D

2020-04-21 Thread Luboš Luňák via Phabricator via cfe-commits
llunak added a comment.

In D73846#1991330 , @rsmith wrote:

> Looks OK as a workaround. Do you know why we consider these to be in the main 
> file? If we could fix that in the source manager, that'd seem preferable.


According to my testing, SourceManager::isInMainFile() can handle "" 
locations in 3 ways:

- for macros defined using -D on the command line the control flow returns 
false in the "if (FI.hasLineDirectives())" block
- for built-in macros such as __clang__ the control flow enters the same "if 
(FI.hasLineDirectives())" block, but Entry->IncludeOffset is 0, so the flow 
then reaches the final "return FI.getIncludeLoc().isInvalid();", which returns 
true
- if PCH is used, macros defined using -D on the command line do not even enter 
"if (FI.hasLineDirectives())" and so they end up returning true the same way 
built-in macros do

But I don't understand this enough to know why and what that actually means.

I've also tried a patch that added SourceManager::setPredefinesFileID() and 
moved the check from this patch to SourceManager::isInMainFile(), but then 
tests fail because apparently Preprocessor::setPredefinesFileID() may be called 
multiple times.


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

https://reviews.llvm.org/D73846



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


[PATCH] D78563: [AIX] Port power alignment rules to clang

2020-04-21 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added inline comments.



Comment at: clang/include/clang/AST/RecordLayout.h:177
 
+  /// getAIXOffsetAlignment - Get the record of aixOffset alignment in
+  /// characters.

Not sure if aixOffset is a thing? Might be better to just say "aix offset 
alignment"? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78563



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


[PATCH] D78563: [AIX] Port power alignment rules to clang

2020-04-21 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added inline comments.



Comment at: clang/test/Layout/aix-double-struct-member.cpp:136
+// CHECK-NEXT:|  nvsize=12, nvalign=4]
+}; // namespace test4

1. I think we also want to test empty base class with a derived class contains 
double as first. And also a non-empty base class with derived contains double 
as first to show that it has effect on basic inheritance as well.
2. We need one more test for seeing how pack align interact with AIX alignment. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78563



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


[PATCH] D77233: [NFC] Refactoring PropertyAttributeKind for ObjCPropertyDecl and ObjCDeclSpec.

2020-04-21 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

@erik.pilkington @arphaman ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77233



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


[PATCH] D78569: [SVE][CodeGen] Lower SDIV & UDIV to SVE intrinsics

2020-04-21 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:7670
+ Mask, Op.getOperand(0), Op.getOperand(1));
+}
+

sdesmalen wrote:
> efriedma wrote:
> > If we're going to support these operations, we might as well just add isel 
> > patterns; that's what we've been doing for other arithmetic operations.
> Just to provide a bit of context to this approach:
> 
> For unpredicated ISD nodes for which there is no predicated instruction, the 
> predicate needs to be generated. For scalable vectors this will be a `ptrue 
> all`, but for fixed-width vectors may take some other predicate such as VL8 
> for fixed `8` elements.
> 
> Rather than creating new predicated AArch64 ISD nodes for each operation such 
> as `AArch64ISD::UDIV_PRED`, the idea is to reuse the intrinsic layer we 
> already added to support the ACLE - which are predicated and for which we 
> already have the patterns - and map directly onto those.
> 
> By doing the expansion in ISelLowering, the patterns stay simple and we can 
> generalise `getPtrue` method so that it generates the right predicate for any 
> scalable/fixed vector size as done in D71760 avoiding the need to write 
> multiple patterns for different vector lengths.
> 
> This patch was meant as the proof of concept of that idea (as discussed in 
> the sync-up call of Apr 2). 
Using INTRINSIC_WO_CHAIN is a little annoying; it's hard to read in DAG dumps, 
and it gives weird error messages if we fail in selection.  But there aren't 
really any other immediate downsides I can think of, vs. doing it the other way 
(converting the intrinsic to AArch64ISD::UDIV_PRED).

Long-term, we're going to have a target-independent ISD::UDIV_PRED.  We 
probably want to start using those nodes at some point, to get 
target-independent optimizations. Not sure if that impacts what we want to do 
right now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78569



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


[PATCH] D75591: [OpenMP] Add firstprivate as a default data-sharing attribute to clang

2020-04-21 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:3211-3213
+  VD->getStorageClass() == SC_Static &&
+  (CanonicalVD->getDeclContext()->isNamespace() ||
+   !VD->isLocalVarDeclOrParm())) {

atmnpatel wrote:
> ABataev wrote:
> > atmnpatel wrote:
> > > ABataev wrote:
> > > > I think just `!VD->hasLocalStorage()` should be enough here. Shall it 
> > > > work for static locals too or just for globals?
> > > Just for globals.
> > What about static data members?
> The TR doesn't specify that static data members should inherit DSAs / have 
> them explicitly defined.
What about non-static globals? Your current check works only for something like 
`static int var;`, but not `int var;`.



Comment at: clang/test/OpenMP/parallel_master_codegen.cpp:145
+
+// CK31:   define internal {{.*}}void [[OMP_OUTLINED]](i32* noalias 
[[GTID:%.+]], i32* noalias [[BTID:%.+]], i32* dereferenceable(4) [[A_VAL]])
+// CK31:   [[GTID_ADDR:%.+]] = alloca i32*

atmnpatel wrote:
> ABataev wrote:
> > atmnpatel wrote:
> > > ABataev wrote:
> > > > Some extra work is required. The variable should not be captured by 
> > > > reference, must be captured by value. Also, a test with calling 
> > > > constructors/destructors is required.
> > > Sorry, I added a test with constructors/destructors with codegen. The 
> > > variable capture discussion was had above and I'm pretty sure that the 
> > > conclusion above (correct me if I'm wrong) was that its not ideal, but 
> > > its fine for now and will be adjusted with the upcoming OMPIRBuilder.
> > It shall emit the correct code anyway. With `default(firstprivate)` and 
> > explicit `firstprivate` clause the codegen will be different and it may 
> > lead to an incompatibility with the existing libraries/object files.
> Ohh I see your concern now. Is the conclusion that I should just table this 
> until something new pops up? I couldn't follow up on @fghanim's advice (sorry 
> I've been on and off trying different things for weeks), it's beyond my 
> capabilities.
You need to modify function `Sema::isOpenMPCapturedByRef`. There is a check for 
firstprivates in there, you need to add a check that the variable has no 
explicit data-sharing attributes and the default data sharing is set to 
`firstprivate`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75591



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


[PATCH] D78513: [hip] Claim builtin type `__float128` supported if the host target supports it.

2020-04-21 Thread Michael Liao via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG86e3b735cd80: [hip] Claim builtin type `__float128` 
supported if the host target supports it. (authored by hliao).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78513

Files:
  clang/lib/Basic/Targets/AMDGPU.cpp
  clang/test/SemaCUDA/amdgpu-f128.cu


Index: clang/test/SemaCUDA/amdgpu-f128.cu
===
--- /dev/null
+++ clang/test/SemaCUDA/amdgpu-f128.cu
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple 
x86_64-unknown-linux-gnu -fcuda-is-device -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+typedef __float128 f128_t;
Index: clang/lib/Basic/Targets/AMDGPU.cpp
===
--- clang/lib/Basic/Targets/AMDGPU.cpp
+++ clang/lib/Basic/Targets/AMDGPU.cpp
@@ -363,4 +363,17 @@
   copyAuxTarget(Aux);
   LongDoubleFormat = SaveLongDoubleFormat;
   Float128Format = SaveFloat128Format;
+  // For certain builtin types support on the host target, claim they are
+  // support to pass the compilation of the host code during the device-side
+  // compilation.
+  // FIXME: As the side effect, we also accept `__float128` uses in the device
+  // code. To rejct these builtin types supported in the host target but not in
+  // the device target, one approach would support `device_builtin` attribute
+  // so that we could tell the device builtin types from the host ones. The
+  // also solves the different representations of the same builtin type, such
+  // as `size_t` in the MSVC environment.
+  if (Aux->hasFloat128Type()) {
+HasFloat128 = true;
+Float128Format = DoubleFormat;
+  }
 }


Index: clang/test/SemaCUDA/amdgpu-f128.cu
===
--- /dev/null
+++ clang/test/SemaCUDA/amdgpu-f128.cu
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+typedef __float128 f128_t;
Index: clang/lib/Basic/Targets/AMDGPU.cpp
===
--- clang/lib/Basic/Targets/AMDGPU.cpp
+++ clang/lib/Basic/Targets/AMDGPU.cpp
@@ -363,4 +363,17 @@
   copyAuxTarget(Aux);
   LongDoubleFormat = SaveLongDoubleFormat;
   Float128Format = SaveFloat128Format;
+  // For certain builtin types support on the host target, claim they are
+  // support to pass the compilation of the host code during the device-side
+  // compilation.
+  // FIXME: As the side effect, we also accept `__float128` uses in the device
+  // code. To rejct these builtin types supported in the host target but not in
+  // the device target, one approach would support `device_builtin` attribute
+  // so that we could tell the device builtin types from the host ones. The
+  // also solves the different representations of the same builtin type, such
+  // as `size_t` in the MSVC environment.
+  if (Aux->hasFloat128Type()) {
+HasFloat128 = true;
+Float128Format = DoubleFormat;
+  }
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76929: [AArch64][SVE] Add SVE intrinsic for LD1RQ

2020-04-21 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen accepted this revision.
sdesmalen added a comment.
This revision is now accepted and ready to land.

LGTM!


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

https://reviews.llvm.org/D76929



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


[PATCH] D78569: [SVE][CodeGen] Lower SDIV & UDIV to SVE intrinsics

2020-04-21 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:7670
+ Mask, Op.getOperand(0), Op.getOperand(1));
+}
+

efriedma wrote:
> If we're going to support these operations, we might as well just add isel 
> patterns; that's what we've been doing for other arithmetic operations.
Just to provide a bit of context to this approach:

For unpredicated ISD nodes for which there is no predicated instruction, the 
predicate needs to be generated. For scalable vectors this will be a `ptrue 
all`, but for fixed-width vectors may take some other predicate such as VL8 for 
fixed `8` elements.

Rather than creating new predicated AArch64 ISD nodes for each operation such 
as `AArch64ISD::UDIV_PRED`, the idea is to reuse the intrinsic layer we already 
added to support the ACLE - which are predicated and for which we already have 
the patterns - and map directly onto those.

By doing the expansion in ISelLowering, the patterns stay simple and we can 
generalise `getPtrue` method so that it generates the right predicate for any 
scalable/fixed vector size as done in D71760 avoiding the need to write 
multiple patterns for different vector lengths.

This patch was meant as the proof of concept of that idea (as discussed in the 
sync-up call of Apr 2). 



Comment at: llvm/test/CodeGen/AArch64/llvm-ir-to-intrinsic.ll:28
+; CHECK: ptrue p0.s
+; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z2.s
+; CHECK-NEXT: sdiv z1.s, p0/m, z1.s, z3.s

This test should use CHECK-DAG instead of CHECK-NEXT, as the sdiv instructions 
are independent. (same for some of the other tests)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78569



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


[PATCH] D75591: [OpenMP] Add firstprivate as a default data-sharing attribute to clang

2020-04-21 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel marked 2 inline comments as done.
atmnpatel added inline comments.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:3211-3213
+  VD->getStorageClass() == SC_Static &&
+  (CanonicalVD->getDeclContext()->isNamespace() ||
+   !VD->isLocalVarDeclOrParm())) {

ABataev wrote:
> atmnpatel wrote:
> > ABataev wrote:
> > > I think just `!VD->hasLocalStorage()` should be enough here. Shall it 
> > > work for static locals too or just for globals?
> > Just for globals.
> What about static data members?
The TR doesn't specify that static data members should inherit DSAs / have them 
explicitly defined.



Comment at: clang/test/OpenMP/parallel_master_codegen.cpp:145
+
+// CK31:   define internal {{.*}}void [[OMP_OUTLINED]](i32* noalias 
[[GTID:%.+]], i32* noalias [[BTID:%.+]], i32* dereferenceable(4) [[A_VAL]])
+// CK31:   [[GTID_ADDR:%.+]] = alloca i32*

ABataev wrote:
> atmnpatel wrote:
> > ABataev wrote:
> > > Some extra work is required. The variable should not be captured by 
> > > reference, must be captured by value. Also, a test with calling 
> > > constructors/destructors is required.
> > Sorry, I added a test with constructors/destructors with codegen. The 
> > variable capture discussion was had above and I'm pretty sure that the 
> > conclusion above (correct me if I'm wrong) was that its not ideal, but its 
> > fine for now and will be adjusted with the upcoming OMPIRBuilder.
> It shall emit the correct code anyway. With `default(firstprivate)` and 
> explicit `firstprivate` clause the codegen will be different and it may lead 
> to an incompatibility with the existing libraries/object files.
Ohh I see your concern now. Is the conclusion that I should just table this 
until something new pops up? I couldn't follow up on @fghanim's advice (sorry 
I've been on and off trying different things for weeks), it's beyond my 
capabilities.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75591



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


[PATCH] D78567: C++2a -> C++20 in some identifiers; NFC

2020-04-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Thanks! I've committed in 6a30894391ca671bab16c505eff30c7819bd8e8e 
. If I get 
a spare moment, I may do this dance again with diagnostic identifers as well.


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

https://reviews.llvm.org/D78567



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


[PATCH] D78134: [Sema] Don't apply an lvalue-to-rvalue conversion to a discarded-value expression if it has an array type

2020-04-21 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 259081.
ahatanak added a comment.

Make Sema::DefaultLvalueConversion ignore gl-values of array type


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78134

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/test/CXX/expr/p10-0x.cpp
  clang/test/SemaCXX/warn-unused-value-cxx11.cpp


Index: clang/test/SemaCXX/warn-unused-value-cxx11.cpp
===
--- clang/test/SemaCXX/warn-unused-value-cxx11.cpp
+++ clang/test/SemaCXX/warn-unused-value-cxx11.cpp
@@ -41,4 +41,13 @@
   (void)noexcept(s.g() = 5); // Ok
 }
 
-}
\ No newline at end of file
+}
+
+namespace volatile_array {
+void test() {
+  char a[10];
+  volatile char b[10];
+  a; // expected-warning-re {{expression result unused{{$
+  b; // expected-warning-re {{expression result unused{{$
+}
+}
Index: clang/test/CXX/expr/p10-0x.cpp
===
--- clang/test/CXX/expr/p10-0x.cpp
+++ clang/test/CXX/expr/p10-0x.cpp
@@ -44,3 +44,12 @@
   refcall();
   1 ? refcall() : *x;
 }
+
+// CHECK: define void @_Z2f3v()
+// CHECK-NOT: load
+// CHECK-NOT: memcpy
+
+void f3(void) {
+  volatile char a[10];
+  a;
+}
Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -370,7 +370,10 @@
 }
   }
 
-  if (E->isGLValue() && E->getType().isVolatileQualified()) {
+  // Tell the user to assign it into a variable to force a volatile load if 
this
+  // isn't an array.
+  if (E->isGLValue() && E->getType().isVolatileQualified() &&
+  !E->getType()->isArrayType()) {
 Diag(Loc, diag::warn_unused_volatile) << R1 << R2;
 return;
   }
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -606,6 +606,10 @@
   QualType T = E->getType();
   assert(!T.isNull() && "r-value conversion on typeless expression?");
 
+  // lvalue-to-rvalue conversion cannot be applied to array types.
+  if (T->isArrayType())
+return E;
+
   // We don't want to throw lvalue-to-rvalue casts on top of
   // expressions of certain types in C++.
   if (getLangOpts().CPlusPlus &&
Index: clang/include/clang/Sema/Sema.h
===
--- clang/include/clang/Sema/Sema.h
+++ clang/include/clang/Sema/Sema.h
@@ -10822,9 +10822,8 @@
   bool Diagnose = true);
 
   // DefaultLvalueConversion - performs lvalue-to-rvalue conversion on
-  // the operand.  This is DefaultFunctionArrayLvalueConversion,
-  // except that it assumes the operand isn't of function or array
-  // type.
+  // the operand. This function assumes the operand isn't of function type. It
+  // is a no-op if the operand has an array type.
   ExprResult DefaultLvalueConversion(Expr *E);
 
   // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that


Index: clang/test/SemaCXX/warn-unused-value-cxx11.cpp
===
--- clang/test/SemaCXX/warn-unused-value-cxx11.cpp
+++ clang/test/SemaCXX/warn-unused-value-cxx11.cpp
@@ -41,4 +41,13 @@
   (void)noexcept(s.g() = 5); // Ok
 }
 
-}
\ No newline at end of file
+}
+
+namespace volatile_array {
+void test() {
+  char a[10];
+  volatile char b[10];
+  a; // expected-warning-re {{expression result unused{{$
+  b; // expected-warning-re {{expression result unused{{$
+}
+}
Index: clang/test/CXX/expr/p10-0x.cpp
===
--- clang/test/CXX/expr/p10-0x.cpp
+++ clang/test/CXX/expr/p10-0x.cpp
@@ -44,3 +44,12 @@
   refcall();
   1 ? refcall() : *x;
 }
+
+// CHECK: define void @_Z2f3v()
+// CHECK-NOT: load
+// CHECK-NOT: memcpy
+
+void f3(void) {
+  volatile char a[10];
+  a;
+}
Index: clang/lib/Sema/SemaStmt.cpp
===
--- clang/lib/Sema/SemaStmt.cpp
+++ clang/lib/Sema/SemaStmt.cpp
@@ -370,7 +370,10 @@
 }
   }
 
-  if (E->isGLValue() && E->getType().isVolatileQualified()) {
+  // Tell the user to assign it into a variable to force a volatile load if this
+  // isn't an array.
+  if (E->isGLValue() && E->getType().isVolatileQualified() &&
+  !E->getType()->isArrayType()) {
 Diag(Loc, diag::warn_unused_volatile) << R1 << R2;
 return;
   }
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -606,6 +606,10 @@
   QualType T = E->getType();
   assert(!T.isNull() && "r-value conversion on typeless expression?");
 
+  // lvalue-to-rvalue conversion cannot be applied to ar

[PATCH] D75591: [OpenMP] Add firstprivate as a default data-sharing attribute to clang

2020-04-21 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:3211-3213
+  VD->getStorageClass() == SC_Static &&
+  (CanonicalVD->getDeclContext()->isNamespace() ||
+   !VD->isLocalVarDeclOrParm())) {

atmnpatel wrote:
> ABataev wrote:
> > I think just `!VD->hasLocalStorage()` should be enough here. Shall it work 
> > for static locals too or just for globals?
> Just for globals.
What about static data members?



Comment at: clang/test/OpenMP/parallel_master_codegen.cpp:145
+
+// CK31:   define internal {{.*}}void [[OMP_OUTLINED]](i32* noalias 
[[GTID:%.+]], i32* noalias [[BTID:%.+]], i32* dereferenceable(4) [[A_VAL]])
+// CK31:   [[GTID_ADDR:%.+]] = alloca i32*

atmnpatel wrote:
> ABataev wrote:
> > Some extra work is required. The variable should not be captured by 
> > reference, must be captured by value. Also, a test with calling 
> > constructors/destructors is required.
> Sorry, I added a test with constructors/destructors with codegen. The 
> variable capture discussion was had above and I'm pretty sure that the 
> conclusion above (correct me if I'm wrong) was that its not ideal, but its 
> fine for now and will be adjusted with the upcoming OMPIRBuilder.
It shall emit the correct code anyway. With `default(firstprivate)` and 
explicit `firstprivate` clause the codegen will be different and it may lead to 
an incompatibility with the existing libraries/object files.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75591



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


[clang] 86e3b73 - [hip] Claim builtin type `__float128` supported if the host target supports it.

2020-04-21 Thread Michael Liao via cfe-commits

Author: Michael Liao
Date: 2020-04-21T15:56:40-04:00
New Revision: 86e3b735cd803cc22c9eae15d99ce9df5956aae6

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

LOG: [hip] Claim builtin type `__float128` supported if the host target 
supports it.

Reviewers: tra, yaxunl

Subscribers: jvesely, nhaehnle, kerbowa, cfe-commits

Tags: #clang

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

Added: 
clang/test/SemaCUDA/amdgpu-f128.cu

Modified: 
clang/lib/Basic/Targets/AMDGPU.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets/AMDGPU.cpp 
b/clang/lib/Basic/Targets/AMDGPU.cpp
index 3fd9008e4660..b9d7640a10b8 100644
--- a/clang/lib/Basic/Targets/AMDGPU.cpp
+++ b/clang/lib/Basic/Targets/AMDGPU.cpp
@@ -363,4 +363,17 @@ void AMDGPUTargetInfo::setAuxTarget(const TargetInfo *Aux) 
{
   copyAuxTarget(Aux);
   LongDoubleFormat = SaveLongDoubleFormat;
   Float128Format = SaveFloat128Format;
+  // For certain builtin types support on the host target, claim they are
+  // support to pass the compilation of the host code during the device-side
+  // compilation.
+  // FIXME: As the side effect, we also accept `__float128` uses in the device
+  // code. To rejct these builtin types supported in the host target but not in
+  // the device target, one approach would support `device_builtin` attribute
+  // so that we could tell the device builtin types from the host ones. The
+  // also solves the 
diff erent representations of the same builtin type, such
+  // as `size_t` in the MSVC environment.
+  if (Aux->hasFloat128Type()) {
+HasFloat128 = true;
+Float128Format = DoubleFormat;
+  }
 }

diff  --git a/clang/test/SemaCUDA/amdgpu-f128.cu 
b/clang/test/SemaCUDA/amdgpu-f128.cu
new file mode 100644
index ..9a0212cdb93c
--- /dev/null
+++ b/clang/test/SemaCUDA/amdgpu-f128.cu
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple 
x86_64-unknown-linux-gnu -fcuda-is-device -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+typedef __float128 f128_t;



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


[clang] 6a30894 - C++2a -> C++20 in some identifiers; NFC.

2020-04-21 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2020-04-21T15:37:19-04:00
New Revision: 6a30894391ca671bab16c505eff30c7819bd8e8e

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

LOG: C++2a -> C++20 in some identifiers; NFC.

Added: 


Modified: 
clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
clang/include/clang/AST/DeclCXX.h
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Basic/LangStandard.h
clang/include/clang/Basic/LangStandards.def
clang/include/clang/Basic/TokenKinds.def
clang/lib/AST/DeclCXX.cpp
clang/lib/AST/DeclTemplate.cpp
clang/lib/AST/ExprConstant.cpp
clang/lib/AST/Interp/Interp.cpp
clang/lib/AST/Interp/Interp.h
clang/lib/Basic/IdentifierTable.cpp
clang/lib/Basic/Targets/OSTargets.cpp
clang/lib/CodeGen/CGExprScalar.cpp
clang/lib/CrossTU/CrossTranslationUnit.cpp
clang/lib/Format/Format.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/InitPreprocessor.cpp
clang/lib/Lex/Lexer.cpp
clang/lib/Lex/LiteralSupport.cpp
clang/lib/Lex/Preprocessor.cpp
clang/lib/Lex/TokenConcatenation.cpp
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/ParseExprCXX.cpp
clang/lib/Parse/ParseStmt.cpp
clang/lib/Parse/ParseTemplate.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaInit.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaType.cpp
clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp

Removed: 




diff  --git 
a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp 
b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
index da0794ade65e..22373439083e 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -456,7 +456,7 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
 // Don't suggest fixes for bitfields because in-class initialization is not
 // possible until C++2a.
 if (F->getType()->isEnumeralType() ||
-(!getLangOpts().CPlusPlus2a && F->isBitField()))
+(!getLangOpts().CPlusPlus20 && F->isBitField()))
   return;
 if (!F->getParent()->isUnion() || UnionsSeen.insert(F->getParent()).second)
   FieldsToFix.insert(F);

diff  --git 
a/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp 
b/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
index 5ce49865a032..9ce56d953c9e 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
@@ -217,7 +217,7 @@ void 
UseDefaultMemberInitCheck::registerMatchers(MatchFinder *Finder) {
   isDefaultConstructor(), unless(isInstantiated()),
   forEachConstructorInitializer(
   cxxCtorInitializer(
-  forField(unless(anyOf(getLangOpts().CPlusPlus2a
+  forField(unless(anyOf(getLangOpts().CPlusPlus20
 ? unless(anything())
 : isBitField(),
 hasInClassInitializer(anything()),

diff  --git a/clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp 
b/clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
index 3f5cf18e12d8..d567f524a6d1 100644
--- a/clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
@@ -96,7 +96,7 @@ void SIMDIntrinsicsCheck::registerMatchers(MatchFinder 
*Finder) {
   // If Std is not specified, infer it from the language options.
   // libcxx implementation backports it to C++11 std::experimental::simd.
   if (Std.empty())
-Std = getLangOpts().CPlusPlus2a ? "std" : "std::experimental";
+Std = getLangOpts().CPlusPlus20 ? "std" : "std::experimental";
 
   Finder->addMatcher(callExpr(callee(functionDecl(
   
matchesName("^::(_mm_|_mm256_|_mm512_|vec_)"),

diff  --git a/clang/include/clang/AST/DeclCXX.h 
b/clang/include/clang/AST/DeclCXX.h
index 58b8646d1ab6..3a400a778e53 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -1167,7 +1167,7 @@ class CXXRecordDecl : public RecordDecl {
   bool defaultedDefaultConstruc

[PATCH] D75591: [OpenMP] Add firstprivate as a default data-sharing attribute to clang

2020-04-21 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel updated this revision to Diff 259073.
atmnpatel marked 3 inline comments as done.
atmnpatel added a comment.

Addresses inline comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75591

Files:
  clang-tools-extra/docs/clang-tidy/checks/openmp-use-default-none.rst
  clang-tools-extra/test/clang-tidy/checkers/openmp-use-default-none.cpp
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/ASTMatchers/Dynamic/Registry.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/distribute_parallel_for_default_messages.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/driver.c
  clang/test/OpenMP/parallel_default_messages.cpp
  clang/test/OpenMP/parallel_for_default_messages.cpp
  clang/test/OpenMP/parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/parallel_master_codegen.cpp
  clang/test/OpenMP/parallel_master_default_messages.cpp
  clang/test/OpenMP/parallel_sections_default_messages.cpp
  clang/test/OpenMP/target_parallel_default_messages.cpp
  clang/test/OpenMP/target_parallel_for_default_messages.cpp
  clang/test/OpenMP/target_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/target_teams_default_messages.cpp
  clang/test/OpenMP/target_teams_distribute_default_messages.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_default_messages.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/task_default_messages.cpp
  clang/test/OpenMP/task_messages.cpp
  clang/test/OpenMP/teams_default_messages.cpp
  clang/test/OpenMP/teams_distribute_default_messages.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_default_messages.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_simd_default_messages.cpp
  clang/test/OpenMP/teams_distribute_simd_default_messages.cpp
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
  clang/unittests/ASTMatchers/ASTMatchersTest.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def

Index: llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
===
--- llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -543,6 +543,7 @@
 
 __OMP_DEFAULT_KIND(none)
 __OMP_DEFAULT_KIND(shared)
+__OMP_DEFAULT_KIND(firstprivate)
 __OMP_DEFAULT_KIND(unknown)
 
 #undef __OMP_DEFAULT_KIND
Index: clang/unittests/ASTMatchers/ASTMatchersTest.h
===
--- clang/unittests/ASTMatchers/ASTMatchersTest.h
+++ clang/unittests/ASTMatchers/ASTMatchersTest.h
@@ -314,6 +314,20 @@
   return matchesConditionally(Code, AMatcher, false, "-fopenmp=libomp");
 }
 
+template 
+testing::AssertionResult matchesWithOpenMP51(const std::string &Code,
+ const T &AMatcher) {
+  return matchesConditionally(Code, AMatcher, true,
+  {"-fopenmp=libomp", "-fopenmp-version=51"});
+}
+
+template 
+testing::AssertionResult notMatchesWithOpenMP51(const std::string &Code,
+const T &AMatcher) {
+  return matchesConditionally(Code, AMatcher, false,
+  {"-fopenmp=libomp", "-fopenmp-version=51"});
+}
+
 template 
 testing::AssertionResult
 matchAndVerifyResultConditionally(const std::string &Code, const T &AMatcher,
Index: clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -1843,11 +1843,18 @@
   EXPECT_TRUE(matchesWithOpenMP(Source3, Matcher));
 
   const std::string Source4 = R"(
+void x() {
+#pragma omp parallel default(firstprivate)
+;
+})";
+  EXPECT_TRUE(matchesWithOpenMP51(Source4, Matcher));
+
+  const std::string Source5 = R"(
 void x(int x) {
 #pragma omp parallel num_threads(x)
 ;
 })";
-  EXPECT_TRUE(notMatchesWithOpenMP(Source4, Matcher));
+  EXPECT_TRUE(notMatchesWithOpenMP(Source5, Matcher));
 }
 
 TEST(MatchFinderAPI, matchesDynamic) {
Index: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -2819,11 +2819,18 @@
   EXPECT_TRUE(matchesWithOpenMP(Source3, Matcher));
 
   const std::string Source4 = R"(
+void x() {
+#pragma omp parallel default(firstprivate)
+;
+})";
+  EXPECT_TRUE(matchesWithOpenMP51(Source4, Matcher));
+
+  const std::string Source5 = R"(
 void x(int x) {
 #pragma omp parallel num_threads(x)
 ;
 })";
-  EXPECT_TRUE(matchesW

[PATCH] D75591: [OpenMP] Add firstprivate as a default data-sharing attribute to clang

2020-04-21 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel marked an inline comment as done and an inline comment as not done.
atmnpatel added inline comments.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:3211-3213
+  VD->getStorageClass() == SC_Static &&
+  (CanonicalVD->getDeclContext()->isNamespace() ||
+   !VD->isLocalVarDeclOrParm())) {

ABataev wrote:
> I think just `!VD->hasLocalStorage()` should be enough here. Shall it work 
> for static locals too or just for globals?
Just for globals.



Comment at: clang/test/OpenMP/parallel_master_codegen.cpp:145
+
+// CK31:   define internal {{.*}}void [[OMP_OUTLINED]](i32* noalias 
[[GTID:%.+]], i32* noalias [[BTID:%.+]], i32* dereferenceable(4) [[A_VAL]])
+// CK31:   [[GTID_ADDR:%.+]] = alloca i32*

ABataev wrote:
> Some extra work is required. The variable should not be captured by 
> reference, must be captured by value. Also, a test with calling 
> constructors/destructors is required.
Sorry, I added a test with constructors/destructors with codegen. The variable 
capture discussion was had above and I'm pretty sure that the conclusion above 
(correct me if I'm wrong) was that its not ideal, but its fine for now and will 
be adjusted with the upcoming OMPIRBuilder.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75591



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


[PATCH] D78252: [AArch64] FMLA/FMLS patterns improvement.

2020-04-21 Thread Pavel Iliin via Phabricator via cfe-commits
ilinpv closed this revision.
ilinpv added a comment.

Committed be881e2831735d6879ee43710f5a4d1c8d50c615 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78252



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


[PATCH] D78567: C++2a -> C++20 in some identifiers; NFC

2020-04-21 Thread David Blaikie via Phabricator via cfe-commits
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: wuzish.

Sounds good!


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

https://reviews.llvm.org/D78567



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


[PATCH] D78030: [TimeProfiler] Emit clock synchronization point

2020-04-21 Thread Sergej Jaskiewicz via Phabricator via cfe-commits
broadwaylamb added a comment.

ping


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

https://reviews.llvm.org/D78030



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


[PATCH] D78513: [hip] Claim builtin type `__float128` supported if the host target supports it.

2020-04-21 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl accepted this revision.
yaxunl 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/D78513/new/

https://reviews.llvm.org/D78513



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


[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-21 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 259060.
baloghadamsoftware added a comment.

My first attempt for a new special kind of region for parameters of functions 
without definitions. Currently it causes more failed tests and assertions than 
ignoring the problem of different `Decl`s. I will investigate these problems 
tomorrow, but this path seems difficult.


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

https://reviews.llvm.org/D77229

Files:
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/Regions.def
  clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/InvalidatedIteratorChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/Iterator.cpp
  clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
  clang/lib/StaticAnalyzer/Checkers/IteratorRangeChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MismatchedIteratorChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/STLAlgorithmModeling.cpp
  clang/lib/StaticAnalyzer/Core/CallEvent.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
  clang/lib/StaticAnalyzer/Core/MemRegion.cpp
  clang/lib/StaticAnalyzer/Core/Store.cpp
  clang/test/Analysis/container-modeling.cpp
  clang/test/Analysis/iterator-modeling.cpp

Index: clang/test/Analysis/iterator-modeling.cpp
===
--- clang/test/Analysis/iterator-modeling.cpp
+++ clang/test/Analysis/iterator-modeling.cpp
@@ -1862,7 +1862,7 @@
 void clang_analyzer_printState();
 
 void print_state(std::vector &V) {
-  const auto i0 = V.cbegin();
+  auto i0 = V.cbegin();
   clang_analyzer_printState();
 
 // CHECK:  "checker_messages": [
@@ -1871,7 +1871,8 @@
 // CHECK-NEXT: "i0 : Valid ; Container == SymRegion{reg_$[[#]] & V>} ; Offset == conj_$[[#]]{long, LC[[#]], S[[#]], #[[#]]}"
 // CHECK-NEXT:   ]}
 
-  const auto i1 = V.cend();
+  ++i0;
+  auto i1 = V.cend();
   clang_analyzer_printState();
   
 // CHECK:  "checker_messages": [
@@ -1879,4 +1880,6 @@
 // CHECK-NEXT: "Iterator Positions :",
 // CHECK-NEXT: "i1 : Valid ; Container == SymRegion{reg_$[[#]] & V>} ; Offset == conj_$[[#]]{long, LC[[#]], S[[#]], #[[#]]}"
 // CHECK-NEXT:   ]}
+
+  --i1;
 }
Index: clang/test/Analysis/container-modeling.cpp
===
--- clang/test/Analysis/container-modeling.cpp
+++ clang/test/Analysis/container-modeling.cpp
@@ -17,7 +17,7 @@
 void clang_analyzer_warnIfReached();
 
 void begin(const std::vector &V) {
-  V.begin();
+  const auto i0 = V.begin();
 
   clang_analyzer_denote(clang_analyzer_container_begin(V), "$V.begin()");
   clang_analyzer_express(clang_analyzer_container_begin(V)); // expected-warning{{$V.begin()}}
@@ -25,7 +25,7 @@
 }
 
 void end(const std::vector &V) {
-  V.end();
+  const auto i0 = V.end();
 
   clang_analyzer_denote(clang_analyzer_container_end(V), "$V.end()");
   clang_analyzer_express(clang_analyzer_container_end(V)); // expected-warning{{$V.end()}}
@@ -41,10 +41,10 @@
 // Move
 
 void move_assignment(std::vector &V1, std::vector &V2) {
-  V1.cbegin();
-  V1.cend();
-  V2.cbegin();
-  V2.cend();
+  const auto i0 = V1.cbegin();
+  const auto i1 = V1.cend();
+  const auto i2 = V2.cbegin();
+  const auto i3 = V2.cend();
   long B1 = clang_analyzer_container_begin(V1);
   long E1 = clang_analyzer_container_end(V1);
   long B2 = clang_analyzer_container_begin(V2);
@@ -70,8 +70,8 @@
 void clang_analyzer_dump(void*);
 
 void push_back(std::vector &V, int n) {
-  V.cbegin();
-  V.cend();
+  const auto i0 = V.cbegin();
+  const auto i1 = V.cend();
 
   clang_analyzer_denote(clang_analyzer_container_begin(V), "$V.begin()");
   clang_analyzer_denote(clang_analyzer_container_end(V), "$V.end()");
@@ -90,8 +90,8 @@
 /// past-the-end position of the container is incremented).
 
 void emplace_back(std::vector &V, int n) {
-  V.cbegin();
-  V.cend();
+  const auto i0 = V.cbegin();
+  const auto i1 = V.cend();
 
   clang_analyzer_denote(clang_analyzer_container_begin(V), "$V.begin()");
   clang_analyzer_denote(clang_analyzer_container_end(V), "$V.end()");
@@ -110,8 +110,8 @@
 /// past-the-end position of the container is decremented).
 
 void pop_back(std::vector &V, int n) {
-  V.cbegin();
-  V.cend();
+  const auto i0 = V.cbegin();
+  const auto i1 = V.cend();
 
   clang_analyzer_denote(clang_analyzer_container_begin(V), "$V.begin()");
   clang_analyzer_denote(clang_analyzer_container_end(V), "$V.end()");
@@ -131,8 +131,8 @@
 /// position of the container is decremented).
 
 void push_front(std::list &L, int n) {
-  L.cbegin();
-  L.cend();
+  const auto i0 = L.cbegin();
+  const auto i1 = L.cend();
 
   clang_analyzer_d

[PATCH] D76932: [AIX] emit .extern and .weak directive linkage

2020-04-21 Thread Digger via Phabricator via cfe-commits
DiggerLin updated this revision to Diff 259057.
DiggerLin marked an inline comment as done.
DiggerLin added a comment.

address comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76932

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-as.c
  llvm/include/llvm/MC/MCAsmInfo.h
  llvm/include/llvm/MC/MCDirectives.h
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/MC/MCAsmInfoXCOFF.cpp
  llvm/lib/MC/MCAsmStreamer.cpp
  llvm/lib/MC/MCXCOFFStreamer.cpp
  llvm/lib/MC/XCOFFObjectWriter.cpp
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/test/CodeGen/PowerPC/aix-LinkOnceAnyLinkage.ll
  llvm/test/CodeGen/PowerPC/aix-LinkOnceODRLinkage.ll
  llvm/test/CodeGen/PowerPC/aix-WeakODRLinkage.ll
  llvm/test/CodeGen/PowerPC/aix-extern-weak.ll
  llvm/test/CodeGen/PowerPC/aix-extern.ll
  llvm/test/CodeGen/PowerPC/aix-reference-func-addr-const.ll
  llvm/test/CodeGen/PowerPC/aix-weak.ll
  llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll

Index: llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
===
--- llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
+++ llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
@@ -36,7 +36,7 @@
 ; OBJ-NEXT:   NumberOfSections: 2
 ; OBJ-NEXT:   TimeStamp: None (0x0)
 ; OBJ-NEXT:   SymbolTableOffset: 0x13C
-; OBJ-NEXT:   SymbolTableEntries: 24
+; OBJ-NEXT:   SymbolTableEntries: 26
 ; OBJ-NEXT:   OptionalHeaderSize: 0x0
 ; OBJ-NEXT:   Flags: 0x0
 ; OBJ-NEXT: }
@@ -86,7 +86,7 @@
 ; RELOC-NEXT:   }
 ; RELOC-NEXT:   Relocation {
 ; RELOC-NEXT: Virtual Address: 0x1A
-; RELOC-NEXT: Symbol: globalA (20)
+; RELOC-NEXT: Symbol: globalA (22)
 ; RELOC-NEXT: IsSigned: No
 ; RELOC-NEXT: FixupBitValue: 0
 ; RELOC-NEXT: Length: 16
@@ -94,7 +94,7 @@
 ; RELOC-NEXT:   }
 ; RELOC-NEXT:   Relocation {
 ; RELOC-NEXT: Virtual Address: 0x1E
-; RELOC-NEXT: Symbol: globalB (22)
+; RELOC-NEXT: Symbol: globalB (24)
 ; RELOC-NEXT: IsSigned: No
 ; RELOC-NEXT: FixupBitValue: 0
 ; RELOC-NEXT: Length: 16
@@ -104,7 +104,7 @@
 ; RELOC-NEXT: Section (index: 2) .data {
 ; RELOC-NEXT: Relocation {
 ; RELOC-NEXT:   Virtual Address: 0x70
-; RELOC-NEXT:   Symbol: arr (12)
+; RELOC-NEXT:   Symbol: arr (14)
 ; RELOC-NEXT:   IsSigned: No
 ; RELOC-NEXT:   FixupBitValue: 0
 ; RELOC-NEXT:   Length: 32
@@ -112,7 +112,7 @@
 ; RELOC-NEXT: }
 ; RELOC-NEXT: Relocation {
 ; RELOC-NEXT:   Virtual Address: 0x74
-; RELOC-NEXT:   Symbol: .foo (4)
+; RELOC-NEXT:   Symbol: .foo (6)
 ; RELOC-NEXT:   IsSigned: No
 ; RELOC-NEXT:   FixupBitValue: 0
 ; RELOC-NEXT:   Length: 32
@@ -120,7 +120,7 @@
 ; RELOC-NEXT: }
 ; RELOC-NEXT: Relocation {
 ; RELOC-NEXT:   Virtual Address: 0x78
-; RELOC-NEXT:   Symbol: TOC (18)
+; RELOC-NEXT:   Symbol: TOC (20)
 ; RELOC-NEXT:   IsSigned: No
 ; RELOC-NEXT:   FixupBitValue: 0
 ; RELOC-NEXT:   Length: 32
@@ -128,7 +128,7 @@
 ; RELOC-NEXT: }
 ; RELOC-NEXT: Relocation {
 ; RELOC-NEXT:   Virtual Address: 0x80
-; RELOC-NEXT:   Symbol: globalA (8)
+; RELOC-NEXT:   Symbol: globalA (10)
 ; RELOC-NEXT:   IsSigned: No
 ; RELOC-NEXT:   FixupBitValue: 0
 ; RELOC-NEXT:   Length: 32
@@ -136,7 +136,7 @@
 ; RELOC-NEXT: }
 ; RELOC-NEXT: Relocation {
 ; RELOC-NEXT:   Virtual Address: 0x84
-; RELOC-NEXT:   Symbol: globalB (10)
+; RELOC-NEXT:   Symbol: globalB (12)
 ; RELOC-NEXT:   IsSigned: No
 ; RELOC-NEXT:   FixupBitValue: 0
 ; RELOC-NEXT:   Length: 32
@@ -168,6 +168,26 @@
 ; SYM-NEXT:   }
 ; SYM-NEXT:   Symbol {
 ; SYM-NEXT: Index: 2
+; SYM-NEXT: Name: bar
+; SYM-NEXT: Value (RelocatableAddress): 0x0
+; SYM-NEXT: Section: N_UNDEF
+; SYM-NEXT: Type: 0x0
+; SYM-NEXT: StorageClass: C_EXT (0x2)
+; SYM-NEXT: NumberOfAuxEntries: 1
+; SYM-NEXT: CSECT Auxiliary Entry {
+; SYM-NEXT:   Index: 3
+; SYM-NEXT:   SectionLen: 0
+; SYM-NEXT:   ParameterHashIndex: 0x0
+; SYM-NEXT:   TypeChkSectNum: 0x0
+; SYM-NEXT:   SymbolAlignmentLog2: 0
+; SYM-NEXT:   SymbolType: XTY_ER (0x0)
+; SYM-NEXT:   StorageMappingClass: XMC_DS (0xA)
+; SYM-NEXT:   StabInfoIndex: 0x0
+; SYM-NEXT:   StabSectNum: 0x0
+; SYM-NEXT: }
+; SYM-NEXT:   }
+; SYM-NEXT:   Symbol {
+; SYM-NEXT: Index: 4
 ; SYM-NEXT: Name: .text
 ; SYM-NEXT: Value (RelocatableAddress): 0x0
 ; SYM-NEXT: Section: .text
@@ -175,7 +195,7 @@
 ; SYM-NEXT: StorageClass: C_HIDEXT (0x6B)
 ; SYM-NEXT: NumberOfAuxEntries: 1
 ; SYM-NEXT: CSECT Auxiliary Entry {
-; SYM-NEXT:   Index: 3
+; SYM-NEXT:   Index: 5
 ; SYM-NEXT:   SectionLen: 64
 ; SYM-NEXT:   ParameterHashIndex: 0x0
 ; SYM-NEXT:   TypeChkSectNum: 0x0
@@ -187,7 +207,7 @@
 ; SYM-NEXT: }
 ; SYM-NEXT:   }
 ; SYM-NEXT:   Symbol {
-; SYM-NEXT: Index: 4
+; SYM-NEXT: Index: 6
 ; SYM-NEXT: Name: .foo
 ; SYM-NEXT: Value (RelocatableAddress): 0x0
 ; SYM-NEXT: Section: .text
@@ -195,

[PATCH] D76801: [AST] Print a> without extra spaces in C++11 or later.

2020-04-21 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D76801#1994003 , @labath wrote:

> In D76801#1993337 , @dblaikie wrote:
>
> > In D76801#1991904 , @labath wrote:
> >
> > > David's example does work with gdb without -Wl,--gdb-index (the member 
> > > variable is shown), presumably due to the aforementioned fuzzy matching. 
> > > However, it does not work if gdb-index is enabled,  nor with lldb (as 
> > > lldb is always very index-oriented and assumes equality everywhere). That 
> > > is definitely not ideal, though I'm not sure that means about this patch. 
> > > This is definitely not the only difference in the formatting of 
> > > DW_AT_names of templates. For example, `template 
> > > operator<<(T, T)` will come out as `operator<< ` with gcc, but as 
> > > `operator<<` with clang (with or without this patch).
> > >  OTOH, differences in type names are more likely to cause problems than 
> > > is the case for functions/operators.
> >
> >
> > That is concerning. Any idea if that's only with lld's gdb-indexx 
> > implementation, or also gold's?
>
>
> I was using gold for my initial test. However, the same thing happens with 
> lld too...


Good to know! Thanks for checking!

>> This isn't the only naming divergence between GCC and Clang, though, so if 
>> gdb-index doesn't support any divergence, that's a problem...
> 
> It becomes a gdb-index problem because with an index the debugger will do a 
> (hashed?) string lookup and expect the string to be there. If the strings 
> differ, the lookup won't find anything. In the no-index scenario, the 
> debugger has to trawl the debug info itself, and so it has some opportunities 
> to do fuzzy matching.

That surprises me a bit - given that one of the things debuggers provide is 
autocomplete (I'm unlikely to write out a type name exactly as the debug info 
contains it - if two compilers can't agree, it's much less likely that all 
users will agree with any compiler rendering), which I'd have thought would be 
facilitated by the index too - in which case lookup via exact match wouldn't be 
viable, you'd still want a way to list anything with a matching substring (or 
at least prefix), etc. Which could help facilitate lookup fuzzy matching like 
in this sort of case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76801



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


[PATCH] D76932: [AIX] emit .extern and .weak directive linkage

2020-04-21 Thread Digger via Phabricator via cfe-commits
DiggerLin marked 2 inline comments as done.
DiggerLin added inline comments.



Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:2146
   }
 }
 

hubert.reinterpretcast wrote:
> Replicate the
> ```
> llvm_unreachable("Unknown linkage type!");
> ```
> here before falling off the end of a function that does not return `void`.
thanks



Comment at: llvm/test/CodeGen/PowerPC/aix-extern-weak.ll:45
+
+; CHECK-NOT:  .weak   .foo_ext_weak_ref
+; COMMON: .csect  .data[RW]

hubert.reinterpretcast wrote:
> This has a prefix that is not checked by the `RUN` lines. Note also that it 
> would only prevent the appearance of the subject line until the next positive 
> match. Running FileCheck a second time on the same output may be necessary to 
> check that it does not appear anywhere in an active manner. The passive 
> method is to count on the block of `COMMON-NEXT` to exclude it.
thanks for let me know


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76932



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


[PATCH] D68049: Propeller: Clang options for basic block sections

2020-04-21 Thread Sriraman Tallam via Phabricator via cfe-commits
tmsriram marked an inline comment as done.
tmsriram added inline comments.



Comment at: clang/include/clang/Driver/Options.td:1975
+def fbasicblock_sections_EQ : Joined<["-"], "fbasicblock-sections=">, 
Group, Flags<[CC1Option, CC1AsOption]>,
+  HelpText<"Place each function's basic blocks in unique sections (ELF Only) : 
all | labels | none | ">;
 def fdata_sections : Flag <["-"], "fdata-sections">, Group,

rsmith wrote:
> It's not great to use the same argument as both one of three specific strings 
> and as an arbitrary filename. This not only prevents using those three names 
> as the file name, it also means adding any more specific strings is a 
> backwards-incompatible change. Can you find some way to tweak this to avoid 
> that problem?
Understood, I have the following suggestions:

1) Would this be ugly?  -fbasicblock-sections=list=
2) I could make this a completely new option.

Is there a preference?  Thanks.


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

https://reviews.llvm.org/D68049



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


[PATCH] D73307: Unique Names for Functions with Internal Linkage

2020-04-21 Thread Sriraman Tallam via Phabricator via cfe-commits
tmsriram marked 3 inline comments as done.
tmsriram added a comment.

@rnk Good now?


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

https://reviews.llvm.org/D73307



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


[PATCH] D78573: [Clang][Sema] Capturing section type conflicts between #pragma clang section and section attributes

2020-04-21 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas updated this revision to Diff 259048.
pratlucas added a comment.

Removing unnecessary function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78573

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/Sema/SemaAttr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/pragma-clang-section.c

Index: clang/test/Sema/pragma-clang-section.c
===
--- clang/test/Sema/pragma-clang-section.c
+++ clang/test/Sema/pragma-clang-section.c
@@ -22,4 +22,9 @@
 #pragma clang section bss = "myrodata.1"   // expected-error {{this causes a section type conflict with a prior #pragma section}}
 #pragma clang section text = "mybss.3" // expected-error {{this causes a section type conflict with a prior #pragma section}}
 
+#pragma clang section rodata = "myrodata.4"  // expected-note {{#pragma entered here}}
+int x __attribute__((section("myrodata.4")));// expected-error {{'x' causes a section type conflict with a prior #pragma section}}
+const int y __attribute__((section("myrodata.5"))) = 10; // expected-note {{declared here}}
+#pragma clang section data = "myrodata.5"// expected-error {{this causes a section type conflict with 'y'}}
+
 int a;
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -12736,7 +12736,7 @@
   if (GlobalStorage && var->isThisDeclarationADefinition() &&
   !inTemplateInstantiation()) {
 PragmaStack *Stack = nullptr;
-int SectionFlags = ASTContext::PSF_Implicit | ASTContext::PSF_Read;
+int SectionFlags = ASTContext::PSF_Read;
 if (var->getType().isConstQualified())
   Stack = &ConstSegStack;
 else if (!var->getInit()) {
@@ -12746,14 +12746,19 @@
   Stack = &DataSegStack;
   SectionFlags |= ASTContext::PSF_Write;
 }
-if (Stack->CurrentValue && !var->hasAttr())
+if (const SectionAttr *SA = var->getAttr()) {
+  if (SA->getSyntax() == AttributeCommonInfo::AS_Declspec)
+SectionFlags |= ASTContext::PSF_Implicit;
+  UnifySection(SA->getName(), SectionFlags, var);
+} else if (Stack->CurrentValue) {
+  SectionFlags |= ASTContext::PSF_Implicit;
+  auto SectionName = Stack->CurrentValue->getString();
   var->addAttr(SectionAttr::CreateImplicit(
-  Context, Stack->CurrentValue->getString(),
-  Stack->CurrentPragmaLocation, AttributeCommonInfo::AS_Pragma,
-  SectionAttr::Declspec_allocate));
-if (const SectionAttr *SA = var->getAttr())
-  if (UnifySection(SA->getName(), SectionFlags, var))
+  Context, SectionName, Stack->CurrentPragmaLocation,
+  AttributeCommonInfo::AS_Pragma, SectionAttr::Declspec_allocate));
+  if (UnifySection(SectionName, SectionFlags, var))
 var->dropAttr();
+}
 
 // Apply the init_seg attribute if this has an initializer.  If the
 // initializer turns out to not be dynamic, we'll end up ignoring this
Index: clang/lib/Sema/SemaAttr.cpp
===
--- clang/lib/Sema/SemaAttr.cpp
+++ clang/lib/Sema/SemaAttr.cpp
@@ -471,42 +471,49 @@
 bool Sema::UnifySection(StringRef SectionName,
 int SectionFlags,
 DeclaratorDecl *Decl) {
-  auto Section = Context.SectionInfos.find(SectionName);
-  if (Section == Context.SectionInfos.end()) {
+  SourceLocation PragmaLocation;
+  if (auto A = Decl->getAttr())
+if (A->isImplicit())
+  PragmaLocation = A->getLocation();
+  auto SectionIt = Context.SectionInfos.find(SectionName);
+  if (SectionIt == Context.SectionInfos.end()) {
 Context.SectionInfos[SectionName] =
-ASTContext::SectionInfo(Decl, SourceLocation(), SectionFlags);
+ASTContext::SectionInfo(Decl, PragmaLocation, SectionFlags);
 return false;
   }
   // A pre-declared section takes precedence w/o diagnostic.
-  if (Section->second.SectionFlags == SectionFlags ||
-  !(Section->second.SectionFlags & ASTContext::PSF_Implicit))
+  const auto &Section = SectionIt->second;
+  if (Section.SectionFlags == SectionFlags ||
+  ((SectionFlags & ASTContext::PSF_Implicit) &&
+   !(Section.SectionFlags & ASTContext::PSF_Implicit)))
 return false;
-  auto OtherDecl = Section->second.Decl;
-  Diag(Decl->getLocation(), diag::err_section_conflict)
-  << Decl << OtherDecl;
-  Diag(OtherDecl->getLocation(), diag::note_declared_at)
-  << OtherDecl->getName();
-  if (auto A = Decl->getAttr())
-if (A->isImplicit())
-  Diag(A->getLocation(), diag::note_pragma_entered_here);
-  if (auto A = OtherDecl->getAttr())
-if (A->isImplicit())
-  Diag(A->getLocation(), diag::note_pragma_entered_here);
+  Diag(Decl->getLocation(), diag::err_section_conflict) << Decl << Sectio

[PATCH] D78569: [SVE][CodeGen] Lower SDIV & UDIV to SVE intrinsics

2020-04-21 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

I'd prefer to handle legalization in a separate patch from handling legal 
sdiv/udiv operations, so we actually have some context to discuss the 
legalization strategy.




Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:7670
+ Mask, Op.getOperand(0), Op.getOperand(1));
+}
+

If we're going to support these operations, we might as well just add isel 
patterns; that's what we've been doing for other arithmetic operations.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78569



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


[clang] be881e2 - [AArch64] FMLA/FMLS patterns improvement.

2020-04-21 Thread Pavel Iliin via cfe-commits

Author: Pavel Iliin
Date: 2020-04-21T18:23:21+01:00
New Revision: be881e2831735d6879ee43710f5a4d1c8d50c615

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

LOG: [AArch64] FMLA/FMLS patterns improvement.

FMLA/FMLS f16 indexed patterns added.
Fixes https://bugs.llvm.org/show_bug.cgi?id=45467
Removed redundant v2f32 vector_extract indexed pattern since
Instruction Selection is able to match v4f32 instead.

Added: 


Modified: 
clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c
llvm/lib/Target/AArch64/AArch64InstrFormats.td
llvm/test/CodeGen/AArch64/fp16_intrinsic_lane.ll

Removed: 




diff  --git a/clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c 
b/clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c
index d7830f71e2de..b72bd3f977dd 100644
--- a/clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c
+++ b/clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c
@@ -89,7 +89,7 @@ float16x8_t test_vfmsq_f16(float16x8_t a, float16x8_t b, 
float16x8_t c) {
 // COMMONIR:  [[TMP5:%.*]] = bitcast <8 x i8> [[TMP0]] to <4 x half>
 // UNCONSTRAINED: [[FMLA:%.*]] = call <4 x half> @llvm.fma.v4f16(<4 x half> 
[[TMP4]], <4 x half> [[LANE]], <4 x half> [[TMP5]])
 // CONSTRAINED:   [[FMLA:%.*]] = call <4 x half> 
@llvm.experimental.constrained.fma.v4f16(<4 x half> [[TMP4]], <4 x half> 
[[LANE]], <4 x half> [[TMP5]], metadata !"round.tonearest", metadata 
!"fpexcept.strict")
-// CHECK-ASM: fmla v{{[0-9]+}}.4h, v{{[0-9]+}}.4h, v{{[0-9]+}}.4h
+// CHECK-ASM: fmla v{{[0-9]+}}.4h, v{{[0-9]+}}.4h, 
v{{[0-9]+}}.h[{{[0-9]+}}]
 // COMMONIR:  ret <4 x half> [[FMLA]]
 float16x4_t test_vfma_lane_f16(float16x4_t a, float16x4_t b, float16x4_t c) {
   return vfma_lane_f16(a, b, c, 3);
@@ -105,7 +105,7 @@ float16x4_t test_vfma_lane_f16(float16x4_t a, float16x4_t 
b, float16x4_t c) {
 // COMMONIR:  [[TMP5:%.*]] = bitcast <16 x i8> [[TMP0]] to <8 x half>
 // UNCONSTRAINED: [[FMLA:%.*]] = call <8 x half> @llvm.fma.v8f16(<8 x half> 
[[TMP4]], <8 x half> [[LANE]], <8 x half> [[TMP5]])
 // CONSTRAINED:   [[FMLA:%.*]] = call <8 x half> 
@llvm.experimental.constrained.fma.v8f16(<8 x half> [[TMP4]], <8 x half> 
[[LANE]], <8 x half> [[TMP5]], metadata !"round.tonearest", metadata 
!"fpexcept.strict")
-// CHECK-ASM: fmla v{{[0-9]+}}.8h, v{{[0-9]+}}.8h, v{{[0-9]+}}.8h
+// CHECK-ASM: fmla v{{[0-9]+}}.8h, v{{[0-9]+}}.8h, 
v{{[0-9]+}}.h[{{[0-9]+}}]
 // COMMONIR:  ret <8 x half> [[FMLA]]
 float16x8_t test_vfmaq_lane_f16(float16x8_t a, float16x8_t b, float16x4_t c) {
   return vfmaq_lane_f16(a, b, c, 3);
@@ -137,7 +137,7 @@ float16x4_t test_vfma_laneq_f16(float16x4_t a, float16x4_t 
b, float16x8_t c) {
 // COMMONIR:  [[LANE:%.*]] = shufflevector <8 x half> [[TMP5]], <8 x half> 
[[TMP5]], <8 x i32> 
 // UNCONSTRAINED: [[FMLA:%.*]] = call <8 x half> @llvm.fma.v8f16(<8 x half> 
[[LANE]], <8 x half> [[TMP4]], <8 x half> [[TMP3]])
 // CONSTRAINED:   [[FMLA:%.*]] = call <8 x half> 
@llvm.experimental.constrained.fma.v8f16(<8 x half> [[LANE]], <8 x half> 
[[TMP4]], <8 x half> [[TMP3]], metadata !"round.tonearest", metadata 
!"fpexcept.strict")
-// CHECK-ASM: fmla v{{[0-9]+}}.8h, v{{[0-9]+}}.8h, v{{[0-9]+}}.8h
+// CHECK-ASM: fmla v{{[0-9]+}}.8h, v{{[0-9]+}}.8h, 
v{{[0-9]+}}.h[{{[0-9]+}}]
 // COMMONIR:  ret <8 x half> [[FMLA]]
 float16x8_t test_vfmaq_laneq_f16(float16x8_t a, float16x8_t b, float16x8_t c) {
   return vfmaq_laneq_f16(a, b, c, 7);
@@ -150,7 +150,7 @@ float16x8_t test_vfmaq_laneq_f16(float16x8_t a, float16x8_t 
b, float16x8_t c) {
 // COMMONIR:  [[TMP3:%.*]] = insertelement <4 x half> [[TMP2]], half %c, 
i32 3
 // UNCONSTRAINED: [[FMA:%.*]]  = call <4 x half> @llvm.fma.v4f16(<4 x half> 
%b, <4 x half> [[TMP3]], <4 x half> %a)
 // CONSTRAINED:   [[FMA:%.*]]  = call <4 x half> 
@llvm.experimental.constrained.fma.v4f16(<4 x half> %b, <4 x half> [[TMP3]], <4 
x half> %a, metadata !"round.tonearest", metadata !"fpexcept.strict")
-// CHECK-ASM: fmla v{{[0-9]+}}.4h, v{{[0-9]+}}.4h, v{{[0-9]+}}.4h
+// CHECK-ASM: fmla v{{[0-9]+}}.4h, v{{[0-9]+}}.4h, 
v{{[0-9]+}}.h[{{[0-9]+}}]
 // COMMONIR:  ret <4 x half> [[FMA]]
 float16x4_t test_vfma_n_f16(float16x4_t a, float16x4_t b, float16_t c) {
   return vfma_n_f16(a, b, c);
@@ -167,7 +167,7 @@ float16x4_t test_vfma_n_f16(float16x4_t a, float16x4_t b, 
float16_t c) {
 // COMMONIR:  [[TMP7:%.*]] = insertelement <8 x half> [[TMP6]], half %c, 
i32 7
 // UNCONSTRAINED: [[FMA:%.*]]  = call <8 x half> @llvm.fma.v8f16(<8 x half> 
%b, <8 x half> [[TMP7]], <8 x half> %a)
 // CONSTRAINED:   [[FMA:%.*]]  = call <8 x half> 
@llvm.experimental.constrained.fma.v8f16(<8 x half> %b, <8 x half> [[TMP7]], <8 
x half> %a, metadata !"round.tonearest", metadata !"fpexcept.strict")
-// 

[PATCH] D78534: [libclang] Install both libclang.a and libclang.so when LIBCLANG_BUILD_STATIC=ON

2020-04-21 Thread Han Zhu via Phabricator via cfe-commits
zhuhan0 updated this revision to Diff 259043.
zhuhan0 added a comment.

Spacing


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78534

Files:
  clang/cmake/modules/AddClang.cmake


Index: clang/cmake/modules/AddClang.cmake
===
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -99,38 +99,40 @@
   endif()
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
 
-  if(TARGET ${name})
-target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
+  foreach(lib ${name} ${name}_static)
+if(TARGET ${lib})
+  target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS})
 
-if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
-  set(export_to_clangtargets)
-  if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-  "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-  NOT LLVM_DISTRIBUTION_COMPONENTS)
-set(export_to_clangtargets EXPORT ClangTargets)
-set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
-  endif()
+  if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
+set(export_to_clangtargets)
+if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+"clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+NOT LLVM_DISTRIBUTION_COMPONENTS)
+  set(export_to_clangtargets EXPORT ClangTargets)
+  set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
+endif()
 
-  install(TARGETS ${name}
-COMPONENT ${name}
-${export_to_clangtargets}
-LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-RUNTIME DESTINATION bin)
+install(TARGETS ${lib}
+  COMPONENT ${lib}
+  ${export_to_clangtargets}
+  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+  ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+  RUNTIME DESTINATION bin)
 
-  if (NOT LLVM_ENABLE_IDE)
-add_llvm_install_targets(install-${name}
- DEPENDS ${name}
- COMPONENT ${name})
-  endif()
+if (NOT LLVM_ENABLE_IDE)
+  add_llvm_install_targets(install-${lib}
+   DEPENDS ${lib}
+   COMPONENT ${lib})
+endif()
 
-  set_property(GLOBAL APPEND PROPERTY CLANG_LIBS ${name})
+set_property(GLOBAL APPEND PROPERTY CLANG_LIBS ${lib})
+  endif()
+  set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${lib})
+else()
+  # Add empty "phony" target
+  add_custom_target(${lib})
 endif()
-set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
-  else()
-# Add empty "phony" target
-add_custom_target(${name})
-  endif()
+  endforeach()
 
   set_target_properties(${name} PROPERTIES FOLDER "Clang libraries")
   set_clang_windows_version_resource_properties(${name})


Index: clang/cmake/modules/AddClang.cmake
===
--- clang/cmake/modules/AddClang.cmake
+++ clang/cmake/modules/AddClang.cmake
@@ -99,38 +99,40 @@
   endif()
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
 
-  if(TARGET ${name})
-target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
+  foreach(lib ${name} ${name}_static)
+if(TARGET ${lib})
+  target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS})
 
-if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
-  set(export_to_clangtargets)
-  if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-  "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-  NOT LLVM_DISTRIBUTION_COMPONENTS)
-set(export_to_clangtargets EXPORT ClangTargets)
-set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
-  endif()
+  if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
+set(export_to_clangtargets)
+if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+"clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+NOT LLVM_DISTRIBUTION_COMPONENTS)
+  set(export_to_clangtargets EXPORT ClangTargets)
+  set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
+endif()
 
-  install(TARGETS ${name}
-COMPONENT ${name}
-${export_to_clangtargets}
-LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-RUNTIME DESTINATION bin)
+install(TARGETS ${lib}
+  COMPONENT ${lib}
+  ${export_to_clangtargets}
+  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+  ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+  RUNTIME DESTINATION bin)
 
-  if (NOT LLVM_ENABLE_IDE)
-add_llvm_

[PATCH] D76929: [AArch64][SVE] Add SVE intrinsic for LD1RQ

2020-04-21 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin updated this revision to Diff 259035.
kmclaughlin marked an inline comment as done.
kmclaughlin added a comment.

- Use Load.getValue(0) when creating a bitcast in performLD1RQCombine


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

https://reviews.llvm.org/D76929

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

Index: llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll
===
--- llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll
@@ -1,6 +1,179 @@
 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
 
 ;
+; LD1RQB
+;
+
+define  @ld1rqb_i8( %pred, i8* %addr) {
+; CHECK-LABEL: ld1rqb_i8:
+; CHECK: ld1rqb { z0.b }, p0/z, [x0]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv16i8( %pred, i8* %addr)
+  ret  %res
+}
+
+define  @ld1rqb_i8_imm( %pred, i8* %addr) {
+; CHECK-LABEL: ld1rqb_i8_imm:
+; CHECK: ld1rqb { z0.b }, p0/z, [x0, #16]
+; CHECK-NEXT: ret
+  %ptr = getelementptr inbounds i8, i8* %addr, i8 16
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv16i8( %pred, i8* %ptr)
+  ret  %res
+}
+
+define  @ld1rqb_i8_imm_lower_bound( %pred, i8* %addr) {
+; CHECK-LABEL: ld1rqb_i8_imm_lower_bound:
+; CHECK: ld1rqb { z0.b }, p0/z, [x0, #-128]
+; CHECK-NEXT: ret
+  %ptr = getelementptr inbounds i8, i8* %addr, i8 -128
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv16i8( %pred, i8* %ptr)
+  ret  %res
+}
+
+define  @ld1rqb_i8_imm_upper_bound( %pred, i8* %addr) {
+; CHECK-LABEL: ld1rqb_i8_imm_upper_bound:
+; CHECK: ld1rqb { z0.b }, p0/z, [x0, #112]
+; CHECK-NEXT: ret
+  %ptr = getelementptr inbounds i8, i8* %addr, i8 112
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv16i8( %pred, i8* %ptr)
+  ret  %res
+}
+
+define  @ld1rqb_i8_imm_out_of_lower_bound( %pred, i8* %addr) {
+; CHECK-LABEL: ld1rqb_i8_imm_out_of_lower_bound:
+; CHECK: sub x8, x0, #129
+; CHECK-NEXT: ld1rqb { z0.b }, p0/z, [x8]
+; CHECK-NEXT: ret
+  %ptr = getelementptr inbounds i8, i8* %addr, i64 -129
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv16i8( %pred, i8* %ptr)
+  ret  %res
+}
+
+define  @ld1rqb_i8_imm_out_of_upper_bound( %pred, i8* %addr) {
+; CHECK-LABEL: ld1rqb_i8_imm_out_of_upper_bound:
+; CHECK: add x8, x0, #113
+; CHECK-NEXT: ld1rqb { z0.b }, p0/z, [x8]
+; CHECK-NEXT: ret
+  %ptr = getelementptr inbounds i8, i8* %addr, i64 113
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv16i8( %pred, i8* %ptr)
+  ret  %res
+}
+
+;
+; LD1RQH
+;
+
+define  @ld1rqh_i16( %pred, i16* %addr) {
+; CHECK-LABEL: ld1rqh_i16:
+; CHECK: ld1rqh { z0.h }, p0/z, [x0]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv8i16( %pred, i16* %addr)
+  ret  %res
+}
+
+define  @ld1rqh_f16( %pred, half* %addr) {
+; CHECK-LABEL: ld1rqh_f16:
+; CHECK: ld1rqh { z0.h }, p0/z, [x0]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv8f16( %pred, half* %addr)
+  ret  %res
+}
+
+define  @ld1rqh_i16_imm( %pred, i16* %addr) {
+; CHECK-LABEL: ld1rqh_i16_imm:
+; CHECK: ld1rqh { z0.h }, p0/z, [x0, #-64]
+; CHECK-NEXT: ret
+  %ptr = getelementptr inbounds i16, i16* %addr, i16 -32
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv8i16( %pred, i16* %ptr)
+  ret  %res
+}
+
+define  @ld1rqh_f16_imm( %pred, half* %addr) {
+; CHECK-LABEL: ld1rqh_f16_imm:
+; CHECK: ld1rqh { z0.h }, p0/z, [x0, #-16]
+; CHECK-NEXT: ret
+  %ptr = getelementptr inbounds half, half* %addr, i16 -8
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv8f16( %pred, half* %ptr)
+  ret  %res
+}
+
+;
+; LD1RQW
+;
+
+define  @ld1rqw_i32( %pred, i32* %addr) {
+; CHECK-LABEL: ld1rqw_i32:
+; CHECK: ld1rqw { z0.s }, p0/z, [x0]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv4i32( %pred, i32* %addr)
+  ret  %res
+}
+
+define  @ld1rqw_f32( %pred, float* %addr) {
+; CHECK-LABEL: ld1rqw_f32:
+; CHECK: ld1rqw { z0.s }, p0/z, [x0]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv4f32( %pred, float* %addr)
+  ret  %res
+}
+
+define  @ld1rqw_i32_imm( %pred, i32* %addr) {
+; CHECK-LABEL: ld1rqw_i32_imm:
+; CHECK: ld1rqw { z0.s }, p0/z, [x0, #112]
+; CHECK-NEXT: ret
+  %ptr = getelementptr inbounds i32, i32* %addr, i32 28
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv4i32( %pred, i32* %ptr)
+  ret  %res
+}
+
+define  @ld1rqw_f32_imm( %pred, float* %addr) {
+; CHECK-LABEL: ld1rqw_f32_imm:
+; CHECK: ld1rqw { z0.s }, p0/z, [x0, #32]
+; CHECK-NEXT: ret
+  %ptr = getelementptr inbounds float, float* %addr, i32 8
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv4f32( %pred, float* %ptr)
+  ret  %res
+}
+
+;
+; LD1RQD
+;
+
+define  @ld1rqd_i64( %pred, i64* %addr) {
+; CHECK-LABEL: ld1rqd_i64:
+; CHECK: ld1rqd { z0.d }, p0/z, [x0]
+; CHECK-NEXT: ret
+  %res = call  @llvm.aarch64.sve.ld1rq.nxv2i64( %pred, i64* %addr)
+  ret  %res
+}
+
+def

[PATCH] D76932: [AIX] emit .extern and .weak directive linkage

2020-04-21 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: llvm/test/CodeGen/PowerPC/aix-extern-weak.ll:174
+; CHECKSYM-NEXT:   Index: [[#Index+11]]
+; CHECKSYM-NEXT:   ContainingCsectSymbolIndex: 8
+; CHECKSYM-NEXT:   ParameterHashIndex: 0x0

This should be relative to `Index`.



Comment at: llvm/test/CodeGen/PowerPC/aix-extern-weak.ll:214
+; CHECKSYM-NEXT:   Index: [[#Index+15]]
+; CHECKSYM-NEXT:   ContainingCsectSymbolIndex: 12
+; CHECKSYM-NEXT:   ParameterHashIndex: 0x0

Same comment.



Comment at: llvm/test/CodeGen/PowerPC/aix-extern.ll:9
+; RUN: -mattr=-altivec -filetype=obj -o %t.o < %s
+; RUN: llvm-readobj  --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
+

Same comments for this test.



Comment at: llvm/test/CodeGen/PowerPC/aix-weak.ll:9
+; RUN: -mattr=-altivec -filetype=obj -o %t.o < %s
+; RUN: llvm-readobj  --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
+

Same comments for this test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76932



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


[PATCH] D76929: [AArch64][SVE] Add SVE intrinsic for LD1RQ

2020-04-21 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:11622
+  if (VT.isFloatingPoint())
+Load = DAG.getNode(ISD::BITCAST, DL, VT, Load);
+

sdesmalen wrote:
> kmclaughlin wrote:
> > sdesmalen wrote:
> > > I'd expect this to then use `Load.getValue(0)` ?
> > I think this will have the same effect, as `Load` just returns a single 
> > value
> `SDValue LoadChain = SDValue(Load.getNode(), 1);` suggests that `Load` has 
> two return values, the result of the load, and the Chain.
> 
I think you're right - I've changed this to use the result of the load as 
suggested


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

https://reviews.llvm.org/D76929



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


[PATCH] D78478: [UpdateTestChecks] Add UTC_ARGS support for update_{llc,cc}_test_checks.py

2020-04-21 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

I feel there is a lot of good stuff here but it seems to mix two things. A 
rewrite of the script infrastructure and the UTC_ARGS stuff. If so, do you 
think we could split them? I feel there are also minor NFC changes that could 
go in on their own without review, I marked on of them below.

(Partially related: Does this handle the mismatch between `enabled` 
configuration status and the flag names `enable/disable` or will it still add 
`--enabled` to the UTC_ARGS?)




Comment at: llvm/utils/update_cc_test_checks.py:109
   help='"clang" executable, defaults to $llvm_bin/clang')
-  parser.add_argument('--clang-args',
+  parser.add_argument('--clang-args', default=[], type=str_to_commandline,
   help='Space-separated extra args to clang, e.g. 
--clang-args=-v')

I guess these 7 lines can be committed on their own as NFC cleanup.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78478



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


[PATCH] D78572: [Clang][Sema] Capturing section type conflicts on #pragma clang section

2020-04-21 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas updated this revision to Diff 259039.
pratlucas added a comment.

Fixing missing clang-format messages.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78572

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/Parse/ParsePragma.cpp
  clang/lib/Sema/SemaAttr.cpp
  clang/test/Sema/pragma-clang-section.c


Index: clang/test/Sema/pragma-clang-section.c
===
--- clang/test/Sema/pragma-clang-section.c
+++ clang/test/Sema/pragma-clang-section.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s -triple arm-none-eabi
-#pragma clang section bss="mybss.1" data="mydata.1" rodata="myrodata.1" 
text="mytext.1"
+#pragma clang section bss = "mybss.1" data = "mydata.1" rodata = "myrodata.1" 
text = "mytext.1" // expected-note {{#pragma entered here}} expected-note 
{{#pragma entered here}}
 #pragma clang section bss="" data="" rodata="" text=""
 #pragma clang section
 
@@ -16,4 +16,10 @@
 #pragma clang section text "text.2"   // expected-error {{expected '=' 
following '#pragma clang section text'}}
 #pragma clang section relro "relro.2"   // expected-error {{expected '=' 
following '#pragma clang section relro'}}
 #pragma clang section bss="" data="" rodata="" text="" more //expected-error 
{{expected one of [bss|data|rodata|text|relro] section kind in '#pragma clang 
section'}}
+
+#pragma clang section bss = "mybss.3" data = "mybss.3" // expected-error 
{{this causes a section type conflict with a prior #pragma section}} 
expected-note {{#pragma entered here}} expected-note {{#pragma entered here}}
+#pragma clang section rodata = "mydata.1"  // expected-error 
{{this causes a section type conflict with a prior #pragma section}}
+#pragma clang section bss = "myrodata.1"   // expected-error 
{{this causes a section type conflict with a prior #pragma section}}
+#pragma clang section text = "mybss.3" // expected-error 
{{this causes a section type conflict with a prior #pragma section}}
+
 int a;
Index: clang/lib/Sema/SemaAttr.cpp
===
--- clang/lib/Sema/SemaAttr.cpp
+++ clang/lib/Sema/SemaAttr.cpp
@@ -256,12 +256,15 @@
 void Sema::ActOnPragmaClangSection(SourceLocation PragmaLoc, 
PragmaClangSectionAction Action,
PragmaClangSectionKind SecKind, StringRef 
SecName) {
   PragmaClangSection *CSec;
+  int SectionFlags = ASTContext::PSF_Read;
   switch (SecKind) {
 case PragmaClangSectionKind::PCSK_BSS:
   CSec = &PragmaClangBSSSection;
+  SectionFlags |= ASTContext::PSF_Write | ASTContext::PSF_ZeroInit;
   break;
 case PragmaClangSectionKind::PCSK_Data:
   CSec = &PragmaClangDataSection;
+  SectionFlags |= ASTContext::PSF_Write;
   break;
 case PragmaClangSectionKind::PCSK_Rodata:
   CSec = &PragmaClangRodataSection;
@@ -271,6 +274,7 @@
   break;
 case PragmaClangSectionKind::PCSK_Text:
   CSec = &PragmaClangTextSection;
+  SectionFlags |= ASTContext::PSF_Execute;
   break;
 default:
   llvm_unreachable("invalid clang section kind");
@@ -281,6 +285,9 @@
 return;
   }
 
+  if (UnifySection(SecName, SectionFlags, PragmaLoc))
+return;
+
   CSec->Valid = true;
   CSec->SectionName = std::string(SecName);
   CSec->PragmaLocation = PragmaLoc;
Index: clang/lib/Parse/ParsePragma.cpp
===
--- clang/lib/Parse/ParsePragma.cpp
+++ clang/lib/Parse/ParsePragma.cpp
@@ -1845,6 +1845,7 @@
   return;
 }
 
+SourceLocation PragmaLocation = Tok.getLocation();
 PP.Lex(Tok); // eat ['bss'|'data'|'rodata'|'text']
 if (Tok.isNot(tok::equal)) {
   PP.Diag(Tok.getLocation(), 
diag::err_pragma_clang_section_expected_equal) << SecKind;
@@ -1855,10 +1856,11 @@
 if (!PP.LexStringLiteral(Tok, SecName, "pragma clang section", false))
   return;
 
-Actions.ActOnPragmaClangSection(Tok.getLocation(),
-  (SecName.size()? Sema::PragmaClangSectionAction::PCSA_Set :
-   Sema::PragmaClangSectionAction::PCSA_Clear),
-   SecKind, SecName);
+Actions.ActOnPragmaClangSection(
+PragmaLocation,
+(SecName.size() ? Sema::PragmaClangSectionAction::PCSA_Set
+: Sema::PragmaClangSectionAction::PCSA_Clear),
+SecKind, SecName);
   }
 }
 
Index: clang/include/clang/AST/ASTContext.h
===
--- clang/include/clang/AST/ASTContext.h
+++ clang/include/clang/AST/ASTContext.h
@@ -2946,6 +2946,7 @@
 PSF_Write = 0x2,
 PSF_Execute = 0x4,
 PSF_Implicit = 0x8,
+PSF_ZeroInit = 0x10,
 PSF_Invalid = 0x8000U,
   };
 


Index: clang/test/Sema/pragma-clang-section.c
===
--- clang/test/Sema/pragma

[PATCH] D78573: [Clang][Sema] Capturing section type conflicts between #pragma clang section and section attributes

2020-04-21 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas updated this revision to Diff 259040.
pratlucas added a comment.

Fixing "mising clang-format" messages.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78573

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/Sema/SemaAttr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/pragma-clang-section.c

Index: clang/test/Sema/pragma-clang-section.c
===
--- clang/test/Sema/pragma-clang-section.c
+++ clang/test/Sema/pragma-clang-section.c
@@ -22,4 +22,9 @@
 #pragma clang section bss = "myrodata.1"   // expected-error {{this causes a section type conflict with a prior #pragma section}}
 #pragma clang section text = "mybss.3" // expected-error {{this causes a section type conflict with a prior #pragma section}}
 
+#pragma clang section rodata = "myrodata.4"  // expected-note {{#pragma entered here}}
+int x __attribute__((section("myrodata.4")));// expected-error {{'x' causes a section type conflict with a prior #pragma section}}
+const int y __attribute__((section("myrodata.5"))) = 10; // expected-note {{declared here}}
+#pragma clang section data = "myrodata.5"// expected-error {{this causes a section type conflict with 'y'}}
+
 int a;
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -12736,7 +12736,7 @@
   if (GlobalStorage && var->isThisDeclarationADefinition() &&
   !inTemplateInstantiation()) {
 PragmaStack *Stack = nullptr;
-int SectionFlags = ASTContext::PSF_Implicit | ASTContext::PSF_Read;
+int SectionFlags = ASTContext::PSF_Read;
 if (var->getType().isConstQualified())
   Stack = &ConstSegStack;
 else if (!var->getInit()) {
@@ -12746,14 +12746,19 @@
   Stack = &DataSegStack;
   SectionFlags |= ASTContext::PSF_Write;
 }
-if (Stack->CurrentValue && !var->hasAttr())
+if (const SectionAttr *SA = var->getAttr()) {
+  if (SA->getSyntax() == AttributeCommonInfo::AS_Declspec)
+SectionFlags |= ASTContext::PSF_Implicit;
+  UnifySection(SA->getName(), SectionFlags, var);
+} else if (Stack->CurrentValue) {
+  SectionFlags |= ASTContext::PSF_Implicit;
+  auto SectionName = Stack->CurrentValue->getString();
   var->addAttr(SectionAttr::CreateImplicit(
-  Context, Stack->CurrentValue->getString(),
-  Stack->CurrentPragmaLocation, AttributeCommonInfo::AS_Pragma,
-  SectionAttr::Declspec_allocate));
-if (const SectionAttr *SA = var->getAttr())
-  if (UnifySection(SA->getName(), SectionFlags, var))
+  Context, SectionName, Stack->CurrentPragmaLocation,
+  AttributeCommonInfo::AS_Pragma, SectionAttr::Declspec_allocate));
+  if (UnifySection(SectionName, SectionFlags, var))
 var->dropAttr();
+}
 
 // Apply the init_seg attribute if this has an initializer.  If the
 // initializer turns out to not be dynamic, we'll end up ignoring this
Index: clang/lib/Sema/SemaAttr.cpp
===
--- clang/lib/Sema/SemaAttr.cpp
+++ clang/lib/Sema/SemaAttr.cpp
@@ -471,42 +471,49 @@
 bool Sema::UnifySection(StringRef SectionName,
 int SectionFlags,
 DeclaratorDecl *Decl) {
-  auto Section = Context.SectionInfos.find(SectionName);
-  if (Section == Context.SectionInfos.end()) {
+  SourceLocation PragmaLocation;
+  if (auto A = Decl->getAttr())
+if (A->isImplicit())
+  PragmaLocation = A->getLocation();
+  auto SectionIt = Context.SectionInfos.find(SectionName);
+  if (SectionIt == Context.SectionInfos.end()) {
 Context.SectionInfos[SectionName] =
-ASTContext::SectionInfo(Decl, SourceLocation(), SectionFlags);
+ASTContext::SectionInfo(Decl, PragmaLocation, SectionFlags);
 return false;
   }
   // A pre-declared section takes precedence w/o diagnostic.
-  if (Section->second.SectionFlags == SectionFlags ||
-  !(Section->second.SectionFlags & ASTContext::PSF_Implicit))
+  const auto &Section = SectionIt->second;
+  if (Section.SectionFlags == SectionFlags ||
+  ((SectionFlags & ASTContext::PSF_Implicit) &&
+   !(Section.SectionFlags & ASTContext::PSF_Implicit)))
 return false;
-  auto OtherDecl = Section->second.Decl;
-  Diag(Decl->getLocation(), diag::err_section_conflict)
-  << Decl << OtherDecl;
-  Diag(OtherDecl->getLocation(), diag::note_declared_at)
-  << OtherDecl->getName();
-  if (auto A = Decl->getAttr())
-if (A->isImplicit())
-  Diag(A->getLocation(), diag::note_pragma_entered_here);
-  if (auto A = OtherDecl->getAttr())
-if (A->isImplicit())
-  Diag(A->getLocation(), diag::note_pragma_entered_here);
+  Diag(Decl->getLocation(), diag::err_section_conflict) << Decl <

[PATCH] D78573: [Clang][Sema] Capturing section type conflicts between #pragma clang section and section attributes

2020-04-21 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Conflicting types for the same section name defined in clang section
pragmas and GNU-style section attributes were not properly captured by
Clang's Sema. The lack of diagnostics was caused by the fact the section
specification coming from attributes was handled by Sema as implicit,
even though explicitly defined by the user.

This patch enables the diagnostics for section type conflicts between
those specifications by making sure sections defined in section
attributes are correctly handled as explicit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78573

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/Sema/SemaAttr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Sema/pragma-clang-section.c

Index: clang/test/Sema/pragma-clang-section.c
===
--- clang/test/Sema/pragma-clang-section.c
+++ clang/test/Sema/pragma-clang-section.c
@@ -22,4 +22,9 @@
 #pragma clang section bss="myrodata.1" // expected-error {{this causes a section type conflict with a prior #pragma section}}
 #pragma clang section text="mybss.3" // expected-error {{this causes a section type conflict with a prior #pragma section}}
 
+#pragma clang section rodata="myrodata.4" // expected-note {{#pragma entered here}}
+int x __attribute__((section("myrodata.4"))); // expected-error {{'x' causes a section type conflict with a prior #pragma section}}
+const int y __attribute__((section("myrodata.5"))) = 10; // expected-note {{declared here}}
+#pragma clang section data="myrodata.5" // expected-error {{this causes a section type conflict with 'y'}}
+
 int a;
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -12736,7 +12736,7 @@
   if (GlobalStorage && var->isThisDeclarationADefinition() &&
   !inTemplateInstantiation()) {
 PragmaStack *Stack = nullptr;
-int SectionFlags = ASTContext::PSF_Implicit | ASTContext::PSF_Read;
+int SectionFlags = ASTContext::PSF_Read;
 if (var->getType().isConstQualified())
   Stack = &ConstSegStack;
 else if (!var->getInit()) {
@@ -12746,14 +12746,19 @@
   Stack = &DataSegStack;
   SectionFlags |= ASTContext::PSF_Write;
 }
-if (Stack->CurrentValue && !var->hasAttr())
+if (const SectionAttr *SA = var->getAttr()) {
+  if (SA->getSyntax() == AttributeCommonInfo::AS_Declspec)
+SectionFlags |= ASTContext::PSF_Implicit;
+  UnifySection(SA->getName(), SectionFlags, var);
+} else if (Stack->CurrentValue) {
+  SectionFlags |= ASTContext::PSF_Implicit;
+  auto SectionName = Stack->CurrentValue->getString();
   var->addAttr(SectionAttr::CreateImplicit(
-  Context, Stack->CurrentValue->getString(),
-  Stack->CurrentPragmaLocation, AttributeCommonInfo::AS_Pragma,
-  SectionAttr::Declspec_allocate));
-if (const SectionAttr *SA = var->getAttr())
-  if (UnifySection(SA->getName(), SectionFlags, var))
+  Context, SectionName, Stack->CurrentPragmaLocation,
+  AttributeCommonInfo::AS_Pragma, SectionAttr::Declspec_allocate));
+  if (UnifySection(SectionName, SectionFlags, var))
 var->dropAttr();
+}
 
 // Apply the init_seg attribute if this has an initializer.  If the
 // initializer turns out to not be dynamic, we'll end up ignoring this
Index: clang/lib/Sema/SemaAttr.cpp
===
--- clang/lib/Sema/SemaAttr.cpp
+++ clang/lib/Sema/SemaAttr.cpp
@@ -471,42 +471,50 @@
 bool Sema::UnifySection(StringRef SectionName,
 int SectionFlags,
 DeclaratorDecl *Decl) {
-  auto Section = Context.SectionInfos.find(SectionName);
-  if (Section == Context.SectionInfos.end()) {
+  SourceLocation PragmaLocation;
+  if (auto A = Decl->getAttr())
+if (A->isImplicit())
+  PragmaLocation = A->getLocation();
+  auto SectionIt = Context.SectionInfos.find(SectionName);
+  if (SectionIt == Context.SectionInfos.end()) {
 Context.SectionInfos[SectionName] =
-ASTContext::SectionInfo(Decl, SourceLocation(), SectionFlags);
+ASTContext::SectionInfo(Decl, PragmaLocation, SectionFlags);
 return false;
   }
   // A pre-declared section takes precedence w/o diagnostic.
-  if (Section->second.SectionFlags == SectionFlags ||
-  !(Section->second.SectionFlags & ASTContext::PSF_Implicit))
+  const auto &Section = SectionIt->second;
+  if (Section.SectionFlags == SectionFlags ||
+  ((SectionFlags & ASTContext::PSF_Implicit) &&
+   !(Section.SectionFlags & ASTContext::PSF_Implicit)))
 return false;
-  auto OtherDecl = Section->second.Decl;
   Diag(Decl->getLocation(), diag::err_section_conflict)
-  << Decl << OtherDecl;
-  Diag(OtherDecl->getLocation(), diag::note_decla

[PATCH] D78572: [Clang][Sema] Capturing section type conflicts on #pragma clang section

2020-04-21 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Section names used in clang section pragmas were not validated against
previously defined sections, causing section type conflicts to be
ignored by Sema.

This patch enables Clang to capture these section type conflicts by
using the existing Sema's UnifySection method to validate section names
from clang section pragmas.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78572

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/Parse/ParsePragma.cpp
  clang/lib/Sema/SemaAttr.cpp
  clang/test/Sema/pragma-clang-section.c


Index: clang/test/Sema/pragma-clang-section.c
===
--- clang/test/Sema/pragma-clang-section.c
+++ clang/test/Sema/pragma-clang-section.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s -triple arm-none-eabi
-#pragma clang section bss="mybss.1" data="mydata.1" rodata="myrodata.1" 
text="mytext.1"
+#pragma clang section bss="mybss.1" data="mydata.1" rodata="myrodata.1" 
text="mytext.1" // expected-note {{#pragma entered here}} expected-note 
{{#pragma entered here}}
 #pragma clang section bss="" data="" rodata="" text=""
 #pragma clang section
 
@@ -16,4 +16,10 @@
 #pragma clang section text "text.2"   // expected-error {{expected '=' 
following '#pragma clang section text'}}
 #pragma clang section relro "relro.2"   // expected-error {{expected '=' 
following '#pragma clang section relro'}}
 #pragma clang section bss="" data="" rodata="" text="" more //expected-error 
{{expected one of [bss|data|rodata|text|relro] section kind in '#pragma clang 
section'}}
+
+#pragma clang section bss="mybss.3" data="mybss.3" // expected-error {{this 
causes a section type conflict with a prior #pragma section}} expected-note 
{{#pragma entered here}} expected-note {{#pragma entered here}}
+#pragma clang section rodata="mydata.1" // expected-error {{this causes a 
section type conflict with a prior #pragma section}}
+#pragma clang section bss="myrodata.1" // expected-error {{this causes a 
section type conflict with a prior #pragma section}}
+#pragma clang section text="mybss.3" // expected-error {{this causes a section 
type conflict with a prior #pragma section}}
+
 int a;
Index: clang/lib/Sema/SemaAttr.cpp
===
--- clang/lib/Sema/SemaAttr.cpp
+++ clang/lib/Sema/SemaAttr.cpp
@@ -256,12 +256,15 @@
 void Sema::ActOnPragmaClangSection(SourceLocation PragmaLoc, 
PragmaClangSectionAction Action,
PragmaClangSectionKind SecKind, StringRef 
SecName) {
   PragmaClangSection *CSec;
+  int SectionFlags = ASTContext::PSF_Read;
   switch (SecKind) {
 case PragmaClangSectionKind::PCSK_BSS:
   CSec = &PragmaClangBSSSection;
+  SectionFlags |= ASTContext::PSF_Write | ASTContext::PSF_ZeroInit;
   break;
 case PragmaClangSectionKind::PCSK_Data:
   CSec = &PragmaClangDataSection;
+  SectionFlags |= ASTContext::PSF_Write;
   break;
 case PragmaClangSectionKind::PCSK_Rodata:
   CSec = &PragmaClangRodataSection;
@@ -271,6 +274,7 @@
   break;
 case PragmaClangSectionKind::PCSK_Text:
   CSec = &PragmaClangTextSection;
+  SectionFlags |= ASTContext::PSF_Execute;
   break;
 default:
   llvm_unreachable("invalid clang section kind");
@@ -281,6 +285,9 @@
 return;
   }
 
+  if (UnifySection(SecName, SectionFlags, PragmaLoc))
+return;
+
   CSec->Valid = true;
   CSec->SectionName = std::string(SecName);
   CSec->PragmaLocation = PragmaLoc;
Index: clang/lib/Parse/ParsePragma.cpp
===
--- clang/lib/Parse/ParsePragma.cpp
+++ clang/lib/Parse/ParsePragma.cpp
@@ -1845,6 +1845,7 @@
   return;
 }
 
+SourceLocation PragmaLocation = Tok.getLocation();
 PP.Lex(Tok); // eat ['bss'|'data'|'rodata'|'text']
 if (Tok.isNot(tok::equal)) {
   PP.Diag(Tok.getLocation(), 
diag::err_pragma_clang_section_expected_equal) << SecKind;
@@ -1855,7 +1856,7 @@
 if (!PP.LexStringLiteral(Tok, SecName, "pragma clang section", false))
   return;
 
-Actions.ActOnPragmaClangSection(Tok.getLocation(),
+Actions.ActOnPragmaClangSection(PragmaLocation,
   (SecName.size()? Sema::PragmaClangSectionAction::PCSA_Set :
Sema::PragmaClangSectionAction::PCSA_Clear),
SecKind, SecName);
Index: clang/include/clang/AST/ASTContext.h
===
--- clang/include/clang/AST/ASTContext.h
+++ clang/include/clang/AST/ASTContext.h
@@ -2946,6 +2946,7 @@
 PSF_Write = 0x2,
 PSF_Execute = 0x4,
 PSF_Implicit = 0x8,
+PSF_ZeroInit = 0x10,
 PSF_Invalid = 0x8000U,
   };
 


Index: clang/test/Sema/pragma-clang-section.c
===
--- clang/test/Sema/pragma-cl

[PATCH] D78569: [SVE][CodeGen] Lower SDIV & UDIV to SVE intrinsics

2020-04-21 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin created this revision.
kmclaughlin added reviewers: sdesmalen, c-rhodes, efriedma, cameron.mcinally.
Herald added subscribers: psnobl, rkruppe, hiraditya, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a project: LLVM.

This patch maps IR operations for sdiv & udiv to the
@llvm.aarch64.sve.[s|u]div intrinsics.

A ptrue must be created during lowering as the div instructions
have only a predicated form.

Patch contains changes by Andrzej Warzynski.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78569

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/TargetLoweringBase.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.h
  llvm/test/CodeGen/AArch64/llvm-ir-to-intrinsic.ll

Index: llvm/test/CodeGen/AArch64/llvm-ir-to-intrinsic.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/llvm-ir-to-intrinsic.ll
@@ -0,0 +1,87 @@
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
+
+;
+; SDIV
+;
+
+define  @sdiv_i32( %a,  %b) {
+; CHECK-LABEL: @sdiv_i32
+; CHECK: ptrue p0.s
+; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z1.s
+; CHECK-NEXT: ret
+  %div = sdiv  %a, %b
+  ret  %div
+}
+
+define  @sdiv_i64( %a,  %b) {
+; CHECK-LABEL: @sdiv_i64
+; CHECK: ptrue p0.d
+; CHECK-NEXT: sdiv z0.d, p0/m, z0.d, z1.d
+; CHECK-NEXT: ret
+  %div = sdiv  %a, %b
+  ret  %div
+}
+
+define  @sdiv_narrow( %a,  %b) {
+; CHECK-LABEL: @sdiv_narrow
+; CHECK: ptrue p0.s
+; CHECK-NEXT: sdiv z0.s, p0/m, z0.s, z2.s
+; CHECK-NEXT: sdiv z1.s, p0/m, z1.s, z3.s
+; CHECK-NEXT: ret
+  %div = sdiv  %a, %b
+  ret  %div
+}
+
+define  @sdiv_widen( %a,  %b) {
+; CHECK-LABEL: @sdiv_widen
+; CHECK: ptrue p0.d
+; CHECK-NEXT: sxtw z1.d, p0/m, z1.d
+; CHECK-NEXT: sxtw z0.d, p0/m, z0.d
+; CHECK-NEXT: sdiv z0.d, p0/m, z0.d, z1.d
+; CHECK-NEXT: ret
+  %div = sdiv  %a, %b
+  ret  %div
+}
+
+;
+; UDIV
+;
+
+define  @udiv_i32( %a,  %b) {
+; CHECK-LABEL: @udiv_i32
+; CHECK: ptrue p0.s
+; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z1.s
+; CHECK-NEXT: ret
+  %div = udiv  %a, %b
+  ret  %div
+}
+
+define  @udiv_i64( %a,  %b) {
+; CHECK-LABEL: @udiv_i64
+; CHECK: ptrue p0.d
+; CHECK-NEXT: udiv z0.d, p0/m, z0.d, z1.d
+; CHECK-NEXT: ret
+  %div = udiv  %a, %b
+  ret  %div
+}
+
+define  @udiv_narrow( %a,  %b) {
+; CHECK-LABEL: @udiv_narrow
+; CHECK: ptrue p0.s
+; CHECK-NEXT: udiv z0.s, p0/m, z0.s, z2.s
+; CHECK-NEXT: udiv z1.s, p0/m, z1.s, z3.s
+; CHECK-NEXT: ret
+  %div = udiv  %a, %b
+  ret  %div
+}
+
+define  @udiv_widen( %a,  %b) {
+; CHECK-LABEL: @udiv_widen
+; CHECK: ptrue p0.d
+; CHECK-NEXT: and z1.d, z1.d, #0x
+; CHECK-NEXT: and z0.d, z0.d, #0x
+; CHECK-NEXT: udiv z0.d, p0/m, z0.d, z1.d
+; CHECK-NEXT: ret
+  %div = udiv  %a, %b
+  ret  %div
+}
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.h
===
--- llvm/lib/Target/AArch64/AArch64ISelLowering.h
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.h
@@ -776,6 +776,8 @@
   SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
   SDValue LowerSPLAT_VECTOR(SDValue Op, SelectionDAG &DAG) const;
   SDValue LowerDUPQLane(SDValue Op, SelectionDAG &DAG) const;
+  SDValue LowerDIV(SDValue Op, SelectionDAG &DAG,
+   unsigned IntrID) const;
   SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, SelectionDAG &DAG) const;
   SDValue LowerVectorSRA_SRL_SHL(SDValue Op, SelectionDAG &DAG) const;
   SDValue LowerShiftLeftParts(SDValue Op, SelectionDAG &DAG) const;
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -883,8 +883,11 @@
 // splat of 0 or undef) once vector selects supported in SVE codegen. See
 // D68877 for more details.
 for (MVT VT : MVT::integer_scalable_vector_valuetypes()) {
-  if (isTypeLegal(VT))
+  if (isTypeLegal(VT)) {
 setOperationAction(ISD::SPLAT_VECTOR, VT, Custom);
+setOperationAction(ISD::SDIV, VT, Custom);
+setOperationAction(ISD::UDIV, VT, Custom);
+  }
 }
 setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::i8, Custom);
 setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::i16, Custom);
@@ -3337,6 +3340,10 @@
 return LowerSPLAT_VECTOR(Op, DAG);
   case ISD::EXTRACT_SUBVECTOR:
 return LowerEXTRACT_SUBVECTOR(Op, DAG);
+  case ISD::SDIV:
+return LowerDIV(Op, DAG, Intrinsic::aarch64_sve_sdiv);
+  case ISD::UDIV:
+return LowerDIV(Op, DAG, Intrinsic::aarch64_sve_udiv);
   case ISD::SRA:
   case ISD::SRL:
   case ISD::SHL:
@@ -7643,6 +7650,25 @@
   return DAG.getNode(ISD::BITCAST, DL, VT, TBL);
 }
 
+SDValue AArch64TargetLowering::LowerDIV(SDValue Op,
+SelectionDAG &DAG,
+   

[PATCH] D78565: [clang][doc] Clang ARM CPU command line argument reference

2020-04-21 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added a comment.

Hi Peter,
Thanks for reviewing again! I thought these examples to be relevant here, 
because it shows usage and examples of this tool (i.e. open-source clang/llvm). 
Additional benefits is that source and documentation is in one place, and it 
allows others, non-Arm people, to edit and review this document too. But I will 
take this question to the list, to see what people think about this.


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

https://reviews.llvm.org/D78565



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


[PATCH] D78252: [AArch64] FMLA/FMLS patterns improvement.

2020-04-21 Thread Dave Green via Phabricator via cfe-commits
dmgreen accepted this revision.
dmgreen added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks




Comment at: llvm/lib/Target/AArch64/AArch64InstrFormats.td:8094
 V128:$Rm, VectorIndexS:$idx)>;
-  def : Pat<(f32 (OpNode (f32 FPR32:$Rd), (f32 FPR32:$Rn),
- (vector_extract (v2f32 V64:$Rm), VectorIndexS:$idx))),

I was a little surprised when you said we could remove these, but it looks like 
the vector_extract (v2f32) is always converted to a vector_extract (v4f32 
insert_subvector (v2f32)). So I agree, seems Ok to remove. (And if we do run 
into a problem, we can always add it back in).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78252



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


[PATCH] D78252: [AArch64] FMLA/FMLS patterns improvement.

2020-04-21 Thread Pavel Iliin via Phabricator via cfe-commits
ilinpv updated this revision to Diff 259008.
ilinpv edited the summary of this revision.
ilinpv added a comment.

v2f32 pattern removed, test added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78252

Files:
  clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics-constrained.c
  llvm/lib/Target/AArch64/AArch64InstrFormats.td
  llvm/test/CodeGen/AArch64/fp16_intrinsic_lane.ll

Index: llvm/test/CodeGen/AArch64/fp16_intrinsic_lane.ll
===
--- llvm/test/CodeGen/AArch64/fp16_intrinsic_lane.ll
+++ llvm/test/CodeGen/AArch64/fp16_intrinsic_lane.ll
@@ -14,8 +14,7 @@
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
 ; CHECK-NEXT:// kill: def $d2 killed $d2 def $q2
-; CHECK-NEXT:dup v2.4h, v2.h[0]
-; CHECK-NEXT:fmla v0.4h, v2.4h, v1.4h
+; CHECK-NEXT:fmla v0.4h, v1.4h, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %lane1 = shufflevector <4 x half> %c, <4 x half> undef, <4 x i32> zeroinitializer
@@ -29,8 +28,7 @@
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
 ; CHECK-NEXT:// kill: def $d2 killed $d2 def $q2
-; CHECK-NEXT:dup v2.8h, v2.h[0]
-; CHECK-NEXT:fmla v0.8h, v2.8h, v1.8h
+; CHECK-NEXT:fmla v0.8h, v1.8h, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %lane1 = shufflevector <4 x half> %c, <4 x half> undef, <8 x i32> zeroinitializer
@@ -43,8 +41,7 @@
 ; CHECK:   .Lt_vfma_laneq_f16$local:
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
-; CHECK-NEXT:dup v2.4h, v2.h[0]
-; CHECK-NEXT:fmla v0.4h, v1.4h, v2.4h
+; CHECK-NEXT:fmla v0.4h, v1.4h, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %lane1 = shufflevector <8 x half> %c, <8 x half> undef, <4 x i32> zeroinitializer
@@ -57,8 +54,7 @@
 ; CHECK:   .Lt_vfmaq_laneq_f16$local:
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
-; CHECK-NEXT:dup v2.8h, v2.h[0]
-; CHECK-NEXT:fmla v0.8h, v1.8h, v2.8h
+; CHECK-NEXT:fmla v0.8h, v1.8h, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %lane1 = shufflevector <8 x half> %c, <8 x half> undef, <8 x i32> zeroinitializer
@@ -72,8 +68,7 @@
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
 ; CHECK-NEXT:// kill: def $h2 killed $h2 def $q2
-; CHECK-NEXT:dup v2.4h, v2.h[0]
-; CHECK-NEXT:fmla v0.4h, v2.4h, v1.4h
+; CHECK-NEXT:fmla v0.4h, v1.4h, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %vecinit = insertelement <4 x half> undef, half %c, i32 0
@@ -88,8 +83,7 @@
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
 ; CHECK-NEXT:// kill: def $h2 killed $h2 def $q2
-; CHECK-NEXT:dup v2.8h, v2.h[0]
-; CHECK-NEXT:fmla v0.8h, v2.8h, v1.8h
+; CHECK-NEXT:fmla v0.8h, v1.8h, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %vecinit = insertelement <8 x half> undef, half %c, i32 0
@@ -104,7 +98,7 @@
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
 ; CHECK-NEXT:// kill: def $d2 killed $d2 def $q2
-; CHECK-NEXT:fmadd h0, h1, h2, h0
+; CHECK-NEXT:fmla h0, h1, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %extract = extractelement <4 x half> %c, i32 0
@@ -117,7 +111,7 @@
 ; CHECK:   .Lt_vfmah_laneq_f16$local:
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
-; CHECK-NEXT:fmadd h0, h1, h2, h0
+; CHECK-NEXT:fmla h0, h1, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %extract = extractelement <8 x half> %c, i32 0
@@ -131,9 +125,7 @@
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
 ; CHECK-NEXT:// kill: def $d2 killed $d2 def $q2
-; CHECK-NEXT:fneg v1.4h, v1.4h
-; CHECK-NEXT:dup v2.4h, v2.h[0]
-; CHECK-NEXT:fmla v0.4h, v2.4h, v1.4h
+; CHECK-NEXT:fmls v0.4h, v1.4h, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %sub = fsub <4 x half> , %b
@@ -148,9 +140,7 @@
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
 ; CHECK-NEXT:// kill: def $d2 killed $d2 def $q2
-; CHECK-NEXT:fneg v1.8h, v1.8h
-; CHECK-NEXT:dup v2.8h, v2.h[0]
-; CHECK-NEXT:fmla v0.8h, v2.8h, v1.8h
+; CHECK-NEXT:fmls v0.8h, v1.8h, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %sub = fsub <8 x half> , %b
@@ -164,8 +154,7 @@
 ; CHECK:   .Lt_vfms_laneq_f16$local:
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
-; CHECK-NEXT:dup v2.4h, v2.h[0]
-; CHECK-NEXT:fmls v0.4h, v2.4h, v1.4h
+; CHECK-NEXT:fmls v0.4h, v1.4h, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %sub = fsub <4 x half> , %b
@@ -179,8 +168,7 @@
 ; CHECK:   .Lt_vfmsq_laneq_f16$local:
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
-; CHECK-NEXT:dup v2.8h, v2.h[0]
-; CHECK-NEXT:fmls v0.8h, v2.8h, v1.8h
+; CHECK-NEXT:fmls v0.8h, v1.8h, v2.h[0]
 ; CHECK-NEXT:ret
 entry:
   %sub = fsub <8 x half> , %b
@@ -195,9 +183,7 @@
 ; CHECK-NEXT:.cfi_startproc
 ; CHECK-NEXT:  // %bb.0: // %entry
 ; CHECK-NEXT:// kill: def $h2 killed $h2 de

[PATCH] D77062: [analyzer] Added check for unacceptable equality operation between Loc and NonLoc types

2020-04-21 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment.

ping


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

https://reviews.llvm.org/D77062



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


[PATCH] D75665: [analyzer] On-demand parsing capability for CTU

2020-04-21 Thread Whisperity via Phabricator via cfe-commits
whisperity added inline comments.



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:21
+
+PCH based analysis
+__

I think it's PCH-based with a -.



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:25
+These can be generated by the Clang Frontend itself, and must be arranged in a 
specific way in the filesystem.
+The index, which maps function USR names to PCH dumps containing them must 
also be generated by the
+`clang-extdef-mapping` clang tool. The external mapping creation implicitly 
uses a compilation command database to

symbols' USR names



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:26
+The index, which maps function USR names to PCH dumps containing them must 
also be generated by the
+`clang-extdef-mapping` clang tool. The external mapping creation implicitly 
uses a compilation command database to
+determine the compilation flags used.

martong wrote:
> Maybe just simply write `This tool uses a compilation command database ...`
> (Same below with the on-demand version.)
~~clang tool~~



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:26
+The index, which maps function USR names to PCH dumps containing them must 
also be generated by the
+`clang-extdef-mapping` clang tool. The external mapping creation implicitly 
uses a compilation command database to
+determine the compilation flags used.

whisperity wrote:
> martong wrote:
> > Maybe just simply write `This tool uses a compilation command database ...`
> > (Same below with the on-demand version.)
> ~~clang tool~~
And perhaps add some cross-references to what a compilation database is, etc. 
These things are also documented within Clang's doc tree.



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:31
+
+[PCH] Manual CTU Analysis
+-

Instead of a prefix, create an overview of PCH-based analysis, and add this and 
the next one as a 3rd-level heading?



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:111-114
+  -Xclang -analyzer-config -Xclang 
experimental-enable-naive-ctu-analysis=true \
+  -Xclang -analyzer-config -Xclang ctu-dir=. \
+  -Xclang -analyzer-config -Xclang ctu-on-demand-parsing=false \
+  -Xclang -analyzer-output=plist-multi-file \

Are these flags documented somewhere?



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:227-228
+compilation database in order to determine the exact compiler invocation used 
for each TU.
+The index, which maps function USR names to source files containing them must 
also be generated by the
+`clang-extdef-mapping` clang tool. The mapping of external definitions 
implicitly uses a compilation command database to
+determine the compilation flags used. Preferably the same compilation database 
should be used when generating the

Same here for comments from above.



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:331-335
+  [INFO 2019-07-16 17:21] - To view results in the terminal use the 
"CodeChecker parse" command.
+  [INFO 2019-07-16 17:21] - To store results use the "CodeChecker store" 
command.
+  [INFO 2019-07-16 17:21] - See --help and the user guide for further options 
about parsing and storing the reports.
+  [INFO 2019-07-16 17:21] - =
+  [INFO 2019-07-16 17:21] - Analysis length: 0.659618854523 sec.

These lines could be removed, I think, they don't add anything to the 
presentation.



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:336-337
+  [INFO 2019-07-16 17:21] - Analysis length: 0.659618854523 sec.
+  $ ls
+  compile_commands.json  foo.cpp main.cpp  reports
+  $ tree reports

Due to the lack of colours, perhaps you could use `ls -F` which suffixes each 
directory with a `/`: `reports/`.



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:387
+-
+We actively develop CTU with CodeChecker as a "runner" script, `scan-build-py` 
is not actively developed for CTU.
+`scan-build-py` has various errors and issues, expect it to work with the very 
basic projects only.

as ~~a runner script~~ the driver for this feature



Comment at: clang/docs/analyzer/user-docs/CrossTranslationUnit.rst:388
+We actively develop CTU with CodeChecker as a "runner" script, `scan-build-py` 
is not actively developed for CTU.
+`scan-build-py` has various errors and issues, expect it to work with the very 
basic projects only.
+

expect it to work only ...

(to emphasise the limitation)



Comment at: clang/lib/CrossTU/Cr

[PATCH] D78565: [clang][doc] Clang ARM CPU command line argument reference

2020-04-21 Thread Peter Smith via Phabricator via cfe-commits
psmith added a comment.

One question I can't answer and I think would need wider review, is whether 
this is type of material (common options for specific CPUs) is suited for the 
Clang Documentation or whether it would be better hosted by Arm itself, for 
example on developer.arm.com? I think that a more reference like Arm CPU 
options like https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html would work 
better in the Clang documentation.

I think the material is useful, especially for people new to these CPUs.




Comment at: clang/docs/ClangARMCPUsCLI.rst:27
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m33 -mfpu=fp-armv8-sp-d16 
-mfloat-abi=hard -mthumb
+

I think you mean arm-arm-none-eabi for an upstream triple selecting the 
bare-metal driver?


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

https://reviews.llvm.org/D78565



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


[PATCH] D78567: C++2a -> C++20 in some identifiers; NFC

2020-04-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman created this revision.
aaron.ballman added reviewers: rsmith, dblaikie, echristo.
Herald added subscribers: martong, kbarton, nemanjai.

This does not hit all of the C++2a -> C++20 changes, but gets all of the ones 
related to the language options and keywords.


https://reviews.llvm.org/D78567

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
  clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
  clang/include/clang/AST/DeclCXX.h
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Basic/LangStandard.h
  clang/include/clang/Basic/LangStandards.def
  clang/include/clang/Basic/TokenKinds.def
  clang/lib/AST/DeclCXX.cpp
  clang/lib/AST/DeclTemplate.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/Interp/Interp.cpp
  clang/lib/AST/Interp/Interp.h
  clang/lib/Basic/IdentifierTable.cpp
  clang/lib/Basic/Targets/OSTargets.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CrossTU/CrossTranslationUnit.cpp
  clang/lib/Format/Format.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/Preprocessor.cpp
  clang/lib/Lex/TokenConcatenation.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Parse/ParseTemplate.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp

Index: clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
===
--- clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
+++ clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
@@ -239,7 +239,7 @@
   if (Amt >= V1.getBitWidth())
 return nullptr;
 
-  if (!Ctx.getLangOpts().CPlusPlus2a) {
+  if (!Ctx.getLangOpts().CPlusPlus20) {
 if (V1.isSigned() && V1.isNegative())
   return nullptr;
 
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -2594,7 +2594,7 @@
 
   // C++2a [dcl.fct]p12:
   //   A volatile-qualified return type is deprecated
-  if (T.isVolatileQualified() && getLangOpts().CPlusPlus2a)
+  if (T.isVolatileQualified() && getLangOpts().CPlusPlus20)
 Diag(Loc, diag::warn_deprecated_volatile_return) << T;
 
   return false;
@@ -2679,7 +2679,7 @@
 
 // C++2a [dcl.fct]p4:
 //   A parameter with volatile-qualified type is deprecated
-if (ParamType.isVolatileQualified() && getLangOpts().CPlusPlus2a)
+if (ParamType.isVolatileQualified() && getLangOpts().CPlusPlus20)
   Diag(Loc, diag::warn_deprecated_volatile_param) << ParamType;
 
 ParamTypes[Idx] = ParamType;
@@ -3180,7 +3180,7 @@
   InventedTemplateParameterInfo *Info = nullptr;
   if (D.getContext() == DeclaratorContext::PrototypeContext) {
 // With concepts we allow 'auto' in function parameters.
-if (!SemaRef.getLangOpts().CPlusPlus2a || !Auto ||
+if (!SemaRef.getLangOpts().CPlusPlus20 || !Auto ||
 Auto->getKeyword() != AutoTypeKeyword::Auto) {
   Error = 0;
   break;
@@ -4795,7 +4795,7 @@
 // An error occurred parsing the trailing return type.
 T = Context.IntTy;
 D.setInvalidType(true);
-  } else if (S.getLangOpts().CPlusPlus2a)
+  } else if (S.getLangOpts().CPlusPlus20)
 // Handle cases like: `auto f() -> auto` or `auto f() -> C auto`.
 if (AutoType *Auto = T->getContainedAutoType())
   if (S.getCurScope()->isFunctionDeclarationScope())
@@ -4904,7 +4904,7 @@
 
 // C++2a [dcl.fct]p12:
 //   A volatile-qualified return type is deprecated
-if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus2a)
+if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus20)
   S.Diag(DeclType.Loc, diag::warn_deprecated_volatile_return) << T;
   }
 
@@ -5395,7 +5395,7 @@
 
   // C++2a [dcl.fct]p4:
   //   A parameter with volatile-qualified type is deprecated
-  if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus2a &&
+  if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus20 &&
   (D.getContext() == DeclaratorContext::PrototypeContext ||
D.getContext() == DeclaratorContext::LambdaExprParameterContext))
 S.Diag(D.getIdentifierLoc(), diag::warn_deprecated_volatile_param) << T;
@@ -5421,7 +5421,7 @@
   // We represent function parameter packs as function parameters whose
   // type is a

[PATCH] D78533: [i386] Fix bug that get __m128/__m256/__m512 with wrong alignment for variadic functions.

2020-04-21 Thread LiuChen via Phabricator via cfe-commits
LiuChen3 added a comment.

I uploaded a new patch D78564  as another 
solution, but it modified the current clang calling convention.


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

https://reviews.llvm.org/D78533



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


[PATCH] D78565: [clang][doc] Clang ARM CPU command line argument reference

2020-04-21 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: psmith, ostannard, kristof.beyls, chill.
Herald added subscribers: danielkiss, arphaman.

Following the discussion about -mtune on the cfe dev list, I thought it would 
be good to make a start with documenting common command line arguments to 
target different ARM CPU and architecture combinations. This list is not yet 
complete, is work in progress, but I have just taken 2 recent M-cores as an 
example.


https://reviews.llvm.org/D78565

Files:
  clang/docs/ClangARMCPUsCLI.rst
  clang/docs/index.rst


Index: clang/docs/index.rst
===
--- clang/docs/index.rst
+++ clang/docs/index.rst
@@ -20,6 +20,7 @@
Toolchain
LanguageExtensions
ClangCommandLineReference
+   ClangARMCPUsCLI
AttributeReference
DiagnosticsReference
CrossCompilation
Index: clang/docs/ClangARMCPUsCLI.rst
===
--- /dev/null
+++ clang/docs/ClangARMCPUsCLI.rst
@@ -0,0 +1,77 @@
+=
+Clang ARM CPU command line argument reference
+=
+
+This page lists common command line arguments to target different ARM CPU
+and architecture combinations. This list is not yet complete, and is work in
+progress.
+
+Cortex-M33
+==
+
+Architecture: Armv8-M
+
+Technical Reference Manual:
+`http://infocenter.arm.com/help/topic/com.arm.doc.100230_0002_00_en/cortex_m33_trm_100230_0002_00_en.pdf`
+
+Optional architecture extensions:
+- single precision floating-point (FP),
+- DSP,
+- ARMv8-M Security Extension (CMSE),
+- Custom Datapath Extension (CDE).
+
+Example architecture configurations and corresponding CLI options:
+
+All extensions enabled, except CMSE and CDE, with DSP implied by 
-mcpu=cortex-m33:
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m33 -mfpu=fp-armv8-sp-d16 
-mfloat-abi=hard -mthumb
+
+All extensions enabled:
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m33 -mfpu=fp-armv8-sp-d16 
-mfloat-abi=hard -mthumb -mcmse
+
+Without single precision float support:
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m33 -mfpu=none -mthumb
+
+Without single precision float and DSP support:
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m33+nodsp -mfpu=none 
-mthumb
+
+Cortex-M55
+==
+
+Architecture: Armv8.1-M Main
+
+Technical Reference Manual: not yet available.
+
+Optional architecture extensions:
+- M-Profile Vector Extension (MVE), integer-only, or also floating-point.
+- Scalar half, single, and double precision floating-point,
+- ARMv8-M Security Extension (CMSE),
+- Custom Datapath Extension (CDE).
+
+Mandatory architecture extensions (thus implied in the examples below):
+- DSP
+
+Example architecture configurations and corresponding CLI options:
+
+Integer and float MVE (INT, F16, F32), and float support (F16, F32, F64):
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m55 -mfloat-abi=hard 
-mthumb
+
+Integer-only MVE, with float support (F16, F32, F64):
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m55+nomve.fp 
-mfloat-abi=hard -mthumb
+
+Integer-only MVE, no float support:
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m55+nofp -mfloat-abi=hard 
-mthumb
+
+No MVE, only float support (F16, F32, F64):
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m55+nomve -mfloat-abi=hard 
-mthumb
+
+Basic Armv8.1-M Main support, no extensions:
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m55+nofp+nomve


Index: clang/docs/index.rst
===
--- clang/docs/index.rst
+++ clang/docs/index.rst
@@ -20,6 +20,7 @@
Toolchain
LanguageExtensions
ClangCommandLineReference
+   ClangARMCPUsCLI
AttributeReference
DiagnosticsReference
CrossCompilation
Index: clang/docs/ClangARMCPUsCLI.rst
===
--- /dev/null
+++ clang/docs/ClangARMCPUsCLI.rst
@@ -0,0 +1,77 @@
+=
+Clang ARM CPU command line argument reference
+=
+
+This page lists common command line arguments to target different ARM CPU
+and architecture combinations. This list is not yet complete, and is work in
+progress.
+
+Cortex-M33
+==
+
+Architecture: Armv8-M
+
+Technical Reference Manual:
+`http://infocenter.arm.com/help/topic/com.arm.doc.100230_0002_00_en/cortex_m33_trm_100230_0002_00_en.pdf`
+
+Optional architecture extensions:
+- single precision floating-point (FP),
+- DSP,
+- ARMv8-M Security Extension (CMSE),
+- Custom Datapath Extension (CDE).
+
+Example architecture configurations and corresponding CLI options:
+
+All extensions enabled, except CMSE and CDE, with DSP implied by -mcpu=cortex-m33:
+
+.. option:: --target=arm-arm-none-eabi -mcpu=cortex-m33 -mfpu=fp-armv8-sp-d16 -mfloat-abi=hard -mthum

[PATCH] D78563: [AIX] Port power alignment rules to clang

2020-04-21 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L created this revision.
Xiangling_L added reviewers: jasonliu, hubert.reinterpretcast, sfertile.
Xiangling_L added a project: LLVM.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Address the following aspects of power alignment rules:

- Implemented double/long double alignment when not first struct member
- A double member in union is always treated as the first member, and should 
not use special alignment rule
- Fixed the alignment issue caused by virtual function
- Applied AIX Alignment rule when layout base class
- Fixed AIX layout for zero sized bitfield followed by double


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78563

Files:
  clang/include/clang/AST/RecordLayout.h
  clang/lib/AST/RecordLayout.cpp
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/test/Layout/aix-double-struct-member.cpp
  clang/test/Layout/aix-virtual-function-alignment.cpp

Index: clang/test/Layout/aix-virtual-function-alignment.cpp
===
--- /dev/null
+++ clang/test/Layout/aix-virtual-function-alignment.cpp
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -emit-llvm-only -triple powerpc-ibm-aix-xcoff \
+// RUN: -fdump-record-layouts -fsyntax-only %s 2>/dev/null | FileCheck \
+// RUN: --check-prefix=CHECK32 %s
+
+// RUN: %clang_cc1 -emit-llvm-only -triple powerpc64-ibm-aix-xcoff \
+// RUN: -fdump-record-layouts -fsyntax-only %s 2>/dev/null | FileCheck \
+// RUN: --check-prefix=CHECK64 %s
+
+struct A {
+  virtual void boo() {}
+};
+
+struct B {
+  bool b;
+  A a;
+};
+
+int i = sizeof(B);
+
+// CHECK32:  *** Dumping AST Record Layout
+// CHECK32-NEXT:  0 | struct A
+// CHECK32-NEXT:  0 |   (A vtable pointer)
+// CHECK32-NEXT:| [sizeof=4, dsize=4, align=4,
+// CHECK32-NEXT:|  nvsize=4, nvalign=4]
+
+// CHECK32:  *** Dumping AST Record Layout
+// CHECK32-NEXT:  0 | struct B
+// CHECK32-NEXT:  0 |   _Bool b
+// CHECK32-NEXT:  4 |   struct A a
+// CHECK32-NEXT:  4 | (A vtable pointer)
+// CHECK32-NEXT:| [sizeof=8, dsize=8, align=4,
+// CHECK32-NEXT:|  nvsize=8, nvalign=4]
+
+// CHECK64:  *** Dumping AST Record Layout
+// CHECK64-NEXT:  0 | struct A
+// CHECK64-NEXT:  0 |   (A vtable pointer)
+// CHECK64-NEXT:| [sizeof=8, dsize=8, align=8,
+// CHECK64-NEXT:|  nvsize=8, nvalign=8]
+
+// CHECK64:  *** Dumping AST Record Layout
+// CHECK64-NEXT:  0 | struct B
+// CHECK64-NEXT:  0 |   _Bool b
+// CHECK64-NEXT:  8 |   struct A a
+// CHECK64-NEXT:  8 | (A vtable pointer)
+// CHECK64-NEXT:| [sizeof=16, dsize=16, align=8,
+// CHECK64-NEXT:|  nvsize=16, nvalign=8]
Index: clang/test/Layout/aix-double-struct-member.cpp
===
--- /dev/null
+++ clang/test/Layout/aix-double-struct-member.cpp
@@ -0,0 +1,136 @@
+// RUN: %clang_cc1 -emit-llvm-only -triple powerpc-ibm-aix-xcoff \
+// RUN: -fdump-record-layouts -fsyntax-only %s 2>/dev/null | FileCheck %s
+
+// RUN: %clang_cc1 -emit-llvm-only -triple powerpc64-ibm-aix-xcoff \
+// RUN: -fdump-record-layouts -fsyntax-only %s 2>/dev/null | FileCheck %s
+
+namespace test1 {
+// Test double alignment when it is/is not the first struct member.
+struct D {
+  double d1;
+  int i1;
+};
+
+struct DoubleFirst {
+  struct D d2;
+  int i2;
+};
+
+struct IntFirst {
+  int i3;
+  struct D d3;
+};
+
+int a = sizeof(DoubleFirst);
+int b = sizeof(IntFirst);
+
+// CHECK: *** Dumping AST Record Layout
+// CHECK-NEXT: 0 | struct test1::D
+// CHECK-NEXT: 0 |   double d1
+// CHECK-NEXT: 8 |   int i1
+// CHECK-NEXT:   | [sizeof=16, dsize=16, align=8,
+// CHECK-NEXT:   |  nvsize=16, nvalign=8]
+
+// CHECK: *** Dumping AST Record Layout
+// CHECK-NEXT: 0 | struct test1::DoubleFirst
+// CHECK-NEXT: 0 |   struct test1::D d2
+// CHECK-NEXT: 0 | double d1
+// CHECK-NEXT: 8 | int i1
+// CHECK-NEXT:16 |   int i2
+// CHECK-NEXT:   | [sizeof=24, dsize=24, align=8,
+// CHECK-NEXT:   |  nvsize=24, nvalign=8]
+
+// CHECK: *** Dumping AST Record Layout
+// CHECK-NEXT: 0 | struct test1::IntFirst
+// CHECK-NEXT: 0 |   int i3
+// CHECK-NEXT: 4 |   struct test1::D d3
+// CHECK-NEXT: 4 | double d1
+// CHECK-NEXT:12 | int i1
+// CHECK-NEXT:   | [sizeof=20, dsize=20, align=4,
+// CHECK-NEXT:   |  nvsize=20, nvalign=4]
+}; // namespace test1
+
+namespace test2 {
+// Test AIX layout for zero sized bitfield followed by double.
+struct Double {
+  int : 0;
+  double d;
+};
+
+int a = sizeof(Double);
+
+// CHECK: *** Dumping AST Record Layout
+// CHECK-NEXT: 0 | struct test2::Double
+// CHECK-NEXT:   0:- |   int
+// CHECK-NEXT: 0 |   double d
+// CHECK-NEXT:   | [si

[PATCH] D76932: [AIX] emit .extern and .weak directive linkage

2020-04-21 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: llvm/test/CodeGen/PowerPC/aix-extern-weak.ll:9
+; RUN: -mattr=-altivec -filetype=obj -o %t.o < %s
+; RUN: llvm-readobj  --symbols %t.o | FileCheck --check-prefix=CHECKSYM %s
+

No need for two consecutive spaces here.



Comment at: llvm/test/CodeGen/PowerPC/aix-extern-weak.ll:45
+
+; CHECK-NOT:  .weak   .foo_ext_weak_ref
+; COMMON: .csect  .data[RW]

This has a prefix that is not checked by the `RUN` lines. Note also that it 
would only prevent the appearance of the subject line until the next positive 
match. Running FileCheck a second time on the same output may be necessary to 
check that it does not appear anywhere in an active manner. The passive method 
is to count on the block of `COMMON-NEXT` to exclude it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76932



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


[clang-tools-extra] f5b0591 - [clangd] Bump VSCode version number to allow republish (icon-only change).

2020-04-21 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2020-04-21T16:09:26+02:00
New Revision: f5b05915523a6faef16963a5b0f40037ed90dadc

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

LOG: [clangd] Bump VSCode version number to allow republish (icon-only change).

Added: 


Modified: 
clang-tools-extra/clangd/clients/clangd-vscode/package-lock.json
clang-tools-extra/clangd/clients/clangd-vscode/package.json

Removed: 




diff  --git a/clang-tools-extra/clangd/clients/clangd-vscode/package-lock.json 
b/clang-tools-extra/clangd/clients/clangd-vscode/package-lock.json
index 8ca4d064fb84..67f4cfb77bc3 100644
--- a/clang-tools-extra/clangd/clients/clangd-vscode/package-lock.json
+++ b/clang-tools-extra/clangd/clients/clangd-vscode/package-lock.json
@@ -1,6 +1,6 @@
 {
 "name": "vscode-clangd",
-"version": "0.0.20",
+"version": "0.0.21",
 "lockfileVersion": 1,
 "requires": true,
 "dependencies": {

diff  --git a/clang-tools-extra/clangd/clients/clangd-vscode/package.json 
b/clang-tools-extra/clangd/clients/clangd-vscode/package.json
index 86dc35a27d49..99ee119ea57d 100644
--- a/clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ b/clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -2,7 +2,7 @@
 "name": "vscode-clangd",
 "displayName": "vscode-clangd",
 "description": "Clang Language Server",
-"version": "0.0.21",
+"version": "0.0.22",
 "publisher": "llvm-vs-code-extensions",
 "homepage": "https://clangd.llvm.org/";,
 "icon": "icon.png",



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


[PATCH] D77735: [SveEmitter] Implement builtins for gathers/scatters

2020-04-21 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen accepted this revision.
sdesmalen added a comment.

LGTM! Cheers @andwar


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77735



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


[PATCH] D75430: [analyzer][NFC] Introduce CXXDeallocatorCall, deploy it in MallocChecker

2020-04-21 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

Ping^2 :)


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

https://reviews.llvm.org/D75430



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


[PATCH] D78509: [AArch64][SVE] Add addressing mode for contiguous loads & stores

2020-04-21 Thread Kerry McLaughlin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0df40d6ef8b8: [AArch64][SVE] Add addressing mode for 
contiguous loads & stores (authored by kmclaughlin).

Changed prior to commit:
  https://reviews.llvm.org/D78509?vs=258954&id=258965#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78509

Files:
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/test/CodeGen/AArch64/sve-intrinsics-ld1-addressing-mode-reg-imm.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-ld1-addressing-mode-reg-reg.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-ld1.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-st1-addressing-mode-reg-imm.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-st1-addressing-mode-reg-reg.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-st1.ll

Index: llvm/test/CodeGen/AArch64/sve-intrinsics-st1-addressing-mode-reg-reg.ll
===
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-st1-addressing-mode-reg-reg.ll
@@ -0,0 +1,184 @@
+; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
+
+;
+; ST1B
+;
+
+define void @st1b_i8( %data,  %pred, i8* %a, i64 %index) {
+; CHECK-LABEL: st1b_i8:
+; CHECK: st1b { z0.b }, p0, [x0, x1]
+; CHECK-NEXT: ret
+  %base = getelementptr i8, i8* %a, i64 %index
+  call void @llvm.aarch64.sve.st1.nxv16i8( %data,
+   %pred,
+  i8* %base)
+  ret void
+}
+
+
+
+define void @st1b_h( %data,  %pred, i8* %a, i64 %index) {
+; CHECK-LABEL: st1b_h:
+; CHECK: st1b { z0.h }, p0, [x0, x1]
+; CHECK-NEXT: ret
+  %base = getelementptr i8, i8* %a, i64 %index
+  %trunc = trunc  %data to 
+  call void @llvm.aarch64.sve.st1.nxv8i8( %trunc,
+  %pred,
+ i8* %base)
+  ret void
+}
+
+define void @st1b_s( %data,  %pred, i8* %a, i64 %index) {
+; CHECK-LABEL: st1b_s:
+; CHECK: st1b { z0.s }, p0, [x0, x1]
+; CHECK-NEXT: ret
+  %base = getelementptr i8, i8* %a, i64 %index
+  %trunc = trunc  %data to 
+  call void @llvm.aarch64.sve.st1.nxv4i8( %trunc,
+  %pred,
+ i8* %base)
+  ret void
+}
+
+define void @st1b_d( %data,  %pred, i8* %a, i64 %index) {
+; CHECK-LABEL: st1b_d:
+; CHECK: st1b { z0.d }, p0, [x0, x1]
+; CHECK-NEXT: ret
+  %base = getelementptr i8, i8* %a, i64 %index
+  %trunc = trunc  %data to 
+  call void @llvm.aarch64.sve.st1.nxv2i8( %trunc,
+  %pred,
+ i8* %base)
+  ret void
+}
+
+;
+; ST1H
+;
+
+define void @st1h_i16( %data,  %pred, i16* %a, i64 %index) {
+; CHECK-LABEL: st1h_i16:
+; CHECK: st1h { z0.h }, p0, [x0, x1, lsl #1]
+; CHECK-NEXT: ret
+  %base = getelementptr i16, i16* %a, i64 %index
+  call void @llvm.aarch64.sve.st1.nxv8i16( %data,
+   %pred,
+  i16* %base)
+  ret void
+}
+
+define void @st1h_f16( %data,  %pred, half* %a, i64 %index) {
+; CHECK-LABEL: st1h_f16:
+; CHECK: st1h { z0.h }, p0, [x0, x1, lsl #1]
+; CHECK-NEXT: ret
+  %base = getelementptr half, half* %a, i64 %index
+  call void @llvm.aarch64.sve.st1.nxv8f16( %data,
+   %pred,
+  half* %base)
+  ret void
+}
+
+define void @st1h_s( %data,  %pred, i16* %addr) {
+; CHECK-LABEL: st1h_s:
+; CHECK: st1h { z0.s }, p0, [x0]
+; CHECK-NEXT: ret
+  %trunc = trunc  %data to 
+  call void @llvm.aarch64.sve.st1.nxv4i16( %trunc,
+  %pred,
+ i16* %addr)
+  ret void
+}
+
+define void @st1h_d( %data,  %pred, i16* %a, i64 %index) {
+; CHECK-LABEL: st1h_d:
+; CHECK: st1h { z0.d }, p0, [x0, x1, lsl #1]
+; CHECK-NEXT: ret
+  %base = getelementptr i16, i16* %a, i64 %index
+  %trunc = trunc  %data to 
+  call void @llvm.aarch64.sve.st1.nxv2i16( %trunc,
+  %pred,
+ i16* %base)
+  ret void
+}
+
+;
+; ST1W
+;
+
+define void @st1w_i32( %data,  %pred, i32* %a, i64 %index) {
+; CHECK-LABEL: st1w_i32:
+; CHECK: st1w { z0.s }, p0, [x0, x1, lsl #2]
+; CHECK-NEXT: ret
+  %base = getelementptr i32, i32* %a, i64 %index
+  call void @llvm.aarch64.sve.st1.nxv4i32( %data,
+   %pred,
+  i32* %base)
+  ret void
+}
+
+define void @st1w_f32( %data,  %pred, float* %a, i64 %index) {
+; CHECK-LABEL: st1w_f32:
+; CHECK: st1w { z0.s }, p0, [x0, x1, lsl #2]
+; CHECK-NEXT: ret
+  %base = getelementptr float, float* %a, i64 %index
+  call void @llvm.aarch64.sve.st1.nxv4f32( %data,
+   %pred,
+  

[clang-tools-extra] 5a68138 - [clangd] Add icon to VSCode extension, and fix URLs

2020-04-21 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2020-04-21T13:40:47+02:00
New Revision: 5a68138403c85c66c367b650a456b915e2636ae0

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

LOG: [clangd] Add icon to VSCode extension, and fix URLs

Added: 
clang-tools-extra/clangd/clients/clangd-vscode/icon.png

Modified: 
clang-tools-extra/clangd/clients/clangd-vscode/package.json

Removed: 




diff  --git a/clang-tools-extra/clangd/clients/clangd-vscode/icon.png 
b/clang-tools-extra/clangd/clients/clangd-vscode/icon.png
new file mode 100644
index ..3c32cc045f2b
Binary files /dev/null and 
b/clang-tools-extra/clangd/clients/clangd-vscode/icon.png 
diff er

diff  --git a/clang-tools-extra/clangd/clients/clangd-vscode/package.json 
b/clang-tools-extra/clangd/clients/clangd-vscode/package.json
index 6a4b948bb654..86dc35a27d49 100644
--- a/clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ b/clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -4,7 +4,8 @@
 "description": "Clang Language Server",
 "version": "0.0.21",
 "publisher": "llvm-vs-code-extensions",
-"homepage": "https://clang.llvm.org/extra/clangd.html";,
+"homepage": "https://clangd.llvm.org/";,
+"icon": "icon.png",
 "engines": {
 "vscode": "^1.41.0"
 },
@@ -55,8 +56,9 @@
 "vscode-test": "^1.3.0"
 },
 "repository": {
-"type": "svn",
-"url": 
"http://llvm.org/svn/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/";
+"type": "git",
+"url": "https://github.com/llvm/llvm-project.git";,
+"directory": "clang-tools/extra/clangd/clients/clangd-vscode"
 },
 "contributes": {
 "languages": [



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


[PATCH] D78491: Avoid relying on address space zero default parameter in llvm/IR

2020-04-21 Thread Dylan McKay via Phabricator via cfe-commits
dylanmckay added a comment.

> should help targets such as AVR than use a non-zero program address space.

It definitely will - we have the exact same problems in terms of every call to 
`getUnqual` on a function pointer becomes a ISel error.

> I think making such bugs a compilation failure should be beneficial for 
> everyone even if it means typing a few more characters to get a pointer type.

I agree, it's the only reasonable way to support AVR at a level on-par with 
other official backends, all of which do not place functions in nonzero address 
spaces.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78491



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


[PATCH] D78509: [AArch64][SVE] Add addressing mode for contiguous loads & stores

2020-04-21 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin added a comment.

Thanks for taking a look at this, @fpetrogalli!


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

https://reviews.llvm.org/D78509



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


[PATCH] D75665: [analyzer] On-demand parsing capability for CTU

2020-04-21 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision.
xazax.hun added a comment.

Ok, looks good to me.

The minor nit regarding the naming is easy to fix before commit. The design 
question I had is not a blocker, my suggested alternative can be implemented 
later (if desired) in a backward-compatible way from the user's point of view.




Comment at: clang/include/clang/CrossTU/CrossTranslationUnit.h:227
+/// Identifier.
+virtual LoadResultTy load(StringRef Identifier) = 0;
+virtual ~ASTLoader() = default;

martong wrote:
> xazax.hun wrote:
> > I am not sure if this is good design.
> > Here, if the meaning of the `Identifier` depends on the subclass, the 
> > caller of this method always needs to be aware of the dynamic type of the 
> > object. What is the point of a common base class if we always need to know 
> > the dynamic type?
> > 
> > Looking at the code this does not look bad. But it might be a code smell.
> The way how we process the `extDefMapping` file is identical in both cases. 
> That's an index, keyed with the `USR`s of functions and then we get back a 
> value. And the way how we use that value is different. In the PCH case that 
> holds the path for the `.ast` file, in the ODM case that is the name of the 
> source file which we must find in the compile db. So, I think the process of 
> getting the AST for a USR requires the polymorphic behavior from the loaders.
> 
> We discussed other alternatives with Endre. We were thinking that maybe the 
> `extDefMapping` file should be identical in both cases. But then we would 
> need to add the `.ast` postfixes for the entries in the PCH case. And we 
> cannot just do that, because we may not know if what is the correct postfix. 
> The user may have generated `.pch` files instead. Also, we don't want to 
> compel any Clang user to use CodeChecker (CC will always create `.ast` 
> files). CTU should be running fine by manually executing the independent 
> steps.
Let me rephrase my concerns a bit. Do we really need a polymorphic `ASTLoader` 
to be present for the whole analysis? Wouldn't it make more sense to always do 
the same thing, i.e. if we are given a pch file load it, if we are given a 
source file, parse it? This way we would not be restricted to on-demand or two 
pass ctu analysis, but we could do any combination of the two.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75665



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


[PATCH] D77735: [SveEmitter] Implement builtins for gathers/scatters

2020-04-21 Thread Andrzej Warzynski via Phabricator via cfe-commits
andwar added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:7458
+llvm_unreachable("Invalid SVETypeFlag!");
+
+  case SVETypeFlags::EltTyInt8:

SjoerdMeijer wrote:
> nit: no need for the newlines here and also below?
IMHO this improves readability, but I agree that that's a matter of personal 
preference :)

I'll keep it as is for the sake of consistency with `getSVEType` below.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:7555
+
+  // From ACLE we always get . This might be incompatible with
+  // the actual type being loaded. Cast accordingly.

SjoerdMeijer wrote:
> nit: can you rephrase this comment a bit I.e. the "From ACLE we always get 
> ..." is a bit confusing I think. You want to say that this is how the ACLE 
> defines this, but the IR looks different. You can also specify which bit is 
> different, because that was not immediately obvious to me. 
> 
Good point, updated!



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:7601
+  llvm::Type *SrcDataTy = getSVEType(TypeFlags);
+  llvm::Type *OverloadedTy = llvm::VectorType::get(
+  SVEBuiltinMemEltTy(TypeFlags), SrcDataTy->getVectorElementCount());

sdesmalen wrote:
> nit: This can use `auto`, which would make OverloadedTy a `llvm::VectorType`
Thanks, good point! I also updated `getSVEType` to return `VectorType` (so I 
can use `auto` for both).



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:7602
+  llvm::Type *OverloadedTy = llvm::VectorType::get(
+  SVEBuiltinMemEltTy(TypeFlags), SrcDataTy->getVectorElementCount());
+

sdesmalen wrote:
> Just be aware that `getVectorElementCount` has been removed from Type in 
> D77278, so you'll need to cast to `VectorType` and use `getElementCount` 
> instead.
> (fyi - in D77596 I've made `getSVEType` actually return a VectorType so that 
> cast wouldn't be needed)
I have done the same ;)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77735



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


[PATCH] D78521: [clangd] Extend dexp to support remote index

2020-04-21 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 258958.
kbobyrev added a comment.

Move type conversions to Marshalling.(h|cpp) and hide IndexClient behind a 
factory function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78521

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/index/Serialization.h
  clang-tools-extra/clangd/index/YAMLSerialization.cpp
  clang-tools-extra/clangd/index/dex/dexp/CMakeLists.txt
  clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
  clang-tools-extra/clangd/index/remote/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/Index.cpp
  clang-tools-extra/clangd/index/remote/Index.h
  clang-tools-extra/clangd/index/remote/Index.proto
  clang-tools-extra/clangd/index/remote/Marshalling.cpp
  clang-tools-extra/clangd/index/remote/Marshalling.h
  clang-tools-extra/clangd/index/remote/client/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/client/Client.cpp
  clang-tools-extra/clangd/index/remote/server/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/server/Server.cpp
  llvm/cmake/modules/FindGRPC.cmake

Index: llvm/cmake/modules/FindGRPC.cmake
===
--- llvm/cmake/modules/FindGRPC.cmake
+++ llvm/cmake/modules/FindGRPC.cmake
@@ -23,11 +23,11 @@
   find_program(PROTOC protoc)
 endif()
 
-# Proto headers are generated in ${CMAKE_CURRENT_BINARY_DIR}.
+# Proto headers are generated in ${GeneratedFilesLocation}.
 # Libraries that use these headers should adjust the include path.
 # FIXME(kirillbobyrev): Allow optional generation of gRPC code and give callers
 # control over it via additional parameters.
-function(generate_grpc_protos LibraryName ProtoFile)
+function(generate_grpc_protos LibraryName ProtoFile GeneratedFilesLocation)
   get_filename_component(ProtoSourceAbsolutePath "${CMAKE_CURRENT_SOURCE_DIR}/${ProtoFile}" ABSOLUTE)
   get_filename_component(ProtoSourcePath ${ProtoSourceAbsolutePath} PATH)
 
@@ -35,6 +35,7 @@
   set(GeneratedProtoHeader "${CMAKE_CURRENT_BINARY_DIR}/Index.pb.h")
   set(GeneratedGRPCSource "${CMAKE_CURRENT_BINARY_DIR}/Index.grpc.pb.cc")
   set(GeneratedGRPCHeader "${CMAKE_CURRENT_BINARY_DIR}/Index.grpc.pb.h")
+  set(${GeneratedFilesLocation} ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
   add_custom_command(
 OUTPUT "${GeneratedProtoSource}" "${GeneratedProtoHeader}" "${GeneratedGRPCSource}" "${GeneratedGRPCHeader}"
 COMMAND ${PROTOC}
Index: clang-tools-extra/clangd/index/remote/server/Server.cpp
===
--- clang-tools-extra/clangd/index/remote/server/Server.cpp
+++ clang-tools-extra/clangd/index/remote/server/Server.cpp
@@ -8,6 +8,7 @@
 
 #include "index/Index.h"
 #include "index/Serialization.h"
+#include "index/remote/Marshalling.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/LineEditor/LineEditor.h"
@@ -23,6 +24,7 @@
 
 namespace clang {
 namespace clangd {
+namespace remote {
 namespace {
 
 static const std::string Overview = R"(
@@ -47,24 +49,51 @@
 
 private:
   grpc::Status Lookup(grpc::ServerContext *Context,
-  const remote::LookupRequest *Request,
-  grpc::ServerWriter *Reply) override {
-llvm::outs() << "Lookup of symbol with ID " << Request->id() << '\n';
-LookupRequest Req;
-auto SID = SymbolID::fromStr(Request->id());
-if (!SID) {
-  llvm::outs() << llvm::toString(SID.takeError()) << "\n";
-  return grpc::Status::CANCELLED;
+  const LookupRequest *Request,
+  grpc::ServerWriter *Reply) override {
+clangd::LookupRequest Req;
+for (const auto &ID : Request->ids()) {
+  auto SID = SymbolID::fromStr(StringRef(ID));
+  if (!SID)
+return grpc::Status::CANCELLED;
+  Req.IDs.insert(*SID);
 }
-Req.IDs.insert(*SID);
-Index->lookup(Req, [&](const Symbol &Sym) {
-  remote::LookupReply NextSymbol;
-  NextSymbol.set_symbol_yaml(toYAML(Sym));
+Index->lookup(Req, [&](const clangd::Symbol &Sym) {
+  remote::Symbol NextSymbol;
+  NextSymbol.set_yaml_serializatiton(toYAML(Sym));
   Reply->Write(NextSymbol);
 });
 return grpc::Status::OK;
   }
 
+  grpc::Status FuzzyFind(grpc::ServerContext *Context,
+ const FuzzyFindRequest *Request,
+ FuzzyFindReply *Reply) override {
+const auto Req = fromProtobuf(Request);
+bool HasMore = Index->fuzzyFind(Req, [&](const clangd::Symbol &Sym) {
+  auto *NextSymbol = Reply->add_symbols();
+  NextSymbol->set_yaml_serializatiton(toYAML(Sym));
+});
+Reply->set_has_more(HasMore);
+return grpc::Status::OK;
+  }
+
+  grpc::Status Refs(grpc::ServerContext *Context, const RefsRequest *Request,
+RefsReply *Reply) override {
+clangd::RefsRequest Req;
+for (const auto &ID : Req

[PATCH] D78509: [AArch64][SVE] Add addressing mode for contiguous loads & stores

2020-04-21 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin updated this revision to Diff 258954.
kmclaughlin marked 5 inline comments as done.
kmclaughlin added a comment.

- Renamed ld1nf multiclass to ldnf1
- Split out existing reg+imm tests into their own files
- Renamed 'offset' to 'index' in reg+reg tests


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

https://reviews.llvm.org/D78509

Files:
  llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
  llvm/test/CodeGen/AArch64/sve-intrinsics-ld1-addressing-mode-reg-imm.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-ld1-addressing-mode-reg-reg.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-ld1.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-st1-addressing-mode-reg-imm.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-st1-addressing-mode-reg-reg.ll
  llvm/test/CodeGen/AArch64/sve-intrinsics-st1.ll

Index: llvm/test/CodeGen/AArch64/sve-intrinsics-st1.ll
===
--- llvm/test/CodeGen/AArch64/sve-intrinsics-st1.ll
+++ llvm/test/CodeGen/AArch64/sve-intrinsics-st1.ll
@@ -47,101 +47,6 @@
   ret void
 }
 
-define void @st1b_upper_bound( %data,  %pg, i8* %a) {
-; CHECK-LABEL: st1b_upper_bound:
-; CHECK: st1b { z0.b }, p0, [x0, #7, mul vl]
-; CHECK-NEXT: ret
-  %base_scalable = bitcast i8* %a to *
-  %base = getelementptr , * %base_scalable, i64 7
-  %base_scalar = bitcast * %base to i8*
-  call void @llvm.aarch64.sve.st1.nxv16i8( %data,  %pg, i8* %base_scalar)
-  ret void
-}
-
-define void @st1b_inbound( %data,  %pg, i8* %a) {
-; CHECK-LABEL: st1b_inbound:
-; CHECK: st1b { z0.b }, p0, [x0, #1, mul vl]
-; CHECK-NEXT: ret
-  %base_scalable = bitcast i8* %a to *
-  %base = getelementptr , * %base_scalable, i64 1
-  %base_scalar = bitcast * %base to i8*
-  call void @llvm.aarch64.sve.st1.nxv16i8( %data,  %pg, i8* %base_scalar)
-  ret void
-}
-
-define void @st1b_lower_bound( %data,  %pg, i8* %a) {
-; CHECK-LABEL: st1b_lower_bound:
-; CHECK: st1b { z0.b }, p0, [x0, #-8, mul vl]
-; CHECK-NEXT: ret
-  %base_scalable = bitcast i8* %a to *
-  %base = getelementptr , * %base_scalable, i64 -8
-  %base_scalar = bitcast * %base to i8*
-  call void @llvm.aarch64.sve.st1.nxv16i8( %data,  %pg, i8* %base_scalar)
-  ret void
-}
-
-define void @st1b_out_of_upper_bound( %data,  %pg, i8* %a) {
-; CHECK-LABEL: st1b_out_of_upper_bound:
-; CHECK: rdvl x[[OFFSET:[0-9]+]], #8
-; CHECK: add x[[BASE:[0-9]+]], x0, x[[OFFSET]]
-; CHECK: st1b { z0.b }, p0, [x[[BASE]]]
-; CHECK-NEXT: ret
-  %base_scalable = bitcast i8* %a to *
-  %base = getelementptr , * %base_scalable, i64 8
-  %base_scalar = bitcast * %base to i8*
-  call void @llvm.aarch64.sve.st1.nxv16i8( %data,  %pg, i8* %base_scalar)
-  ret void
-}
-
-define void @st1b_out_of_lower_bound( %data,  %pg, i8* %a) {
-; CHECK-LABEL: st1b_out_of_lower_bound:
-; CHECK: rdvl x[[OFFSET:[0-9]+]], #-9
-; CHECK: add x[[BASE:[0-9]+]], x0, x[[OFFSET]]
-; CHECK: st1b { z0.b }, p0, [x[[BASE]]]
-; CHECK-NEXT: ret
-  %base_scalable = bitcast i8* %a to *
-  %base = getelementptr , * %base_scalable, i64 -9
-  %base_scalar = bitcast * %base to i8*
-  call void @llvm.aarch64.sve.st1.nxv16i8( %data,  %pg, i8* %base_scalar)
-  ret void
-}
-
-define void @st1b_s_inbound( %data,  %pg, i8* %a) {
-; CHECK-LABEL: st1b_s_inbound:
-; CHECK: st1b { z0.s }, p0, [x0, #7, mul vl]
-; CHECK-NEXT: ret
-  %base_scalable = bitcast i8* %a to *
-  %base = getelementptr , * %base_scalable, i64 7
-  %base_scalar = bitcast * %base to i8*
-  %trunc = trunc  %data to 
-  call void @llvm.aarch64.sve.st1.nxv4i8( %trunc,  %pg, i8* %base_scalar)
-  ret void
-}
-
-define void @st1b_h_inbound( %data,  %pg, i8* %a) {
-; CHECK-LABEL: st1b_h_inbound:
-; CHECK: st1b { z0.h }, p0, [x0, #1, mul vl]
-; CHECK-NEXT: ret
-  %base_scalable = bitcast i8* %a to *
-  %base = getelementptr , * %base_scalable, i64 1
-  %base_scalar = bitcast * %base to i8*
-  %trunc = trunc  %data to 
-  call void @llvm.aarch64.sve.st1.nxv8i8( %trunc,  %pg, i8* %base_scalar)
-  ret void
-}
-
-define void @st1b_d_inbound( %data,  %pg, i8* %a) {
-; CHECK-LABEL: st1b_d_inbound:
-; CHECK: st1b { z0.d }, p0, [x0, #-7, mul vl]
-; CHECK-NEXT: ret
-  %base_scalable = bitcast i8* %a to *
-  %base = getelementptr , * %base_scalable, i64 -7
-  %base_scalar = bitcast * %base to i8*
-  %trunc = trunc  %data to 
-  call void @llvm.aarch64.sve.st1.nxv2i8( %trunc,  %pg, i8* %base_scalar)
-  ret void
-}
-
 ;
 ; ST1H
 ;
@@ -188,52 +93,6 @@
   ret void
 }
 
-define void @st1h_inbound( %data,  %pg, i16* %a) {
-; CHECK-LABEL: st1h_inbound:
-; CHECK: st1h { z0.h }, p0, [x0, #-1, mul vl]
-; CHECK-NEXT: ret
-  %base_scalable = bitcast i16* %a to *
-  %base = getelementptr , * %base_scalable, i64 -1
-  %base_scalar = bitcast * %base to i16*
-  call void @llvm.aarch64.sve.st1.nxv8i16( %data,  %pg, i16* %base_scalar)
-  ret void
-}
-
-define void @st1h_f16_inbound( %data,  %pg, half* %a) {
-; CHECK-LABEL: st1h_f16_inbound:
-; CHECK: st1h { z0.h }, p0, [x0, #-5, mul vl]
-; CHECK-NEXT: ret
-  %base_scalable = bitcast half* %a to *
-  

[PATCH] D78533: [i386] Fix bug that get __m128/__m256/__m512 with wrong alignment for variadic functions.

2020-04-21 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added a subscriber: cfe-commits.
RKSimon added a comment.

CCing cfe-commits


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

https://reviews.llvm.org/D78533



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


[PATCH] D75665: [analyzer] On-demand parsing capability for CTU

2020-04-21 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments.



Comment at: clang/include/clang/CrossTU/CrossTranslationUnit.h:56
+  load_threshold_reached,
+  ambiguous_compile_commands_database
 };

xazax.hun wrote:
> The two enum values refer to compilation database and compile command 
> database. I'd prefer to use the same wording in both values.
+1



Comment at: clang/include/clang/CrossTU/CrossTranslationUnit.h:227
+/// Identifier.
+virtual LoadResultTy load(StringRef Identifier) = 0;
+virtual ~ASTLoader() = default;

xazax.hun wrote:
> I am not sure if this is good design.
> Here, if the meaning of the `Identifier` depends on the subclass, the caller 
> of this method always needs to be aware of the dynamic type of the object. 
> What is the point of a common base class if we always need to know the 
> dynamic type?
> 
> Looking at the code this does not look bad. But it might be a code smell.
The way how we process the `extDefMapping` file is identical in both cases. 
That's an index, keyed with the `USR`s of functions and then we get back a 
value. And the way how we use that value is different. In the PCH case that 
holds the path for the `.ast` file, in the ODM case that is the name of the 
source file which we must find in the compile db. So, I think the process of 
getting the AST for a USR requires the polymorphic behavior from the loaders.

We discussed other alternatives with Endre. We were thinking that maybe the 
`extDefMapping` file should be identical in both cases. But then we would need 
to add the `.ast` postfixes for the entries in the PCH case. And we cannot just 
do that, because we may not know if what is the correct postfix. The user may 
have generated `.pch` files instead. Also, we don't want to compel any Clang 
user to use CodeChecker (CC will always create `.ast` files). CTU should be 
running fine by manually executing the independent steps.



Comment at: clang/lib/CrossTU/CrossTranslationUnit.cpp:120
+case index_error_code::ambiguous_compile_commands_database:
+  return "Compile commands database contains multiple references to the "
+ "same source file.";

xazax.hun wrote:
> Unfortunately, this is a very common case for a large number of projects that 
> supports multiple targets (e.g. 32 and 64 bits). Is there a plan to mitigate 
> this problem?
I don't think we could do that. We need to merge ASTs of those TUs that are 
linkable. Otherwise the merge will be unsuccessful because of certain 
mismatches in Decls (structural eq will fail).
Even in CodeChecker we are planning to issue a hard error in these ambiguous 
cases, even with the PCH method too. (The error would be suppressible by the 
user of course, but if that is suppressed then we take no responsibility.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75665



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


[PATCH] D78521: [clangd] Extend dexp to support remote index

2020-04-21 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 258942.
kbobyrev added a comment.

Add correct definition and fix build.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78521

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/index/Serialization.h
  clang-tools-extra/clangd/index/YAMLSerialization.cpp
  clang-tools-extra/clangd/index/dex/dexp/CMakeLists.txt
  clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
  clang-tools-extra/clangd/index/remote/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/Index.cpp
  clang-tools-extra/clangd/index/remote/Index.h
  clang-tools-extra/clangd/index/remote/Index.proto
  clang-tools-extra/clangd/index/remote/client/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/client/Client.cpp
  clang-tools-extra/clangd/index/remote/server/Server.cpp
  llvm/cmake/modules/FindGRPC.cmake

Index: llvm/cmake/modules/FindGRPC.cmake
===
--- llvm/cmake/modules/FindGRPC.cmake
+++ llvm/cmake/modules/FindGRPC.cmake
@@ -23,11 +23,11 @@
   find_program(PROTOC protoc)
 endif()
 
-# Proto headers are generated in ${CMAKE_CURRENT_BINARY_DIR}.
+# Proto headers are generated in ${GeneratedFilesLocation}.
 # Libraries that use these headers should adjust the include path.
 # FIXME(kirillbobyrev): Allow optional generation of gRPC code and give callers
 # control over it via additional parameters.
-function(generate_grpc_protos LibraryName ProtoFile)
+function(generate_grpc_protos LibraryName ProtoFile GeneratedFilesLocation)
   get_filename_component(ProtoSourceAbsolutePath "${CMAKE_CURRENT_SOURCE_DIR}/${ProtoFile}" ABSOLUTE)
   get_filename_component(ProtoSourcePath ${ProtoSourceAbsolutePath} PATH)
 
@@ -35,6 +35,7 @@
   set(GeneratedProtoHeader "${CMAKE_CURRENT_BINARY_DIR}/Index.pb.h")
   set(GeneratedGRPCSource "${CMAKE_CURRENT_BINARY_DIR}/Index.grpc.pb.cc")
   set(GeneratedGRPCHeader "${CMAKE_CURRENT_BINARY_DIR}/Index.grpc.pb.h")
+  set(${GeneratedFilesLocation} ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
   add_custom_command(
 OUTPUT "${GeneratedProtoSource}" "${GeneratedProtoHeader}" "${GeneratedGRPCSource}" "${GeneratedGRPCHeader}"
 COMMAND ${PROTOC}
Index: clang-tools-extra/clangd/index/remote/server/Server.cpp
===
--- clang-tools-extra/clangd/index/remote/server/Server.cpp
+++ clang-tools-extra/clangd/index/remote/server/Server.cpp
@@ -23,6 +23,7 @@
 
 namespace clang {
 namespace clangd {
+namespace remote {
 namespace {
 
 static const std::string Overview = R"(
@@ -40,6 +41,22 @@
   return loadIndex(Index, /*UseIndex=*/true);
 }
 
+clangd::FuzzyFindRequest deserialize(const FuzzyFindRequest *Request) {
+  clangd::FuzzyFindRequest Result;
+  Result.Query = Request->query();
+  for (const auto &Scope : Request->scopes())
+Result.Scopes.push_back(Scope);
+  Result.AnyScope = Request->any_scope();
+  if (Request->limit())
+Result.Limit = Request->limit();
+  Result.RestrictForCodeCompletion = Request->resricted_for_code_completion();
+  for (const auto &Path : Request->proximity_paths())
+Result.ProximityPaths.push_back(Path);
+  for (const auto &Type : Request->preferred_types())
+Result.ProximityPaths.push_back(Type);
+  return Result;
+}
+
 class RemoteIndexServer final : public remote::Index::Service {
 public:
   RemoteIndexServer(std::unique_ptr Index)
@@ -47,24 +64,51 @@
 
 private:
   grpc::Status Lookup(grpc::ServerContext *Context,
-  const remote::LookupRequest *Request,
-  grpc::ServerWriter *Reply) override {
-llvm::outs() << "Lookup of symbol with ID " << Request->id() << '\n';
-LookupRequest Req;
-auto SID = SymbolID::fromStr(Request->id());
-if (!SID) {
-  llvm::outs() << llvm::toString(SID.takeError()) << "\n";
-  return grpc::Status::CANCELLED;
+  const LookupRequest *Request,
+  grpc::ServerWriter *Reply) override {
+clangd::LookupRequest Req;
+for (const auto &ID : Request->ids()) {
+  auto SID = SymbolID::fromStr(StringRef(ID));
+  if (!SID)
+return grpc::Status::CANCELLED;
+  Req.IDs.insert(*SID);
 }
-Req.IDs.insert(*SID);
-Index->lookup(Req, [&](const Symbol &Sym) {
-  remote::LookupReply NextSymbol;
-  NextSymbol.set_symbol_yaml(toYAML(Sym));
+Index->lookup(Req, [&](const clangd::Symbol &Sym) {
+  remote::Symbol NextSymbol;
+  NextSymbol.set_yaml_serializatiton(toYAML(Sym));
   Reply->Write(NextSymbol);
 });
 return grpc::Status::OK;
   }
 
+  grpc::Status FuzzyFind(grpc::ServerContext *Context,
+ const FuzzyFindRequest *Request,
+ FuzzyFindReply *Reply) override {
+const auto Req = deserialize(Request);
+bool HasMore = Index->fuzzyFind(Req, [&](const clangd::Symbol &Sym) {
+ 

[PATCH] D78365: [AST] Preserve the invalid initializer for auto VarDecl.

2020-04-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein marked an inline comment as done.
hokein added inline comments.



Comment at: clang/lib/Sema/SemaDecl.cpp:11852
+  // There are unresolved typos in Init. Usually it indicates the
+  // initializer is very ill-formed, just drop it.
   RealDecl->setInvalidDecl();

sammccall wrote:
> Do you have an example to back this up? (Not to include in the comment, just 
> curious).
> 
> ISTM when there are errors in the input, you can get "lucky" and they turn 
> into recoveryexpr and survive here, or you get "unlucky" and they turn into 
> typoexpr and are dropped here after correction fails. And lucky/unlucky might 
> mostly depend on details about the type of error, not how ill-formed the code 
> is?
> 
> This suggests two possible recovery strategies:
>  - if CorrectDelayedTyposInExpr fails typo-correction, it could rebuild with 
> the typos "degraded" to RecoveryExpr of some sort
>  - or we could just wrap `Init` in `RecoveryExpr`, TypoExprs and all. With 
> the assumption that stuff that doesn't handle TypoExpr should either treate 
> RecoveryExpr as opaque or should bail out at the top-level based on 
> ContainsErrors.
> 
> The former seems more precise and more general, probably more work too.
> 
> None of this needs to be addressed in this patch except maybe a FIXME and/or 
> a tweak to the existing comment.
> Do you have an example to back this up?

we have an example, see the test.

 `auto unresolved_typo = gned.*[] {};` the initExpr looks like below, it seems 
less useful. I'm not sure it is worth the effort to preserve the AST if the 
typo correction is not resolved. it requires some work either #1 or #2. 

```
BinaryOperator 0x8992288 '' contains-errors '.*'
|-TypoExpr 0x8991a78 '' contains-errors lvalue
`-LambdaExpr 0x8992150 'class (lambda at /tmp/t4.cpp:11:32)'
  |-CXXRecordDecl 0x8991b30  implicit class definition
  | |-DefinitionData lambda pass_in_registers empty standard_layout 
trivially_copyable literal can_const_default_init
  | | |-DefaultConstructor defaulted_is_constexpr
  | | |-CopyConstructor simple trivial has_const_param needs_implicit 
implicit_has_const_param
  | | |-MoveConstructor exists simple trivial needs_implicit
  | | |-CopyAssignment trivial has_const_param needs_implicit 
implicit_has_const_param
  | | |-MoveAssignment
  | | `-Destructor simple irrelevant trivial
  | |-CXXMethodDecl 0x8991c70  constexpr operator() 'auto (void) const -> void' 
inline
  | | `-CompoundStmt 0x8991d20
  | |-CXXConversionDecl 0x8991fe8  implicit constexpr operator void (*)() 'auto 
(*(void) const noexcept)(void) -> void' inline
  | |-CXXMethodDecl 0x8992098  implicit __invoke 'auto (void) -> void' static 
inline
  | `-CXXDestructorDecl 0x8992180  implicit referenced ~ 'void (void) noexcept' 
inline default trivial
  `-CompoundStmt 0x8991d20
```


> And lucky/unlucky might mostly depend on details about the type of error, not 
> how ill-formed the code is?

probably, but this also implies our current recovery strategy can't handle this 
case well.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78365



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


[clang-tools-extra] 4ccafab - [clangd] Change field name to prevent shadowing

2020-04-21 Thread Kadir Cetinkaya via cfe-commits

Author: Kadir Cetinkaya
Date: 2020-04-21T11:57:59+02:00
New Revision: 4ccafab0769ffaf1aee1c727ee5b733ce7907594

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

LOG: [clangd] Change field name to prevent shadowing

Added: 


Modified: 
clang-tools-extra/clangd/CodeComplete.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/CodeComplete.cpp 
b/clang-tools-extra/clangd/CodeComplete.cpp
index 3fa5b53ebaad..3d9bfe509f2b 100644
--- a/clang-tools-extra/clangd/CodeComplete.cpp
+++ b/clang-tools-extra/clangd/CodeComplete.cpp
@@ -1023,7 +1023,7 @@ struct SemaCompleteInput {
   PathRef FileName;
   const tooling::CompileCommand &Command;
   const PreambleData &Preamble;
-  const PreamblePatch &PreamblePatch;
+  const PreamblePatch &Patch;
   llvm::StringRef Contents;
   size_t Offset;
   llvm::IntrusiveRefCntPtr VFS;
@@ -1096,7 +1096,7 @@ bool 
semaCodeComplete(std::unique_ptr Consumer,
   PreambleBounds PreambleRegion =
   ComputePreambleBounds(*CI->getLangOpts(), ContentsBuffer.get(), 0);
   bool CompletingInPreamble = PreambleRegion.Size > Input.Offset;
-  Input.PreamblePatch.apply(*CI);
+  Input.Patch.apply(*CI);
   // NOTE: we must call BeginSourceFile after prepareCompilerInstance. 
Otherwise
   // the remapped buffers do not get freed.
   auto Clang = prepareCompilerInstance(



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


[PATCH] D69987: [RISCV] Assemble/Disassemble v-ext instructions.

2020-04-21 Thread Simon Cook via Phabricator via cfe-commits
simoncook added a reviewer: simoncook.
simoncook added a comment.

This is looking good, overall the patch is nicely laid out which has made it 
easy to compare against the spec.

I've made a few comments, mostly about ordering of instructions so that they 
are identical to the spec.

One question, I appreciate the Zvediv/Zvqmac sections say they are not planned 
to be part of the base V extension, but is it worth having them too behind 
separate flags so they can be used/evaluated. (I'm thinking like the 
Zbproposedc extension we added for bitmanip, which is not part of the proposed 
finalized 'B', but is included for comparisons).

The other thing I've noticed looking through the spec, there are references to 
psuedoinstructions, but these aren't covered by this patch. It would be good 
for `InstAlias`es to be defined for these and land in the same patch.




Comment at: llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp:160
+
+  Register Reg = RISCV::V0 + RegNo;
+  Inst.addOperand(MCOperand::createReg(Reg));

If you are going to rely on the register names being contiguous, extend the 
static_asserts in RISCVRegisterInfo.cpp to validate this at compile time.



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoV.td:449
+}
+}
+

Add comment noting end of earlyclobber/constraint scope



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoV.td:532
+// Vector Integer Move Instructions
+let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
+// op vd, vs1

I'm not sure if this will read better if you move the common `let vs2=0, vm=1` 
up here?



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoV.td:551
+}
+}
+

Add `// hasSideEffects = 0, mayLoad = 0, mayStore = 0`



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoV.td:578
+
+// Vector Single-Width Integer Reduction Instructions
+defm VREDSUM : VALU_MV_V<"vredsum", 0b00>;

Following through the 0.8 spec I would have expected the `defm VFADD_V : 
VALU_FV_V_F` result here, since the previous instruction was defined in section 
13.5, and VFADD.V[VF] is the next thing defined in 14.2.

The chapter 14 instructions look like they are defined in the order the spec 
says (with the exception of VFREDOSUM, etc at the bottom of this file). Could 
you move chapter 13 instructions here so the order matches, to make it easier 
to validate as the spec advances.



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoV.td:648
+
+}
+

The vfmv definition from line 814 should move here? (17.2?)



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoV.td:651
+foreach nf = [1, 2, 4, 8] in {
+  def VMV#nf#R_V  : RVInstV<0b100111, !add(nf, -1), OPIVI, (outs VRegOp:$vd),
+(ins VRegOp:$vs2), "vmv" # nf # "r.v",

This should be below vcompress?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69987



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


[PATCH] D78521: [clangd] Extend dexp to support remote index

2020-04-21 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 258936.
kbobyrev marked 2 inline comments as done.
kbobyrev added a comment.

Implement refs(), address some comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78521

Files:
  clang-tools-extra/clangd/CMakeLists.txt
  clang-tools-extra/clangd/index/Serialization.h
  clang-tools-extra/clangd/index/YAMLSerialization.cpp
  clang-tools-extra/clangd/index/dex/dexp/CMakeLists.txt
  clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
  clang-tools-extra/clangd/index/remote/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/Index.cpp
  clang-tools-extra/clangd/index/remote/Index.h
  clang-tools-extra/clangd/index/remote/Index.proto
  clang-tools-extra/clangd/index/remote/client/CMakeLists.txt
  clang-tools-extra/clangd/index/remote/client/Client.cpp
  clang-tools-extra/clangd/index/remote/server/Server.cpp
  llvm/cmake/modules/FindGRPC.cmake

Index: llvm/cmake/modules/FindGRPC.cmake
===
--- llvm/cmake/modules/FindGRPC.cmake
+++ llvm/cmake/modules/FindGRPC.cmake
@@ -23,11 +23,11 @@
   find_program(PROTOC protoc)
 endif()
 
-# Proto headers are generated in ${CMAKE_CURRENT_BINARY_DIR}.
+# Proto headers are generated in ${GeneratedFilesLocation}.
 # Libraries that use these headers should adjust the include path.
 # FIXME(kirillbobyrev): Allow optional generation of gRPC code and give callers
 # control over it via additional parameters.
-function(generate_grpc_protos LibraryName ProtoFile)
+function(generate_grpc_protos LibraryName ProtoFile GeneratedFilesLocation)
   get_filename_component(ProtoSourceAbsolutePath "${CMAKE_CURRENT_SOURCE_DIR}/${ProtoFile}" ABSOLUTE)
   get_filename_component(ProtoSourcePath ${ProtoSourceAbsolutePath} PATH)
 
@@ -35,6 +35,7 @@
   set(GeneratedProtoHeader "${CMAKE_CURRENT_BINARY_DIR}/Index.pb.h")
   set(GeneratedGRPCSource "${CMAKE_CURRENT_BINARY_DIR}/Index.grpc.pb.cc")
   set(GeneratedGRPCHeader "${CMAKE_CURRENT_BINARY_DIR}/Index.grpc.pb.h")
+  set(${GeneratedFilesLocation} ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
   add_custom_command(
 OUTPUT "${GeneratedProtoSource}" "${GeneratedProtoHeader}" "${GeneratedGRPCSource}" "${GeneratedGRPCHeader}"
 COMMAND ${PROTOC}
Index: clang-tools-extra/clangd/index/remote/server/Server.cpp
===
--- clang-tools-extra/clangd/index/remote/server/Server.cpp
+++ clang-tools-extra/clangd/index/remote/server/Server.cpp
@@ -23,6 +23,7 @@
 
 namespace clang {
 namespace clangd {
+namespace remote {
 namespace {
 
 static const std::string Overview = R"(
@@ -40,6 +41,22 @@
   return loadIndex(Index, /*UseIndex=*/true);
 }
 
+clangd::FuzzyFindRequest deserialize(const FuzzyFindRequest *Request) {
+  clangd::FuzzyFindRequest Result;
+  Result.Query = Request->query();
+  for (const auto &Scope : Request->scopes())
+Result.Scopes.push_back(Scope);
+  Result.AnyScope = Request->any_scope();
+  if (Request->limit())
+Result.Limit = Request->limit();
+  Result.RestrictForCodeCompletion = Request->resricted_for_code_completion();
+  for (const auto &Path : Request->proximity_paths())
+Result.ProximityPaths.push_back(Path);
+  for (const auto &Type : Request->preferred_types())
+Result.ProximityPaths.push_back(Type);
+  return Result;
+}
+
 class RemoteIndexServer final : public remote::Index::Service {
 public:
   RemoteIndexServer(std::unique_ptr Index)
@@ -47,24 +64,51 @@
 
 private:
   grpc::Status Lookup(grpc::ServerContext *Context,
-  const remote::LookupRequest *Request,
-  grpc::ServerWriter *Reply) override {
-llvm::outs() << "Lookup of symbol with ID " << Request->id() << '\n';
-LookupRequest Req;
-auto SID = SymbolID::fromStr(Request->id());
-if (!SID) {
-  llvm::outs() << llvm::toString(SID.takeError()) << "\n";
-  return grpc::Status::CANCELLED;
+  const LookupRequest *Request,
+  grpc::ServerWriter *Reply) override {
+clangd::LookupRequest Req;
+for (const auto &ID : Request->ids()) {
+  auto SID = SymbolID::fromStr(StringRef(ID));
+  if (!SID)
+return grpc::Status::CANCELLED;
+  Req.IDs.insert(*SID);
 }
-Req.IDs.insert(*SID);
-Index->lookup(Req, [&](const Symbol &Sym) {
-  remote::LookupReply NextSymbol;
-  NextSymbol.set_symbol_yaml(toYAML(Sym));
+Index->lookup(Req, [&](const clangd::Symbol &Sym) {
+  remote::Symbol NextSymbol;
+  NextSymbol.set_yaml_serializatiton(toYAML(Sym));
   Reply->Write(NextSymbol);
 });
 return grpc::Status::OK;
   }
 
+  grpc::Status FuzzyFind(grpc::ServerContext *Context,
+ const FuzzyFindRequest *Request,
+ FuzzyFindReply *Reply) override {
+const auto Req = deserialize(Request);
+bool HasMore = Index->fuzz

[PATCH] D78511: [Driver][doc] Document option -mtune as a no-op. NFC.

2020-04-21 Thread Sjoerd Meijer via Phabricator via cfe-commits
SjoerdMeijer added a comment.

Thank you both for reviewing!
And I will wait a day.


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

https://reviews.llvm.org/D78511



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


[PATCH] D78116: [AST] dont invaliate VarDecl when the initializer contains errors.

2020-04-21 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.
Closed by commit rG89d9912cbf45: [AST] dont invaliate VarDecl when the 
initializer contains errors. (authored by hokein).

Changed prior to commit:
  https://reviews.llvm.org/D78116?vs=258169&id=258933#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78116

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/test/AST/ast-dump-invalid-initialized.cpp
  clang/test/AST/ast-dump-recovery.cpp
  clang/test/CXX/special/class.copy/p11.0x.move.cpp
  clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
  clang/test/OpenMP/task_messages.cpp
  clang/test/SemaCXX/block-call.cpp
  clang/test/SemaCXX/constant-expression-cxx11.cpp
  clang/test/SemaCXX/cxx11-crashes.cpp
  clang/test/SemaCXX/cxx2a-explicit-bool.cpp
  clang/test/SemaCXX/for-range-dereference.cpp
  clang/test/SemaCXX/member-init.cpp
  clang/test/SemaCXX/recovery-initializer.cpp
  clang/test/SemaObjCXX/parameterized_classes_arc.mm

Index: clang/test/SemaObjCXX/parameterized_classes_arc.mm
===
--- clang/test/SemaObjCXX/parameterized_classes_arc.mm
+++ clang/test/SemaObjCXX/parameterized_classes_arc.mm
@@ -13,7 +13,7 @@
 
 @interface PC1 : NSObject
 - (T) get;
-- (void) set: (T) v;
+- (void) set: (T) v; // expected-note 4{{passing argument to}}
 @end
 
 void test1a(PC1<__weak id> *obj) { // expected-error {{type argument '__weak id' cannot be qualified with '__weak'}}
@@ -34,17 +34,17 @@
 // Test that this doesn't completely kill downstream type-checking.
 void test1d(PC1<__weak Forward*> *obj) { // expected-error {{type argument 'Forward *__weak' cannot be qualified with '__weak'}}
   Forward2 *x = [obj get]; // expected-error {{cannot initialize}}
-  [obj set: x];
+  [obj set: x]; // expected-error {{cannot initialize a parameter of type 'Forward *' with an lvalue of type 'Forward2 *__strong'}}
 }
 
 void test1e(PC1<__strong Forward*> *obj) { // expected-error {{type argument 'Forward *__strong' cannot be qualified with '__strong'}}
   Forward2 *x = [obj get]; // expected-error {{cannot initialize}}
-  [obj set: x];
+  [obj set: x]; // expected-error {{cannot initialize a parameter of type 'Forward *'}}
 }
 
 void test1f(PC1 *obj) {
   Forward2 *x = [obj get]; // expected-error {{cannot initialize}}
-  [obj set: x];
+  [obj set: x]; // expected-error {{cannot initialize a parameter of type 'Forward *'}}
 }
 
 // Typedefs are fine, just silently ignore them.
@@ -57,7 +57,7 @@
 typedef __strong Forward *StrongForward;
 void test1h(PC1 *obj) {
   Forward2 *x = [obj get]; // expected-error {{cannot initialize}}
-  [obj set: x];
+  [obj set: x]; // expected-error {{cannot initialize a parameter of type 'Forward *'}}
 }
 
 // These aren't really ARC-specific, but they're the same basic idea.
Index: clang/test/SemaCXX/recovery-initializer.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/recovery-initializer.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -frecovery-ast -verify %s
+
+// NOTE: these tests can be merged to existing tests after -frecovery-ast is
+// turned on by default.
+void test1() {
+  struct Data {};
+  struct T {
+Data *begin();
+Data *end();
+  };
+  T *pt;
+  for (Data *p : T()) {} // expected-error {{no viable conversion from 'Data' to 'Data *'}}
+ // expected-note@-5 {{selected 'begin' function with iterator type}}
+}
+
+void test2() {
+  struct Bottom {
+constexpr Bottom() {}
+  };
+  struct Base : Bottom {
+constexpr Base(int a = 42, const char *b = "test") : a(a), b(b) {}
+int a;
+const char *b;
+  };
+  constexpr Base *nullB = 12; // expected-error {{cannot initialize a variable of type}}
+  // verify that the "static_assert expression is not an integral constant expr"
+  // diagnostic is suppressed.
+  static_assert((Bottom*)nullB == 0, "");
+}
Index: clang/test/SemaCXX/member-init.cpp
===
--- clang/test/SemaCXX/member-init.cpp
+++ clang/test/SemaCXX/member-init.cpp
@@ -64,7 +64,7 @@
   template
   struct X { 
 X() {
-  T* x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
+  T* x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} expected-warning {{unused variable}}
 }
   };
 
Index: clang/test/SemaCXX/for-range-dereference.cpp
===
--- clang/test/SemaCXX/for-range-dereference.cpp
+++ clang/test/SemaCXX/for-range-dereference.cpp
@@ -85,5 +85,4 @@
 
   for (Data *p : pt) { } // expected-error {{invalid range expression of type 'T *'; did you mean to dereference it with '*'?}}
   // expected-e

[PATCH] D78546: Enable bugprone-argument-comments check in llvm.

2020-04-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

LLVM code style encourages this [1], this check can detect the missing cases
and provide an automatic fixit.

[1] https://llvm.org/docs/CodingStandards.html#comment-formatting


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78546

Files:
  .clang-tidy


Index: .clang-tidy
===
--- .clang-tidy
+++ .clang-tidy
@@ -1,4 +1,4 @@
-Checks: 
'-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
+Checks: 
'-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming,bugprone-argument-comment'
 CheckOptions:
   - key: readability-identifier-naming.ClassCase
 value:   CamelCase
@@ -16,4 +16,11 @@
 value:   CamelCase
   - key: readability-identifier-naming.IgnoreMainLikeFunctions
 value:   1
-
+  - key: bugprone-argument-comment.CommentBoolLiterals
+value:   1
+  - key: bugprone-argument-comment.CommentIntegerLiterals
+value:   1
+  - key: bugprone-argument-comment.CommentFloatLiterals
+value:   1
+  - key: bugprone-argument-comment.CommentNullPtrs
+value:   1


Index: .clang-tidy
===
--- .clang-tidy
+++ .clang-tidy
@@ -1,4 +1,4 @@
-Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
+Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming,bugprone-argument-comment'
 CheckOptions:
   - key: readability-identifier-naming.ClassCase
 value:   CamelCase
@@ -16,4 +16,11 @@
 value:   CamelCase
   - key: readability-identifier-naming.IgnoreMainLikeFunctions
 value:   1
-
+  - key: bugprone-argument-comment.CommentBoolLiterals
+value:   1
+  - key: bugprone-argument-comment.CommentIntegerLiterals
+value:   1
+  - key: bugprone-argument-comment.CommentFloatLiterals
+value:   1
+  - key: bugprone-argument-comment.CommentNullPtrs
+value:   1
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76801: [AST] Print a> without extra spaces in C++11 or later.

2020-04-21 Thread Pavel Labath via Phabricator via cfe-commits
labath added a comment.

In D76801#1993337 , @dblaikie wrote:

> In D76801#1991904 , @labath wrote:
>
> > David's example does work with gdb without -Wl,--gdb-index (the member 
> > variable is shown), presumably due to the aforementioned fuzzy matching. 
> > However, it does not work if gdb-index is enabled,  nor with lldb (as lldb 
> > is always very index-oriented and assumes equality everywhere). That is 
> > definitely not ideal, though I'm not sure that means about this patch. This 
> > is definitely not the only difference in the formatting of DW_AT_names of 
> > templates. For example, `template operator<<(T, T)` will come 
> > out as `operator<< ` with gcc, but as `operator<<` with clang (with 
> > or without this patch).
> >  OTOH, differences in type names are more likely to cause problems than is 
> > the case for functions/operators.
>
>
> That is concerning. Any idea if that's only with lld's gdb-indexx 
> implementation, or also gold's?


I was using gold for my initial test. However, the same thing happens with lld 
too...

> This isn't the only naming divergence between GCC and Clang, though, so if 
> gdb-index doesn't support any divergence, that's a problem...

It becomes a gdb-index problem because with an index the debugger will do a 
(hashed?) string lookup and expect the string to be there. If the strings 
differ, the lookup won't find anything. In the no-index scenario, the debugger 
has to trawl the debug info itself, and so it has some opportunities to do 
fuzzy matching.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76801



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


[PATCH] D78511: [Driver][doc] Document option -mtune as a no-op. NFC.

2020-04-21 Thread Peter Smith via Phabricator via cfe-commits
psmith accepted this revision.
psmith added a comment.
This revision is now accepted and ready to land.

That wording looks good to me. I've accepted the change, but worth waiting a 
day or so to see if there are any objections or suggestions.


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

https://reviews.llvm.org/D78511



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


[clang-tools-extra] 6b3168f - [clangd] Fix windows buildbots for #import statements

2020-04-21 Thread Kadir Cetinkaya via cfe-commits

Author: Kadir Cetinkaya
Date: 2020-04-21T10:56:34+02:00
New Revision: 6b3168f8cdb46656330929877b0b4daab35d30de

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

LOG: [clangd] Fix windows buildbots for #import statements

Added: 


Modified: 
clang-tools-extra/clangd/unittests/HeadersTests.cpp
clang-tools-extra/clangd/unittests/PreambleTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/HeadersTests.cpp 
b/clang-tools-extra/clangd/unittests/HeadersTests.cpp
index cb760a3d6c35..7f87573d9a11 100644
--- a/clang-tools-extra/clangd/unittests/HeadersTests.cpp
+++ b/clang-tools-extra/clangd/unittests/HeadersTests.cpp
@@ -210,6 +210,8 @@ TEST_F(HeadersTest, IncludeDirective) {
 #include_next "foo.h"
 )cpp";
 
+  // ms-compatibility changes meaning of #import, make sure it is turned off.
+  CDB.ExtraClangFlags.push_back("-fno-ms-compatibility");
   EXPECT_THAT(collectIncludes().MainFileIncludes,
   UnorderedElementsAre(Directive(tok::pp_include),
Directive(tok::pp_import),

diff  --git a/clang-tools-extra/clangd/unittests/PreambleTests.cpp 
b/clang-tools-extra/clangd/unittests/PreambleTests.cpp
index 2815ca0a46f1..6382285b63fc 100644
--- a/clang-tools-extra/clangd/unittests/PreambleTests.cpp
+++ b/clang-tools-extra/clangd/unittests/PreambleTests.cpp
@@ -61,6 +61,8 @@ TEST(PreamblePatchTest, IncludeParsing) {
 ^#include )cpp",
   };
 
+  // ms-compatibility changes meaning of #import, make sure it is turned off.
+  CDB.ExtraClangFlags.push_back("-fno-ms-compatibility");
   const auto FileName = testPath("foo.cc");
   for (const auto Case : Cases) {
 Annotations Test(Case);
@@ -96,6 +98,8 @@ TEST(PreamblePatchTest, ContainsNewIncludes) {
   MockFSProvider FS;
   MockCompilationDatabase CDB;
   IgnoreDiagnostics Diags;
+  // ms-compatibility changes meaning of #import, make sure it is turned off.
+  CDB.ExtraClangFlags.push_back("-fno-ms-compatibility");
 
   const auto FileName = testPath("foo.cc");
   ParseInputs PI;



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


[clang] 89d9912 - [AST] dont invaliate VarDecl when the initializer contains errors.

2020-04-21 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2020-04-21T10:53:35+02:00
New Revision: 89d9912cbf45068770ac8c1e2ef97b74c3b662ab

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

LOG: [AST] dont invaliate VarDecl when the initializer contains errors.

Summary:
This patch contains 2 separate changes:
1) the initializer of a variable should play no part in decl "invalid" bit;
2) preserve the invalid initializer via recovery exprs;

With 1), we will regress the diagnostics (one big regression is that we loose
the "selected 'begin' function with iterator type" diagnostic in for-range stmt;
but with 2) together, we don't have regressions (the new diagnostics seems to be
improved).

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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

Added: 
clang/test/SemaCXX/recovery-initializer.cpp

Modified: 
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaStmt.cpp
clang/test/AST/ast-dump-invalid-initialized.cpp
clang/test/AST/ast-dump-recovery.cpp
clang/test/CXX/special/class.copy/p11.0x.move.cpp
clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
clang/test/OpenMP/task_messages.cpp
clang/test/SemaCXX/block-call.cpp
clang/test/SemaCXX/constant-expression-cxx11.cpp
clang/test/SemaCXX/cxx11-crashes.cpp
clang/test/SemaCXX/cxx2a-explicit-bool.cpp
clang/test/SemaCXX/for-range-dereference.cpp
clang/test/SemaCXX/member-init.cpp
clang/test/SemaObjCXX/parameterized_classes_arc.mm

Removed: 




diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 6241162fd992..c90c840a5e24 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -11996,7 +11996,12 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr 
*Init, bool DirectInit) {
/*TreatUnavailableAsInvalid=*/false);
 ExprResult Result = InitSeq.Perform(*this, Entity, Kind, Args, &DclT);
 if (Result.isInvalid()) {
-  VDecl->setInvalidDecl();
+  // If the provied initializer fails to initialize the var decl,
+  // we attach a recovery expr for better recovery.
+  auto RecoveryExpr =
+  CreateRecoveryExpr(Init->getBeginLoc(), Init->getEndLoc(), Args);
+  if (RecoveryExpr.get())
+VDecl->setInit(RecoveryExpr.get());
   return;
 }
 

diff  --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 21cca3d04325..291f7641c910 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -2669,7 +2669,8 @@ StmtResult Sema::BuildCXXForRangeStmt(SourceLocation 
ForLoc,
 // trying to determine whether this would be a valid range.
 if (!LoopVar->isInvalidDecl() && Kind != BFRK_Check) {
   AddInitializerToDecl(LoopVar, DerefExpr.get(), /*DirectInit=*/false);
-  if (LoopVar->isInvalidDecl())
+  if (LoopVar->isInvalidDecl() ||
+  (LoopVar->getInit() && LoopVar->getInit()->containsErrors()))
 NoteForRangeBeginEndFunction(*this, BeginExpr.get(), BEF_begin);
 }
   }

diff  --git a/clang/test/AST/ast-dump-invalid-initialized.cpp 
b/clang/test/AST/ast-dump-invalid-initialized.cpp
index 800a79cc831b..1b3c8581a94f 100644
--- a/clang/test/AST/ast-dump-invalid-initialized.cpp
+++ b/clang/test/AST/ast-dump-invalid-initialized.cpp
@@ -4,6 +4,8 @@ struct A { A(int, int) {} };
 class ForwardDecl;
 
 void test() {
+  // Verify the valid-bit of the VarDecl.
+
   // CHECK: `-VarDecl {{.*}} a1 'A'
   A a1;
   // CHECK: `-VarDecl {{.*}} a2 'const A'
@@ -16,4 +18,10 @@ void test() {
   const A& b1;
   // CHECK: `-VarDecl {{.*}} invalid b2 'ForwardDecl'
   ForwardDecl b2;
+  // CHECK: `-VarDecl {{.*}} invalid b3 'auto'
+  auto b3 = garbage();
+  // CHECK: `-VarDecl {{.*}} invalid b4 'auto'
+  auto b4 = A(1);
+  // CHECK: `-VarDecl {{.*}} invalid b5 'auto'
+  auto b5 = A{1};
 }
\ No newline at end of file

diff  --git a/clang/test/AST/ast-dump-recovery.cpp 
b/clang/test/AST/ast-dump-recovery.cpp
index 248470a5093c..86511181f0a6 100644
--- a/clang/test/AST/ast-dump-recovery.cpp
+++ b/clang/test/AST/ast-dump-recovery.cpp
@@ -103,3 +103,56 @@ void test(int x) {
 // CHECK-NEXT:| `-RecoveryExpr {{.*}} contains-errors
 // CHECK-NEXT:|   `-UnresolvedLookupExpr {{.*}} 'invalid'
 struct alignas(invalid()) Aligned {};
+
+void InvalidInitalizer(int x) {
+  struct Bar { Bar(); };
+  // CHECK: `-VarDecl {{.*}} a1 'Bar'
+  // CHECK-NEXT: `-RecoveryExpr {{.*}} contains-errors
+  // CHECK-NEXT:  `-IntegerLiteral {{.*}} 'int' 1
+  Bar a1(1);
+  // CHECK: `-VarDecl {{.*}} a2 'Bar'
+  // CHECK-NEXT: `-RecoveryExpr {{.*}} contains-errors
+  // CHECK-NEXT:  `-DeclRefExpr {{.*}} 'x'
+  Bar a2(x);
+  // CHECK: `-VarDecl {{.*}} a3 'Bar'
+  // CHECK-NEXT: `-RecoveryExpr {{.*}} contains-

  1   2   >