[PATCH] D105092: [RISCV] (1/2) Add the tail policy argument to builtins/intrinsics.

2021-09-23 Thread Zakk Chen via Phabricator via cfe-commits
khchen added inline comments.



Comment at: llvm/include/llvm/IR/IntrinsicsRISCV.td:162
   // For unit stride load with mask
   // Input: (maskedoff, pointer, mask, vl)
   class RISCVUSLoadMask

maybe we could have another NFC patch to update those `argument info` comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105092

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


[PATCH] D72566: [clang-tidy] Clang tidy is now alias aware

2021-09-23 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment.

Fully agree. Such an opt-in feature shouldn't break things. I'd be happy to 
implement it if people think it's a good idea! Would need some hand-holding 
though, never touched the LLVM codebase before :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72566

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


[PATCH] D69764: [clang-format] Add Left/Right Const fixer capability

2021-09-23 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay updated this revision to Diff 374455.
MyDeveloperDay marked 3 inline comments as done.
MyDeveloperDay added a comment.

Fix clang-format and clang-tidy issues


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

https://reviews.llvm.org/D69764

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/ReleaseNotes.rst
  clang/docs/tools/dump_format_style.py
  clang/include/clang/Format/Format.h
  clang/lib/Format/CMakeLists.txt
  clang/lib/Format/Format.cpp
  clang/lib/Format/QualifierAlignmentFixer.cpp
  clang/lib/Format/QualifierAlignmentFixer.h
  clang/tools/clang-format/ClangFormat.cpp
  clang/unittests/Format/CMakeLists.txt
  clang/unittests/Format/FormatTest.cpp
  clang/unittests/Format/QualifierFixerTest.cpp

Index: clang/unittests/Format/QualifierFixerTest.cpp
===
--- /dev/null
+++ clang/unittests/Format/QualifierFixerTest.cpp
@@ -0,0 +1,810 @@
+//===- unittest/Format/QualifierFixerTest.cpp - Formatting unit tests -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "clang/Format/Format.h"
+
+#include "FormatTestUtils.h"
+#include "TestLexer.h"
+#include "gtest/gtest.h"
+
+#include "../../lib/Format/QualifierAlignmentFixer.h"
+
+#define DEBUG_TYPE "format-qualifier-fixer-test"
+
+using testing::ScopedTrace;
+
+namespace clang {
+namespace format {
+namespace {
+
+#define CHECK_PARSE(TEXT, FIELD, VALUE)\
+  EXPECT_NE(VALUE, Style.FIELD) << "Initial value already the same!";  \
+  EXPECT_EQ(0, parseConfiguration(TEXT, &Style).value());  \
+  EXPECT_EQ(VALUE, Style.FIELD) << "Unexpected value after parsing!"
+
+#define FAIL_PARSE(TEXT, FIELD, VALUE) \
+  EXPECT_NE(0, parseConfiguration(TEXT, &Style).value());  \
+  EXPECT_EQ(VALUE, Style.FIELD) << "Unexpected value after parsing!"
+
+class QualifierFixerTest : public ::testing::Test {
+protected:
+  enum StatusCheck { SC_ExpectComplete, SC_ExpectIncomplete, SC_DoNotCheck };
+
+  TokenList annotate(llvm::StringRef Code,
+ const FormatStyle &Style = getLLVMStyle()) {
+return TestLexer(Allocator, Buffers, Style).annotate(Code);
+  }
+  llvm::SpecificBumpPtrAllocator Allocator;
+  std::vector> Buffers;
+
+  std::string format(llvm::StringRef Code,
+ const FormatStyle &Style = getLLVMStyle(),
+ StatusCheck CheckComplete = SC_ExpectComplete) {
+LLVM_DEBUG(llvm::errs() << "---\n");
+LLVM_DEBUG(llvm::errs() << Code << "\n\n");
+std::vector Ranges(1, tooling::Range(0, Code.size()));
+FormattingAttemptStatus Status;
+tooling::Replacements Replaces =
+reformat(Style, Code, Ranges, "", &Status);
+if (CheckComplete != SC_DoNotCheck) {
+  bool ExpectedCompleteFormat = CheckComplete == SC_ExpectComplete;
+  EXPECT_EQ(ExpectedCompleteFormat, Status.FormatComplete)
+  << Code << "\n\n";
+}
+ReplacementCount = Replaces.size();
+auto Result = applyAllReplacements(Code, Replaces);
+EXPECT_TRUE(static_cast(Result));
+LLVM_DEBUG(llvm::errs() << "\n" << *Result << "\n\n");
+return *Result;
+  }
+
+  FormatStyle getStyleWithColumns(FormatStyle Style, unsigned ColumnLimit) {
+Style.ColumnLimit = ColumnLimit;
+return Style;
+  }
+
+  FormatStyle getLLVMStyleWithColumns(unsigned ColumnLimit) {
+return getStyleWithColumns(getLLVMStyle(), ColumnLimit);
+  }
+
+  void _verifyFormat(const char *File, int Line, llvm::StringRef Expected,
+ llvm::StringRef Code,
+ const FormatStyle &Style = getLLVMStyle()) {
+ScopedTrace t(File, Line, ::testing::Message() << Code.str());
+EXPECT_EQ(Expected.str(), format(Expected, Style))
+<< "Expected code is not stable";
+EXPECT_EQ(Expected.str(), format(Code, Style));
+if (Style.Language == FormatStyle::LK_Cpp) {
+  // Objective-C++ is a superset of C++, so everything checked for C++
+  // needs to be checked for Objective-C++ as well.
+  FormatStyle ObjCStyle = Style;
+  ObjCStyle.Language = FormatStyle::LK_ObjC;
+  EXPECT_EQ(Expected.str(), format(test::messUp(Code), ObjCStyle));
+}
+  }
+
+  void _verifyFormat(const char *File, int Line, llvm::StringRef Code,
+ const FormatStyle &Style = getLLVMStyle()) {
+_verifyFormat(File, Line, Code, test::messUp(Code), Style);
+  }
+
+  void _verifyIncompleteFormat(const char *File, int Line, llvm::StringRef Code,
+   const FormatStyle &Style = getLLVMStyle()) {
+ScopedTrace t(File, Line, ::testing::Message() << Code.str());
+EXPECT_EQ(C

[clang] 352a2e6 - [clang][tooling] NFC: Refactor command-line diagnostic tests

2021-09-23 Thread Jan Svoboda via cfe-commits

Author: Jan Svoboda
Date: 2021-09-23T09:08:53+02:00
New Revision: 352a2e67162541efe79a1e144b40a054751e7d5c

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

LOG: [clang][tooling] NFC: Refactor command-line diagnostic tests

This patch uses a different command-line arguments to test 
`clang::tooling::ToolInvocation` that are not specific to Darwin.

Reviewed By: dexonsmith

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

Added: 


Modified: 
clang/unittests/Tooling/ToolingTest.cpp

Removed: 




diff  --git a/clang/unittests/Tooling/ToolingTest.cpp 
b/clang/unittests/Tooling/ToolingTest.cpp
index d5aa8b763669a..40a0fad9a23a1 100644
--- a/clang/unittests/Tooling/ToolingTest.cpp
+++ b/clang/unittests/Tooling/ToolingTest.cpp
@@ -15,6 +15,7 @@
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Frontend/FrontendActions.h"
+#include "clang/Frontend/TextDiagnosticBuffer.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "clang/Tooling/Tooling.h"
@@ -224,16 +225,6 @@ TEST(ToolInvocation, TestVirtualModulesCompilation) {
   EXPECT_TRUE(Invocation.run());
 }
 
-struct ErrorCountingDiagnosticConsumer : public DiagnosticConsumer {
-  ErrorCountingDiagnosticConsumer() : NumErrorsSeen(0) {}
-  void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
-const Diagnostic &Info) override {
-if (DiagLevel == DiagnosticsEngine::Level::Error)
-  ++NumErrorsSeen;
-  }
-  unsigned NumErrorsSeen;
-};
-
 TEST(ToolInvocation, DiagnosticsEngineProperlyInitializedForCC1Construction) {
   llvm::IntrusiveRefCntPtr OverlayFileSystem(
   new llvm::vfs::OverlayFileSystem(llvm::vfs::getRealFileSystem()));
@@ -245,24 +236,22 @@ TEST(ToolInvocation, 
DiagnosticsEngineProperlyInitializedForCC1Construction) {
 
   std::vector Args;
   Args.push_back("tool-executable");
-  Args.push_back("-target");
-  // Invalid argument that by default results in an error diagnostic:
-  Args.push_back("i386-apple-ios14.0-simulator");
-  // Argument that downgrades the error into a warning:
-  Args.push_back("-Wno-error=invalid-ios-deployment-target");
-  Args.push_back("-fsyntax-only");
+  // Unknown warning option will result in a warning.
+  Args.push_back("-fexpensive-optimizations");
+  // Argument that will suppress the warning above.
+  Args.push_back("-Wno-ignored-optimization-argument");
+  Args.push_back("-E");
   Args.push_back("test.cpp");
 
   clang::tooling::ToolInvocation Invocation(
   Args, std::make_unique(), Files.get());
-  InMemoryFileSystem->addFile(
-  "test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int a() {}\n"));
-  ErrorCountingDiagnosticConsumer Consumer;
+  InMemoryFileSystem->addFile("test.cpp", 0,
+  llvm::MemoryBuffer::getMemBuffer(""));
+  TextDiagnosticBuffer Consumer;
   Invocation.setDiagnosticConsumer(&Consumer);
   EXPECT_TRUE(Invocation.run());
-  // Check that `-Wno-error=invalid-ios-deployment-target` downgraded the error
-  // into a warning.
-  EXPECT_EQ(Consumer.NumErrorsSeen, 0u);
+  // Check that the warning was ignored due to the '-Wno-xxx' argument.
+  EXPECT_EQ(std::distance(Consumer.warn_begin(), Consumer.warn_end()), 0u);
 }
 
 TEST(ToolInvocation, CustomDiagnosticOptionsOverwriteParsedOnes) {
@@ -276,28 +265,28 @@ TEST(ToolInvocation, 
CustomDiagnosticOptionsOverwriteParsedOnes) {
 
   std::vector Args;
   Args.push_back("tool-executable");
-  Args.push_back("-target");
-  // Invalid argument that by default results in an error diagnostic:
-  Args.push_back("i386-apple-ios14.0-simulator");
-  // Argument that downgrades the error into a warning:
-  Args.push_back("-Wno-error=invalid-ios-deployment-target");
-  Args.push_back("-fsyntax-only");
+  // Unknown warning option will result in a warning.
+  Args.push_back("-fexpensive-optimizations");
+  // Argument that will suppress the warning above.
+  Args.push_back("-Wno-ignored-optimization-argument");
+  Args.push_back("-E");
   Args.push_back("test.cpp");
 
   clang::tooling::ToolInvocation Invocation(
   Args, std::make_unique(), Files.get());
-  InMemoryFileSystem->addFile(
-  "test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int a() {}\n"));
-  ErrorCountingDiagnosticConsumer Consumer;
+  InMemoryFileSystem->addFile("test.cpp", 0,
+  llvm::MemoryBuffer::getMemBuffer(""));
+  TextDiagnosticBuffer Consumer;
   Invocation.setDiagnosticConsumer(&Consumer);
 
+  // Inject custom `DiagnosticOptions` for command-line parsing.
   auto DiagOpts = llvm::makeIntrusiveRefCnt();
   Invocation.setDiagnosticOptions(&*DiagOpts);
 
   EXPECT_TRUE(Invocation.run());
-  // Check that `-Wno-error=invalid-ios-deployment-ta

[PATCH] D110160: [clang][tooling] NFC: Refactor command-line diagnostic tests

2021-09-23 Thread Jan Svoboda via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG352a2e671625: [clang][tooling] NFC: Refactor command-line 
diagnostic tests (authored by jansvoboda11).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110160

Files:
  clang/unittests/Tooling/ToolingTest.cpp

Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -15,6 +15,7 @@
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendAction.h"
 #include "clang/Frontend/FrontendActions.h"
+#include "clang/Frontend/TextDiagnosticBuffer.h"
 #include "clang/Tooling/ArgumentsAdjusters.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "clang/Tooling/Tooling.h"
@@ -224,16 +225,6 @@
   EXPECT_TRUE(Invocation.run());
 }
 
-struct ErrorCountingDiagnosticConsumer : public DiagnosticConsumer {
-  ErrorCountingDiagnosticConsumer() : NumErrorsSeen(0) {}
-  void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
-const Diagnostic &Info) override {
-if (DiagLevel == DiagnosticsEngine::Level::Error)
-  ++NumErrorsSeen;
-  }
-  unsigned NumErrorsSeen;
-};
-
 TEST(ToolInvocation, DiagnosticsEngineProperlyInitializedForCC1Construction) {
   llvm::IntrusiveRefCntPtr OverlayFileSystem(
   new llvm::vfs::OverlayFileSystem(llvm::vfs::getRealFileSystem()));
@@ -245,24 +236,22 @@
 
   std::vector Args;
   Args.push_back("tool-executable");
-  Args.push_back("-target");
-  // Invalid argument that by default results in an error diagnostic:
-  Args.push_back("i386-apple-ios14.0-simulator");
-  // Argument that downgrades the error into a warning:
-  Args.push_back("-Wno-error=invalid-ios-deployment-target");
-  Args.push_back("-fsyntax-only");
+  // Unknown warning option will result in a warning.
+  Args.push_back("-fexpensive-optimizations");
+  // Argument that will suppress the warning above.
+  Args.push_back("-Wno-ignored-optimization-argument");
+  Args.push_back("-E");
   Args.push_back("test.cpp");
 
   clang::tooling::ToolInvocation Invocation(
   Args, std::make_unique(), Files.get());
-  InMemoryFileSystem->addFile(
-  "test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int a() {}\n"));
-  ErrorCountingDiagnosticConsumer Consumer;
+  InMemoryFileSystem->addFile("test.cpp", 0,
+  llvm::MemoryBuffer::getMemBuffer(""));
+  TextDiagnosticBuffer Consumer;
   Invocation.setDiagnosticConsumer(&Consumer);
   EXPECT_TRUE(Invocation.run());
-  // Check that `-Wno-error=invalid-ios-deployment-target` downgraded the error
-  // into a warning.
-  EXPECT_EQ(Consumer.NumErrorsSeen, 0u);
+  // Check that the warning was ignored due to the '-Wno-xxx' argument.
+  EXPECT_EQ(std::distance(Consumer.warn_begin(), Consumer.warn_end()), 0u);
 }
 
 TEST(ToolInvocation, CustomDiagnosticOptionsOverwriteParsedOnes) {
@@ -276,28 +265,28 @@
 
   std::vector Args;
   Args.push_back("tool-executable");
-  Args.push_back("-target");
-  // Invalid argument that by default results in an error diagnostic:
-  Args.push_back("i386-apple-ios14.0-simulator");
-  // Argument that downgrades the error into a warning:
-  Args.push_back("-Wno-error=invalid-ios-deployment-target");
-  Args.push_back("-fsyntax-only");
+  // Unknown warning option will result in a warning.
+  Args.push_back("-fexpensive-optimizations");
+  // Argument that will suppress the warning above.
+  Args.push_back("-Wno-ignored-optimization-argument");
+  Args.push_back("-E");
   Args.push_back("test.cpp");
 
   clang::tooling::ToolInvocation Invocation(
   Args, std::make_unique(), Files.get());
-  InMemoryFileSystem->addFile(
-  "test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int a() {}\n"));
-  ErrorCountingDiagnosticConsumer Consumer;
+  InMemoryFileSystem->addFile("test.cpp", 0,
+  llvm::MemoryBuffer::getMemBuffer(""));
+  TextDiagnosticBuffer Consumer;
   Invocation.setDiagnosticConsumer(&Consumer);
 
+  // Inject custom `DiagnosticOptions` for command-line parsing.
   auto DiagOpts = llvm::makeIntrusiveRefCnt();
   Invocation.setDiagnosticOptions(&*DiagOpts);
 
   EXPECT_TRUE(Invocation.run());
-  // Check that `-Wno-error=invalid-ios-deployment-target` didn't downgrade the
-  // error into a warning due to being overwritten by custom diagnostic options.
-  EXPECT_EQ(Consumer.NumErrorsSeen, 1u);
+  // Check that the warning was issued during command-line parsing due to the
+  // custom `DiagnosticOptions` without '-Wno-xxx'.
+  EXPECT_EQ(std::distance(Consumer.warn_begin(), Consumer.warn_end()), 1u);
 }
 
 struct DiagnosticConsumerExpectingSourceManager : public DiagnosticConsumer {
___
cfe-commits mailing list
cfe-commits

[PATCH] D69764: [clang-format] Add Left/Right Const fixer capability

2021-09-23 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/lib/Format/QualifierAlignmentFixer.cpp:449
+return false;
+  if (Tok->is(TT_TypenameMacro))
+return false;

HazardyKnusperkeks wrote:
> I think this is still right, because it is a type (according to the 
> configuration).
yeah, let's do this a different way after we have landed this, I was thinking 
about having a list of "Types" that users could specify that would help us 
classify tok::identifiers a little better (could help with some of the casting 
issues we've seen before)

I notice in projects like Linux they make heavy use of these ForeachMacros and 
StatementMacros, I don't want to steal another list I'd rather we had one that 
was very specific to types, I think this could help


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

https://reviews.llvm.org/D69764

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


[PATCH] D110130: [clangd] Ensure lambda init-capture gets semantic token

2021-09-23 Thread Nathan Ridge via Phabricator via cfe-commits
nridge updated this revision to Diff 374461.
nridge marked 3 inline comments as done.
nridge added a comment.

address review comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110130

Files:
  clang-tools-extra/clangd/SemanticHighlighting.cpp
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp


Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -729,6 +729,14 @@
   }
 };
   )cpp",
+  // init-captures
+  R"cpp(
+void $Function_decl[[foo]]() {
+  int $LocalVariable_decl[[a]], $LocalVariable_decl[[b]];
+  [ $LocalVariable_decl[[c]] = $LocalVariable[[a]],
+$LocalVariable_decl[[d]]($LocalVariable[[b]]) ]() {}();
+}
+  )cpp",
   };
   for (const auto &TestCase : TestCases)
 // Mask off scope modifiers to keep the tests manageable.
@@ -797,7 +805,7 @@
   )cpp",
   R"cpp(
 // Lambdas are considered functions, not classes.
-auto $Variable_fileScope[[x]] = [m(42)] { // FIXME: annotate capture
+auto $Variable_fileScope[[x]] = 
[$LocalVariable_functionScope[[m]](42)] {
   return $LocalVariable_functionScope[[m]];
 };
   )cpp",
Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -512,16 +512,24 @@
 auto *AT = D->getType()->getContainedAutoType();
 if (!AT)
   return true;
-if (auto K = kindForType(AT->getDeducedType().getTypePtrOrNull(),
- H.getResolver())) {
-  auto &Tok = H.addToken(D->getTypeSpecStartLoc(), *K)
-  .addModifier(HighlightingModifier::Deduced);
-  const Type *Deduced = AT->getDeducedType().getTypePtrOrNull();
-  if (auto Mod = scopeModifier(Deduced))
-Tok.addModifier(*Mod);
-  if (isDefaultLibrary(Deduced))
-Tok.addModifier(HighlightingModifier::DefaultLibrary);
-}
+auto K =
+kindForType(AT->getDeducedType().getTypePtrOrNull(), H.getResolver());
+if (!K)
+  return true;
+SourceLocation StartLoc = D->getTypeSpecStartLoc();
+// The AutoType may not have a corresponding token, e.g. in the case of
+// init-captures. In this case, StartLoc overlaps with the location
+// of the decl itself, and producing a token for the type here would result
+// in both it and the token for the decl being dropped due to conflict.
+if (StartLoc == D->getLocation())
+  return true;
+auto &Tok =
+H.addToken(StartLoc, *K).addModifier(HighlightingModifier::Deduced);
+const Type *Deduced = AT->getDeducedType().getTypePtrOrNull();
+if (auto Mod = scopeModifier(Deduced))
+  Tok.addModifier(*Mod);
+if (isDefaultLibrary(Deduced))
+  Tok.addModifier(HighlightingModifier::DefaultLibrary);
 return true;
   }
 


Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -729,6 +729,14 @@
   }
 };
   )cpp",
+  // init-captures
+  R"cpp(
+void $Function_decl[[foo]]() {
+  int $LocalVariable_decl[[a]], $LocalVariable_decl[[b]];
+  [ $LocalVariable_decl[[c]] = $LocalVariable[[a]],
+$LocalVariable_decl[[d]]($LocalVariable[[b]]) ]() {}();
+}
+  )cpp",
   };
   for (const auto &TestCase : TestCases)
 // Mask off scope modifiers to keep the tests manageable.
@@ -797,7 +805,7 @@
   )cpp",
   R"cpp(
 // Lambdas are considered functions, not classes.
-auto $Variable_fileScope[[x]] = [m(42)] { // FIXME: annotate capture
+auto $Variable_fileScope[[x]] = [$LocalVariable_functionScope[[m]](42)] {
   return $LocalVariable_functionScope[[m]];
 };
   )cpp",
Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -512,16 +512,24 @@
 auto *AT = D->getType()->getContainedAutoType();
 if (!AT)
   return true;
-if (auto K = kindForType(AT->getDeducedType().getTypePtrOrNull(),
- H.getResolver())) {
-  auto &Tok = H.addToken(D->getTypeSpecStartLoc(), *K)
-  .addModifier(HighlightingModifier::Deduced);
-  const Type *Deduced = AT->getDeducedType

[clang-tools-extra] 4223195 - [clangd] Ensure lambda init-capture gets semantic token

2021-09-23 Thread Nathan Ridge via cfe-commits

Author: Nathan Ridge
Date: 2021-09-23T03:52:57-04:00
New Revision: 4223195de3eaaa9c221d1f178899f221be6264c5

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

LOG: [clangd] Ensure lambda init-capture gets semantic token

Prior to this patch, CollectExtraHighlightings would incorrectly produce
a token for the init-capture's type which overlapped the name and
resulted in both being dropped.

Fixes https://github.com/clangd/clangd/issues/868

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

Added: 


Modified: 
clang-tools-extra/clangd/SemanticHighlighting.cpp
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp 
b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index d55bd9e459d53..76e810f5a3b83 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -601,16 +601,24 @@ class CollectExtraHighlightings
 auto *AT = D->getType()->getContainedAutoType();
 if (!AT)
   return true;
-if (auto K = kindForType(AT->getDeducedType().getTypePtrOrNull(),
- H.getResolver())) {
-  auto &Tok = H.addToken(D->getTypeSpecStartLoc(), *K)
-  .addModifier(HighlightingModifier::Deduced);
-  const Type *Deduced = AT->getDeducedType().getTypePtrOrNull();
-  if (auto Mod = scopeModifier(Deduced))
-Tok.addModifier(*Mod);
-  if (isDefaultLibrary(Deduced))
-Tok.addModifier(HighlightingModifier::DefaultLibrary);
-}
+auto K =
+kindForType(AT->getDeducedType().getTypePtrOrNull(), H.getResolver());
+if (!K)
+  return true;
+SourceLocation StartLoc = D->getTypeSpecStartLoc();
+// The AutoType may not have a corresponding token, e.g. in the case of
+// init-captures. In this case, StartLoc overlaps with the location
+// of the decl itself, and producing a token for the type here would result
+// in both it and the token for the decl being dropped due to conflict.
+if (StartLoc == D->getLocation())
+  return true;
+auto &Tok =
+H.addToken(StartLoc, *K).addModifier(HighlightingModifier::Deduced);
+const Type *Deduced = AT->getDeducedType().getTypePtrOrNull();
+if (auto Mod = scopeModifier(Deduced))
+  Tok.addModifier(*Mod);
+if (isDefaultLibrary(Deduced))
+  Tok.addModifier(HighlightingModifier::DefaultLibrary);
 return true;
   }
 

diff  --git a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp 
b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
index 1a9220e911e32..4653490f5b036 100644
--- a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -772,6 +772,14 @@ sizeof...($TemplateParameter[[Elements]]);
   $Function[[foo]]($Parameter[[x]]); 
 }
   )cpp",
+  // init-captures
+  R"cpp(
+void $Function_decl[[foo]]() {
+  int $LocalVariable_decl[[a]], $LocalVariable_decl[[b]];
+  [ $LocalVariable_decl[[c]] = $LocalVariable[[a]],
+$LocalVariable_decl[[d]]($LocalVariable[[b]]) ]() {}();
+}
+  )cpp",
   };
   for (const auto &TestCase : TestCases)
 // Mask off scope modifiers to keep the tests manageable.
@@ -840,7 +848,7 @@ TEST(SemanticHighlighting, ScopeModifiers) {
   )cpp",
   R"cpp(
 // Lambdas are considered functions, not classes.
-auto $Variable_fileScope[[x]] = [m(42)] { // FIXME: annotate capture
+auto $Variable_fileScope[[x]] = 
[$LocalVariable_functionScope[[m]](42)] {
   return $LocalVariable_functionScope[[m]];
 };
   )cpp",



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


[PATCH] D110130: [clangd] Ensure lambda init-capture gets semantic token

2021-09-23 Thread Nathan Ridge via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4223195de3ea: [clangd] Ensure lambda init-capture gets 
semantic token (authored by nridge).

Changed prior to commit:
  https://reviews.llvm.org/D110130?vs=374461&id=374463#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110130

Files:
  clang-tools-extra/clangd/SemanticHighlighting.cpp
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp


Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -772,6 +772,14 @@
   $Function[[foo]]($Parameter[[x]]); 
 }
   )cpp",
+  // init-captures
+  R"cpp(
+void $Function_decl[[foo]]() {
+  int $LocalVariable_decl[[a]], $LocalVariable_decl[[b]];
+  [ $LocalVariable_decl[[c]] = $LocalVariable[[a]],
+$LocalVariable_decl[[d]]($LocalVariable[[b]]) ]() {}();
+}
+  )cpp",
   };
   for (const auto &TestCase : TestCases)
 // Mask off scope modifiers to keep the tests manageable.
@@ -840,7 +848,7 @@
   )cpp",
   R"cpp(
 // Lambdas are considered functions, not classes.
-auto $Variable_fileScope[[x]] = [m(42)] { // FIXME: annotate capture
+auto $Variable_fileScope[[x]] = 
[$LocalVariable_functionScope[[m]](42)] {
   return $LocalVariable_functionScope[[m]];
 };
   )cpp",
Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -601,16 +601,24 @@
 auto *AT = D->getType()->getContainedAutoType();
 if (!AT)
   return true;
-if (auto K = kindForType(AT->getDeducedType().getTypePtrOrNull(),
- H.getResolver())) {
-  auto &Tok = H.addToken(D->getTypeSpecStartLoc(), *K)
-  .addModifier(HighlightingModifier::Deduced);
-  const Type *Deduced = AT->getDeducedType().getTypePtrOrNull();
-  if (auto Mod = scopeModifier(Deduced))
-Tok.addModifier(*Mod);
-  if (isDefaultLibrary(Deduced))
-Tok.addModifier(HighlightingModifier::DefaultLibrary);
-}
+auto K =
+kindForType(AT->getDeducedType().getTypePtrOrNull(), H.getResolver());
+if (!K)
+  return true;
+SourceLocation StartLoc = D->getTypeSpecStartLoc();
+// The AutoType may not have a corresponding token, e.g. in the case of
+// init-captures. In this case, StartLoc overlaps with the location
+// of the decl itself, and producing a token for the type here would result
+// in both it and the token for the decl being dropped due to conflict.
+if (StartLoc == D->getLocation())
+  return true;
+auto &Tok =
+H.addToken(StartLoc, *K).addModifier(HighlightingModifier::Deduced);
+const Type *Deduced = AT->getDeducedType().getTypePtrOrNull();
+if (auto Mod = scopeModifier(Deduced))
+  Tok.addModifier(*Mod);
+if (isDefaultLibrary(Deduced))
+  Tok.addModifier(HighlightingModifier::DefaultLibrary);
 return true;
   }
 


Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -772,6 +772,14 @@
   $Function[[foo]]($Parameter[[x]]); 
 }
   )cpp",
+  // init-captures
+  R"cpp(
+void $Function_decl[[foo]]() {
+  int $LocalVariable_decl[[a]], $LocalVariable_decl[[b]];
+  [ $LocalVariable_decl[[c]] = $LocalVariable[[a]],
+$LocalVariable_decl[[d]]($LocalVariable[[b]]) ]() {}();
+}
+  )cpp",
   };
   for (const auto &TestCase : TestCases)
 // Mask off scope modifiers to keep the tests manageable.
@@ -840,7 +848,7 @@
   )cpp",
   R"cpp(
 // Lambdas are considered functions, not classes.
-auto $Variable_fileScope[[x]] = [m(42)] { // FIXME: annotate capture
+auto $Variable_fileScope[[x]] = [$LocalVariable_functionScope[[m]](42)] {
   return $LocalVariable_functionScope[[m]];
 };
   )cpp",
Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -601,16 +601,24 @@
 auto *AT = D->getType()->getContainedAutoType();
 if (!AT)
   return true;
-if (auto K = kindForType(AT->getDe

[PATCH] D109625: [compiler-rt] Ensure required deps for tests targets are actually built

2021-09-23 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: compiler-rt/test/CMakeLists.txt:48
+  if (NOT TARGET ${dep})
+llvm_ExternalProject_BuildCmd(build_${dep} ${dep} ${BINARY_DIR})
+add_custom_target(${dep}

leonardchan wrote:
> leonardchan wrote:
> > phosek wrote:
> > > This is going to run Ninja in the LLVM build once for each dependency 
> > > listed above, correct? That seems quite expensive.
> > > 
> > > We already pass most of these to the child build via corresponding CMake 
> > > variables, see 
> > > https://github.com/llvm/llvm-project/blob/ed921282e551f2252ccfcbddd7a85ad8a006ed3f/llvm/cmake/modules/LLVMExternalProjectUtils.cmake#L160
> > > 
> > > For example, if just need some readelf implementation and not necessarily 
> > > llvm-readelf, it may be better to use the value of `CMAKE_READELF` and 
> > > propagate that down to tests through substitution (that is wherever the 
> > > tests invoke `llvm-readelf`, we would replace it with `%readelf`).
> > > 
> > > We're still going to need this logic for tools where there's no 
> > > corresponding CMake variable like `FileCheck` but it should be 
> > > significantly fewer ones.
> > So it looks like only FileCheck, count, and not are required but don't have 
> > cmake variables. Would what I have now be ok where instead we just iterate 
> > over a trimmed list of tools?
> I lied, there's also clang-resource-headers and llvm-readelf.
`llvm-readelf` should be addressed by D110313.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109625

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


[PATCH] D109322: [RISCV] (2/2) Add the tail policy argument to builtins/intrinsics.

2021-09-23 Thread Zakk Chen via Phabricator via cfe-commits
khchen added inline comments.
Herald added a subscriber: achieveartificialintelligence.



Comment at: clang/include/clang/Basic/riscv_vector.td:181
+  // no need to specify the tail policy.
+  bit HasPolicy = true;
+

Add more comment like:
If `HasPolicy`, masked operation have tail policy argument in the last 
position, and append `t` in function name. 
and update the HasVL comment too.

personally, I prefer the naming like `HasTailPolicy`, `HasTail` or 
`HasTailOperand`.



Comment at: clang/include/clang/Basic/riscv_vector.td:2186
+}] in
+def policy : RVVHeader;

It seems like we can rewrite `vsetvli/vsetvl` and ` vsetvlmax` instructions by 
using the `RVVHeader` mechanism?
We only need to have one mechanism to dump header code.



Comment at: clang/test/CodeGen/RISCV/rvv-intrinsics/vadd.c:14
 //
-vint8mf8_t test_vadd_vv_i8mf8(vint8mf8_t op1, vint8mf8_t op2, size_t vl) {
+vint8mf8_t test_vadd_vv_i8mf8 (vint8mf8_t op1, vint8mf8_t op2, size_t vl) {
   return vadd_vv_i8mf8(op1, op2, vl);

Nit: we don't need to add a space here.



Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:1180
 }
 // If HasVL, append 'z' to last operand
 if (HasVL) {

Nit: update this comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109322

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


[PATCH] D110065: [AArch64] Add support for the 'R' architecture profile.

2021-09-23 Thread Lucas Prates via Phabricator via cfe-commits
pratlucas added inline comments.



Comment at: llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp:3299
 static void setRequiredFeatureString(FeatureBitset FBS, std::string &Str) {
   if (FBS[AArch64::HasV8_1aOps])
 Str += "ARMv8.1a";

As features can now depend on `HasV8_0aOps`, does it make sense to cover it 
here?



Comment at: 
llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp:1567-1571
+Reg = AArch64SysReg::lookupSysRegByName("TTBR0_EL2");
+if (Reg && Reg->Readable && Reg->haveFeatures(STI.getFeatureBits())) {
+  O << Reg->Name;
+  return;
+}

Nit: Maybe extract this block to a function as it's used a few times.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110065

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


[clang] 5e28c89 - [Driver] Correctly handle static C++ standard library

2021-09-23 Thread Petr Hosek via cfe-commits

Author: Petr Hosek
Date: 2021-09-23T01:00:11-07:00
New Revision: 5e28c892d06f95600f8b6290ad4de38bfe142637

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

LOG: [Driver] Correctly handle static C++ standard library

When statically linking C++ standard library, we shouldn't add -Bdynamic
after including the library on the link line because that might override
user settings like -static and -static-pie. Rather, we should surround
the library with --push-state/--pop-state to make sure that -Bstatic
only applies to C++ standard library and nothing else. This has been
supported since GNU ld 2.25 (2014) so backwards compatibility should
no longer be a concern.

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Fuchsia.cpp
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/fuchsia.cpp
clang/test/Driver/linux-ld.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp 
b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 13db5a073..fe865229f5bbe 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -138,14 +138,13 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
 bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) 
&&
!Args.hasArg(options::OPT_static);
 CmdArgs.push_back("--push-state");
-CmdArgs.push_back("--as-needed");
 if (OnlyLibstdcxxStatic)
   CmdArgs.push_back("-Bstatic");
+else
+  CmdArgs.push_back("--as-needed");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-if (OnlyLibstdcxxStatic)
-  CmdArgs.push_back("-Bdynamic");
-CmdArgs.push_back("-lm");
 CmdArgs.push_back("--pop-state");
+CmdArgs.push_back("-lm");
   }
 }
 

diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 79bec347baad5..a440ca56d54e1 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -577,11 +577,11 @@ void tools::gnutools::Linker::ConstructJob(Compilation 
&C, const JobAction &JA,
 if (ToolChain.ShouldLinkCXXStdlib(Args)) {
   bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
  !Args.hasArg(options::OPT_static);
+  CmdArgs.push_back("--push-state");
   if (OnlyLibstdcxxStatic)
 CmdArgs.push_back("-Bstatic");
   ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-  if (OnlyLibstdcxxStatic)
-CmdArgs.push_back("-Bdynamic");
+  CmdArgs.push_back("--pop-state");
 }
 CmdArgs.push_back("-lm");
   }

diff  --git a/clang/test/Driver/fuchsia.cpp b/clang/test/Driver/fuchsia.cpp
index bd4c7ebeb5601..2165f7e4f15e6 100644
--- a/clang/test/Driver/fuchsia.cpp
+++ b/clang/test/Driver/fuchsia.cpp
@@ -37,8 +37,8 @@
 // CHECK: "--push-state"
 // CHECK: "--as-needed"
 // CHECK: "-lc++"
-// CHECK: "-lm"
 // CHECK: "--pop-state"
+// CHECK: "-lm"
 // CHECK-X86_64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}x86_64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK-AARCH64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aarch64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK-RISCV64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}riscv64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
@@ -55,12 +55,10 @@
 // RUN: -fuse-ld=lld 2>&1 \
 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC: "--push-state"
-// CHECK-STATIC: "--as-needed"
 // CHECK-STATIC: "-Bstatic"
 // CHECK-STATIC: "-lc++"
-// CHECK-STATIC: "-Bdynamic"
-// CHECK-STATIC: "-lm"
 // CHECK-STATIC: "--pop-state"
+// CHECK-STATIC: "-lm"
 // CHECK-STATIC: "-lc"
 
 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -nostdlib++ 
-fuse-ld=lld 2>&1 \

diff  --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
index cc505588331bb..e8ba60023e86e 100644
--- a/clang/test/Driver/linux-ld.c
+++ b/clang/test/Driver/linux-ld.c
@@ -496,6 +496,24 @@
 // CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-GCC-VERSION1: 
"{{.*}}/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|}}crtbegin.o"
 
+// RUN: %clangxx -x c++ %s -### 2>&1 \
+// RUN: --target=x86_64-unknown-linux-gnu \
+// RUN: -stdlib=libc++ \
+// RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-SHARED %s
+// CHECK-BASIC-LIBCXX-SHARED: "--push-state"
+// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "-lc++"
+// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "--pop-state"
+// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "-lm"
+// RUN: %clangxx  -x c++ %s -### 2>&1 \
+// RUN: --target=x86_64-unknown-linux-gnu \
+// RUN: -stdlib=libc++ -static-

[PATCH] D110128: [Driver] Correctly handle static C++ standard library

2021-09-23 Thread Petr Hosek via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5e28c892d06f: [Driver] Correctly handle static C++ standard 
library (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D110128?vs=374154&id=374467#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110128

Files:
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/test/Driver/fuchsia.cpp
  clang/test/Driver/linux-ld.c


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -496,6 +496,24 @@
 // CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-GCC-VERSION1: 
"{{.*}}/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|}}crtbegin.o"
 
+// RUN: %clangxx -x c++ %s -### 2>&1 \
+// RUN: --target=x86_64-unknown-linux-gnu \
+// RUN: -stdlib=libc++ \
+// RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-SHARED %s
+// CHECK-BASIC-LIBCXX-SHARED: "--push-state"
+// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "-lc++"
+// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "--pop-state"
+// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "-lm"
+// RUN: %clangxx  -x c++ %s -### 2>&1 \
+// RUN: --target=x86_64-unknown-linux-gnu \
+// RUN: -stdlib=libc++ -static-libstdc++ \
+// RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-STATIC %s
+// CHECK-BASIC-LIBCXX-STATIC: "--push-state"
+// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "-Bstatic"
+// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "-lc++"
+// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "--pop-state"
+// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "-lm"
+
 // Test a simulated installation of libc++ on Linux, both through sysroot and
 // the installation path of Clang.
 // RUN: %clangxx -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
Index: clang/test/Driver/fuchsia.cpp
===
--- clang/test/Driver/fuchsia.cpp
+++ clang/test/Driver/fuchsia.cpp
@@ -37,8 +37,8 @@
 // CHECK: "--push-state"
 // CHECK: "--as-needed"
 // CHECK: "-lc++"
-// CHECK: "-lm"
 // CHECK: "--pop-state"
+// CHECK: "-lm"
 // CHECK-X86_64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}x86_64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK-AARCH64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aarch64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK-RISCV64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}riscv64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
@@ -55,12 +55,10 @@
 // RUN: -fuse-ld=lld 2>&1 \
 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC: "--push-state"
-// CHECK-STATIC: "--as-needed"
 // CHECK-STATIC: "-Bstatic"
 // CHECK-STATIC: "-lc++"
-// CHECK-STATIC: "-Bdynamic"
-// CHECK-STATIC: "-lm"
 // CHECK-STATIC: "--pop-state"
+// CHECK-STATIC: "-lm"
 // CHECK-STATIC: "-lc"
 
 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -nostdlib++ 
-fuse-ld=lld 2>&1 \
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -577,11 +577,11 @@
 if (ToolChain.ShouldLinkCXXStdlib(Args)) {
   bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
  !Args.hasArg(options::OPT_static);
+  CmdArgs.push_back("--push-state");
   if (OnlyLibstdcxxStatic)
 CmdArgs.push_back("-Bstatic");
   ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-  if (OnlyLibstdcxxStatic)
-CmdArgs.push_back("-Bdynamic");
+  CmdArgs.push_back("--pop-state");
 }
 CmdArgs.push_back("-lm");
   }
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -138,14 +138,13 @@
 bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) 
&&
!Args.hasArg(options::OPT_static);
 CmdArgs.push_back("--push-state");
-CmdArgs.push_back("--as-needed");
 if (OnlyLibstdcxxStatic)
   CmdArgs.push_back("-Bstatic");
+else
+  CmdArgs.push_back("--as-needed");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-if (OnlyLibstdcxxStatic)
-  CmdArgs.push_back("-Bdynamic");
-CmdArgs.push_back("-lm");
 CmdArgs.push_back("--pop-state");
+CmdArgs.push_back("-lm");
   }
 }
 


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -496,6 +496,24 @@
 // CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--

[clang] 904ca7d - Revert "[Driver] Correctly handle static C++ standard library"

2021-09-23 Thread Petr Hosek via cfe-commits

Author: Petr Hosek
Date: 2021-09-23T01:13:10-07:00
New Revision: 904ca7d2ed97bf114fd11373c722acd1e54bfaa3

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

LOG: Revert "[Driver] Correctly handle static C++ standard library"

This reverts commit 5e28c892d06f95600f8b6290ad4de38bfe142637 as
the linker on the clang-ppc64le-rhel bot doesn't seem to support
--push-state/--pop-state.

Added: 


Modified: 
clang/lib/Driver/ToolChains/Fuchsia.cpp
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/fuchsia.cpp
clang/test/Driver/linux-ld.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp 
b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index fe865229f5bbe..13db5a073 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -138,13 +138,14 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
 bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) 
&&
!Args.hasArg(options::OPT_static);
 CmdArgs.push_back("--push-state");
+CmdArgs.push_back("--as-needed");
 if (OnlyLibstdcxxStatic)
   CmdArgs.push_back("-Bstatic");
-else
-  CmdArgs.push_back("--as-needed");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-CmdArgs.push_back("--pop-state");
+if (OnlyLibstdcxxStatic)
+  CmdArgs.push_back("-Bdynamic");
 CmdArgs.push_back("-lm");
+CmdArgs.push_back("--pop-state");
   }
 }
 

diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index a440ca56d54e1..79bec347baad5 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -577,11 +577,11 @@ void tools::gnutools::Linker::ConstructJob(Compilation 
&C, const JobAction &JA,
 if (ToolChain.ShouldLinkCXXStdlib(Args)) {
   bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
  !Args.hasArg(options::OPT_static);
-  CmdArgs.push_back("--push-state");
   if (OnlyLibstdcxxStatic)
 CmdArgs.push_back("-Bstatic");
   ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-  CmdArgs.push_back("--pop-state");
+  if (OnlyLibstdcxxStatic)
+CmdArgs.push_back("-Bdynamic");
 }
 CmdArgs.push_back("-lm");
   }

diff  --git a/clang/test/Driver/fuchsia.cpp b/clang/test/Driver/fuchsia.cpp
index 2165f7e4f15e6..bd4c7ebeb5601 100644
--- a/clang/test/Driver/fuchsia.cpp
+++ b/clang/test/Driver/fuchsia.cpp
@@ -37,8 +37,8 @@
 // CHECK: "--push-state"
 // CHECK: "--as-needed"
 // CHECK: "-lc++"
-// CHECK: "--pop-state"
 // CHECK: "-lm"
+// CHECK: "--pop-state"
 // CHECK-X86_64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}x86_64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK-AARCH64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aarch64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
 // CHECK-RISCV64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}riscv64-unknown-fuchsia{{/|}}libclang_rt.builtins.a"
@@ -55,10 +55,12 @@
 // RUN: -fuse-ld=lld 2>&1 \
 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC: "--push-state"
+// CHECK-STATIC: "--as-needed"
 // CHECK-STATIC: "-Bstatic"
 // CHECK-STATIC: "-lc++"
-// CHECK-STATIC: "--pop-state"
+// CHECK-STATIC: "-Bdynamic"
 // CHECK-STATIC: "-lm"
+// CHECK-STATIC: "--pop-state"
 // CHECK-STATIC: "-lc"
 
 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -nostdlib++ 
-fuse-ld=lld 2>&1 \

diff  --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
index e8ba60023e86e..cc505588331bb 100644
--- a/clang/test/Driver/linux-ld.c
+++ b/clang/test/Driver/linux-ld.c
@@ -496,24 +496,6 @@
 // CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-GCC-VERSION1: 
"{{.*}}/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|}}crtbegin.o"
 
-// RUN: %clangxx -x c++ %s -### 2>&1 \
-// RUN: --target=x86_64-unknown-linux-gnu \
-// RUN: -stdlib=libc++ \
-// RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-SHARED %s
-// CHECK-BASIC-LIBCXX-SHARED: "--push-state"
-// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "-lc++"
-// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "--pop-state"
-// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "-lm"
-// RUN: %clangxx  -x c++ %s -### 2>&1 \
-// RUN: --target=x86_64-unknown-linux-gnu \
-// RUN: -stdlib=libc++ -static-libstdc++ \
-// RUN:   | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-STATIC %s
-// CHECK-BASIC-LIBCXX-STATIC: "--push-state"
-// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "-Bstatic"
-// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "-lc++"
-// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "--pop-state"
-// CHECK-BASIC-LIBCXX-STATIC-SAM

[PATCH] D110128: [Driver] Correctly handle static C++ standard library

2021-09-23 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

Looks like the linker used on `clang-ppc64le-rhel` bot doesn't support 
`--push-state`/`--pop-state`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110128

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


[PATCH] D106778: [OpenCL] opencl-c.h: add CL 3.0 non-generic address space atomics

2021-09-23 Thread Yang Haonan via Phabricator via cfe-commits
haonanya added inline comments.



Comment at: clang/lib/Headers/opencl-c.h:13379
+uint __ovld atomic_fetch_xor(volatile __global atomic_uint *object, uint 
operand);
+uint __ovld atomic_fetch_xor(volatile __local atomic_uint *object, uint 
operand);i
+int __ovld atomic_fetch_and(volatile __global atomic_int *object, int operand);

typo error on line 13379:
uint __ovld atomic_fetch_xor(volatile __local atomic_uint *object, uint 
operand);i


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106778

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


[PATCH] D108194: [clangd] IncludeCleaner: Mark used headers

2021-09-23 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev updated this revision to Diff 374469.
kbobyrev added a comment.

Perform the computation in the IncludeStructure::File space.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108194

Files:
  clang-tools-extra/clangd/Headers.cpp
  clang-tools-extra/clangd/Headers.h
  clang-tools-extra/clangd/IncludeCleaner.cpp
  clang-tools-extra/clangd/IncludeCleaner.h
  clang-tools-extra/clangd/ParsedAST.cpp
  clang-tools-extra/clangd/ParsedAST.h
  clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp

Index: clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
===
--- clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
+++ clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp
@@ -16,6 +16,8 @@
 namespace clangd {
 namespace {
 
+using ::testing::UnorderedElementsAre;
+
 TEST(IncludeCleaner, ReferencedLocations) {
   struct TestCase {
 std::string HeaderCode;
@@ -131,6 +133,42 @@
   }
 }
 
+TEST(IncludeCleaner, GetUnusedHeaders) {
+  llvm::StringLiteral MainFile = R"cpp(
+#include "a.h"
+#include "b.h"
+#include "dir/c.h"
+#include "dir/unused.h"
+#include "unused.h"
+void foo() {
+  a();
+  b();
+  c();
+})cpp";
+  // Build expected ast with symbols coming from headers.
+  TestTU TU;
+  TU.Filename = "foo.cpp";
+  TU.AdditionalFiles["foo.h"] = "void foo();";
+  TU.AdditionalFiles["a.h"] = "void a();";
+  TU.AdditionalFiles["b.h"] = "void b();";
+  TU.AdditionalFiles["dir/c.h"] = "void c();";
+  TU.AdditionalFiles["unused.h"] = "void unused();";
+  TU.AdditionalFiles["dir/unused.h"] = "void dirUnused();";
+  TU.AdditionalFiles["not_included.h"] = "void notIncluded();";
+  TU.ExtraArgs = {"-I" + testPath("dir")};
+  TU.Code = MainFile.str();
+  ParsedAST AST = TU.build();
+  auto UnusedIncludes = AST.computeUnusedIncludes();
+  std::vector UnusedHeaders;
+  UnusedHeaders.reserve(UnusedIncludes.size());
+  for (const auto &Include : UnusedIncludes) {
+// Strip enclosing "".
+UnusedHeaders.push_back(
+Include.Written.substr(1, Include.Written.size() - 2));
+  }
+  EXPECT_THAT(UnusedHeaders, UnorderedElementsAre("unused.h", "dir/unused.h"));
+}
+
 } // namespace
 } // namespace clangd
 } // namespace clang
Index: clang-tools-extra/clangd/ParsedAST.h
===
--- clang-tools-extra/clangd/ParsedAST.h
+++ clang-tools-extra/clangd/ParsedAST.h
@@ -116,6 +116,8 @@
 return Resolver.get();
   }
 
+  std::vector computeUnusedIncludes();
+
 private:
   ParsedAST(llvm::StringRef Version,
 std::shared_ptr Preamble,
Index: clang-tools-extra/clangd/ParsedAST.cpp
===
--- clang-tools-extra/clangd/ParsedAST.cpp
+++ clang-tools-extra/clangd/ParsedAST.cpp
@@ -18,6 +18,7 @@
 #include "FeatureModule.h"
 #include "Headers.h"
 #include "HeuristicResolver.h"
+#include "IncludeCleaner.h"
 #include "IncludeFixer.h"
 #include "Preamble.h"
 #include "SourceCode.h"
@@ -614,5 +615,35 @@
 return llvm::None;
   return llvm::StringRef(Preamble->Version);
 }
+
+std::vector ParsedAST::computeUnusedIncludes() {
+  const auto &SM = getSourceManager();
+
+  auto Refs = findReferencedLocations(*this);
+  auto ReferencedFileIDs = findReferencedFiles(Refs, SM);
+  llvm::DenseSet ReferencedFiles;
+  ReferencedFiles.reserve(ReferencedFileIDs.size());
+  for (FileID FID : ReferencedFileIDs) {
+const FileEntry *FE = SM.getFileEntryForID(FID);
+if (!FE) {
+  elog("Missing FE for {0}", SM.getComposedLoc(FID, 0).printToString(SM));
+  continue;
+}
+const auto File = Includes.getFile(FE->getName());
+if (!File) {
+  elog("Missing FE for {0}", SM.getComposedLoc(FID, 0).printToString(SM));
+  continue;
+}
+ReferencedFiles.insert(*File);
+  }
+  auto MainFileIndex =
+  Includes.getFile(SM.getFileEntryForID(SM.getMainFileID())->getName());
+  if (!MainFileIndex) {
+elog("Missing MainFile in the IncludeStructure");
+return {};
+  }
+  return getUnused(*MainFileIndex, Includes, ReferencedFiles, SM);
+}
+
 } // namespace clangd
 } // namespace clang
Index: clang-tools-extra/clangd/IncludeCleaner.h
===
--- clang-tools-extra/clangd/IncludeCleaner.h
+++ clang-tools-extra/clangd/IncludeCleaner.h
@@ -25,6 +25,7 @@
 #include "ParsedAST.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/DenseSet.h"
+#include 
 
 namespace clang {
 namespace clangd {
@@ -46,6 +47,29 @@
 /// - err on the side of reporting all possible locations
 ReferencedLocations findReferencedLocations(ParsedAST &AST);
 
+/// Retrieves IDs of all files containing SourceLocations from \p Locs.
+/// FIXME: Those locations could be within macro expansions and are resolved to
+/// their spelling/expansion locations.

[PATCH] D109322: [RISCV] (2/2) Add the tail policy argument to builtins/intrinsics.

2021-09-23 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai added inline comments.



Comment at: clang/include/clang/Basic/riscv_vector.td:2186
+}] in
+def policy : RVVHeader;

khchen wrote:
> It seems like we can rewrite `vsetvli/vsetvl` and ` vsetvlmax` instructions 
> by using the `RVVHeader` mechanism?
> We only need to have one mechanism to dump header code.
Should we create `vsetvli/vsetvlmax` builtins? If we should, we may not be able 
to use `RVVHeader` for these intrinsics.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109322

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


[PATCH] D110315: [Sema] Fix a null pointer reference crash.

2021-09-23 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision.
hokein added a reviewer: sammccall.
hokein requested review of this revision.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110315

Files:
  clang/lib/Sema/SemaDecl.cpp


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -14493,7 +14493,7 @@
   FunctionScopeInfo *FSI = getCurFunction();
   FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr;
 
-  if (FSI->UsesFPIntrin && !FD->hasAttr())
+  if (FSI->UsesFPIntrin && FD && !FD->hasAttr())
 FD->addAttr(StrictFPAttr::CreateImplicit(Context));
 
   sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();


Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -14493,7 +14493,7 @@
   FunctionScopeInfo *FSI = getCurFunction();
   FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr;
 
-  if (FSI->UsesFPIntrin && !FD->hasAttr())
+  if (FSI->UsesFPIntrin && FD && !FD->hasAttr())
 FD->addAttr(StrictFPAttr::CreateImplicit(Context));
 
   sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110315: [Sema] Fix a null pointer reference crash.

2021-09-23 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clang/lib/Sema/SemaDecl.cpp:14496
 
-  if (FSI->UsesFPIntrin && !FD->hasAttr())
+  if (FSI->UsesFPIntrin && FD && !FD->hasAttr())
 FD->addAttr(StrictFPAttr::CreateImplicit(Context));

I have a reproduce test case, and wait for the creduce to minimize it (will add 
it once creduce finishes)

I think the bug is obvious,  by reading the code on the line 14495, FD could be 
a nullptr.  


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110315

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


[PATCH] D105092: [RISCV] (1/2) Add the tail policy argument to builtins/intrinsics.

2021-09-23 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai added a comment.
Herald added a subscriber: achieveartificialintelligence.

I will wait for https://reviews.llvm.org/D109322 be accepted. These two patches 
need to get in together.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105092

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


[PATCH] D105092: [RISCV] (1/2) Add the tail policy argument to builtins/intrinsics.

2021-09-23 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai added inline comments.



Comment at: llvm/include/llvm/IR/IntrinsicsRISCV.td:162
   // For unit stride load with mask
   // Input: (maskedoff, pointer, mask, vl)
   class RISCVUSLoadMask

khchen wrote:
> maybe we could have another NFC patch to update those `argument info` 
> comments.
I will update these comments. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105092

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


[PATCH] D110257: [CFE][Codegen] Do not break the contiguity of static allocas.

2021-09-23 Thread Mahesha S via Phabricator via cfe-commits
hsmhsm updated this revision to Diff 374486.
hsmhsm added a comment.

Rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110257

Files:
  clang/lib/CodeGen/CGExpr.cpp
  clang/test/CodeGenCUDA/builtins-amdgcn.cu
  clang/test/CodeGenCXX/amdgcn-automatic-variable.cpp
  clang/test/CodeGenCXX/amdgcn-func-arg.cpp
  clang/test/CodeGenCXX/builtin-amdgcn-atomic-inc-dec.cpp
  clang/test/CodeGenCXX/vla.cpp
  clang/test/CodeGenSYCL/address-space-deduction.cpp
  clang/test/OpenMP/amdgcn_target_init_temp_alloca.cpp
  clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen.cpp
  clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
  clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
  clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
  clang/test/OpenMP/target_codegen_global_capture.cpp
  clang/test/OpenMP/target_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/target_parallel_if_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/task_codegen.c
  clang/test/OpenMP/teams_distribute_parallel_for_if_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_simd_if_codegen.cpp
  clang/test/OpenMP/vla_crash.c

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


[PATCH] D109818: [HIPSPV] Convert HIP kernels to SPIR-V kernels

2021-09-23 Thread Henry Linjamäki via Phabricator via cfe-commits
linjamaki added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:10224
+// pointers for HIPSPV. When the language mode is HIP, the SPIRTargetInfo
+// maps cuda_device to SPIR-V's CrossWorkGroup address space.
+llvm::Type *LTy = CGT.ConvertType(Ty);

bader wrote:
> Anastasia wrote:
> > linjamaki wrote:
> > > Anastasia wrote:
> > > > Can you explain why this mapping is needed? We already have an address 
> > > > space map to perform the mapping of address spaces b/w language and 
> > > > target. It would be good if we don't replicate similar logic in too 
> > > > many places.
> > > HIP does not require address space qualifiers on kernel pointer arguments 
> > > (e.g. see hipspv-kernel.cpp) nor there are AS qualifiers that can be 
> > > placed on them. With the default logic, provided by SPIRVTargetInfo’s 
> > > address space map, the kernel pointer arguments get converted to generic 
> > > pointers which are not allowed by the OpenCL SPIR-V Environment 
> > > Specification.
> > I feel that it is the same for SYCL... It might be good to check with 
> > @bader whether there is already a way to handle this that can be reused for 
> > HIP...
> We need to do similar transformation for SYCL, but it's not exactly the same. 
> For SYCL kernels, which represented as function objects, compiler generates 
> SPIR kernel function and fixes up the address space for pointer arguments in 
> compiler generated declaration. For more details, see the description of 
> https://reviews.llvm.org/D71016  and `handlePointerType` function code in 
> clang/lib/Sema/SemaSYCL.cpp of this review request (lines 848-876). As 
> address space is fixed in Sema, it works for all targets SYCL currently 
> supports SPIR, NVPTX and AMDGPU.
> 
> If I understand it correctly, we are trying to do minimal amount of work for 
> convert HIP kernel function to SPIR kernel function, i.e. fix calling 
> convention and address spaces. 
> Are these two fixes enough or we need more fixes to enable more sophisticated 
> kernels?
This patch and D108621 covers only the calling convention and the address space 
aspects in HIP->SPIR-V conversion. There are still various HIP features [1] 
which need to be expanded or emulated afterwards. A fully linked device program 
is needed before the fixes can be applied, so these fixes won’t be implemented 
at Sema nor CodeGen which operate per translation unit. The full-program fixes 
are applied by the HIPSPV tool chain by applying LLVM passes provided by a 
HIPSPV runtime [2].  For the time being, we are not seeing a need to specialize 
SPIR target infos further.

[1]: “HIP code expansion” section of the “[RFC][HIPSPV] Emitting HIP device 
code as SPIR-V”
[2]: clang/lib/Driver/ToolChains/HIPSPV.cpp:constructEmitSpirvCommand() @ 
https://github.com/parmance/llvm-project/tree/hipspv-wip


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109818

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


[PATCH] D110258: [AArch64][Clang] Always add -tune-cpu argument to -cc1 driver

2021-09-23 Thread Paul Walker via Phabricator via cfe-commits
paulwalker-arm added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:1850
+  else
+TuneCPU = "generic";
+} else

What benefit does `-tune-cpu generic` provide?

I'm wondering if the patch can be restricted to only add `-tune-cpu` when a 
`-mtune=` is specified with a real name or a detected name for when "native" is 
specified.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:1857-1860
+  else if (!Args.getLastArg(clang::driver::options::OPT_mcpu_EQ)) {
+CmdArgs.push_back("-tune-cpu");
+CmdArgs.push_back("generic");
+  }

See me comment above.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110258

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


[PATCH] D109322: [RISCV] (2/2) Add the tail policy argument to builtins/intrinsics.

2021-09-23 Thread Zakk Chen via Phabricator via cfe-commits
khchen accepted this revision.
khchen added a comment.
This revision is now accepted and ready to land.

LGTM.




Comment at: clang/include/clang/Basic/riscv_vector.td:2186
+}] in
+def policy : RVVHeader;

HsiangKai wrote:
> khchen wrote:
> > It seems like we can rewrite `vsetvli/vsetvl` and ` vsetvlmax` instructions 
> > by using the `RVVHeader` mechanism?
> > We only need to have one mechanism to dump header code.
> Should we create `vsetvli/vsetvlmax` builtins? If we should, we may not be 
> able to use `RVVHeader` for these intrinsics.
oh, you are right. I forget that.
Could you please move class definition in top of this file due to all class 
centralized there.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109322

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


[PATCH] D108912: [release][analyzer] Add 13.0.0 release notes

2021-09-23 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus closed this revision.
Szelethus added a comment.

Commited in rGee6913cc8317c08b603daed64b07a17a95ec926a 
 to 
`release/13.x`.


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

https://reviews.llvm.org/D108912

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


[PATCH] D109707: [HIP] [AlwaysInliner] Disable AlwaysInliner to eliminate undefined symbols

2021-09-23 Thread Anshil Gandhi via Phabricator via cfe-commits
gandhi21299 updated this revision to Diff 374369.
gandhi21299 added a comment.

- refreshing patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109707

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu
  llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
  llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
  llvm/test/CodeGen/AMDGPU/inline-calls.ll


Index: llvm/test/CodeGen/AMDGPU/inline-calls.ll
===
--- llvm/test/CodeGen/AMDGPU/inline-calls.ll
+++ llvm/test/CodeGen/AMDGPU/inline-calls.ll
@@ -1,6 +1,4 @@
 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck  
%s
-; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck  %s
-; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck %s
 
 ; ALL-NOT: {{^}}func:
 define internal i32 @func(i32 %a) {
@@ -18,8 +16,8 @@
   ret void
 }
 
-; CHECK-NOT: func_alias
-; ALL-NOT: func_alias
+; CHECK: func_alias
+; ALL: func_alias
 @func_alias = alias i32 (i32), i32 (i32)* @func
 
 ; ALL: {{^}}kernel3:
Index: llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -62,7 +62,7 @@
 return nullptr;
   }
 
-  return cast(Op.getGlobal());
+  return dyn_cast(Op.getGlobal());
 }
 
 static bool hasAnyNonFlatUseOfReg(const MachineRegisterInfo &MRI,
Index: llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
@@ -93,6 +93,8 @@
 
   for (GlobalAlias &A : M.aliases()) {
 if (Function* F = dyn_cast(A.getAliasee())) {
+  if (A.getLinkage() != GlobalValue::InternalLinkage)
+continue;
   A.replaceAllUsesWith(F);
   AliasesToRemove.push_back(&A);
 }
Index: clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu
===
--- /dev/null
+++ clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu
@@ -0,0 +1,15 @@
+// RUN: %clang --offload-arch=gfx906 --cuda-device-only -x hip -emit-llvm -S 
-o - %s \
+// RUN:   -fgpu-rdc -O3 -mllvm -amdgpu-early-inline-all=true -mllvm 
-amdgpu-function-calls=false | \
+// RUN:   FileCheck %s
+
+#include "Inputs/cuda.h"
+
+// CHECK: %struct.B = type { i8 }
+struct B {
+
+  // CHECK: @_ZN1BC1Ei = hidden unnamed_addr alias void (%struct.B*, i32), 
void (%struct.B*, i32)* @_ZN1BC2Ei
+  __device__ B(int x);
+};
+
+__device__ B::B(int x) {
+}
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -5084,9 +5084,9 @@
   }
 
   // Enable -mconstructor-aliases except on darwin, where we have to work 
around
-  // a linker bug (see ), and CUDA/AMDGPU device code,
-  // where aliases aren't supported.
-  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX() && !RawTriple.isAMDGPU())
+  // a linker bug (see ), and CUDA device code, where
+  // aliases aren't supported.
+  if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX())
 CmdArgs.push_back("-mconstructor-aliases");
 
   // Darwin's kernel doesn't support guard variables; just die if we


Index: llvm/test/CodeGen/AMDGPU/inline-calls.ll
===
--- llvm/test/CodeGen/AMDGPU/inline-calls.ll
+++ llvm/test/CodeGen/AMDGPU/inline-calls.ll
@@ -1,6 +1,4 @@
 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck  %s
-; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck  %s
-; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck %s
 
 ; ALL-NOT: {{^}}func:
 define internal i32 @func(i32 %a) {
@@ -18,8 +16,8 @@
   ret void
 }
 
-; CHECK-NOT: func_alias
-; ALL-NOT: func_alias
+; CHECK: func_alias
+; ALL: func_alias
 @func_alias = alias i32 (i32), i32 (i32)* @func
 
 ; ALL: {{^}}kernel3:
Index: llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -62,7 +62,7 @@
 return nullptr;
   }
 
-  return cast(Op.getGlobal());
+  return dyn_cast(Op.getGlobal());
 }
 
 static bool hasAnyNonFlatUseOfReg(const MachineRegisterInfo &MRI,
Index: llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
===
--- llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
@@ -93,6 +93,8 @@
 
   

[PATCH] D89013: [libcxx] Support per-target __config_site in per-target runtime build

2021-09-23 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added a comment.

Building with this patch Debian packages is failing with:

  
"/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/clang++"
 -DHAVE___CXA_THREAD_ATEXIT_IMPL -DLIBCXXABI_USE_LLVM_UNWINDER 
-D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_DISABLE_EXTERN_TEMPLATE 
-D_LIBCXXABI_BUILDING_LIBRARY -D_LIBCXXABI_LINK_PTHREAD_LIB -I../include 
-I"/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/libunwind/include"
 
-I"/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/libcxx/src"
 -g -O2 
-fdebug-prefix-map=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0=.
 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
-D_FORTIFY_SOURCE=2 --target=x86_64-pc-linux-gnu  -O2 -g -DNDEBUG -fPIC 
--target=x86_64-pc-linux-gnu -nostdinc++ -Werror=return-type -W -Wall 
-Wchar-subscripts -Wconversion -Wmismatched-tags -Wmissing-braces -Wnewline-eof 
-Wunused-function -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wsign-conversion 
-Wstrict-aliasing=2 -Wstrict-overflow=4 -Wunused-parameter -Wunused-variable 
-Wwrite-strings -Wundef -Wno-suggest-override -Wno-error -pedantic 
-fstrict-aliasing -funwind-tables -D_DEBUG -I 
"/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/include/c++/v1"
 -std=c++20 -MD -MT src/CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o -MF 
src/CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o.d -o 
src/CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o -c ../src/cxa_demangle.cpp
  In file included from ../src/cxa_demangle.cpp:13:
  In file included from ../src/demangle/ItaniumDemangle.h:21:
  In file included from ../src/demangle/DemangleConfig.h:14:
  In file included from 
/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/include/c++/v1/ciso646:18:
  
/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/include/c++/v1/__config:13:10:
 fatal error: '__config_site' file not found
  #include <__config_site>
   ^~~
  1 error generated.
  ninja: build stopped: subcommand failed.

cmake:

   cmake \
  -S . -B build \
  -G Ninja \
  -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-14 -DCMAKE_POSITION_INDEPENDENT_CODE=ON 
-DLLVM_CONFIG_PATH=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/llvm-config
 -DCMAKE_BUILD_TYPE=RelWithDebInfo 
-DCMAKE_CXX_COMPILER=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/clang++
 
-DCMAKE_C_COMPILER=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/clang
 -DCMAKE_CXX_FLAGS="-g -O2 
-fdebug-prefix-map=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0=.
 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
-D_FORTIFY_SOURCE=2" -DCMAKE_EXE_LINKER_FLAGS="" -DCMAKE_SHARED_LINKER_FLAGS="" 
-DCMAKE_MODULE_LINKER_FLAGS="" 
-DCMAKE_AR=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/llvm-ar
 
-DCMAKE_RANLIB=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/llvm-ranlib
 
-DLLVM_EXTERNAL_LIT=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/llvm/utils/lit/lit.py
 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 
-DCLANG_SYSTEMZ_DEFAULT_ARCH=z196 -DLLVM_BINUTILS_INCDIR=/usr/include/ 
-DLLVM_USE_PERF=yes -DLLVM_ENABLE_LIBPFM=ON \
  
-DLIBCXXABI_LIBCXX_PATH=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/libcxx
 \
  
-DLIBCXXABI_LIBCXX_LIBRARY_PATH=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/libcxx/build/lib
 \
  
-DLIBCXXABI_LIBCXX_INCLUDES=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/include/c++/v1/
 \
  -DLIBCXXABI_ENABLE_EXCEPTIONS=ON \
  -DLIBCXXABI_USE_COMPILER_RT=ON \
  -DLLVM_ENABLE_RTTI=ON \
  -DLIBCXXABI_USE

[PATCH] D89013: [libcxx] Support per-target __config_site in per-target runtime build

2021-09-23 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In D89013#3017317 , @sylvestre.ledru 
wrote:

> Building with this patch Debian packages is failing with:
>
>   
> "/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/clang++"
>  -DHAVE___CXA_THREAD_ATEXIT_IMPL -DLIBCXXABI_USE_LLVM_UNWINDER 
> -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_DISABLE_EXTERN_TEMPLATE 
> -D_LIBCXXABI_BUILDING_LIBRARY -D_LIBCXXABI_LINK_PTHREAD_LIB -I../include 
> -I"/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/libunwind/include"
>  
> -I"/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/libcxx/src"
>  -g -O2 
> -fdebug-prefix-map=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0=.
>  -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
> -D_FORTIFY_SOURCE=2 --target=x86_64-pc-linux-gnu  -O2 -g -DNDEBUG -fPIC 
> --target=x86_64-pc-linux-gnu -nostdinc++ -Werror=return-type -W -Wall 
> -Wchar-subscripts -Wconversion -Wmismatched-tags -Wmissing-braces 
> -Wnewline-eof -Wunused-function -Wshadow -Wshorten-64-to-32 -Wsign-compare 
> -Wsign-conversion -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wunused-parameter 
> -Wunused-variable -Wwrite-strings -Wundef -Wno-suggest-override -Wno-error 
> -pedantic -fstrict-aliasing -funwind-tables -D_DEBUG -I 
> "/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/include/c++/v1"
>  -std=c++20 -MD -MT src/CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o -MF 
> src/CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o.d -o 
> src/CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o -c ../src/cxa_demangle.cpp
>   In file included from ../src/cxa_demangle.cpp:13:
>   In file included from ../src/demangle/ItaniumDemangle.h:21:
>   In file included from ../src/demangle/DemangleConfig.h:14:
>   In file included from 
> /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/include/c++/v1/ciso646:18:
>   
> /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/include/c++/v1/__config:13:10:
>  fatal error: '__config_site' file not found
>   #include <__config_site>
>^~~
>   1 error generated.
>   ninja: build stopped: subcommand failed.
>
> cmake:
>
>cmake \
>   -S . -B build \
>   -G Ninja \
>   -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-14 
> -DCMAKE_POSITION_INDEPENDENT_CODE=ON 
> -DLLVM_CONFIG_PATH=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/llvm-config
>  -DCMAKE_BUILD_TYPE=RelWithDebInfo 
> -DCMAKE_CXX_COMPILER=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/clang++
>  
> -DCMAKE_C_COMPILER=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/clang
>  -DCMAKE_CXX_FLAGS="-g -O2 
> -fdebug-prefix-map=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0=.
>  -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
> -D_FORTIFY_SOURCE=2" -DCMAKE_EXE_LINKER_FLAGS="" 
> -DCMAKE_SHARED_LINKER_FLAGS="" -DCMAKE_MODULE_LINKER_FLAGS="" 
> -DCMAKE_AR=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/llvm-ar
>  
> -DCMAKE_RANLIB=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/build-llvm/tools/clang/stage2-bins/bin/llvm-ranlib
>  
> -DLLVM_EXTERNAL_LIT=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/llvm/utils/lit/lit.py
>  -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON 
> -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCLANG_SYSTEMZ_DEFAULT_ARCH=z196 
> -DLLVM_BINUTILS_INCDIR=/usr/include/ -DLLVM_USE_PERF=yes 
> -DLLVM_ENABLE_LIBPFM=ON \
>   
> -DLIBCXXABI_LIBCXX_PATH=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/libcxx
>  \
>   
> -DLIBCXXABI_LIBCXX_LIBRARY_PATH=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0/libcxx/build/lib
>  \
>   
> -DLIBCXXABI_LIBCXX_INCLUDES=/home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-to

[PATCH] D89013: [libcxx] Support per-target __config_site in per-target runtime build

2021-09-23 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added a comment.

> How was the toolchain in 
> /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-toolchain-snapshot-14~++20210922093928+5da21338bcd0
>  
> /build-llvm
>  built?

Only using PROJECTS using stage2, not RUNTIMES (it is planned)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89013

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


[PATCH] D110281: Change __builtin_sycl_unique_stable_name to just use an Itanium mangling

2021-09-23 Thread Alexey Bader via Phabricator via cfe-commits
bader added a comment.

LGTM, just one typo in addition to linter reports and I'd like John to take a 
look.




Comment at: clang/docs/LanguageExtensions.rst:2524
 mangling scheme at runtime. The mangler marks all the lambdas required to name
-the SYCL kernel and emits a stable local ordering of the respective lambdas,
-starting from ``1``. The initial value of ``1`` serves as an obvious
-differentiator from ordinary lambda mangling numbers but does not serve any
-other purpose and may change in the future. The resulting pattern is
-demanglable. When non-lambda types are passed to the builtin, the mangler emits
-their usual pattern without any special treatment.
+the SYCL kernel a nd emits a stable local ordering of the respective lambdas.
+The resulting pattern is demanglable.  When non-lambda types are passed to the

"a nd" -> "and"


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

https://reviews.llvm.org/D110281

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


[PATCH] D108370: [clang-tidy] Fix wrong FixIt about union in cppcoreguidelines-pro-type-member-init

2021-09-23 Thread gehry via Phabricator via cfe-commits
Sockke updated this revision to Diff 374430.
Sockke added a comment.

Update!


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

https://reviews.llvm.org/D108370

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp


Index: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp
===
--- 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp
+++ 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp
@@ -516,3 +516,39 @@
 
 PositiveDefaultConstructorOutOfDecl::PositiveDefaultConstructorOutOfDecl() = 
default;
 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: constructor does not initialize 
these fields: F
+
+union U1 {
+  U1() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: union constructor should 
initialize one of these fields: X, K, Z, Y
+  int X;
+  // CHECK-FIXES: int X{};
+  union {
+int K;
+// CHECK-FIXES-NOT: int K{};
+  };
+  union {
+int Z;
+// CHECK-FIXES-NOT: int Z{};
+int Y;
+// CHECK-FIXES-NOT: int Y{};
+  };
+};
+
+union U2 {
+  U2() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: union constructor should 
initialize one of these fields: B, C, A
+  struct {
+int B;
+// CHECK-FIXES: int B{};
+union {
+  struct {
+PositiveMultipleConstructors Value;
+// CHECK-FIXES-NOT: PositiveMultipleConstructors Value{};
+  };
+  int C;
+  // CHECK-FIXES: int C{};
+};
+  };
+  int A;
+  // CHECK-FIXES-NOT: int A{};
+};
Index: clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
===
--- clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -44,6 +44,23 @@
   }
 }
 
+template 
+void forEachFieldWithFilter(const RecordDecl &Record, const T &Fields,
+bool &AnyMemberHasInitPerUnion, Func &&Fn) {
+  for (const FieldDecl *F : Fields) {
+if (F->isAnonymousStructOrUnion()) {
+  if (const CXXRecordDecl *R = F->getType()->getAsCXXRecordDecl()) {
+AnyMemberHasInitPerUnion = false;
+forEachFieldWithFilter(*R, R->fields(), AnyMemberHasInitPerUnion, Fn);
+  }
+} else {
+  Fn(F);
+}
+if (Record.isUnion() && AnyMemberHasInitPerUnion)
+  break;
+  }
+}
+
 void removeFieldsInitializedInBody(
 const Stmt &Stmt, ASTContext &Context,
 SmallPtrSetImpl &FieldDecls) {
@@ -461,8 +478,9 @@
   // Collect all fields but only suggest a fix for the first member of unions,
   // as initializing more than one union member is an error.
   SmallPtrSet FieldsToFix;
-  SmallPtrSet UnionsSeen;
-  forEachField(ClassDecl, OrderedFields, [&](const FieldDecl *F) {
+  bool AnyMemberHasInitPerUnion = false;
+  forEachFieldWithFilter(ClassDecl, ClassDecl.fields(),
+ AnyMemberHasInitPerUnion, [&](const FieldDecl *F) {
 if (!FieldsToInit.count(F))
   return;
 // Don't suggest fixes for enums because we don't know a good default.
@@ -471,8 +489,8 @@
 if (F->getType()->isEnumeralType() ||
 (!getLangOpts().CPlusPlus20 && F->isBitField()))
   return;
-if (!F->getParent()->isUnion() || UnionsSeen.insert(F->getParent()).second)
-  FieldsToFix.insert(F);
+FieldsToFix.insert(F);
+AnyMemberHasInitPerUnion = true;
   });
   if (FieldsToFix.empty())
 return;


Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp
@@ -516,3 +516,39 @@
 
 PositiveDefaultConstructorOutOfDecl::PositiveDefaultConstructorOutOfDecl() = default;
 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: constructor does not initialize these fields: F
+
+union U1 {
+  U1() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: union constructor should initialize one of these fields: X, K, Z, Y
+  int X;
+  // CHECK-FIXES: int X{};
+  union {
+int K;
+// CHECK-FIXES-NOT: int K{};
+  };
+  union {
+int Z;
+// CHECK-FIXES-NOT: int Z{};
+int Y;
+// CHECK-FIXES-NOT: int Y{};
+  };
+};
+
+union U2 {
+  U2() {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: union constructor should initialize one of these fields: B, C, A
+  struct {
+int B;
+// CHECK-FIXES: int B{};
+union {
+  struct {
+PositiveMultipleConstructors Value;
+// CHECK-FIXES-NOT: PositiveMultipleConstructors Value{};
+  };
+  int C;
+  // CHECK-FIXES: int C{};
+};
+  };
+  int A;
+  // CHECK-FIXES-NOT: 

[PATCH] D108370: [clang-tidy] Fix wrong FixIt about union in cppcoreguidelines-pro-type-member-init

2021-09-23 Thread gehry via Phabricator via cfe-commits
Sockke added inline comments.



Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:484
+ AnyMemberHasInitPerUnion, [&](const FieldDecl *F) {
 if (!FieldsToInit.count(F))
   return;

aaron.ballman wrote:
> Given that we're touching this code, we might as well make clang-format happy 
> with it (though I can't quite spot what it wants changed, so if it turns out 
> to be a bad idea for some reason, I don't insist).
> Given that we're touching this code, we might as well make clang-format happy 
> with it (though I can't quite spot what it wants changed, so if it turns out 
> to be a bad idea for some reason, I don't insist).

Yes, I have tried to format this code with clang-format but it does not work 
perfectly.


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

https://reviews.llvm.org/D108370

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


[PATCH] D108370: [clang-tidy] Fix wrong FixIt about union in cppcoreguidelines-pro-type-member-init

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

LGTM!




Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:484
+ AnyMemberHasInitPerUnion, [&](const FieldDecl *F) {
 if (!FieldsToInit.count(F))
   return;

Sockke wrote:
> aaron.ballman wrote:
> > Given that we're touching this code, we might as well make clang-format 
> > happy with it (though I can't quite spot what it wants changed, so if it 
> > turns out to be a bad idea for some reason, I don't insist).
> > Given that we're touching this code, we might as well make clang-format 
> > happy with it (though I can't quite spot what it wants changed, so if it 
> > turns out to be a bad idea for some reason, I don't insist).
> 
> Yes, I have tried to format this code with clang-format but it does not work 
> perfectly.
Then as-is is fine by me, thank you!


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

https://reviews.llvm.org/D108370

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


[PATCH] D110324: clangd: Do not report inline overrides twice

2021-09-23 Thread Christian Kandeler via Phabricator via cfe-commits
ckandeler created this revision.
ckandeler added a reviewer: sammccall.
Herald added subscribers: usaxena95, kadircet, arphaman.
ckandeler requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

... in textDocument/references.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110324

Files:
  clang-tools-extra/clangd/XRefs.cpp
  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
@@ -1947,6 +1947,9 @@
   void $overridedecl[[func]]() override;
 };
 void Derived::$overridedef[[func]]() {}
+class Derived2 : public Base {
+  void $overridedef[[func]]() override {}
+};
 void test(Derived* D) {
   D->func();  // No references to the overrides.
 })cpp";
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1431,17 +1431,20 @@
 !OverriddenBy.Subjects.empty())
   Index->relations(
   OverriddenBy, [&](const SymbolID &Subject, const Symbol &Object) {
-if (auto LSPLoc =
-toLSPLocation(Object.CanonicalDeclaration, *MainFilePath)) 
{
+const auto LSPLocDecl = toLSPLocation(Object.CanonicalDeclaration,
+  *MainFilePath);
+const auto LSPLocDef = toLSPLocation(Object.Definition,
+ *MainFilePath);
+if (LSPLocDecl && LSPLocDecl != LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDecl);
   Result.Attributes =
   ReferencesResult::Declaration | ReferencesResult::Override;
   Results.References.push_back(std::move(Result));
 }
-if (auto LSPLoc = toLSPLocation(Object.Definition, *MainFilePath)) 
{
+if (LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDef);
   Result.Attributes = ReferencesResult::Declaration |
   ReferencesResult::Definition |
   ReferencesResult::Override;


Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -1947,6 +1947,9 @@
   void $overridedecl[[func]]() override;
 };
 void Derived::$overridedef[[func]]() {}
+class Derived2 : public Base {
+  void $overridedef[[func]]() override {}
+};
 void test(Derived* D) {
   D->func();  // No references to the overrides.
 })cpp";
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1431,17 +1431,20 @@
 !OverriddenBy.Subjects.empty())
   Index->relations(
   OverriddenBy, [&](const SymbolID &Subject, const Symbol &Object) {
-if (auto LSPLoc =
-toLSPLocation(Object.CanonicalDeclaration, *MainFilePath)) {
+const auto LSPLocDecl = toLSPLocation(Object.CanonicalDeclaration,
+  *MainFilePath);
+const auto LSPLocDef = toLSPLocation(Object.Definition,
+ *MainFilePath);
+if (LSPLocDecl && LSPLocDecl != LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDecl);
   Result.Attributes =
   ReferencesResult::Declaration | ReferencesResult::Override;
   Results.References.push_back(std::move(Result));
 }
-if (auto LSPLoc = toLSPLocation(Object.Definition, *MainFilePath)) {
+if (LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDef);
   Result.Attributes = ReferencesResult::Declaration |
   ReferencesResult::Definition |
   ReferencesResult::Override;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/ma

[PATCH] D110260: [ORC] Minor renaming and typo fixes (NFC)

2021-09-23 Thread Shivam Gupta via Phabricator via cfe-commits
xgupta added a comment.

Although this patch is correct, running  ./LLJITWithTargetProcessControl result 
in segmentation fault.

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash 
backtrace.
Stack dump:
0.  Program arguments: ./LLJITWithTargetProcessControl
#0 0x7fdee365ab73 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
(/home/xgupta/llvm/llvm-upstream/build/bin/../lib/libLLVMSupport.so.14git+0x1f6b73)
#1 0x7fdee365892e llvm::sys::RunSignalHandlers() 
(/home/xgupta/llvm/llvm-upstream/build/bin/../lib/libLLVMSupport.so.14git+0x1f492e)
#2 0x7fdee365b03a SignalHandler(int) Signals.cpp:0:0
#3 0x7fdee3c16870 __restore_rt sigaction.c:0:0
#4 0x7fdee461a9e4 
llvm::orc::EPCIndirectionUtils::Create(llvm::orc::ExecutorProcessControl&) 
(/home/xgupta/llvm/llvm-upstream/build/bin/../lib/libLLVMOrcJIT.so.14git+0xfb9e4)
#5 0x00208781 main (./LLJITWithTargetProcessControl+0x208781)
#6 0x7fdee2f48b25 __libc_start_main (/usr/lib/libc.so.6+0x27b25)
#7 0x00207fde _start (./LLJITWithTargetProcessControl+0x207fde)
[1]52081 segmentation fault (core dumped)  ./LLJITWithTargetProcessControl


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110260

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


[PATCH] D110289: [libc++] Remove unused macro in __config

2021-09-23 Thread Louis Dionne via Phabricator via cfe-commits
ldionne updated this revision to Diff 374518.
ldionne added a comment.
Herald added subscribers: cfe-commits, llvm-commits, dexonsmith, usaxena95, 
kadircet, arphaman, hiraditya.
Herald added projects: LLVM, clang-tools-extra.

Remove uses of __MAC_OS_X_VERSION_MIN_REQUIRED in LLVM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110289

Files:
  clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
  libcxx/include/__config
  llvm/lib/Support/LockFileManager.cpp


Index: llvm/lib/Support/LockFileManager.cpp
===
--- llvm/lib/Support/LockFileManager.cpp
+++ llvm/lib/Support/LockFileManager.cpp
@@ -35,7 +35,7 @@
 #include 
 #endif
 
-#if defined(__APPLE__) && defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && 
(__MAC_OS_X_VERSION_MIN_REQUIRED > 1050)
+#if defined(__APPLE__) && 
defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && 
(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1050)
 #define USE_OSX_GETHOSTUUID 1
 #else
 #define USE_OSX_GETHOSTUUID 0
Index: libcxx/include/__config
===
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -912,13 +912,6 @@
 #  define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
 #endif
 
-#if defined(__APPLE__)
-#  if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
-  defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
-#define __MAC_OS_X_VERSION_MIN_REQUIRED 
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
-#  endif
-#endif // defined(__APPLE__)
-
 #if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || \
 (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
 #  define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
Index: clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
===
--- clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
+++ clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
@@ -18,8 +18,8 @@
 
 // No fmemopen on windows or on versions of MacOS X earlier than 10.13, so we
 // can't easily run this test.
-#if !(defined(_WIN32) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) &&  
\
-  __MAC_OS_X_VERSION_MIN_REQUIRED < 101300))
+#if !(defined(_WIN32) || 
(defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+  __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 
101300))
 
 // Fixture takes care of managing the input/output buffers for the transport.
 class JSONTransportTest : public ::testing::Test {


Index: llvm/lib/Support/LockFileManager.cpp
===
--- llvm/lib/Support/LockFileManager.cpp
+++ llvm/lib/Support/LockFileManager.cpp
@@ -35,7 +35,7 @@
 #include 
 #endif
 
-#if defined(__APPLE__) && defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (__MAC_OS_X_VERSION_MIN_REQUIRED > 1050)
+#if defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1050)
 #define USE_OSX_GETHOSTUUID 1
 #else
 #define USE_OSX_GETHOSTUUID 0
Index: libcxx/include/__config
===
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -912,13 +912,6 @@
 #  define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
 #endif
 
-#if defined(__APPLE__)
-#  if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
-  defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
-#define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
-#  endif
-#endif // defined(__APPLE__)
-
 #if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || \
 (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
 #  define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
Index: clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
===
--- clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
+++ clang-tools-extra/clangd/unittests/JSONTransportTests.cpp
@@ -18,8 +18,8 @@
 
 // No fmemopen on windows or on versions of MacOS X earlier than 10.13, so we
 // can't easily run this test.
-#if !(defined(_WIN32) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) &&  \
-  __MAC_OS_X_VERSION_MIN_REQUIRED < 101300))
+#if !(defined(_WIN32) || (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+  __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300))
 
 // Fixture takes care of managing the input/output buffers for the transport.
 class JSONTransportTest : public ::testing::Test {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110289: [libc++] Remove unused macro in __config

2021-09-23 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

In D110289#3016525 , @jloser wrote:

> I think it's used in a few places from a quick `git grep`: [...]

`__MAC_OS_X_VERSION_MIN_REQUIRED` is defined by Apple's ``. It 
is equivalent to `__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__`, which is set 
by the compiler. I suspect libc++ was defining it at some point for internal 
use (e.g. in the code I removed in https://reviews.llvm.org/rGebaf1d5e2b87), 
but now it's not needed anymore.

> This is safe for `libc++` use, so LGTM since CI is passing. As an aside, it 
> looks like there are a few other spots in `llvm` that could benefit from the 
> removal too:
>
>   git grep '__MAC_OS_X_VERSION_MIN_REQUIRED'
>   clang-tools-extra/clangd/unittests/JSONTransportTests.cpp:#if 
> !(defined(_WIN32) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) &&  \
>   clang-tools-extra/clangd/unittests/JSONTransportTests.cpp:  
> __MAC_OS_X_VERSION_MIN_REQUIRED < 101300))
>   llvm/lib/Support/LockFileManager.cpp:#if defined(__APPLE__) && 
> defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (__MAC_OS_X_VERSION_MIN_REQUIRED 
> > 1050)

Good point -- those could either have been using the value defined in 
`` or unknowingly using the one set by libc++. I'll move those 
over to `__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__`, which is always 
defined by the compiler.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110289

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


[PATCH] D110324: clangd: Do not report inline overrides twice

2021-09-23 Thread Christian Kandeler via Phabricator via cfe-commits
ckandeler updated this revision to Diff 374520.
ckandeler added a comment.

Fixed formatting.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110324

Files:
  clang-tools-extra/clangd/XRefs.cpp
  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
@@ -1947,6 +1947,9 @@
   void $overridedecl[[func]]() override;
 };
 void Derived::$overridedef[[func]]() {}
+class Derived2 : public Base {
+  void $overridedef[[func]]() override {}
+};
 void test(Derived* D) {
   D->func();  // No references to the overrides.
 })cpp";
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1431,17 +1431,20 @@
 !OverriddenBy.Subjects.empty())
   Index->relations(
   OverriddenBy, [&](const SymbolID &Subject, const Symbol &Object) {
-if (auto LSPLoc =
-toLSPLocation(Object.CanonicalDeclaration, *MainFilePath)) 
{
+const auto LSPLocDecl =
+toLSPLocation(Object.CanonicalDeclaration, *MainFilePath);
+const auto LSPLocDef =
+toLSPLocation(Object.Definition, *MainFilePath);
+if (LSPLocDecl && LSPLocDecl != LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDecl);
   Result.Attributes =
   ReferencesResult::Declaration | ReferencesResult::Override;
   Results.References.push_back(std::move(Result));
 }
-if (auto LSPLoc = toLSPLocation(Object.Definition, *MainFilePath)) 
{
+if (LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDef);
   Result.Attributes = ReferencesResult::Declaration |
   ReferencesResult::Definition |
   ReferencesResult::Override;


Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -1947,6 +1947,9 @@
   void $overridedecl[[func]]() override;
 };
 void Derived::$overridedef[[func]]() {}
+class Derived2 : public Base {
+  void $overridedef[[func]]() override {}
+};
 void test(Derived* D) {
   D->func();  // No references to the overrides.
 })cpp";
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1431,17 +1431,20 @@
 !OverriddenBy.Subjects.empty())
   Index->relations(
   OverriddenBy, [&](const SymbolID &Subject, const Symbol &Object) {
-if (auto LSPLoc =
-toLSPLocation(Object.CanonicalDeclaration, *MainFilePath)) {
+const auto LSPLocDecl =
+toLSPLocation(Object.CanonicalDeclaration, *MainFilePath);
+const auto LSPLocDef =
+toLSPLocation(Object.Definition, *MainFilePath);
+if (LSPLocDecl && LSPLocDecl != LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDecl);
   Result.Attributes =
   ReferencesResult::Declaration | ReferencesResult::Override;
   Results.References.push_back(std::move(Result));
 }
-if (auto LSPLoc = toLSPLocation(Object.Definition, *MainFilePath)) {
+if (LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDef);
   Result.Attributes = ReferencesResult::Declaration |
   ReferencesResult::Definition |
   ReferencesResult::Override;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110315: [Sema] Fix a null pointer reference crash.

2021-09-23 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a subscriber: mibintc.
sammccall added a comment.
This revision is now accepted and ready to land.

LG because not crashing here is surely better than crashing, but I'm not sure 
whether the behaviour is actually right.
If we can't be sure, maybe leave a comment?




Comment at: clang/lib/Sema/SemaDecl.cpp:14496
 
-  if (FSI->UsesFPIntrin && !FD->hasAttr())
+  if (FSI->UsesFPIntrin && FD && !FD->hasAttr())
 FD->addAttr(StrictFPAttr::CreateImplicit(Context));

hokein wrote:
> I have a reproduce test case, and wait for the creduce to minimize it (will 
> add it once creduce finishes)
> 
> I think the bug is obvious,  by reading the code on the line 14495, FD could 
> be a nullptr.  
Yes, the bug is clear.
It's not obvious to me that the fix is right, because I don't know:
 - when dcl can be null
 - when/if dcl can be non-null but neither a function nor function template
 - how the FP attr should apply in such cases

cc @mibintc who may know the answer to at least the 3rd question, and I guess 
your testcase will give an example of either 1 or 2.

I'm *fairly* sure that not applying the strictfpattr is better than crashing 
here though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110315

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


[PATCH] D107450: [clang-tidy] Fix wrong FIxIt in performance-move-const-arg

2021-09-23 Thread gehry via Phabricator via cfe-commits
Sockke added a comment.

Hi, Could you please take some time to review this diff again? @whisperity


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

https://reviews.llvm.org/D107450

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


[PATCH] D110281: Change __builtin_sycl_unique_stable_name to just use an Itanium mangling

2021-09-23 Thread Erich Keane via Phabricator via cfe-commits
erichkeane updated this revision to Diff 374523.
erichkeane added a comment.

fix typo that @bader found


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

https://reviews.llvm.org/D110281

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/ItaniumCXXABI.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/MicrosoftCXXABI.cpp
  clang/lib/Sema/SemaSYCL.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/CodeGenSYCL/unique_stable_name.cpp
  clang/test/CodeGenSYCL/unique_stable_name_windows_diff.cpp
  clang/test/SemaSYCL/unique_stable_name.cpp

Index: clang/test/SemaSYCL/unique_stable_name.cpp
===
--- clang/test/SemaSYCL/unique_stable_name.cpp
+++ clang/test/SemaSYCL/unique_stable_name.cpp
@@ -15,10 +15,6 @@
 template 
 void kernel1func(const Func &F1) {
   constexpr const char *F1_output = __builtin_sycl_unique_stable_name(Func); // #USN_F1
-  // expected-error@#kernelSingleTask{{kernel instantiation changes the result of an evaluated '__builtin_sycl_unique_stable_name'}}
-  // expected-note@#kernel1func_call{{in instantiation of function template specialization}}
-  // expected-note@#USN_F1{{'__builtin_sycl_unique_stable_name' evaluated here}}
-  // expected-note@+1{{in instantiation of function template specialization}}
   kernel_single_task(F1); // #kernel1_call
 }
 
@@ -38,10 +34,6 @@
 template 
 void kernel2func(const Func &F2) {
   constexpr const char *F2_output = __builtin_sycl_unique_stable_name(Func); // #USN_F2
-  // expected-error@#kernelSingleTask{{kernel instantiation changes the result of an evaluated '__builtin_sycl_unique_stable_name'}}
-  // expected-note@#kernel2func_call{{in instantiation of function template specialization}}
-  // expected-note@#USN_F2{{'__builtin_sycl_unique_stable_name' evaluated here}}
-  // expected-note@+1{{in instantiation of function template specialization}}
   kernel_single_task([]() {});
 }
 
@@ -93,40 +85,34 @@
   kernel_single_task(
   [=]() { l5(); }); // Used in the kernel, but not the kernel name itself
 
-  // kernel6 - expect error
+  // kernel6 - expect no error
   // Test that passing the lambda to the unique stable name builtin and then
-  // using the same lambda in the naming of a kernel causes a diagnostic on the
-  // kernel use due to the change in results to the stable name.
+  // using the same lambda in the naming of a kernel does not cause a diagnostic
+  // on the kernel use due to the change in results to the stable name.
   auto l6 = []() { return 1; };
   constexpr const char *l6_output =
   __builtin_sycl_unique_stable_name(decltype(l6)); // #USN_l6
-  // expected-error@#kernelSingleTask{{kernel instantiation changes the result of an evaluated '__builtin_sycl_unique_stable_name'}}
-  // expected-note@#USN_l6{{'__builtin_sycl_unique_stable_name' evaluated here}}
-  // expected-note@+1{{in instantiation of function template specialization}}
   kernel_single_task(l6); // Used in the kernel name after builtin
 
-  // kernel7 - expect error
+  // kernel7 - expect no error
   // Same as kernel11 (below) except make the lambda part of naming the kernel.
   // Test that passing a lambda to the unique stable name builtin and then
-  // passing a second lambda to the kernel throws an error because the first
-  // lambda is included in the signature of the second lambda, hence it changes
-  // the mangling of the kernel.
+  // passing a second lambda to the kernel does not throw an error because the
+  // first lambda is included in the signature of the second lambda, but does
+  // not change the mangling of the kernel.
   auto l7 = []() { return 1; };
   auto l8 = [](decltype(l7) *derp = nullptr) { return 2; };
   constexpr const char *l7_output =
   __builtin_sycl_unique_stable_name(decltype(l7)); // #USN_l7
-  // expected-error@#kernelSingleTask{{kernel instantiation changes the result of an evaluated '__builtin_sycl_unique_stable_name'}}
-  // expected-note@#USN_l7{{'__builtin_sycl_unique_stable_name' evaluated here}}
-  // expected-note@+1{{in instantiation of function template specialization}}
   kernel_single_task(l8);
 
-  // kernel8 and kernel9 - expect error
-  // Tests that passing a lambda to the unique stable name builtin and passing it
-  // to a kernel called with an if constexpr branch causes a diagnostic on the
-  // kernel9 use due to the change in the results to the stable name. This happens
-  // even though the use of kernel9 happens in the false branch of a constexpr if
-  // because both the true and the false branches cause the instantiation of
-  // kernel_single_task.
+  // kernel8 and kernel9 - expect no error
+  // Tests that passing a lambda to the unique stable name builtin and passing
+  // it

[PATCH] D110324: clangd: Do not report inline overrides twice

2021-09-23 Thread Christian Kandeler via Phabricator via cfe-commits
ckandeler updated this revision to Diff 374526.
ckandeler added a comment.

Re-formatting, take two.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110324

Files:
  clang-tools-extra/clangd/XRefs.cpp
  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
@@ -1947,6 +1947,9 @@
   void $overridedecl[[func]]() override;
 };
 void Derived::$overridedef[[func]]() {}
+class Derived2 : public Base {
+  void $overridedef[[func]]() override {}
+};
 void test(Derived* D) {
   D->func();  // No references to the overrides.
 })cpp";
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1431,17 +1431,20 @@
 !OverriddenBy.Subjects.empty())
   Index->relations(
   OverriddenBy, [&](const SymbolID &Subject, const Symbol &Object) {
-if (auto LSPLoc =
-toLSPLocation(Object.CanonicalDeclaration, *MainFilePath)) 
{
+const auto LSPLocDecl =
+toLSPLocation(Object.CanonicalDeclaration, *MainFilePath);
+const auto LSPLocDef =
+toLSPLocation(Object.Definition, *MainFilePath);
+if (LSPLocDecl && LSPLocDecl != LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDecl);
   Result.Attributes =
   ReferencesResult::Declaration | ReferencesResult::Override;
   Results.References.push_back(std::move(Result));
 }
-if (auto LSPLoc = toLSPLocation(Object.Definition, *MainFilePath)) 
{
+if (LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDef);
   Result.Attributes = ReferencesResult::Declaration |
   ReferencesResult::Definition |
   ReferencesResult::Override;


Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -1947,6 +1947,9 @@
   void $overridedecl[[func]]() override;
 };
 void Derived::$overridedef[[func]]() {}
+class Derived2 : public Base {
+  void $overridedef[[func]]() override {}
+};
 void test(Derived* D) {
   D->func();  // No references to the overrides.
 })cpp";
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1431,17 +1431,20 @@
 !OverriddenBy.Subjects.empty())
   Index->relations(
   OverriddenBy, [&](const SymbolID &Subject, const Symbol &Object) {
-if (auto LSPLoc =
-toLSPLocation(Object.CanonicalDeclaration, *MainFilePath)) {
+const auto LSPLocDecl =
+toLSPLocation(Object.CanonicalDeclaration, *MainFilePath);
+const auto LSPLocDef =
+toLSPLocation(Object.Definition, *MainFilePath);
+if (LSPLocDecl && LSPLocDecl != LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDecl);
   Result.Attributes =
   ReferencesResult::Declaration | ReferencesResult::Override;
   Results.References.push_back(std::move(Result));
 }
-if (auto LSPLoc = toLSPLocation(Object.Definition, *MainFilePath)) {
+if (LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDef);
   Result.Attributes = ReferencesResult::Declaration |
   ReferencesResult::Definition |
   ReferencesResult::Override;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106550: [PowerPC] Allow MMA built-ins to accept restrict and volatile qualified pointers

2021-09-23 Thread Ahsan Saghir via Phabricator via cfe-commits
saghir updated this revision to Diff 374529.
saghir added a comment.

Changed approach for Sema checks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106550

Files:
  clang/lib/Sema/SemaChecking.cpp
  clang/test/Sema/ppc-pair-mma-types.c


Index: clang/test/Sema/ppc-pair-mma-types.c
===
--- clang/test/Sema/ppc-pair-mma-types.c
+++ clang/test/Sema/ppc-pair-mma-types.c
@@ -335,3 +335,23 @@
   __vector_pair vp = __builtin_vsx_lxvp(ll, v); // expected-error {{passing 
'__vector int' (vector of 4 'int' values) to parameter of incompatible type 
'const __vector_pair *'}}
   __builtin_vsx_stxvp(vp, ll, s);   // expected-error {{passing 
'unsigned short' to parameter of incompatible type 'const __vector_pair *'}}
 }
+
+void testRestrictQualifiedPointer1(int *__restrict acc) {
+  vector float arr[4];
+  __builtin_mma_disassemble_acc((void*)arr, acc); // expected-error {{passing 
'int *restrict' to parameter of incompatible type '__vector_quad *'}}
+}
+
+void testRestrictQualifiedPointer2(__vector_quad *__restrict acc) {
+  vector float arr[4];
+  __builtin_mma_disassemble_acc((void*)arr, acc);
+}
+
+void testVolatileQualifiedPointer1(int *__volatile acc) {
+  vector float arr[4];
+  __builtin_mma_disassemble_acc((void*)arr, acc); // expected-error {{passing 
'int *volatile' to parameter of incompatible type '__vector_quad *'}}
+}
+
+void testVolatileQualifiedPointer2(__vector_quad *__volatile acc) {
+  vector float arr[4];
+  __builtin_mma_disassemble_acc((void*)arr, acc);
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -7436,10 +7436,15 @@
 
 Expr *Arg = TheCall->getArg(ArgNum);
 QualType ArgType = Arg->getType();
+bool IsRestrictOrVolatile =
+ArgType.isRestrictQualified() || ArgType.isVolatileQualified();
 
 if ((ExpectedType->isVoidPointerType() && !ArgType->isPointerType()) ||
 (!ExpectedType->isVoidPointerType() &&
-   ArgType.getCanonicalType() != ExpectedType))
+ ((IsRestrictOrVolatile &&
+   ArgType.getCanonicalType().getUnqualifiedType() != ExpectedType) ||
+  (!IsRestrictOrVolatile &&
+   ArgType.getCanonicalType() != ExpectedType
   return Diag(Arg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
  << ArgType << ExpectedType << 1 << 0 << 0;
 


Index: clang/test/Sema/ppc-pair-mma-types.c
===
--- clang/test/Sema/ppc-pair-mma-types.c
+++ clang/test/Sema/ppc-pair-mma-types.c
@@ -335,3 +335,23 @@
   __vector_pair vp = __builtin_vsx_lxvp(ll, v); // expected-error {{passing '__vector int' (vector of 4 'int' values) to parameter of incompatible type 'const __vector_pair *'}}
   __builtin_vsx_stxvp(vp, ll, s);   // expected-error {{passing 'unsigned short' to parameter of incompatible type 'const __vector_pair *'}}
 }
+
+void testRestrictQualifiedPointer1(int *__restrict acc) {
+  vector float arr[4];
+  __builtin_mma_disassemble_acc((void*)arr, acc); // expected-error {{passing 'int *restrict' to parameter of incompatible type '__vector_quad *'}}
+}
+
+void testRestrictQualifiedPointer2(__vector_quad *__restrict acc) {
+  vector float arr[4];
+  __builtin_mma_disassemble_acc((void*)arr, acc);
+}
+
+void testVolatileQualifiedPointer1(int *__volatile acc) {
+  vector float arr[4];
+  __builtin_mma_disassemble_acc((void*)arr, acc); // expected-error {{passing 'int *volatile' to parameter of incompatible type '__vector_quad *'}}
+}
+
+void testVolatileQualifiedPointer2(__vector_quad *__volatile acc) {
+  vector float arr[4];
+  __builtin_mma_disassemble_acc((void*)arr, acc);
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -7436,10 +7436,15 @@
 
 Expr *Arg = TheCall->getArg(ArgNum);
 QualType ArgType = Arg->getType();
+bool IsRestrictOrVolatile =
+ArgType.isRestrictQualified() || ArgType.isVolatileQualified();
 
 if ((ExpectedType->isVoidPointerType() && !ArgType->isPointerType()) ||
 (!ExpectedType->isVoidPointerType() &&
-   ArgType.getCanonicalType() != ExpectedType))
+ ((IsRestrictOrVolatile &&
+   ArgType.getCanonicalType().getUnqualifiedType() != ExpectedType) ||
+  (!IsRestrictOrVolatile &&
+   ArgType.getCanonicalType() != ExpectedType
   return Diag(Arg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
  << ArgType << ExpectedType << 1 << 0 << 0;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D110324: clangd: Do not report inline overrides twice

2021-09-23 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110324

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


[PATCH] D110282: [PowerPC] SemaChecking for darn family of builtins

2021-09-23 Thread Lei Huang via Phabricator via cfe-commits
lei accepted this revision as: lei.
lei added a comment.
This revision is now accepted and ready to land.

LGTM.
Pleases address the test issue on commit.




Comment at: clang/test/CodeGen/builtins-ppc-xlcompat-darn-32.c:13
+int testdarn_32(void) {
+  return __darn_32();
+}

Isn't this valid for both 32 and 64bit?
Maybe change one of the run lines above to a 64bit test.


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

https://reviews.llvm.org/D110282

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


[PATCH] D107647: [PowerPC] MMA - Add __builtin_vsx_build_pair and __builtin_mma_build_acc builtins

2021-09-23 Thread Lei Huang via Phabricator via cfe-commits
lei accepted this revision.
lei added a comment.
This revision is now accepted and ready to land.

LGTM once the code is simplified as Nemanja suggested.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107647

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


[PATCH] D110324: clangd: Do not report inline overrides twice

2021-09-23 Thread Christian Kandeler via Phabricator via cfe-commits
ckandeler added a comment.

Can you please merge it, too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110324

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


[PATCH] D109710: [PowerPC] Add range checks for P10 Vector Builtins

2021-09-23 Thread Lei Huang via Phabricator via cfe-commits
lei accepted this revision as: lei.
lei added a comment.
This revision is now accepted and ready to land.

LGTM
Please add comment to tc upon commit.




Comment at: clang/test/CodeGen/builtins-ppc-p10vector.c:1417
 
+vector signed int test_vec_vec_splati_ins_range(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1

nit: pleases add a comment here explaining behaviour for when param 2 is out of 
expected value range.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109710

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


[PATCH] D110257: [CFE][Codegen] Do not break the contiguity of static allocas.

2021-09-23 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

Pls make sure the patch passes internal CI. Thanks.




Comment at: clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp:264
 // CHECK1:   omp.inner.for.cond:
-// CHECK1-NEXT:[[TMP7:%.*]] = load i32, i32* [[DOTOMP_IV]], align 4
-// CHECK1-NEXT:[[TMP8:%.*]] = load i32, i32* [[DOTOMP_UB]], align 4
+// CHECK1-NEXT:[[TMP7:%.*]] = load i32, i32* [[DOTOMP_IV]], align 4, 
!llvm.access.group !15
+// CHECK1-NEXT:[[TMP8:%.*]] = load i32, i32* [[DOTOMP_UB]], align 4, 
!llvm.access.group !15

Is the test updated by a script? If the original test does not check 
!llvm.access.group, the updated test should not check it either. This makes the 
test less stable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110257

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


[PATCH] D108643: Introduce _BitInt, deprecate _ExtInt

2021-09-23 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

FYI: @craig.topper noticed my ping above and tells me he at least doesn't agree 
with my understanding of the hallway discussion we had a few years ago.  I am 
hopeful he can correct my memory/interpretation of the conversation.


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

https://reviews.llvm.org/D108643

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


[clang-tools-extra] eb209c1 - clangd: Do not report inline overrides twice

2021-09-23 Thread Sam McCall via cfe-commits

Author: Christian Kandeler
Date: 2021-09-23T16:09:13+02:00
New Revision: eb209c13cce99b1ad8d8e619bf2006f4376ed1ef

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

LOG: clangd: Do not report inline overrides twice

... in textDocument/references.

Reviewed By: sammccall

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

Added: 


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

Removed: 




diff  --git a/clang-tools-extra/clangd/XRefs.cpp 
b/clang-tools-extra/clangd/XRefs.cpp
index 4cec85e20ad6..ea61cba460ef 100644
--- a/clang-tools-extra/clangd/XRefs.cpp
+++ b/clang-tools-extra/clangd/XRefs.cpp
@@ -1431,17 +1431,20 @@ ReferencesResult findReferences(ParsedAST &AST, 
Position Pos, uint32_t Limit,
 !OverriddenBy.Subjects.empty())
   Index->relations(
   OverriddenBy, [&](const SymbolID &Subject, const Symbol &Object) {
-if (auto LSPLoc =
-toLSPLocation(Object.CanonicalDeclaration, *MainFilePath)) 
{
+const auto LSPLocDecl =
+toLSPLocation(Object.CanonicalDeclaration, *MainFilePath);
+const auto LSPLocDef =
+toLSPLocation(Object.Definition, *MainFilePath);
+if (LSPLocDecl && LSPLocDecl != LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDecl);
   Result.Attributes =
   ReferencesResult::Declaration | ReferencesResult::Override;
   Results.References.push_back(std::move(Result));
 }
-if (auto LSPLoc = toLSPLocation(Object.Definition, *MainFilePath)) 
{
+if (LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDef);
   Result.Attributes = ReferencesResult::Declaration |
   ReferencesResult::Definition |
   ReferencesResult::Override;

diff  --git a/clang-tools-extra/clangd/unittests/XRefsTests.cpp 
b/clang-tools-extra/clangd/unittests/XRefsTests.cpp
index 166e0674afea..6a9d355792a6 100644
--- a/clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ b/clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -1947,6 +1947,9 @@ TEST(FindReferences, IncludeOverrides) {
   void $overridedecl[[func]]() override;
 };
 void Derived::$overridedef[[func]]() {}
+class Derived2 : public Base {
+  void $overridedef[[func]]() override {}
+};
 void test(Derived* D) {
   D->func();  // No references to the overrides.
 })cpp";



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


[PATCH] D110324: clangd: Do not report inline overrides twice

2021-09-23 Thread Sam McCall via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeb209c13cce9: clangd: Do not report inline overrides twice 
(authored by ckandeler, committed by sammccall).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110324

Files:
  clang-tools-extra/clangd/XRefs.cpp
  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
@@ -1947,6 +1947,9 @@
   void $overridedecl[[func]]() override;
 };
 void Derived::$overridedef[[func]]() {}
+class Derived2 : public Base {
+  void $overridedef[[func]]() override {}
+};
 void test(Derived* D) {
   D->func();  // No references to the overrides.
 })cpp";
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1431,17 +1431,20 @@
 !OverriddenBy.Subjects.empty())
   Index->relations(
   OverriddenBy, [&](const SymbolID &Subject, const Symbol &Object) {
-if (auto LSPLoc =
-toLSPLocation(Object.CanonicalDeclaration, *MainFilePath)) 
{
+const auto LSPLocDecl =
+toLSPLocation(Object.CanonicalDeclaration, *MainFilePath);
+const auto LSPLocDef =
+toLSPLocation(Object.Definition, *MainFilePath);
+if (LSPLocDecl && LSPLocDecl != LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDecl);
   Result.Attributes =
   ReferencesResult::Declaration | ReferencesResult::Override;
   Results.References.push_back(std::move(Result));
 }
-if (auto LSPLoc = toLSPLocation(Object.Definition, *MainFilePath)) 
{
+if (LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDef);
   Result.Attributes = ReferencesResult::Declaration |
   ReferencesResult::Definition |
   ReferencesResult::Override;


Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -1947,6 +1947,9 @@
   void $overridedecl[[func]]() override;
 };
 void Derived::$overridedef[[func]]() {}
+class Derived2 : public Base {
+  void $overridedef[[func]]() override {}
+};
 void test(Derived* D) {
   D->func();  // No references to the overrides.
 })cpp";
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1431,17 +1431,20 @@
 !OverriddenBy.Subjects.empty())
   Index->relations(
   OverriddenBy, [&](const SymbolID &Subject, const Symbol &Object) {
-if (auto LSPLoc =
-toLSPLocation(Object.CanonicalDeclaration, *MainFilePath)) {
+const auto LSPLocDecl =
+toLSPLocation(Object.CanonicalDeclaration, *MainFilePath);
+const auto LSPLocDef =
+toLSPLocation(Object.Definition, *MainFilePath);
+if (LSPLocDecl && LSPLocDecl != LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDecl);
   Result.Attributes =
   ReferencesResult::Declaration | ReferencesResult::Override;
   Results.References.push_back(std::move(Result));
 }
-if (auto LSPLoc = toLSPLocation(Object.Definition, *MainFilePath)) {
+if (LSPLocDef) {
   ReferencesResult::Reference Result;
-  Result.Loc = std::move(*LSPLoc);
+  Result.Loc = std::move(*LSPLocDef);
   Result.Attributes = ReferencesResult::Declaration |
   ReferencesResult::Definition |
   ReferencesResult::Override;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109437: [PowerPC] FP compare and test XL compat builtins.

2021-09-23 Thread Lei Huang via Phabricator via cfe-commits
lei requested changes to this revision.
lei added inline comments.
This revision now requires changes to proceed.



Comment at: clang/include/clang/Sema/Sema.h:12680
   bool CheckPPCMMAType(QualType Type, SourceLocation TypeLoc);
+  bool CheckPPCTestDataClassType(CallExpr *TheCall);
 

need to remove.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:16039-16040
+  case PPC::BI__builtin_ppc_test_data_class:
+Value *ArgValue = EmitScalarExpr(E->getArg(0));
+llvm::Type *ArgType = ArgValue->getType();
+unsigned Int;

`ArgValue` is only used one so not needed. 
```
llvm::Type *ArgType = EmitScalarExpr(E->getArg(0))->getType();
```




Comment at: clang/lib/CodeGen/CGBuiltin.cpp:16041
+llvm::Type *ArgType = ArgValue->getType();
+unsigned Int;
+if (ArgType->isDoubleTy()) {

variables should be discriptive of what they represent.  This is no diff then a 
single char variable 🙂
```
unsigned IntrinsicID;
```



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:16042
+unsigned Int;
+if (ArgType->isDoubleTy()) {
+  Int = Intrinsic::ppc_test_data_class_d;

braces here are redundant.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:16050
+Function *F = CGM.getIntrinsic(Int);
+return Builder.CreateCall(F, Ops, "test_data_class");
   }

Try to refrain from def one-time use variables.
```
return Builder.CreateCall(CGM.getIntrinsic(Int), Ops, "test_data_class");
```



Comment at: clang/lib/Sema/SemaChecking.cpp:3492
+  Diag(TheCall->getBeginLoc(), diag::err_ppc_invalid_test_data_class_type);
+  ArgTypeIsInvalid = true;
+}

I'm not sure this is needed... can't we just `return true` here since this is a 
`S` error?



Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:10382-10383
+switch (IntrinsicID) {
+default:
+  llvm_unreachable("Unknown Intrinsic");
+case Intrinsic::ppc_compare_exp_lt:

I dont' think this is needed since you will only be here if he IntrinsicID 
matches the lines listed prior to this block.



Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:10397-10398
+}
+SDValue Op1 = Op.getOperand(1);
+SDValue Op2 = Op.getOperand(2);
+SDValue Ops[]{

one time used variables can be removed.



Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:10408-10417
+switch (IntrinsicID) {
+default:
+  llvm_unreachable("Unknown Intrinsic");
+case Intrinsic::ppc_test_data_class_d:
+  CmprOpc = PPC::XSTSTDCDP;
+  break;
+case Intrinsic::ppc_test_data_class_f:

this can just be an if/else since you won't be in this block unless the 
IntrisicID are `ppc_test_data_class_[d|f]`
```
unsigned CmprOpc = PPC::XSTSTDCDP;
if (IntrinsicID == Intrinsic::ppc_test_data_class_f)
  CmprOpc = PPC::XSTSTDCSP;
```



Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:10419
+SDValue Op1 = Op.getOperand(2);
+SDValue Op2 = Op.getOperand(1);
+SDValue Ops[]{

one-time use variable.  Can be merged into the call below.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109437

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


[PATCH] D110257: [CFE][Codegen] Do not break the contiguity of static allocas.

2021-09-23 Thread Mahesha S via Phabricator via cfe-commits
hsmhsm added inline comments.



Comment at: clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp:264
 // CHECK1:   omp.inner.for.cond:
-// CHECK1-NEXT:[[TMP7:%.*]] = load i32, i32* [[DOTOMP_IV]], align 4
-// CHECK1-NEXT:[[TMP8:%.*]] = load i32, i32* [[DOTOMP_UB]], align 4
+// CHECK1-NEXT:[[TMP7:%.*]] = load i32, i32* [[DOTOMP_IV]], align 4, 
!llvm.access.group !15
+// CHECK1-NEXT:[[TMP8:%.*]] = load i32, i32* [[DOTOMP_UB]], align 4, 
!llvm.access.group !15

yaxunl wrote:
> Is the test updated by a script? If the original test does not check 
> !llvm.access.group, the updated test should not check it either. This makes 
> the test less stable.
Yes, most of the tests here are updated by script only. Probably I might have 
missed few command line options to the script. I have not passed any option to 
the script while updating it. Let me check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110257

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


[PATCH] D110324: clangd: Do not report inline overrides twice

2021-09-23 Thread Christian Kandeler via Phabricator via cfe-commits
ckandeler added a comment.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110324

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


RE: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple-template-names={simple,mangled}

2021-09-23 Thread via cfe-commits
Resending to cfe-commits instead of llvm-commits (doh!).

> -Original Message-
> From: Robinson, Paul
> Sent: Thursday, September 23, 2021 10:05 AM
> To: David Blaikie ; 'llvm-comm...@lists.llvm.org'
> 
> Cc: Adrian Prantl ; Jonas Devlieghere
> 
> Subject: RE: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple-
> template-names={simple,mangled}
> 
> -gsimple-template-names=mangled seems like a testing feature?
> That would be parseable only by llvm-dwarfdump...
> In which case it seems like it should be a -cc1 option not a
> driver option.
> --paulr
> 
> > -Original Message-
> > From: cfe-commits  On Behalf Of
> David
> > Blaikie via cfe-commits
> > Sent: Wednesday, September 22, 2021 2:12 PM
> > To: cfe-commits@lists.llvm.org
> > Subject: [clang] 38c09ea - DebugInfo: Add (initially no-op) -gsimple-
> > template-names={simple,mangled}
> >
> >
> > Author: David Blaikie
> > Date: 2021-09-22T11:11:49-07:00
> > New Revision: 38c09ea2d279eabe3602e2002f8cdfcc5380
> >
> > URL: https://urldefense.com/v3/__https://github.com/llvm/llvm-
> >
> project/commit/38c09ea2d279eabe3602e2002f8cdfcc5380__;!!JmoZiZGBv3RvKR
> > Sx!sx4rLw3CFwdj-rfDEK1Ah3HnANZSLOpXYFIcie1Oiyili8LKwFHxFk-g0F7-Z2pXAg$
> > DIFF: https://urldefense.com/v3/__https://github.com/llvm/llvm-
> >
> project/commit/38c09ea2d279eabe3602e2002f8cdfcc5380.diff__;!!JmoZiZGBv
> > 3RvKRSx!sx4rLw3CFwdj-rfDEK1Ah3HnANZSLOpXYFIcie1Oiyili8LKwFHxFk-
> > g0F4WQP9bxA$
> >
> > LOG: DebugInfo: Add (initially no-op) -gsimple-template-
> > names={simple,mangled}
> >
> > This is to build the foundation of a new debug info feature to use only
> > the base name of template as its debug info name (eg: "t1" instead of
> > the full "t1"). The intent being that a consumer can still retrieve
> > all that information from the DW_TAG_template_*_parameters.
> >
> > So gno-simple-template-names is business as usual/previously ("t1")
> >=simple is the simplified name ("t1")
> >=mangled is a special mode to communicate the full information, but
> >also indicate that the name should be able to be simplified. The data
> >is encoded as "_STNt1|" which will be matched with an
> >llvm-dwarfdump --verify feature to deconstruct this name, rebuild the
> >original name, and then try to rebuild the simple name via the DWARF
> >tags - then compare the latter and the former to ensure that all the
> >data necessary to fully rebuild the name is present.
> >
> > Added:
> >
> >
> > Modified:
> > clang/include/clang/Basic/CodeGenOptions.def
> > clang/include/clang/Basic/DebugInfoOptions.h
> > clang/include/clang/Driver/Options.td
> > clang/lib/Driver/ToolChains/Clang.cpp
> > clang/lib/Frontend/CompilerInvocation.cpp
> > clang/test/Driver/debug-options.c
> >
> > Removed:
> >
> >
> >
> >
> ##
> > ##
> > diff  --git a/clang/include/clang/Basic/CodeGenOptions.def
> > b/clang/include/clang/Basic/CodeGenOptions.def
> > index 37900bf3ead1..5d1d4f9dc58e 100644
> > --- a/clang/include/clang/Basic/CodeGenOptions.def
> > +++ b/clang/include/clang/Basic/CodeGenOptions.def
> > @@ -320,6 +320,12 @@ CODEGENOPT(DebugFwdTemplateParams, 1, 0) ///<
> Whether
> > to emit complete
> >   ///< template parameter
> > descriptions in
> >   ///< forward declarations
> > (versus just
> >   ///< including them in the
> > name).
> > +ENUM_CODEGENOPT(DebugSimpleTemplateNames,
> > codegenoptions::DebugTemplateNamesKind, 2,
> > codegenoptions::DebugTemplateNamesKind::Full) ///< Whether to emit
> > template parameters
> > +   ///< in the textual names of
> > template
> > +  ///< specializations.
> > +  ///< Implies DebugFwdTemplateNames to
> > +  ///< allow decorated names to be
> > +  ///< reconstructed when needed.
> >  CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize
> use-
> > lists.
> >
> >  CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-
> program
> >
> > diff  --git a/clang/include/clang/Basic/DebugInfoOptions.h
> > b/clang/include/clang/Basic/DebugInfoOptions.h
> > index c1259d7797db..a99a2b5903d7 100644
> > --- a/clang/include/clang/Basic/DebugInfoOptions.h
> > +++ b/clang/include/clang/Basic/DebugInfoOptions.h
> > @@ -54,6 +54,12 @@ enum DebugInfoKind {
> >UnusedTypeInfo,
> >  };
> >
> > +enum class DebugTemplateNamesKind {
> > +  Full,
> > +  Simple,
> > +  Mangled
> > +};
> > +
> >  } // end namespace codegenoptions
> >  } // end namespace clang
> >
> >
> > diff  --git a/clang/include/clang/Driver/Options.td
> > b/clang/include/clang/Driver/Options.td
> > index f0932a0bd1de..13d740cdb0fb 100644
> > --- a/clang/include/cla

[PATCH] D108696: [Coroutines] [Frontend] Lookup in std namespace first

2021-09-23 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

This sounds more reasonable to me, however we need to ship `` in 
libc++ before we enable this, or else we're going to start suggesting that 
users include `` when we don't have it.




Comment at: clang/lib/Sema/SemaCoroutine.cpp:1668
+if (!CoroNamespace || !LookupQualifiedName(Result, CoroNamespace)) {
+  /// TODO: Lookup in std::expeirmental namespace for compability.
+  /// Remove this once users get familiar with coroutine under std





Comment at: clang/lib/Sema/SemaCoroutine.cpp:1677
   }
+  /// TODO: Add warning here once we updates libcxx.
+}

Add a warning about what?



Comment at: clang/test/SemaCXX/coroutines-exp-namespace.cpp:2
+// This file is the same with coroutines.cpp except the coroutine components 
are defined in std::experimental namespace.
+// This intention of this test is to make sure the legacy imeplementation in 
std::experimental namespace could work.
+// TODO: Remove this test once we didn't support




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

https://reviews.llvm.org/D108696

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


[PATCH] D110315: [Sema] Fix a null pointer reference crash.

2021-09-23 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 374538.
hokein added a comment.

upload a minimized testcase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110315

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaCXX/rounding-math-crash.cpp


Index: clang/test/SemaCXX/rounding-math-crash.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/rounding-math-crash.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -frounding-math -verify %s
+
+template  b::a() {}  // expected-error {{nested name specifier}}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -14493,7 +14493,7 @@
   FunctionScopeInfo *FSI = getCurFunction();
   FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr;
 
-  if (FSI->UsesFPIntrin && !FD->hasAttr())
+  if (FSI->UsesFPIntrin && FD && !FD->hasAttr())
 FD->addAttr(StrictFPAttr::CreateImplicit(Context));
 
   sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();


Index: clang/test/SemaCXX/rounding-math-crash.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/rounding-math-crash.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -frounding-math -verify %s
+
+template  b::a() {}  // expected-error {{nested name specifier}}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -14493,7 +14493,7 @@
   FunctionScopeInfo *FSI = getCurFunction();
   FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr;
 
-  if (FSI->UsesFPIntrin && !FD->hasAttr())
+  if (FSI->UsesFPIntrin && FD && !FD->hasAttr())
 FD->addAttr(StrictFPAttr::CreateImplicit(Context));
 
   sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110282: [PowerPC] SemaChecking for darn family of builtins

2021-09-23 Thread Albion Fung via Phabricator via cfe-commits
Conanap added inline comments.



Comment at: clang/test/CodeGen/builtins-ppc-xlcompat-darn-32.c:13
+int testdarn_32(void) {
+  return __darn_32();
+}

lei wrote:
> Isn't this valid for both 32 and 64bit?
> Maybe change one of the run lines above to a 64bit test.
It is indeed valid for both 32 bit and 64 bit; there is already a runline for 
64 bit in the `clang/test/CodeGen/builtins-ppc-xlcompat-darn.c` test case 
(which includes `__darn_32`, which is why I didn't include it here.


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

https://reviews.llvm.org/D110282

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


[PATCH] D110282: [PowerPC] SemaChecking for darn family of builtins

2021-09-23 Thread Amy Kwan via Phabricator via cfe-commits
amyk added inline comments.



Comment at: clang/test/CodeGen/builtins-ppc-xlcompat-darn-32.c:13
+int testdarn_32(void) {
+  return __darn_32();
+}

lei wrote:
> Isn't this valid for both 32 and 64bit?
> Maybe change one of the run lines above to a 64bit test.
I agree. I thought __darn_32 is both 32-bit and 64-bit.


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

https://reviews.llvm.org/D110282

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


[PATCH] D110282: [PowerPC] SemaChecking for darn family of builtins

2021-09-23 Thread Amy Kwan via Phabricator via cfe-commits
amyk added inline comments.



Comment at: clang/test/CodeGen/builtins-ppc-xlcompat-darn-32.c:13
+int testdarn_32(void) {
+  return __darn_32();
+}

Conanap wrote:
> amyk wrote:
> > lei wrote:
> > > Isn't this valid for both 32 and 64bit?
> > > Maybe change one of the run lines above to a 64bit test.
> > I agree. I thought __darn_32 is both 32-bit and 64-bit.
> It is indeed valid for both 32 bit and 64 bit; there is already a runline for 
> 64 bit in the `clang/test/CodeGen/builtins-ppc-xlcompat-darn.c` test case 
> (which includes `__darn_32`, which is why I didn't include it here.
You removed `__darn_32` from that file, so maybe we should add it back. And 
also, adjust the description of the patch to say that `__darn_32` is available 
for 32 and 64-bit.


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

https://reviews.llvm.org/D110282

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


[PATCH] D110315: [Sema] Fix a null pointer reference crash.

2021-09-23 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clang/lib/Sema/SemaDecl.cpp:14496
 
-  if (FSI->UsesFPIntrin && !FD->hasAttr())
+  if (FSI->UsesFPIntrin && FD && !FD->hasAttr())
 FD->addAttr(StrictFPAttr::CreateImplicit(Context));

sammccall wrote:
> hokein wrote:
> > I have a reproduce test case, and wait for the creduce to minimize it (will 
> > add it once creduce finishes)
> > 
> > I think the bug is obvious,  by reading the code on the line 14495, FD 
> > could be a nullptr.  
> Yes, the bug is clear.
> It's not obvious to me that the fix is right, because I don't know:
>  - when dcl can be null
>  - when/if dcl can be non-null but neither a function nor function template
>  - how the FP attr should apply in such cases
> 
> cc @mibintc who may know the answer to at least the 3rd question, and I guess 
> your testcase will give an example of either 1 or 2.
> 
> I'm *fairly* sure that not applying the strictfpattr is better than crashing 
> here though.
my understanding is that dcl is `null` if clang fails to to parse the function 
declarator in some way, but still can recover to parse the function body.
The testcase shows it happens for a broken function template. I think it is 
fine to not apply attr, since the ast node is broken and likely discarded 
afterwards

I'm going to land this patch now as this issue blocks one of our internal 
tools, @mibintc feel free to polish it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110315

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


[clang] 3778c1c - [Sema] Fix a null pointer reference crash.

2021-09-23 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2021-09-23T16:37:37+02:00
New Revision: 3778c1cd6ef5a3286d5d49e842a2c65fffb8f3a6

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

LOG: [Sema] Fix a null pointer reference crash.

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

Added: 
clang/test/SemaCXX/rounding-math-crash.cpp

Modified: 
clang/lib/Sema/SemaDecl.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 79080098026c6..db7c9f9418042 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -14493,7 +14493,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt 
*Body,
   FunctionScopeInfo *FSI = getCurFunction();
   FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr;
 
-  if (FSI->UsesFPIntrin && !FD->hasAttr())
+  if (FSI->UsesFPIntrin && FD && !FD->hasAttr())
 FD->addAttr(StrictFPAttr::CreateImplicit(Context));
 
   sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();

diff  --git a/clang/test/SemaCXX/rounding-math-crash.cpp 
b/clang/test/SemaCXX/rounding-math-crash.cpp
new file mode 100644
index 0..32f1fc0f792c3
--- /dev/null
+++ b/clang/test/SemaCXX/rounding-math-crash.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -frounding-math -verify %s
+
+template  b::a() {}  // expected-error {{nested name specifier}}



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


[PATCH] D110315: [Sema] Fix a null pointer reference crash.

2021-09-23 Thread Haojian Wu via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3778c1cd6ef5: [Sema] Fix a null pointer reference crash. 
(authored by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110315

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaCXX/rounding-math-crash.cpp


Index: clang/test/SemaCXX/rounding-math-crash.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/rounding-math-crash.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -frounding-math -verify %s
+
+template  b::a() {}  // expected-error {{nested name specifier}}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -14493,7 +14493,7 @@
   FunctionScopeInfo *FSI = getCurFunction();
   FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr;
 
-  if (FSI->UsesFPIntrin && !FD->hasAttr())
+  if (FSI->UsesFPIntrin && FD && !FD->hasAttr())
 FD->addAttr(StrictFPAttr::CreateImplicit(Context));
 
   sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();


Index: clang/test/SemaCXX/rounding-math-crash.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/rounding-math-crash.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -frounding-math -verify %s
+
+template  b::a() {}  // expected-error {{nested name specifier}}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -14493,7 +14493,7 @@
   FunctionScopeInfo *FSI = getCurFunction();
   FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr;
 
-  if (FSI->UsesFPIntrin && !FD->hasAttr())
+  if (FSI->UsesFPIntrin && FD && !FD->hasAttr())
 FD->addAttr(StrictFPAttr::CreateImplicit(Context));
 
   sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110260: [ORC] Minor renaming and typo fixes (NFC)

2021-09-23 Thread Stefan Gränitz via Phabricator via cfe-commits
sgraenitz added a comment.

Thanks @xgupta for your note! The parameter passed to 
`EPCIndirectionUtils::Create()` in the example was referencing a moved-from 
value. This caused the segfault. Unfortunately, the examples don't have good 
test coverage so far.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110260

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


[PATCH] D109902: [PowerPC] Improved codegen related to xscvdpsxws/xscvdpuxws

2021-09-23 Thread Amy Kwan via Phabricator via cfe-commits
amyk added inline comments.



Comment at: llvm/lib/Target/PowerPC/PPCInstrVSX.td:2815
+def : Pat<(v4i32 (PPCSToV DblToUInt.A)),
+  (v4i32 (SUBREG_TO_REG (i64 1), (XSCVDPSXWS f64:$A), sub_64))>;
 defm : ScalToVecWPermute<

This should be `XSCVDPUXWS`?



Comment at: llvm/test/CodeGen/PowerPC/test-vector-insert.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; xscvdpsxws and uxws is only available on Power7 and above
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \

nit: Move this comment under the RUN lines.



Comment at: llvm/test/CodeGen/PowerPC/test-vector-insert.ll:3
+; xscvdpsxws and uxws is only available on Power7 and above
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:  -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-LE

I'm not sure why P8 is LE run only line, and P7 is BE run line only. 
Maybe we should have LE/BE run lines for both P7 and P8 for more coverage. 
Furthermore, if both the LE/BE checks end up the same, we can do `CHECK-P7` and 
`CHECK-P8`. 

Also, since this looks like it's a Linux test, please add 
`-ppc-asm-full-reg-names -ppc-vsr-nums-as-vr`.



Comment at: llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i32_elts.ll:16
 ; CHECK-P8-NEXT:xxswapd vs0, v2
-; CHECK-P8-NEXT:xscvdpuxws f1, v2
-; CHECK-P8-NEXT:xscvdpuxws f0, f0
-; CHECK-P8-NEXT:mffprwz r3, f1
-; CHECK-P8-NEXT:mtvsrwz v2, r3
-; CHECK-P8-NEXT:mffprwz r4, f0
-; CHECK-P8-NEXT:mtvsrwz v3, r4
+; CHECK-P8-NEXT:xscvdpsxws v2, v2
+; CHECK-P8-NEXT:xscvdpsxws v3, f0

This is an unsigned test case, so should be `xscvdpuxws`, right?


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

https://reviews.llvm.org/D109902

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


[PATCH] D109710: [PowerPC] Add range checks for P10 Vector Builtins

2021-09-23 Thread Amy Kwan via Phabricator via cfe-commits
amyk accepted this revision as: amyk.
amyk added a comment.

LGTM as long as Lei's comment is addressed. Thanks Quinn!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109710

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


[clang] 8ecf366 - Fix buildbot error.

2021-09-23 Thread Haojian Wu via cfe-commits

Author: Haojian Wu
Date: 2021-09-23T17:04:46+02:00
New Revision: 8ecf3660f2de3b88d10db0fd52d0bc80bda33dcc

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

LOG: Fix buildbot error.

-frounding-math is not available for all targets.

Added: 


Modified: 
clang/test/SemaCXX/rounding-math-crash.cpp

Removed: 




diff  --git a/clang/test/SemaCXX/rounding-math-crash.cpp 
b/clang/test/SemaCXX/rounding-math-crash.cpp
index 32f1fc0f792c..fb45d236b41b 100644
--- a/clang/test/SemaCXX/rounding-math-crash.cpp
+++ b/clang/test/SemaCXX/rounding-math-crash.cpp
@@ -1,3 +1,3 @@
-// RUN: %clang_cc1 -fsyntax-only -frounding-math -verify %s
+// RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -frounding-math -verify 
%s
 
 template  b::a() {}  // expected-error {{nested name specifier}}



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


[PATCH] D110315: [Sema] Fix a null pointer reference crash.

2021-09-23 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Arm Mac: http://45.33.8.238/macm1/18463/step_7.txt


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110315

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


[PATCH] D110273: [PowerPC] Fix lharx and lbarx builtin signatures

2021-09-23 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 374556.
Conanap added a comment.

Added test cases


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

https://reviews.llvm.org/D110273

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c


Index: clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
===
--- clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
+++ clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
@@ -46,3 +46,18 @@
   // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later 
CPUs
   return __sthcx(a, val);
 }
+
+// extra test cases that previously caused error during usage
+int test_lharx_intret(volatile short *a) {
+  // CHECK-LABEL: @test_lharx_intret
+  // CHECK: %0 = tail call i16 asm sideeffect "lharx $0, ${1:y}", 
"=r,*Z,~{memory}"(i16* %a)
+  // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later 
CPUs
+  return __lharx(a);
+}
+
+int test_lbarx_intret(volatile char *a) {
+  // CHECK-LABEL: @test_lbarx_intret
+  // CHECK: %0 = tail call i8 asm sideeffect "lbarx $0, ${1:y}", 
"=r,*Z,~{memory}"(i8* %a)
+  // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later 
CPUs
+  return __lbarx(a);
+}
Index: clang/include/clang/Basic/BuiltinsPPC.def
===
--- clang/include/clang/Basic/BuiltinsPPC.def
+++ clang/include/clang/Basic/BuiltinsPPC.def
@@ -74,8 +74,8 @@
 BUILTIN(__builtin_ppc_fetch_and_swaplp, "ULiULiD*ULi", "")
 BUILTIN(__builtin_ppc_ldarx, "LiLiD*", "")
 BUILTIN(__builtin_ppc_lwarx, "iiD*", "")
-BUILTIN(__builtin_ppc_lharx, "isD*", "")
-BUILTIN(__builtin_ppc_lbarx, "UiUcD*", "")
+BUILTIN(__builtin_ppc_lharx, "ssD*", "")
+BUILTIN(__builtin_ppc_lbarx, "ccD*", "")
 BUILTIN(__builtin_ppc_stdcx, "iLiD*Li", "")
 BUILTIN(__builtin_ppc_stwcx, "iiD*i", "")
 BUILTIN(__builtin_ppc_sthcx, "isD*s", "")


Index: clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
===
--- clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
+++ clang/test/CodeGen/builtins-ppc-xlcompat-LoadReseve-StoreCond.c
@@ -46,3 +46,18 @@
   // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later CPUs
   return __sthcx(a, val);
 }
+
+// extra test cases that previously caused error during usage
+int test_lharx_intret(volatile short *a) {
+  // CHECK-LABEL: @test_lharx_intret
+  // CHECK: %0 = tail call i16 asm sideeffect "lharx $0, ${1:y}", "=r,*Z,~{memory}"(i16* %a)
+  // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later CPUs
+  return __lharx(a);
+}
+
+int test_lbarx_intret(volatile char *a) {
+  // CHECK-LABEL: @test_lbarx_intret
+  // CHECK: %0 = tail call i8 asm sideeffect "lbarx $0, ${1:y}", "=r,*Z,~{memory}"(i8* %a)
+  // CHECK-NON-PWR8-ERR:  error: this builtin is only valid on POWER8 or later CPUs
+  return __lbarx(a);
+}
Index: clang/include/clang/Basic/BuiltinsPPC.def
===
--- clang/include/clang/Basic/BuiltinsPPC.def
+++ clang/include/clang/Basic/BuiltinsPPC.def
@@ -74,8 +74,8 @@
 BUILTIN(__builtin_ppc_fetch_and_swaplp, "ULiULiD*ULi", "")
 BUILTIN(__builtin_ppc_ldarx, "LiLiD*", "")
 BUILTIN(__builtin_ppc_lwarx, "iiD*", "")
-BUILTIN(__builtin_ppc_lharx, "isD*", "")
-BUILTIN(__builtin_ppc_lbarx, "UiUcD*", "")
+BUILTIN(__builtin_ppc_lharx, "ssD*", "")
+BUILTIN(__builtin_ppc_lbarx, "ccD*", "")
 BUILTIN(__builtin_ppc_stdcx, "iLiD*Li", "")
 BUILTIN(__builtin_ppc_stwcx, "iiD*i", "")
 BUILTIN(__builtin_ppc_sthcx, "isD*s", "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109710: [PowerPC] Add range checks for P10 Vector Builtins

2021-09-23 Thread Quinn Pham via Phabricator via cfe-commits
quinnp updated this revision to Diff 374561.
quinnp added a comment.

Added a comment to the out-of-range argument test case to describe the 
behaviour.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109710

Files:
  clang/lib/Headers/altivec.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtins-ppc-p10vector-error.c
  clang/test/CodeGen/builtins-ppc-p10vector.c

Index: clang/test/CodeGen/builtins-ppc-p10vector.c
===
--- clang/test/CodeGen/builtins-ppc-p10vector.c
+++ clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -1370,10 +1370,12 @@
 }
 
 vector signed int test_vec_vec_splati_ins_si(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1383,10 +1385,12 @@
 }
 
 vector unsigned int test_vec_vec_splati_ins_ui(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1396,10 +1400,12 @@
 }
 
 vector float test_vec_vec_splati_ins_f(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x float>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1408,6 +1414,24 @@
   return vec_splati_ins(vfa, 0, 1.0f);
 }
 
+// In this test case, the second argument of vec_splati_ins is outside of the 
+// valid range [0,1]. A mask of 0x01 is applied to obtain an in-range value for 
+// the second argument.
+vector signed int test_vec_vec_splati_ins_range(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
+  // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
+  // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
+  // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
+  // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
+  // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
+  // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
+  // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
+  // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T2]]
+  // CHECK-LE: ret <4 x i32>
+  return vec_splati_ins(vsia, 2, -17);
+}
+
 void test_vec_xst_trunc_sc(vector signed __int128 __a, signed long long __b,
signed char *__c) {
   // CHECK: store i8 %{{.+}}, i8* %{{.+}}, align 1
Index: clang/test/CodeGen/builtins-ppc-p10vector-error.c
===
--- /dev/null
+++ clang/test/CodeGen/builtins-ppc-p10vector-error.c
@@ -0,0 +1,32 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc-unknown-aix -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+
+#include 
+
+vector unsigned char vuca;
+vector unsigned short vusa;
+vector unsigned int vuia;
+vector unsigned long long vulla;
+
+unsigned long long test_vec_cntm_uc(void) {
+  return vec_cntm(vuca, -1); // expected-error 1+ {{argument value 255 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_us(void) {
+  return vec_cntm(vusa, -1); // expected-error 1+ {{argument value 255 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_ui(void) {
+  return vec_cntm(vuia, 2); // expected-error 1+ {{argument value 2 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_ull(void) {
+  return vec_cntm(vulla, 2); // expected-error 1+ {{argumen

[PATCH] D110336: [X86][FP16] Add more builtins to avoid multi evaluation problems & add 2 missed intrinsics

2021-09-23 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei created this revision.
pengfei added reviewers: LuoYuanke, craig.topper, RKSimon, yubing.
pengfei requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110336

Files:
  clang/include/clang/Basic/BuiltinsX86.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/avx512fp16intrin.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/X86/avx512fp16-builtins.c
  llvm/include/llvm/IR/IntrinsicsX86.td

Index: llvm/include/llvm/IR/IntrinsicsX86.td
===
--- llvm/include/llvm/IR/IntrinsicsX86.td
+++ llvm/include/llvm/IR/IntrinsicsX86.td
@@ -5754,7 +5754,7 @@
   [ llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty, llvm_i8_ty ],
   [ IntrNoMem ]>;
   def int_x86_avx512fp16_mask_vfcmadd_cph_512
-  : GCCBuiltin<"__builtin_ia32_vfcmaddcph512_mask">,
+  : GCCBuiltin<"__builtin_ia32_vfcmaddcph512_mask3">,
 Intrinsic<[ llvm_v16f32_ty ],
   [ llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty, llvm_i16_ty,
 llvm_i32_ty ],
@@ -5786,7 +5786,7 @@
   [ llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty, llvm_i8_ty ],
   [ IntrNoMem ]>;
   def int_x86_avx512fp16_mask_vfmadd_cph_512
-  : GCCBuiltin<"__builtin_ia32_vfmaddcph512_mask">,
+  : GCCBuiltin<"__builtin_ia32_vfmaddcph512_mask3">,
 Intrinsic<[ llvm_v16f32_ty ],
   [ llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty, llvm_i16_ty,
 llvm_i32_ty ],
Index: clang/test/CodeGen/X86/avx512fp16-builtins.c
===
--- clang/test/CodeGen/X86/avx512fp16-builtins.c
+++ clang/test/CodeGen/X86/avx512fp16-builtins.c
@@ -4086,10 +4086,8 @@
   // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
   // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
   // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
-  // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
   // CHECK:  %{{.*}} = call <4 x float> @llvm.x86.avx512fp16.mask.vfcmadd.csh(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 %{{.*}}, i32 4)
-  // CHECK:  %{{.*}} = extractelement <4 x float> %{{.*}}, i32 0
-  // CHECK:  %{{.*}} = insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0
+  // CHECK:  %{{.*}} = shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> 
   // CHECK:  %{{.*}} = bitcast <4 x float> %{{.*}} to <8 x half>
   return _mm_mask3_fcmadd_sch(__A, __B, __C, __U);
 }
@@ -4119,10 +4117,8 @@
   // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
   // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
   // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
-  // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
   // CHECK:  %{{.*}} = call <4 x float> @llvm.x86.avx512fp16.mask.vfcmadd.csh(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 %{{.*}}, i32 11)
-  // CHECK:  %{{.*}} = extractelement <4 x float> %{{.*}}, i32 0
-  // CHECK:  %{{.*}} = insertelement <4 x float> %{{.*}}, float %{{.*}}, i32 0
+  // CHECK:  %{{.*}} = shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> 
   // CHECK:  %{{.*}} = bitcast <4 x float> %{{.*}} to <8 x half>
   return _mm_mask3_fcmadd_round_sch(__A, __B, __C, __U, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
 }
@@ -4147,6 +4143,17 @@
   return _mm_maskz_fmadd_sch(__U, __A, __B, __C);
 }
 
+__m128h test_mm_mask3_fmadd_sch(__m128h __A, __m128h __B, __m128h __C, __mmask8 __U) {
+  // CHECK-LABEL: @test_mm_mask3_fmadd_sch
+  // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
+  // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
+  // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
+  // CHECK:  %{{.*}} = call <4 x float> @llvm.x86.avx512fp16.mask.vfmadd.csh(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}, i8 %{{.*}}, i32 4)
+  // CHECK:  %{{.*}} = shufflevector <4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x i32> 
+  // CHECK:  %{{.*}} = bitcast <4 x float> %{{.*}} to <8 x half>
+  return _mm_mask3_fmadd_sch(__A, __B, __C, __U);
+}
+
 __m128h test_mm_fmadd_round_sch(__m128h __A, __m128h __B, __m128h __C) {
   // CHECK-LABEL: @test_mm_fmadd_round_sch
   // CHECK: @llvm.x86.avx512fp16.mask.vfmadd.csh
@@ -4167,6 +4174,17 @@
   return _mm_maskz_fmadd_round_sch(__U, __A, __B, __C, _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC);
 }
 
+__m128h test_mm_mask3_fmadd_round_sch(__m128h __A, __m128h __B, __m128h __C, __mmask8 __U) {
+  // CHECK-LABEL: @test_mm_mask3_fmadd_round_sch
+  // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
+  // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
+  // CHECK:  %{{.*}} = bitcast <8 x half> %{{.*}} to <4 x float>
+  // CHECK:  %{{.*}} = call <4 x float> @llv

[PATCH] D109710: [PowerPC] Add range checks for P10 Vector Builtins

2021-09-23 Thread Quinn Pham via Phabricator via cfe-commits
quinnp updated this revision to Diff 374563.
quinnp added a comment.

Word change. valid -> expected


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109710

Files:
  clang/lib/Headers/altivec.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtins-ppc-p10vector-error.c
  clang/test/CodeGen/builtins-ppc-p10vector.c

Index: clang/test/CodeGen/builtins-ppc-p10vector.c
===
--- clang/test/CodeGen/builtins-ppc-p10vector.c
+++ clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -1370,10 +1370,12 @@
 }
 
 vector signed int test_vec_vec_splati_ins_si(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1383,10 +1385,12 @@
 }
 
 vector unsigned int test_vec_vec_splati_ins_ui(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1396,10 +1400,12 @@
 }
 
 vector float test_vec_vec_splati_ins_f(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x float>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1408,6 +1414,24 @@
   return vec_splati_ins(vfa, 0, 1.0f);
 }
 
+// In this test case, the second argument of vec_splati_ins is outside of the 
+// expected range [0,1]. A mask of 0x01 is applied to obtain an in-range value 
+// for the second argument.
+vector signed int test_vec_vec_splati_ins_range(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
+  // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
+  // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
+  // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
+  // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
+  // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
+  // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
+  // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
+  // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T2]]
+  // CHECK-LE: ret <4 x i32>
+  return vec_splati_ins(vsia, 2, -17);
+}
+
 void test_vec_xst_trunc_sc(vector signed __int128 __a, signed long long __b,
signed char *__c) {
   // CHECK: store i8 %{{.+}}, i8* %{{.+}}, align 1
Index: clang/test/CodeGen/builtins-ppc-p10vector-error.c
===
--- /dev/null
+++ clang/test/CodeGen/builtins-ppc-p10vector-error.c
@@ -0,0 +1,32 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc-unknown-aix -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+
+#include 
+
+vector unsigned char vuca;
+vector unsigned short vusa;
+vector unsigned int vuia;
+vector unsigned long long vulla;
+
+unsigned long long test_vec_cntm_uc(void) {
+  return vec_cntm(vuca, -1); // expected-error 1+ {{argument value 255 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_us(void) {
+  return vec_cntm(vusa, -1); // expected-error 1+ {{argument value 255 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_ui(void) {
+  return vec_cntm(vuia, 2); // expected-error 1+ {{argument value 2 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_ull(void) {
+  return vec_cntm(vulla, 2); // expected-error 1+ {{argument value 2 is outside the valid range [0, 1]}}
+}

[PATCH] D110257: [CFE][Codegen] Do not break the contiguity of static allocas.

2021-09-23 Thread Mahesha S via Phabricator via cfe-commits
hsmhsm added inline comments.



Comment at: clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp:264
 // CHECK1:   omp.inner.for.cond:
-// CHECK1-NEXT:[[TMP7:%.*]] = load i32, i32* [[DOTOMP_IV]], align 4
-// CHECK1-NEXT:[[TMP8:%.*]] = load i32, i32* [[DOTOMP_UB]], align 4
+// CHECK1-NEXT:[[TMP7:%.*]] = load i32, i32* [[DOTOMP_IV]], align 4, 
!llvm.access.group !15
+// CHECK1-NEXT:[[TMP8:%.*]] = load i32, i32* [[DOTOMP_UB]], align 4, 
!llvm.access.group !15

hsmhsm wrote:
> yaxunl wrote:
> > Is the test updated by a script? If the original test does not check 
> > !llvm.access.group, the updated test should not check it either. This makes 
> > the test less stable.
> Yes, most of the tests here are updated by script only. Probably I might have 
> missed few command line options to the script. I have not passed any option 
> to the script while updating it. Let me check.
I have used exact command line as in the test file plus extra option 
"--force-update". But it's presence or absence is not making any difference 
here. 

But the !llvm.access.group metadata is newly added. And I am not finding anyway 
of disabling it.

Do you have any idea? or anyone else for that matter? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110257

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


[PATCH] D110282: [PowerPC] SemaChecking for darn family of builtins

2021-09-23 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 374565.
Conanap added a comment.

Moved test case back to original file and use `#ifdef __PPC64__` instead


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

https://reviews.llvm.org/D110282

Files:
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtins-ppc-xlcompat-darn.c
  clang/test/CodeGen/builtins-ppc-xlcompat-error.c
  clang/test/CodeGen/builtins-ppc.c

Index: clang/test/CodeGen/builtins-ppc.c
===
--- clang/test/CodeGen/builtins-ppc.c
+++ clang/test/CodeGen/builtins-ppc.c
@@ -36,16 +36,3 @@
   // CHECK: call double @llvm.ppc.setflm(double %1)
   res = __builtin_setflm(res);
 }
-
-void test_builtin_ppc_darn() {
-  volatile long res;
-  volatile int x;
-  // CHECK: call i64 @llvm.ppc.darn()
-  res = __builtin_darn();
-
-  // CHECK: call i64 @llvm.ppc.darnraw()
-  res = __builtin_darn_raw();
-
-  // CHECK: call i32 @llvm.ppc.darn32()
-  x = __builtin_darn_32();
-}
Index: clang/test/CodeGen/builtins-ppc-xlcompat-error.c
===
--- clang/test/CodeGen/builtins-ppc-xlcompat-error.c
+++ clang/test/CodeGen/builtins-ppc-xlcompat-error.c
@@ -96,6 +96,14 @@
 unsigned long long testdivdeu(unsigned long long dividend, unsigned long long divisor) {
   return __divdeu(dividend, divisor); //expected-error {{this builtin is only available on 64-bit targets}}
 }
+
+int test_darn() {
+  return __darn(); //expected-error {{this builtin is only available on 64-bit targets}}
+}
+
+int test_darn_raw() {
+  return __darn_raw(); //expected-error {{this builtin is only available on 64-bit targets}}
+}
 #endif
 
 unsigned long test_mfspr(void) {
Index: clang/test/CodeGen/builtins-ppc-xlcompat-darn.c
===
--- clang/test/CodeGen/builtins-ppc-xlcompat-darn.c
+++ clang/test/CodeGen/builtins-ppc-xlcompat-darn.c
@@ -1,10 +1,13 @@
 // REQUIRES: powerpc-registered-target
 // RUN: %clang_cc1 -triple powerpc64-unknown-unknown \
-// RUN:-emit-llvm %s -o -  -target-cpu pwr9 | FileCheck %s
+// RUN:-emit-llvm %s -o -  -target-cpu pwr9 | \
+// RUN:FileCheck %s --check-prefix=CHECK-64
 // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown \
-// RUN:   -emit-llvm %s -o -  -target-cpu pwr9 | FileCheck %s
+// RUN:   -emit-llvm %s -o -  -target-cpu pwr9 | \
+// RUN:FileCheck %s --check-prefix=CHECK-64
 // RUN: %clang_cc1 -triple powerpc64-unknown-aix \
-// RUN:-emit-llvm %s -o -  -target-cpu pwr9 | FileCheck %s
+// RUN:-emit-llvm %s -o -  -target-cpu pwr9 | \
+// RUN:FileCheck %s --check-prefix=CHECK-64
 // RUN: %clang_cc1 -triple powerpc-unknown-unknown \
 // RUN:-emit-llvm %s -o -  -target-cpu pwr9 | FileCheck %s
 // RUN: %clang_cc1 -triple powerpcle-unknown-unknown \
@@ -15,21 +18,23 @@
 // The darn class of builtins are Power 9 and up and only darn_32 works in
 // 32 bit mode.
 
-// CHECK-LABEL: @testdarn(
-// CHECK: [[TMP0:%.*]] = call i64 @llvm.ppc.darn()
-// CHECK-NEXT:ret i64 [[TMP0]]
+#ifdef __PPC64__
+// CHECK-64-LABEL: @testdarn(
+// CHECK-64: [[TMP0:%.*]] = call i64 @llvm.ppc.darn()
+// CHECK-64-NEXT:ret i64 [[TMP0]]
 //
 long long testdarn(void) {
   return __darn();
 }
 
-// CHECK-LABEL: @testdarn_raw(
-// CHECK: [[TMP0:%.*]] = call i64 @llvm.ppc.darnraw()
-// CHECK-NEXT:ret i64 [[TMP0]]
+// CHECK-64-LABEL: @testdarn_raw(
+// CHECK-64: [[TMP0:%.*]] = call i64 @llvm.ppc.darnraw()
+// CHECK-64-NEXT:ret i64 [[TMP0]]
 //
 long long testdarn_raw(void) {
   return __darn_raw();
 }
+#endif
 
 // CHECK-LABEL: @testdarn_32(
 // CHECK: [[TMP0:%.*]] = call i32 @llvm.ppc.darn32()
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -3295,6 +3295,8 @@
   case PPC::BI__builtin_ppc_insert_exp:
   case PPC::BI__builtin_ppc_extract_sig:
   case PPC::BI__builtin_ppc_addex:
+  case PPC::BI__builtin_darn:
+  case PPC::BI__builtin_darn_raw:
 return true;
   }
   return false;
@@ -3473,6 +3475,11 @@
 return SemaFeatureCheck(*this, TheCall, "isa-v207-instructions",
 diag::err_ppc_builtin_only_on_arch, "8") ||
SemaBuiltinConstantArgRange(TheCall, 1, 1, 16);
+  case PPC::BI__builtin_darn:
+  case PPC::BI__builtin_darn_raw:
+  case PPC::BI__builtin_darn_32:
+return SemaFeatureCheck(*this, TheCall, "isa-v30-instructions",
+diag::err_ppc_builtin_only_on_arch, "9");
 #define CUSTOM_BUILTIN(Name, Intr, Types, Acc) \
   case PPC::BI__builtin_##Name: \
 return SemaBuiltinPPCMMACall(TheCall, Types);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110282: [PowerPC] SemaChecking for darn family of builtins

2021-09-23 Thread Amy Kwan via Phabricator via cfe-commits
amyk accepted this revision as: amyk.
amyk added a comment.

Thanks for updating the tests and description, Albion.


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

https://reviews.llvm.org/D110282

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


[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-23 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment.

@martong
BTW, this patch is the first one in the stack. There are also D107339 
 and D108032 
. You could also express your opinion there.


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

https://reviews.llvm.org/D104285

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


[PATCH] D106823: [analyzer][solver] Iterate to a fixpoint during symbol simplification with constants

2021-09-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment.

@vsavchenko gentle ping


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106823

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


[PATCH] D110065: [AArch64] Add support for the 'R' architecture profile.

2021-09-23 Thread Alexandros Lamprineas via Phabricator via cfe-commits
labrinea updated this revision to Diff 374572.

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

https://reviews.llvm.org/D110065

Files:
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h
  clang/test/Driver/aarch64-cpus.c
  clang/test/Preprocessor/aarch64-target-features.c
  llvm/lib/Support/AArch64TargetParser.cpp
  llvm/lib/Target/AArch64/AArch64.td
  llvm/lib/Target/AArch64/AArch64InstrInfo.td
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/lib/Target/AArch64/AArch64SystemOperands.td
  llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
  llvm/test/CodeGen/AArch64/arm64-crc32.ll
  llvm/test/MC/AArch64/arm64-branch-encoding.s
  llvm/test/MC/AArch64/arm64-system-encoding.s
  llvm/test/MC/AArch64/armv8.1a-lse.s
  llvm/test/MC/AArch64/armv8.1a-pan.s
  llvm/test/MC/AArch64/armv8.1a-rdma.s
  llvm/test/MC/AArch64/armv8.2a-at.s
  llvm/test/MC/AArch64/armv8.2a-crypto.s
  llvm/test/MC/AArch64/armv8.2a-dotprod-errors.s
  llvm/test/MC/AArch64/armv8.2a-dotprod.s
  llvm/test/MC/AArch64/armv8.2a-persistent-memory.s
  llvm/test/MC/AArch64/armv8.2a-uao.s
  llvm/test/MC/AArch64/armv8r-inst.s
  llvm/test/MC/AArch64/armv8r-sysreg.s
  llvm/test/MC/AArch64/armv8r-unsupported-inst.s
  llvm/test/MC/AArch64/armv8r-unsupported-sysreg.s
  llvm/test/MC/AArch64/basic-a64-instructions.s
  llvm/test/MC/AArch64/ras-extension.s
  llvm/test/MC/Disassembler/AArch64/arm64-branch.txt
  llvm/test/MC/Disassembler/AArch64/armv8.3a-complex.txt
  llvm/test/MC/Disassembler/AArch64/armv8.3a-js.txt
  llvm/test/MC/Disassembler/AArch64/armv8.3a-rcpc.txt
  llvm/test/MC/Disassembler/AArch64/armv8.4a-dit.txt
  llvm/test/MC/Disassembler/AArch64/armv8.4a-flag.txt
  llvm/test/MC/Disassembler/AArch64/armv8.4a-ras.txt
  llvm/test/MC/Disassembler/AArch64/armv8.4a-tlb.txt
  llvm/test/MC/Disassembler/AArch64/armv8.4a-trace.txt
  llvm/test/MC/Disassembler/AArch64/armv8.4a-virt.txt
  llvm/test/MC/Disassembler/AArch64/armv8.5a-predres.txt
  llvm/test/MC/Disassembler/AArch64/armv8.5a-specrestrict.txt
  llvm/test/MC/Disassembler/AArch64/armv8.5a-ssbs.txt
  llvm/test/MC/Disassembler/AArch64/armv8a-el3.txt
  llvm/test/MC/Disassembler/AArch64/armv8a-fpmul.txt
  llvm/test/MC/Disassembler/AArch64/basic-a64-instructions.txt

Index: llvm/test/MC/Disassembler/AArch64/basic-a64-instructions.txt
===
--- llvm/test/MC/Disassembler/AArch64/basic-a64-instructions.txt
+++ llvm/test/MC/Disassembler/AArch64/basic-a64-instructions.txt
@@ -1257,27 +1257,21 @@
 0xe1 0xff 0x1f 0xd4
 
 # CHECK: hvc  #{{1|0x1}}
-# CHECK: smc  #{{12000|0x2ee0}}
 # CHECK: brk  #{{12|0xc}}
 # CHECK: hlt  #{{123|0x7b}}
 0x22 0x0 0x0 0xd4
-0x3 0xdc 0x5 0xd4
 0x80 0x1 0x20 0xd4
 0x60 0xf 0x40 0xd4
 
 # CHECK: dcps1#{{42|0x2a}}
 # CHECK: dcps2#{{9|0x9}}
-# CHECK: dcps3#{{1000|0x3e8}}
 0x41 0x5 0xa0 0xd4
 0x22 0x1 0xa0 0xd4
-0x3 0x7d 0xa0 0xd4
 
 # CHECK: dcps1
 # CHECK: dcps2
-# CHECK: dcps3
 0x1 0x0 0xa0 0xd4
 0x2 0x0 0xa0 0xd4
-0x3 0x0 0xa0 0xd4
 
 #--
 # Extract (immediate)
@@ -3258,13 +3252,11 @@
 # CHECK: msr  {{hacr_el2|HACR_EL2}}, x12
 # CHECK: msr  {{mdcr_el3|MDCR_EL3}}, x12
 # CHECK: msr  {{ttbr0_el1|TTBR0_EL1}}, x12
-# CHECK: msr  {{ttbr0_el2|TTBR0_EL2}}, x12
 # CHECK: msr  {{ttbr0_el3|TTBR0_EL3}}, x12
 # CHECK: msr  {{ttbr1_el1|TTBR1_EL1}}, x12
 # CHECK: msr  {{tcr_el1|TCR_EL1}}, x12
 # CHECK: msr  {{tcr_el2|TCR_EL2}}, x12
 # CHECK: msr  {{tcr_el3|TCR_EL3}}, x12
-# CHECK: msr  {{vttbr_el2|VTTBR_EL2}}, x12
 # CHECK: msr  {{vtcr_el2|VTCR_EL2}}, x12
 # CHECK: msr  {{dacr32_el2|DACR32_EL2}}, x12
 # CHECK: msr  {{spsr_el1|SPSR_EL1}}, x12
@@ -3554,13 +3546,11 @@
 # CHECK: mrs  x9, {{hacr_el2|HACR_EL2}}
 # CHECK: mrs  x9, {{mdcr_el3|MDCR_EL3}}
 # CHECK: mrs  x9, {{ttbr0_el1|TTBR0_EL1}}
-# CHECK: mrs  x9, {{ttbr0_el2|TTBR0_EL2}}
 # CHECK: mrs  x9, {{ttbr0_el3|TTBR0_EL3}}
 # CHECK: mrs  x9, {{ttbr1_el1|TTBR1_EL1}}
 # CHECK: mrs  x9, {{tcr_el1|TCR_EL1}}
 # CHECK: mrs  x9, {{tcr_el2|TCR_EL2}}
 # CHECK: mrs  x9, {{tcr_el3|TCR_EL3}}
-# CHECK: mrs  x9, {{vttbr_el2|VTTBR_EL2}}
 # CHECK: mrs  x9, {{vtcr_el2|VTCR_EL2}}
 # CHECK: mrs  x9, {{dacr32_el2|DACR32_EL2}}
 # CHECK: mrs  x9, {{spsr_el1|SPSR_EL1}}
Index: llvm/test/MC/Disassembler/AArch64/armv8a-fpmul.txt
===
--- llvm/test/MC/Disassembler/AArch64/armv8a-fpmul.txt
+++ llvm/test/MC/Disassembler/AArch64/armv8a-fpmul.txt
@@ -1,5 +1,6 @@
 # RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=+fp16fml   --disassemble < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,FP16
 # RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=-fullfp16,+fp16fml --disassemble < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,FP16
+# RUN:

[PATCH] D110041: [clang] Use portable "#!/usr/bin/env bash" shebang for tools and utils.

2021-09-23 Thread Shivam Gupta via Phabricator via cfe-commits
xgupta accepted this revision.
xgupta added a comment.

I can push this for you @fcambus.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110041

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


[PATCH] D110041: [clang] Use portable "#!/usr/bin/env bash" shebang for tools and utils.

2021-09-23 Thread Shivam Gupta via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7f5ca8cc2158: [clang] Use portable "#!/usr/bin/env 
bash" shebang for tools and utils. (authored by fcambus, committed by 
xgupta).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110041

Files:
  clang/tools/diag-build/diag-build.sh
  clang/utils/make-ast-dump-check.sh


Index: clang/utils/make-ast-dump-check.sh
===
--- clang/utils/make-ast-dump-check.sh
+++ clang/utils/make-ast-dump-check.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/usr/bin/env bash
 
 # This script is intended as a FileCheck replacement to update the test
 # expectations in a -ast-dump test.
Index: clang/tools/diag-build/diag-build.sh
===
--- clang/tools/diag-build/diag-build.sh
+++ clang/tools/diag-build/diag-build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # diag-build: a tool showing enabled warnings in a project.
 #


Index: clang/utils/make-ast-dump-check.sh
===
--- clang/utils/make-ast-dump-check.sh
+++ clang/utils/make-ast-dump-check.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/usr/bin/env bash
 
 # This script is intended as a FileCheck replacement to update the test
 # expectations in a -ast-dump test.
Index: clang/tools/diag-build/diag-build.sh
===
--- clang/tools/diag-build/diag-build.sh
+++ clang/tools/diag-build/diag-build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # diag-build: a tool showing enabled warnings in a project.
 #
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 7f5ca8c - [clang] Use portable "#!/usr/bin/env bash" shebang for tools and utils.

2021-09-23 Thread Shivam Gupta via cfe-commits

Author: Frederic Cambus
Date: 2021-09-23T21:16:43+05:30
New Revision: 7f5ca8cc2158debe3f09eb19b4613e75e124

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

LOG: [clang] Use portable "#!/usr/bin/env bash" shebang for tools and utils.

Reviewed By: JDevlieghere

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

Added: 


Modified: 
clang/tools/diag-build/diag-build.sh
clang/utils/make-ast-dump-check.sh

Removed: 




diff  --git a/clang/tools/diag-build/diag-build.sh 
b/clang/tools/diag-build/diag-build.sh
index 018288dda9566..b1504ffcc418e 100755
--- a/clang/tools/diag-build/diag-build.sh
+++ b/clang/tools/diag-build/diag-build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # diag-build: a tool showing enabled warnings in a project.
 #

diff  --git a/clang/utils/make-ast-dump-check.sh 
b/clang/utils/make-ast-dump-check.sh
index 365f227cc1c66..cb4c7924e4c3e 100755
--- a/clang/utils/make-ast-dump-check.sh
+++ b/clang/utils/make-ast-dump-check.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/usr/bin/env bash
 
 # This script is intended as a FileCheck replacement to update the test
 # expectations in a -ast-dump test.



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


[PATCH] D36850: [ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagation

2021-09-23 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added a comment.

Few follow ups below.




Comment at: clang/test/CodeGen/thinlto-funcattr-prop.ll:16
+
+; CHECK: ^2 = gv: (guid: 13959900437860518209, summaries: (function: (module: 
^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, 
live: 1, dsoLocal: 1, canAutoHide: 0), insts: 2, calls: ((callee: ^3)
+; CHECK: ^3 = gv: (guid: 14959766916849974397, summaries: (function: (module: 
^1, flags: (linkage: external, visibility: default, notEligibleToImport: 0, 
live: 1, dsoLocal: 0, canAutoHide: 0), insts: 1, funcFlags: (readNone: 0, 
readOnly: 0, noRecurse: 1, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, 
noUnwind: 1, mayThrow: 0, hasUnknownCall: 0

I believe this corresponds to call_extern - why aren't we getting noRecurse and 
noUnwind propagated here?

(also, suggest adding a comment above each of these summaries as to what 
function name they correspond to)



Comment at: llvm/include/llvm/Transforms/IPO/FunctionImport.h:224
+ const GVSummaryMapTy &DefinedGlobals,
+ bool PropagateAttrs = false);
 

Suggest either removing default since you are always passing this argument, or 
default it to true and stop passing it in the places where it is true (since 
generally we want this to be true except in a few ThinLTOCodeGenerator.cpp 
locations that are testing specific things that don't involve propagation). 
Some preference for the former option (removing default), to make sure any new 
callers that get added think through the appropriate value.



Comment at: llvm/lib/Transforms/IPO/FunctionAttrs.cpp:480
+if (!CalleeSummary->fflags().NoUnwind ||
+CalleeSummary->fflags().MayThrow)
+  InferredFlags.NoUnwind = false;

Please make sure one of the may throw propagation tests would fail without this 
fix (i.e. when it was checking the caller's maythrow setting).



Comment at: llvm/lib/Transforms/IPO/FunctionImport.cpp:1110
+const auto &GV = DefinedGlobals.find(F.getGUID());
+if (GV == DefinedGlobals.end())
+  return;

Can this be merged with updateLinkage so we only do the DefinedGlobals lookup 
once per symbol?



Comment at: llvm/test/ThinLTO/X86/funcattrs-prop.ll:6
+
+;; ThinLTO Function attribute propagation uses the prevailing symbol to 
propagate attributes to its callers. Interposable (linkonce and weak) linkages 
are fair game given we know the prevailing copy 
+;; will be used in the final binary.

Nit,  line length


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D36850

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


[PATCH] D110257: [CFE][Codegen] Do not break the contiguity of static allocas.

2021-09-23 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In D110257#3016918 , @hsmhsm wrote:

> That said, it is still good idea (and actually an explicitly not mandated 
> requirement) to maintain the contiguity of the static allocas at the top of 
> the basic block as one cluster, and it should start from FE itself.  So, this 
> patch is still relevant.

The patch mostly affects GPU tests, so as long as the GPU folks (AMD/nvptx) are 
happy with the regenerated test cases, this seems fine to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110257

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


[PATCH] D110252: Added note about Whatstyle and Unformat

2021-09-23 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

Whatstyle has not been updated since Dec 2020, is it going to cover the latest 
style configuration options?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110252

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


[clang] f9912fe - [PowerPC] Add range checks for P10 Vector Builtins

2021-09-23 Thread Quinn Pham via cfe-commits

Author: Quinn Pham
Date: 2021-09-23T11:05:49-05:00
New Revision: f9912fe4eac91f27965c22d015b3109c5158d050

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

LOG: [PowerPC] Add range checks for P10 Vector Builtins

This patch adds range checking for some Power10 altivec builtins and
changes the signature of a builtin to match documentation. For `vec_cntm`,
range checking is done via SemaChecking. For `vec_splati_ins`, the second
argument is masked to extract the 0th bit so that we always receive either a `0`
or a `1`.

Reviewed By: lei, amyk

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

Added: 
clang/test/CodeGen/builtins-ppc-p10vector-error.c

Modified: 
clang/lib/Headers/altivec.h
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/builtins-ppc-p10vector.c

Removed: 




diff  --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h
index 239c93d5b115c..6cfe9815228fa 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -18221,13 +18221,13 @@ vec_expandm(vector unsigned __int128 __a) {
 
 #define vec_cntm(__a, __mp)
\
   _Generic((__a), vector unsigned char 
\
-   : __builtin_altivec_vcntmbb((__a), (unsigned int)(__mp)),   
\
+   : __builtin_altivec_vcntmbb((__a), (unsigned char)(__mp)),  
\
  vector unsigned short 
\
-   : __builtin_altivec_vcntmbh((__a), (unsigned int)(__mp)),   
\
+   : __builtin_altivec_vcntmbh((__a), (unsigned char)(__mp)),  
\
  vector unsigned int   
\
-   : __builtin_altivec_vcntmbw((__a), (unsigned int)(__mp)),   
\
+   : __builtin_altivec_vcntmbw((__a), (unsigned char)(__mp)),  
\
  vector unsigned long long 
\
-   : __builtin_altivec_vcntmbd((__a), (unsigned int)(__mp)))
+   : __builtin_altivec_vcntmbd((__a), (unsigned char)(__mp)))
 
 /* vec_gen[b|h|w|d|q]m */
 
@@ -18756,36 +18756,39 @@ static __inline__ vector double __ATTRS_o_ai 
vec_splatid(const float __a) {
 
 static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins(
 vector signed int __a, const unsigned int __b, const signed int __c) {
+  const unsigned int __d = __b & 0x01;
 #ifdef __LITTLE_ENDIAN__
-  __a[1 - __b] = __c;
-  __a[3 - __b] = __c;
+  __a[1 - __d] = __c;
+  __a[3 - __d] = __c;
 #else
-  __a[__b] = __c;
-  __a[2 + __b] = __c;
+  __a[__d] = __c;
+  __a[2 + __d] = __c;
 #endif
   return __a;
 }
 
 static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins(
 vector unsigned int __a, const unsigned int __b, const unsigned int __c) {
+  const unsigned int __d = __b & 0x01;
 #ifdef __LITTLE_ENDIAN__
-  __a[1 - __b] = __c;
-  __a[3 - __b] = __c;
+  __a[1 - __d] = __c;
+  __a[3 - __d] = __c;
 #else
-  __a[__b] = __c;
-  __a[2 + __b] = __c;
+  __a[__d] = __c;
+  __a[2 + __d] = __c;
 #endif
   return __a;
 }
 
 static __inline__ vector float __ATTRS_o_ai
 vec_splati_ins(vector float __a, const unsigned int __b, const float __c) {
+  const unsigned int __d = __b & 0x01;
 #ifdef __LITTLE_ENDIAN__
-  __a[1 - __b] = __c;
-  __a[3 - __b] = __c;
+  __a[1 - __d] = __c;
+  __a[3 - __d] = __c;
 #else
-  __a[__b] = __c;
-  __a[2 + __b] = __c;
+  __a[__d] = __c;
+  __a[2 + __d] = __c;
 #endif
   return __a;
 }

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 9862306325322..5cc968c133ce3 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3473,6 +3473,11 @@ bool Sema::CheckPPCBuiltinFunctionCall(const TargetInfo 
&TI, unsigned BuiltinID,
 return SemaFeatureCheck(*this, TheCall, "isa-v207-instructions",
 diag::err_ppc_builtin_only_on_arch, "8") ||
SemaBuiltinConstantArgRange(TheCall, 1, 1, 16);
+  case PPC::BI__builtin_altivec_vcntmbb:
+  case PPC::BI__builtin_altivec_vcntmbh:
+  case PPC::BI__builtin_altivec_vcntmbw:
+  case PPC::BI__builtin_altivec_vcntmbd:
+return SemaBuiltinConstantArgRange(TheCall, 1, 0, 1);
 #define CUSTOM_BUILTIN(Name, Intr, Types, Acc) \
   case PPC::BI__builtin_##Name: \
 return SemaBuiltinPPCMMACall(TheCall, Types);

diff  --git a/clang/test/CodeGen/builtins-ppc-p10vector-error.c 
b/clang/test/CodeGen/builtins-ppc-p10vector-error.c
new file mode 100644
index 0..e509c5a82c5b0
--- /dev/null
+++ b/clang/test/CodeGen/builtins-ppc-p10vector-error.c
@@ -0,0 +1,32 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Wer

[PATCH] D109710: [PowerPC] Add range checks for P10 Vector Builtins

2021-09-23 Thread Quinn Pham via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf9912fe4eac9: [PowerPC] Add range checks for P10 Vector 
Builtins (authored by quinnp).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109710

Files:
  clang/lib/Headers/altivec.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/builtins-ppc-p10vector-error.c
  clang/test/CodeGen/builtins-ppc-p10vector.c

Index: clang/test/CodeGen/builtins-ppc-p10vector.c
===
--- clang/test/CodeGen/builtins-ppc-p10vector.c
+++ clang/test/CodeGen/builtins-ppc-p10vector.c
@@ -1371,10 +1371,12 @@
 }
 
 vector signed int test_vec_vec_splati_ins_si(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1384,10 +1386,12 @@
 }
 
 vector unsigned int test_vec_vec_splati_ins_ui(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1397,10 +1401,12 @@
 }
 
 vector float test_vec_vec_splati_ins_f(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-BE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 %{{.+}}
   // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
   // CHECK-BE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 [[T1]]
   // CHECK-BE: ret <4 x float>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
   // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
   // CHECK-LE: insertelement <4 x float> %{{.+}}, float %{{.+}}, i32 [[T1]]
   // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
@@ -1409,6 +1415,24 @@
   return vec_splati_ins(vfa, 0, 1.0f);
 }
 
+// In this test case, the second argument of vec_splati_ins is outside of the 
+// expected range [0,1]. A mask of 0x01 is applied to obtain an in-range value 
+// for the second argument.
+vector signed int test_vec_vec_splati_ins_range(void) {
+  // CHECK-BE: [[T0:%.+]] = and i32 %{{.+}}, 1
+  // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 %{{.+}}
+  // CHECK-BE:  [[T1:%.+]] = add i32 2, %{{.+}}
+  // CHECK-BE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
+  // CHECK-BE: ret <4 x i32>
+  // CHECK-LE: [[T0:%.+]] = and i32 %{{.+}}, 1
+  // CHECK-LE:  [[T1:%.+]] = sub i32 1, %{{.+}}
+  // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T1]]
+  // CHECK-LE:  [[T2:%.+]] = sub i32 3, %{{.+}}
+  // CHECK-LE: insertelement <4 x i32> %{{.+}}, i32 %{{.+}}, i32 [[T2]]
+  // CHECK-LE: ret <4 x i32>
+  return vec_splati_ins(vsia, 2, -17);
+}
+
 void test_vec_xst_trunc_sc(vector signed __int128 __a, signed long long __b,
signed char *__c) {
   // CHECK: store i8 %{{.+}}, i8* %{{.+}}, align 1
Index: clang/test/CodeGen/builtins-ppc-p10vector-error.c
===
--- /dev/null
+++ clang/test/CodeGen/builtins-ppc-p10vector-error.c
@@ -0,0 +1,32 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+// RUN: %clang_cc1 -triple powerpc-unknown-aix -target-cpu pwr10 \
+// RUN:   -fsyntax-only -Wall -Werror -verify %s
+
+#include 
+
+vector unsigned char vuca;
+vector unsigned short vusa;
+vector unsigned int vuia;
+vector unsigned long long vulla;
+
+unsigned long long test_vec_cntm_uc(void) {
+  return vec_cntm(vuca, -1); // expected-error 1+ {{argument value 255 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_us(void) {
+  return vec_cntm(vusa, -1); // expected-error 1+ {{argument value 255 is outside the valid range [0, 1]}}
+}
+
+unsigned long long test_vec_cntm_ui(void) {
+  return vec_cntm(vuia, 2); // expected-error 1+ {{argument value 2 is outside the valid range [0, 1]}}
+}
+
+unsigned long long 

[PATCH] D109902: [PowerPC] Improved codegen related to xscvdpsxws/xscvdpuxws

2021-09-23 Thread Albion Fung via Phabricator via cfe-commits
Conanap updated this revision to Diff 374578.
Conanap added a comment.

Updated test cases, fixed a typo


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

https://reviews.llvm.org/D109902

Files:
  llvm/lib/Target/PowerPC/PPCInstrVSX.td
  llvm/test/CodeGen/PowerPC/test-vector-insert.ll
  llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i32_elts.ll

Index: llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i32_elts.ll
===
--- llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i32_elts.ll
+++ llvm/test/CodeGen/PowerPC/vec_conv_fp64_to_i32_elts.ll
@@ -13,12 +13,8 @@
 ; CHECK-P8-LABEL: test2elt:
 ; CHECK-P8:   # %bb.0: # %entry
 ; CHECK-P8-NEXT:xxswapd vs0, v2
-; CHECK-P8-NEXT:xscvdpuxws f1, v2
-; CHECK-P8-NEXT:xscvdpuxws f0, f0
-; CHECK-P8-NEXT:mffprwz r3, f1
-; CHECK-P8-NEXT:mtvsrwz v2, r3
-; CHECK-P8-NEXT:mffprwz r4, f0
-; CHECK-P8-NEXT:mtvsrwz v3, r4
+; CHECK-P8-NEXT:xscvdpuxws v2, v2
+; CHECK-P8-NEXT:xscvdpuxws v3, f0
 ; CHECK-P8-NEXT:vmrghw v2, v2, v3
 ; CHECK-P8-NEXT:xxswapd vs0, v2
 ; CHECK-P8-NEXT:mffprd r3, f0
@@ -26,26 +22,18 @@
 ;
 ; CHECK-P9-LABEL: test2elt:
 ; CHECK-P9:   # %bb.0: # %entry
-; CHECK-P9-NEXT:xscvdpuxws f0, v2
-; CHECK-P9-NEXT:mffprwz r3, f0
 ; CHECK-P9-NEXT:xxswapd vs0, v2
-; CHECK-P9-NEXT:mtvsrwz v3, r3
-; CHECK-P9-NEXT:xscvdpuxws f0, f0
-; CHECK-P9-NEXT:mffprwz r3, f0
-; CHECK-P9-NEXT:mtvsrwz v2, r3
+; CHECK-P9-NEXT:xscvdpuxws v3, v2
+; CHECK-P9-NEXT:xscvdpuxws v2, f0
 ; CHECK-P9-NEXT:vmrghw v2, v3, v2
 ; CHECK-P9-NEXT:mfvsrld r3, v2
 ; CHECK-P9-NEXT:blr
 ;
 ; CHECK-BE-LABEL: test2elt:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:xscvdpuxws f0, v2
-; CHECK-BE-NEXT:mffprwz r3, f0
 ; CHECK-BE-NEXT:xxswapd vs0, v2
-; CHECK-BE-NEXT:mtvsrwz v3, r3
-; CHECK-BE-NEXT:xscvdpuxws f0, f0
-; CHECK-BE-NEXT:mffprwz r3, f0
-; CHECK-BE-NEXT:mtvsrwz v2, r3
+; CHECK-BE-NEXT:xscvdpuxws v3, v2
+; CHECK-BE-NEXT:xscvdpuxws v2, f0
 ; CHECK-BE-NEXT:vmrgow v2, v3, v2
 ; CHECK-BE-NEXT:mfvsrd r3, v2
 ; CHECK-BE-NEXT:blr
@@ -305,12 +293,8 @@
 ; CHECK-P8-LABEL: test2elt_signed:
 ; CHECK-P8:   # %bb.0: # %entry
 ; CHECK-P8-NEXT:xxswapd vs0, v2
-; CHECK-P8-NEXT:xscvdpsxws f1, v2
-; CHECK-P8-NEXT:xscvdpsxws f0, f0
-; CHECK-P8-NEXT:mffprwz r3, f1
-; CHECK-P8-NEXT:mtvsrwz v2, r3
-; CHECK-P8-NEXT:mffprwz r4, f0
-; CHECK-P8-NEXT:mtvsrwz v3, r4
+; CHECK-P8-NEXT:xscvdpsxws v2, v2
+; CHECK-P8-NEXT:xscvdpsxws v3, f0
 ; CHECK-P8-NEXT:vmrghw v2, v2, v3
 ; CHECK-P8-NEXT:xxswapd vs0, v2
 ; CHECK-P8-NEXT:mffprd r3, f0
@@ -318,26 +302,18 @@
 ;
 ; CHECK-P9-LABEL: test2elt_signed:
 ; CHECK-P9:   # %bb.0: # %entry
-; CHECK-P9-NEXT:xscvdpsxws f0, v2
-; CHECK-P9-NEXT:mffprwz r3, f0
 ; CHECK-P9-NEXT:xxswapd vs0, v2
-; CHECK-P9-NEXT:mtvsrwz v3, r3
-; CHECK-P9-NEXT:xscvdpsxws f0, f0
-; CHECK-P9-NEXT:mffprwz r3, f0
-; CHECK-P9-NEXT:mtvsrwz v2, r3
+; CHECK-P9-NEXT:xscvdpsxws v3, v2
+; CHECK-P9-NEXT:xscvdpsxws v2, f0
 ; CHECK-P9-NEXT:vmrghw v2, v3, v2
 ; CHECK-P9-NEXT:mfvsrld r3, v2
 ; CHECK-P9-NEXT:blr
 ;
 ; CHECK-BE-LABEL: test2elt_signed:
 ; CHECK-BE:   # %bb.0: # %entry
-; CHECK-BE-NEXT:xscvdpsxws f0, v2
-; CHECK-BE-NEXT:mffprwz r3, f0
 ; CHECK-BE-NEXT:xxswapd vs0, v2
-; CHECK-BE-NEXT:mtvsrwz v3, r3
-; CHECK-BE-NEXT:xscvdpsxws f0, f0
-; CHECK-BE-NEXT:mffprwz r3, f0
-; CHECK-BE-NEXT:mtvsrwz v2, r3
+; CHECK-BE-NEXT:xscvdpsxws v3, v2
+; CHECK-BE-NEXT:xscvdpsxws v2, f0
 ; CHECK-BE-NEXT:vmrgow v2, v3, v2
 ; CHECK-BE-NEXT:mfvsrd r3, v2
 ; CHECK-BE-NEXT:blr
Index: llvm/test/CodeGen/PowerPC/test-vector-insert.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/test-vector-insert.ll
@@ -0,0 +1,184 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:  -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
+; RUN:  -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-LE-P8
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:  -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
+; RUN:  -mcpu=pwr7 < %s | FileCheck %s --check-prefix=CHECK-LE-P7
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu \
+; RUN:  -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
+; RUN:  -mcpu=pwr7 < %s | FileCheck %s --check-prefix=CHECK-BE
+; xscvdpsxws and uxws is only available on Power7 and above
+; Codgen is different for LE Power7 and Power8
+
+define dso_local <4 x i32> @test(<4 x i32> %a, double %b) {
+; CHECK-LE-P8-LABEL: test:
+; CHECK-LE-P8:   # %bb.0: # %entry
+; CHECK-LE-P8-NEXT:xscvdpsxws v3, f1
+; CHECK-LE-P8-NEXT:addis r3, r2, .LCPI0_0@toc@ha
+; CHECK-LE-P8-NEXT:ad

[PATCH] D109902: [PowerPC] Improved codegen related to xscvdpsxws/xscvdpuxws

2021-09-23 Thread Albion Fung via Phabricator via cfe-commits
Conanap marked 3 inline comments as done.
Conanap added inline comments.



Comment at: llvm/test/CodeGen/PowerPC/test-vector-insert.ll:8
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \
+; RUN:  -mcpu=pwr7 < %s | FileCheck %s
+

kamaub wrote:
> It seems like this run line is redundant, it produces the same assembly as 
> the big endian specific line above. Maybe the `-mcpu=pwr7` can be moved to 
> the first Little-endian specific run line? That line currently only test the 
> target cpu of the test machine.
good point, thanks!


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

https://reviews.llvm.org/D109902

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


[PATCH] D110260: [ORC] Minor renaming and typo fixes (NFC)

2021-09-23 Thread Shivam Gupta via Phabricator via cfe-commits
xgupta accepted this revision.
xgupta added a comment.
This revision is now accepted and ready to land.

In D110260#3018110 , @sgraenitz wrote:

> Thanks @xgupta for your note! The parameter passed to 
> `EPCIndirectionUtils::Create()` in the example was referencing a moved-from 
> value. This caused the segfault. Unfortunately, the examples don't have good 
> test coverage so far.

Yeah we need testcases, now it says

JIT session error: Symbols not found: [ return1 ]
JIT session error: Failed to materialize symbols: { (main, { foo_body }) }
Unable to lazily compile function. Exiting.

Anyways the current patch LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110260

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


[PATCH] D110276: Clean up large copies of binaries copied into temp directories in tests

2021-09-23 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson added a comment.

In D110276#3016312 , @tejohnson wrote:

> In D110276#3016295 , @thakis wrote:
>
>> Oh, the win failure 
>> (https://buildkite.com/llvm-project/premerge-checks/builds/57480#f7da3275-775a-4cf4-9624-d3539dd1f709)
>>  might actually be real. Windows doesn't allow deleting files that are still 
>> in use, and due to AV or similar, the file might still be in use for a bit 
>> even after the program completes.
>
> The failures I am seeing there are in a few other tests, not in the ones I 
> modified. Can you confirm?

@thakis ping - I don't see any failures related to the tests I changed - can 
you confirm or let me know if I missed something?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110276

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


[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

2021-09-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment.

In D104285#3018257 , @ASDenysPetrov 
wrote:

> @martong
> BTW, this patch is the first one in the stack. There are also D107339 
>  and D108032 
> . You could also express your opinion there.

Okay, I am going to have a look, in the meanwhile let's land this first and see 
if the build bots are happy.


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

https://reviews.llvm.org/D104285

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


[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

2021-09-23 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

In D103938#3013503 , @thakis wrote:

> This flags this code from absl:

Did you see this comment? Looks like this relanded, but it still warns there 
even though it has an effect there I think (?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103938

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


[PATCH] D110260: [ORC] Minor renaming and typo fixes (NFC)

2021-09-23 Thread Stefan Gränitz via Phabricator via cfe-commits
sgraenitz added a comment.

In D110260#3018412 , @xgupta wrote:

> Yeah we need testcases, now it says
>
> JIT session error: Symbols not found: [ return1 ]
> JIT session error: Failed to materialize symbols: { (main, { foo_body }) }
> Unable to lazily compile function. Exiting.

Interesting, it does work for me now on macOS with both, shared libs on and 
off. Can you please check if you get something like this as well:

  ➜ nm bin/LLJITWithExecutorProcessControl | grep return1
  00014c10 T _return1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110260

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


[PATCH] D109707: [HIP] [AlwaysInliner] Disable AlwaysInliner to eliminate undefined symbols

2021-09-23 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments.



Comment at: llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp:65
 
-  return cast(Op.getGlobal());
+  return dyn_cast(Op.getGlobal());
 }

I think this is not the right place for this. If we can determine the callee 
function, we should have directly set it in the instruction during call lowering


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109707

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


[PATCH] D103938: Diagnose -Wunused-value based on CFG reachability

2021-09-23 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D103938#3013503 , @thakis wrote:

> This flags this code from absl:
>
>   template  typename std::enable_if::value, 
> int>::type =
> (GenT{}, 0)>
>   constexpr FlagDefaultArg DefaultArg(int) {
> return {FlagDefaultSrc(GenT{}.value), FlagDefaultKind::kOneWord};
>   }
>
> (https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/flags/internal/flag.h;l=293?q=third_party%2Fabseil-cpp%2Fabsl%2Fflags%2Finternal%2Fflag.h)
>
>   ../../third_party/abseil-cpp/absl/flags/internal/flag.h:293:16: warning: 
> left operand of comma operator has no effect [-Wunused-value]
> (GenT{}, 0)>
>  ^   ~~
>   ../../third_party/abseil-cpp/absl/flags/internal/flag.h:293:16: warning: 
> left operand of comma operator has no effect [-Wunused-value]
> (GenT{}, 0)>
>  ^   ~~
>
> I guess it has a SFINAE effect there?

Sorry for having missed this comment before when reviewing the code @thakis, 
thanks for pinging on it! That does look like a false positive assuming it's 
being used for SFINAE. @ychen, can you take a look (and revert if it looks like 
it'll take a while to resolve)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103938

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


[PATCH] D110304: [HIP] Fix linking of asanrt.bc

2021-09-23 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/include/clang/Driver/ToolChain.h:116-117
 
+  // Enums corresponding to clang options for linking bitcode, i.e.,
+  // -mlink-builtin-bitcode or -mlink-bitcode-file
+  enum BitCodeLinkOpt {

It appears that what we dealing with here is an on/off switch for whether we 
want to internalize symbols.

Perhaps it should be implemented as such. 
getHIPDeviceLibs() will set the bool flag indicating *what* we want to do with 
the library and then the toolchain-specific code will decide *how* to make it 
happen. Currently it translates into specific linking option, but it may be 
something else. getHIPDeviceLibs does not need to know that.

The code will remain essentially the same, it's mostly the naming exercise.




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

https://reviews.llvm.org/D110304

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


  1   2   >