[PATCH] D108189: [RISCV] Add arch attribute support for P extension

2021-09-02 Thread Jim Lin via Phabricator via cfe-commits
Jim updated this revision to Diff 370484.
Jim added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Base on D105168  to support arch features, 
arch attributes and
preprocessor definitions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108189

Files:
  clang/test/Driver/riscv-arch.c
  clang/test/Preprocessor/riscv-target-features.c
  llvm/lib/Support/RISCVISAInfo.cpp
  llvm/test/CodeGen/RISCV/attributes.ll
  llvm/test/MC/RISCV/attribute-arch-invalid.s
  llvm/test/MC/RISCV/attribute-arch.s

Index: llvm/test/MC/RISCV/attribute-arch.s
===
--- llvm/test/MC/RISCV/attribute-arch.s
+++ llvm/test/MC/RISCV/attribute-arch.s
@@ -36,6 +36,12 @@
 .attribute arch, "rv32ib"
 # CHECK: attribute  5, "rv32i2p0_b0p93_zba0p93_zbb0p93_zbc0p93_zbe0p93_zbf0p93_zbm0p93_zbp0p93_zbr0p93_zbs0p93_zbt0p93"
 
+.attribute arch, "rv32ip"
+# CHECK: attribute  5, "rv32i2p0_p0p93_zpn0p93_zpsfoperand0p93"
+
+.attribute arch, "rv64ip"
+# CHECK: attribute  5, "rv64i2p0_p0p93_zpn0p93_zprvsfextra0p93_zpsfoperand0p93"
+
 .attribute arch, "rv32iv"
 # CHECK: attribute  5, "rv32i2p0_v0p10_zvlsseg0p10"
 
@@ -72,6 +78,15 @@
 .attribute arch, "rv32izbt"
 # CHECK: attribute  5, "rv32i2p0_zbt0p93"
 
+.attribute arch, "rv32izpn"
+# CHECK: attribute  5, "rv32i2p0_zpn0p93"
+
+.attribute arch, "rv32izpsfoperand"
+# CHECK: attribute  5, "rv32i2p0_zpsfoperand0p93"
+
+.attribute arch, "rv64izprvsfextra"
+# CHECK: attribute  5, "rv64i2p0_zprvsfextra0p93"
+
 .attribute arch, "rv32ifzfh"
 # CHECK: attribute  5, "rv32i2p0_f2p0_zfh0p1"
 
Index: llvm/test/MC/RISCV/attribute-arch-invalid.s
===
--- /dev/null
+++ llvm/test/MC/RISCV/attribute-arch-invalid.s
@@ -0,0 +1,3 @@
+# RUN: not llvm-mc %s -triple=riscv32 -filetype=asm 2>&1 | FileCheck %s
+
+.attribute arch, "rv32izprvsfextra" # CHECK: :[[@LINE]]:18: error: invalid arch name 'rv32izprvsfextra', standard user-level extension 'zprvsfextra' requires 'rv64'
Index: llvm/test/CodeGen/RISCV/attributes.ll
===
--- llvm/test/CodeGen/RISCV/attributes.ll
+++ llvm/test/CodeGen/RISCV/attributes.ll
@@ -20,6 +20,9 @@
 ; RUN: llc -mtriple=riscv32 -mattr=+experimental-zbs %s -o - | FileCheck --check-prefix=RV32ZBS %s
 ; RUN: llc -mtriple=riscv32 -mattr=+experimental-zbt %s -o - | FileCheck --check-prefix=RV32ZBT %s
 ; RUN: llc -mtriple=riscv32 -mattr=+experimental-zbb,+experimental-zfh,+experimental-zvamo,+experimental-v,+f,+experimental-zvlsseg %s -o - | FileCheck --check-prefix=RV32COMBINED %s
+; RUN: llc -mtriple=riscv32 -mattr=+experimental-p %s -o - | FileCheck --check-prefix=RV32P %s
+; RUN: llc -mtriple=riscv32 -mattr=+experimental-zpn %s -o - | FileCheck --check-prefix=RV32ZPN %s
+; RUN: llc -mtriple=riscv32 -mattr=+experimental-zpsfoperand %s -o - | FileCheck --check-prefix=RV32ZPSFOPERAND %s
 ; RUN: llc -mtriple=riscv64 -mattr=+m %s -o - | FileCheck --check-prefix=RV64M %s
 ; RUN: llc -mtriple=riscv64 -mattr=+a %s -o - | FileCheck --check-prefix=RV64A %s
 ; RUN: llc -mtriple=riscv64 -mattr=+f %s -o - | FileCheck --check-prefix=RV64F %s
@@ -40,6 +43,10 @@
 ; RUN: llc -mtriple=riscv64 -mattr=+experimental-zbs %s -o - | FileCheck --check-prefix=RV64ZBS %s
 ; RUN: llc -mtriple=riscv64 -mattr=+experimental-zbt %s -o - | FileCheck --check-prefix=RV64ZBT %s
 ; RUN: llc -mtriple=riscv64 -mattr=+experimental-zbb,+experimental-zfh,+experimental-zvamo,+experimental-v,+f,+experimental-zvlsseg %s -o - | FileCheck --check-prefix=RV64COMBINED %s
+; RUN: llc -mtriple=riscv64 -mattr=+experimental-p %s -o - | FileCheck --check-prefix=RV64P %s
+; RUN: llc -mtriple=riscv64 -mattr=+experimental-zpn %s -o - | FileCheck --check-prefix=RV64ZPN %s
+; RUN: llc -mtriple=riscv64 -mattr=+experimental-zpsfoperand %s -o - | FileCheck --check-prefix=RV64ZPSFOPERAND %s
+; RUN: llc -mtriple=riscv64 -mattr=+experimental-zprvsfextra %s -o - | FileCheck --check-prefix=RV64ZPRVSFEXTRA %s
 
 ; RV32M: .attribute 5, "rv32i2p0_m2p0"
 ; RV32A: .attribute 5, "rv32i2p0_a2p0"
@@ -61,6 +68,9 @@
 ; RV32ZBS: .attribute 5, "rv32i2p0_zbs0p93"
 ; RV32ZBT: .attribute 5, "rv32i2p0_zbt0p93"
 ; RV32COMBINED: .attribute 5, "rv32i2p0_f2p0_v0p10_zfh0p1_zbb0p93_zvamo0p10_zvlsseg0p10"
+; RV32P: .attribute 5, "rv32i2p0_p0p93_zpn0p93_zpsfoperand0p93"
+; RV32ZPN: .attribute 5, "rv32i2p0_zpn0p93"
+; RV32ZPSFOPERAND: .attribute 5, "rv32i2p0_zpsfoperand0p93"
 
 ; RV64M: .attribute 5, "rv64i2p0_m2p0"
 ; RV64A: .attribute 5, "rv64i2p0_a2p0"
@@ -82,6 +92,10 @@
 ; RV64ZBT: .attribute 5, "rv64i2p0_zbt0p93"
 ; RV64V: .attribute 5, "rv64i2p0_v0p10_zvamo0p10_zvlsseg0p10"
 ; RV64COMBINED: .attribute 5, "rv64i2p0_f2p0_v0p10_zfh0p1_zbb0p93_zvamo0p10_zvlsseg0p10"
+; RV64P: .attribute 5, 

[PATCH] D105168: [RISCV] Unify the arch string parsing logic to RISCVISAInfo.

2021-09-02 Thread Jim Lin via Phabricator via cfe-commits
Jim added inline comments.



Comment at: llvm/lib/Support/RISCVISAInfo.cpp:416
+ExtensionInfoIterator->Version.Minor);
+  if (ExtName == "e") {
+if (XLen != 32)

Could this checking put before ISAInfo->addExtension...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105168

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


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-09-02 Thread Keith Smiley via Phabricator via cfe-commits
keith updated this revision to Diff 370480.
keith marked 2 inline comments as done.
keith added a comment.

Update variable name and add unit test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109128

Files:
  clang/test/VFS/relative-path-errors.c
  llvm/lib/Support/VirtualFileSystem.cpp
  llvm/unittests/Support/VirtualFileSystemTest.cpp


Index: llvm/unittests/Support/VirtualFileSystemTest.cpp
===
--- llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -1607,6 +1607,26 @@
   EXPECT_EQ(0, NumDiagnostics);
 }
 
+TEST_F(VFSFromYAMLTest, RelativePathFallthrough) {
+  IntrusiveRefCntPtr BaseFS =
+  new vfs::InMemoryFileSystem;
+  BaseFS->addFile("//root/foo/a", 0, MemoryBuffer::getMemBuffer("contents of 
a"));
+  ASSERT_FALSE(BaseFS->setCurrentWorkingDirectory("//root/foo"));
+  auto RemappedFS = vfs::RedirectingFileSystem::create(
+  {}, /*UseExternalNames=*/false, *BaseFS);
+
+  auto OpenedF = RemappedFS->openFileForRead("a");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("a", Name.get());
+  EXPECT_EQ("a", OpenedS->getName());
+  EXPECT_FALSE(OpenedS->IsVFSMapped);
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
 TEST_F(VFSFromYAMLTest, CaseInsensitive) {
   IntrusiveRefCntPtr Lower(new DummyFileSystem());
   Lower->addRegularFile("//root/foo/bar/a");
Index: llvm/lib/Support/VirtualFileSystem.cpp
===
--- llvm/lib/Support/VirtualFileSystem.cpp
+++ llvm/lib/Support/VirtualFileSystem.cpp
@@ -2003,14 +2003,14 @@
 } // namespace
 
 ErrorOr>
-RedirectingFileSystem::openFileForRead(const Twine _) {
-  SmallString<256> Path;
-  Path_.toVector(Path);
+RedirectingFileSystem::openFileForRead(const Twine ) {
+  SmallString<256> CanonicalPath;
+  Path.toVector(CanonicalPath);
 
-  if (std::error_code EC = makeCanonical(Path))
+  if (std::error_code EC = makeCanonical(CanonicalPath))
 return EC;
 
-  ErrorOr Result = lookupPath(Path);
+  ErrorOr Result = 
lookupPath(CanonicalPath);
   if (!Result) {
 if (shouldFallBackToExternalFS(Result.getError()))
   return ExternalFS->openFileForRead(Path);
@@ -2036,7 +2036,7 @@
 
   // FIXME: Update the status with the name and VFSMapped.
   Status S = getRedirectedFileStatus(
-  Path, RE->useExternalName(UseExternalNames), *ExternalStatus);
+  CanonicalPath, RE->useExternalName(UseExternalNames), *ExternalStatus);
   return std::unique_ptr(
   std::make_unique(std::move(*ExternalFile), S));
 }
Index: clang/test/VFS/relative-path-errors.c
===
--- /dev/null
+++ clang/test/VFS/relative-path-errors.c
@@ -0,0 +1,8 @@
+// RUN: mkdir -p %t
+// RUN: cd %t
+// RUN: echo '{"roots": [],"version": 0}' > %t.yaml
+// RUN: cp %s main.c
+// RUN: not %clang_cc1 -ivfsoverlay %t.yaml main.c 2>&1 | FileCheck %s
+
+// CHECK: {{^}}main.c:8:1: error:
+foobarbaz


Index: llvm/unittests/Support/VirtualFileSystemTest.cpp
===
--- llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -1607,6 +1607,26 @@
   EXPECT_EQ(0, NumDiagnostics);
 }
 
+TEST_F(VFSFromYAMLTest, RelativePathFallthrough) {
+  IntrusiveRefCntPtr BaseFS =
+  new vfs::InMemoryFileSystem;
+  BaseFS->addFile("//root/foo/a", 0, MemoryBuffer::getMemBuffer("contents of a"));
+  ASSERT_FALSE(BaseFS->setCurrentWorkingDirectory("//root/foo"));
+  auto RemappedFS = vfs::RedirectingFileSystem::create(
+  {}, /*UseExternalNames=*/false, *BaseFS);
+
+  auto OpenedF = RemappedFS->openFileForRead("a");
+  ASSERT_FALSE(OpenedF.getError());
+  llvm::ErrorOr Name = (*OpenedF)->getName();
+  ASSERT_FALSE(Name.getError());
+  auto OpenedS = (*OpenedF)->status();
+  ASSERT_FALSE(OpenedS.getError());
+  EXPECT_EQ("a", Name.get());
+  EXPECT_EQ("a", OpenedS->getName());
+  EXPECT_FALSE(OpenedS->IsVFSMapped);
+  EXPECT_EQ(0, NumDiagnostics);
+}
+
 TEST_F(VFSFromYAMLTest, CaseInsensitive) {
   IntrusiveRefCntPtr Lower(new DummyFileSystem());
   Lower->addRegularFile("//root/foo/bar/a");
Index: llvm/lib/Support/VirtualFileSystem.cpp
===
--- llvm/lib/Support/VirtualFileSystem.cpp
+++ llvm/lib/Support/VirtualFileSystem.cpp
@@ -2003,14 +2003,14 @@
 } // namespace
 
 ErrorOr>
-RedirectingFileSystem::openFileForRead(const Twine _) {
-  SmallString<256> Path;
-  Path_.toVector(Path);
+RedirectingFileSystem::openFileForRead(const Twine ) {
+  SmallString<256> CanonicalPath;
+  Path.toVector(CanonicalPath);
 
-  if (std::error_code EC = makeCanonical(Path))
+  if (std::error_code EC = 

[PATCH] D108421: Mark openmp internal global dso_local

2021-09-02 Thread Umesh Kalappa via Phabricator via cfe-commits
umesh.kalappa0 added a comment.

In D108421#2977216 , @MaskRay wrote:

> In D108421#2977107 , @kamleshbhalui 
> wrote:
>
>> In D108421#2958848 , @MaskRay 
>> wrote:
>>
>>> If you read the comment in TargetMachine::shouldAssumeDSOLocal: this is the 
>>> wrong direction. dso_local is assumed to be marked by the frontend.
>>>
>>> Direct accesses and GOT accesses are trade-offs. Direct accesses are not 
>>> always preferred. The MachO special case is an unfortunate case for their 
>>> xnu kernel, not a good example here.
>>
>> @MaskRay I would like to know more about these trade-offs details, any 
>> supporting documents will do.
>> Considering below testcase, can you shed some light how code generated by 
>> llc-12 is better than llc-11 for given testcase?
>> https://godbolt.org/z/x9xojWb58
>
> This is a very minor issue. First, global variable access is rarely a 
> performance bottleneck.
> Second, if the symbol turns out to be non-preemptible (which implies that it 
> is defined in the component), the R_X86_64_REX_GOTPCRELX GOT indirection can 
> be optimized out.
> The only minor issue is slightly longer code sequence.
>
>> And FYI this testcase does not work when build as Linux Kernel Module. LKM 
>> loader throw error("Unknown rela relocation: 42")?
>
> This is a kernel issue. Please mention the justification (is it related to 
> OpenMP?) in the first place.
> The kernel can be compiled in -fpie mode. In this mode, taking the address of 
> a default-visibility undefined symbol uses R_X86_64_REX_GOTPCRELX.
> So the kernel should support R_X86_64_REX_GOTPCRELX anyway.
>
> ---
>
> If we think the optimization is meaningful:
>
> Depending on the property of `.gomp_critical_user_.atomic_reduction.var` 
> different DSOLocal strategies should be used.
> If it is TU-local, make it local linkage. If it is linked image local, make 
> it hidden visibility.
> If it may be defined in a shared object and shared with other shared objects 
> or the main executable, (not so sure because such symbol interposition does 
> not work in other binary formats), use dso_preemptable as is.
>
> I believe the current forced dso_local is definitely incorrect because it may 
> break `-fpic -shared` links.

@kamleshbhalui  ,make the changes accordingly that honour -fpic and don't mark 
dsolocal in this case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108421

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


[PATCH] D109210: [clang-tidy] Attach fixit to warning, not note, in add_new_check.py example

2021-09-02 Thread Matt Beardsley via Phabricator via cfe-commits
mattbeardsley created this revision.
mattbeardsley added reviewers: njames93, aaron.ballman.
Herald added a subscriber: xazax.hun.
mattbeardsley requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Per this commit, "Note" diagnostics should not be used to provide the default
fix behavior:
https://reviews.llvm.org/rGabbe9e227ed31e5dde9bb7567bb9f0dd047689c6

With the default clang-tidy behavior being to not "--fix-notes" in the above
commit, the add_new_check.py script would generate a check that does not pass
its own generated test (before this change)

Because the generated example clang-tidy check has a clear default FixItHint,
based on the above commit, the FixItHint would be better suited by being sent to
the warning diag(...), as opposed to keeping the separate note diag(...) and
passing "--fix-notes" in the generated test


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109210

Files:
  clang-tools-extra/clang-tidy/add_new_check.py


Index: clang-tools-extra/clang-tidy/add_new_check.py
===
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -144,8 +144,7 @@
   if (!MatchedDecl->getIdentifier() || 
MatchedDecl->getName().startswith("awesome_"))
 return;
   diag(MatchedDecl->getLocation(), "function %%0 is insufficiently awesome")
-  << MatchedDecl;
-  diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note)
+  << MatchedDecl
   << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
 }
 


Index: clang-tools-extra/clang-tidy/add_new_check.py
===
--- clang-tools-extra/clang-tidy/add_new_check.py
+++ clang-tools-extra/clang-tidy/add_new_check.py
@@ -144,8 +144,7 @@
   if (!MatchedDecl->getIdentifier() || MatchedDecl->getName().startswith("awesome_"))
 return;
   diag(MatchedDecl->getLocation(), "function %%0 is insufficiently awesome")
-  << MatchedDecl;
-  diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note)
+  << MatchedDecl
   << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109199: [compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain

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



Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:123
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_CAN_EXECUTE_TESTS ON CACHE BOOL "")

leonardchan wrote:
> phosek wrote:
> > This shouldn't be needed.
> So while we do build builtins, this is actually needed to run builtins tests: 
> https://github.com/llvm/llvm-project/blob/ad7e12226f6b1ebf91511899016cdfb29aa8919e/compiler-rt/test/CMakeLists.txt#L59
We are already build builtins in a separate build so I think we should be 
running the tests there rather than building the twice.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109199

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


[PATCH] D108886: Add RISC-V sifive-s51 cpu

2021-09-02 Thread Alexander Pivovarov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6cd4b508a8a5: [RISCV] Add SiFive core S51 (authored by 
apivovarov).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108886

Files:
  clang/docs/ReleaseNotes.rst
  clang/test/Driver/riscv-cpus.c
  clang/test/Misc/target-invalid-cpu-note.c
  llvm/include/llvm/Support/RISCVTargetParser.def
  llvm/lib/Target/RISCV/RISCV.td


Index: llvm/lib/Target/RISCV/RISCV.td
===
--- llvm/lib/Target/RISCV/RISCV.td
+++ llvm/lib/Target/RISCV/RISCV.td
@@ -254,6 +254,11 @@
  FeatureStdExtA,
  FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-s51", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ FeatureStdExtA,
+ FeatureStdExtC]>;
+
 def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
  FeatureStdExtM,
  FeatureStdExtA,
Index: llvm/include/llvm/Support/RISCVTargetParser.def
===
--- llvm/include/llvm/Support/RISCVTargetParser.def
+++ llvm/include/llvm/Support/RISCVTargetParser.def
@@ -20,6 +20,7 @@
 PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""})
 PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""})
 PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_S51, {"sifive-s51"}, FK_64BIT, {"rv64imac"})
 PROC(SIFIVE_U54, {"sifive-u54"}, FK_64BIT, {"rv64gc"})
 PROC(SIFIVE_E76, {"sifive-e76"}, FK_NONE, {"rv32imafc"})
 PROC(SIFIVE_U74, {"sifive-u74"}, FK_64BIT, {"rv64gc"})
Index: clang/test/Misc/target-invalid-cpu-note.c
===
--- clang/test/Misc/target-invalid-cpu-note.c
+++ clang/test/Misc/target-invalid-cpu-note.c
@@ -196,7 +196,7 @@
 
 // RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix RISCV64
 // RISCV64: error: unknown target CPU 'not-a-cpu'
-// RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-u54, sifive-u74
+// RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-s51, sifive-u54, sifive-u74
 
 // RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix TUNE-RISCV32
 // TUNE-RISCV32: error: unknown target CPU 'not-a-cpu'
@@ -204,4 +204,4 @@
 
 // RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
 // TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
-// TUNE-RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-u54, sifive-u74, generic, rocket, sifive-7-series
+// TUNE-RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-s51, sifive-u54, sifive-u74, generic, rocket, 
sifive-7-series
Index: clang/test/Driver/riscv-cpus.c
===
--- clang/test/Driver/riscv-cpus.c
+++ clang/test/Driver/riscv-cpus.c
@@ -45,6 +45,13 @@
 // RUN: %clang -target riscv64 -### -c %s 2>&1 -mtune=sifive-7-series | 
FileCheck -check-prefix=MTUNE-SIFIVE7-SERIES-64 %s
 // MTUNE-SIFIVE7-SERIES-64: "-tune-cpu" "sifive-7-rv64"
 
+// mcpu with mabi option
+// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-s51 -mabi=lp64 | 
FileCheck -check-prefix=MCPU-ABI-SIFIVE-S51 %s
+// MCPU-ABI-SIFIVE-S51: "-nostdsysteminc" "-target-cpu" "sifive-s51"
+// MCPU-ABI-SIFIVE-S51: "-target-feature" "+m" "-target-feature" "+a"
+// MCPU-ABI-SIFIVE-S51: "-target-feature" "+c" "-target-feature" "+64bit"
+// MCPU-ABI-SIFIVE-S51: "-target-abi" "lp64"
+
 // mcpu with default march
 // RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-u54 | FileCheck 
-check-prefix=MCPU-SIFIVE-U54 %s
 // MCPU-SIFIVE-U54: "-nostdsysteminc" "-target-cpu" "sifive-u54"
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -71,7 +71,9 @@
 Modified Compiler Flags
 ---
 
-- ...
+- Support has been added for the following processors (``-mcpu`` identifiers 
in parentheses):
+
+  - RISC-V SiFive S51 (``sifive-s51``).
 
 Removed Compiler Flags
 -


Index: llvm/lib/Target/RISCV/RISCV.td
===
--- llvm/lib/Target/RISCV/RISCV.td
+++ llvm/lib/Target/RISCV/RISCV.td
@@ -254,6 +254,11 @@
  FeatureStdExtA,
  

[clang] 6cd4b50 - [RISCV] Add SiFive core S51

2021-09-02 Thread Alexander Pivovarov via cfe-commits

Author: Alexander Pivovarov
Date: 2021-09-02T18:45:25-07:00
New Revision: 6cd4b508a8a51ecd16d2b0297dfeb445ab41b42e

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

LOG: [RISCV] Add SiFive core S51

Add SiFive core s51 as rv64imac RocketModel

Reviewed-By: MaskRay, evandro
Differential Revision: https://reviews.llvm.org/D108886

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/test/Driver/riscv-cpus.c
clang/test/Misc/target-invalid-cpu-note.c
llvm/include/llvm/Support/RISCVTargetParser.def
llvm/lib/Target/RISCV/RISCV.td

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 8bae1ed29eeb8..c62cefc54a663 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -71,7 +71,9 @@ Deprecated Compiler Flags
 Modified Compiler Flags
 ---
 
-- ...
+- Support has been added for the following processors (``-mcpu`` identifiers 
in parentheses):
+
+  - RISC-V SiFive S51 (``sifive-s51``).
 
 Removed Compiler Flags
 -

diff  --git a/clang/test/Driver/riscv-cpus.c b/clang/test/Driver/riscv-cpus.c
index bca25059fd21d..4c26bf8751c27 100644
--- a/clang/test/Driver/riscv-cpus.c
+++ b/clang/test/Driver/riscv-cpus.c
@@ -45,6 +45,13 @@
 // RUN: %clang -target riscv64 -### -c %s 2>&1 -mtune=sifive-7-series | 
FileCheck -check-prefix=MTUNE-SIFIVE7-SERIES-64 %s
 // MTUNE-SIFIVE7-SERIES-64: "-tune-cpu" "sifive-7-rv64"
 
+// mcpu with mabi option
+// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-s51 -mabi=lp64 | 
FileCheck -check-prefix=MCPU-ABI-SIFIVE-S51 %s
+// MCPU-ABI-SIFIVE-S51: "-nostdsysteminc" "-target-cpu" "sifive-s51"
+// MCPU-ABI-SIFIVE-S51: "-target-feature" "+m" "-target-feature" "+a"
+// MCPU-ABI-SIFIVE-S51: "-target-feature" "+c" "-target-feature" "+64bit"
+// MCPU-ABI-SIFIVE-S51: "-target-abi" "lp64"
+
 // mcpu with default march
 // RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-u54 | FileCheck 
-check-prefix=MCPU-SIFIVE-U54 %s
 // MCPU-SIFIVE-U54: "-nostdsysteminc" "-target-cpu" "sifive-u54"

diff  --git a/clang/test/Misc/target-invalid-cpu-note.c 
b/clang/test/Misc/target-invalid-cpu-note.c
index 837ec4a6a4427..8963c309e6dbe 100644
--- a/clang/test/Misc/target-invalid-cpu-note.c
+++ b/clang/test/Misc/target-invalid-cpu-note.c
@@ -196,7 +196,7 @@
 
 // RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix RISCV64
 // RISCV64: error: unknown target CPU 'not-a-cpu'
-// RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-u54, sifive-u74
+// RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-s51, sifive-u54, sifive-u74
 
 // RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix TUNE-RISCV32
 // TUNE-RISCV32: error: unknown target CPU 'not-a-cpu'
@@ -204,4 +204,4 @@
 
 // RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 
2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
 // TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
-// TUNE-RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-u54, sifive-u74, generic, rocket, sifive-7-series
+// TUNE-RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 
sifive-7-rv64, sifive-s51, sifive-u54, sifive-u74, generic, rocket, 
sifive-7-series

diff  --git a/llvm/include/llvm/Support/RISCVTargetParser.def 
b/llvm/include/llvm/Support/RISCVTargetParser.def
index 6a06f9258105c..01f560ae99a0e 100644
--- a/llvm/include/llvm/Support/RISCVTargetParser.def
+++ b/llvm/include/llvm/Support/RISCVTargetParser.def
@@ -20,6 +20,7 @@ PROC(ROCKET_RV64, {"rocket-rv64"}, FK_64BIT, {""})
 PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""})
 PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""})
 PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"})
+PROC(SIFIVE_S51, {"sifive-s51"}, FK_64BIT, {"rv64imac"})
 PROC(SIFIVE_U54, {"sifive-u54"}, FK_64BIT, {"rv64gc"})
 PROC(SIFIVE_E76, {"sifive-e76"}, FK_NONE, {"rv32imafc"})
 PROC(SIFIVE_U74, {"sifive-u74"}, FK_64BIT, {"rv64gc"})

diff  --git a/llvm/lib/Target/RISCV/RISCV.td b/llvm/lib/Target/RISCV/RISCV.td
index 52e8d8cdc7742..61034fd7295c7 100644
--- a/llvm/lib/Target/RISCV/RISCV.td
+++ b/llvm/lib/Target/RISCV/RISCV.td
@@ -254,6 +254,11 @@ def : ProcessorModel<"sifive-e31", RocketModel, 
[FeatureStdExtM,
  FeatureStdExtA,
  FeatureStdExtC]>;
 
+def : ProcessorModel<"sifive-s51", RocketModel, [Feature64Bit,
+ FeatureStdExtM,
+ 

[PATCH] D109139: [AIX][RFC] Undefine __STDC_NO_ATOMICS__ to enable c11 atomics functionality

2021-09-02 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

For the missing library implementation, we may be able to use the 
implementation in compiler-rt. Seems like some other platforms do so.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109139

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


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-09-02 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

Was looking at an issue caused by over-eager RedirectingFileSystem path 
canonicalization and this patch fixes it. The repro we have is more complicated 
(involves 3 modules), so I don't think it is worth including with this change.




Comment at: llvm/lib/Support/VirtualFileSystem.cpp:2006
 ErrorOr>
 RedirectingFileSystem::openFileForRead(const Twine _) {
   SmallString<256> Path;

dexonsmith wrote:
> I suggest giving this a real name if it's being used for anything. Maybe 
> `PathAsWritten`?
Another idea is to keep this variable `Path` and rename old Path to 
`CanonicalPath`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109128

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


[PATCH] D109199: [compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain

2021-09-02 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment.

Split also into https://reviews.llvm.org/D109207 and 
https://reviews.llvm.org/D109208


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109199

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


[PATCH] D109199: [compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain

2021-09-02 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan updated this revision to Diff 370447.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109199

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -60,7 +60,6 @@
   set(COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
 
   set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
-  set(LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
   set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
   set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
   set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
@@ -121,9 +120,10 @@
 set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE 
STRING "")
 set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING 
"")
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_CAN_EXECUTE_TESTS ON CACHE BOOL "")
 set(RUNTIMES_${target}_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
 set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
-set(RUNTIMES_${target}_LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
 set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
 set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
 set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
@@ -136,6 +136,10 @@
 set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_TEST_COMPILER_CFLAGS 
"--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_SANITIZER_COMMON_TEST_TARGET_CFLAGS 
"--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_TSAN_TEST_TARGET_CFLAGS "--unwindlib=libunwind 
-static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE BOOL 
"")
 set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES 
"compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
 
 # Use .build-id link.


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -60,7 +60,6 @@
   set(COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
 
   set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
-  set(LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
   set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
   set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
   set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
@@ -121,9 +120,10 @@
 set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
 set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_CAN_EXECUTE_TESTS ON CACHE BOOL "")
 set(RUNTIMES_${target}_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
 set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
-set(RUNTIMES_${target}_LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
 set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
 set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
 set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
@@ -136,6 +136,10 @@
 set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_TEST_COMPILER_CFLAGS "--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_SANITIZER_COMMON_TEST_TARGET_CFLAGS "--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_TSAN_TEST_TARGET_CFLAGS "--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE BOOL "")
 set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
 
 # Use .build-id link.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109199: [compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain

2021-09-02 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added inline comments.



Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:141
+set(RUNTIMES_${target}_SANITIZER_COMMON_TEST_TARGET_CFLAGS 
"--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_TSAN_TEST_TARGET_CFLAGS "--unwindlib=libunwind" 
CACHE STRING "")
+set(RUNTIMES_${target}_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE BOOL 
"")

leonardchan wrote:
> phosek wrote:
> > Don't we need the `-static-libgcc` flag here as well?
> When testing locally, there was actually a tsan test that wasn't working if 
> `-static-libgcc` was here. I can try to reproduce it. I believe it had to do 
> with static linking in an archive, but a particular object file in that 
> archive wasn't getting linked in which changed some runtime logic and caused 
> the test to fail.
Oh ok. Disregard my last explanation. So the test is 
`compiler-rt/test/tsan/Linux/check_memcpy.c`, and the actual reason it failed 
is because the test just checks to make sure calls to `memcpy/memset` are not 
used at all (since tsan should intercept them and replace them with its own 
functions/code).

The issue is that if we statically link in an uninstrumented libunwind, then 
the test will fail bc it will find memcpy/set calls in that libunwind code. 
Removing the `-static-libgcc` seems to instead opt for dynamically linking 
against libunwind.so, and not linking in any uninstrumented code. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109199

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


[PATCH] D109181: Reland "Try to unbreak Win build differently after 973519826edb76""

2021-09-02 Thread Geoffrey Martin-Noble via Phabricator via cfe-commits
GMNGeoffrey added a comment.

I can't repro the failure locally and it appears to also be broken at head


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109181

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


[PATCH] D109181: Reland "Try to unbreak Win build differently after 973519826edb76""

2021-09-02 Thread Geoffrey Martin-Noble 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 rGcc2d4dc3e0cc: Reland Try to unbreak Win build 
differently after 973519826edb76 (authored by thakis, committed by 
GMNGeoffrey).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109181

Files:
  clang/lib/Driver/ToolChains/Arch/X86.cpp
  llvm/include/llvm/ADT/StringMap.h
  llvm/unittests/ADT/StringMapTest.cpp


Index: llvm/unittests/ADT/StringMapTest.cpp
===
--- llvm/unittests/ADT/StringMapTest.cpp
+++ llvm/unittests/ADT/StringMapTest.cpp
@@ -308,7 +308,21 @@
   EXPECT_EQ(0, try1.first->second.copy);
 }
 
-TEST_F(StringMapTest, IterMapKeys) {
+TEST_F(StringMapTest, IterMapKeysVector) {
+  StringMap Map;
+  Map["A"] = 1;
+  Map["B"] = 2;
+  Map["C"] = 3;
+  Map["D"] = 3;
+
+  std::vector Keys{Map.keys().begin(), Map.keys().end()};
+  llvm::sort(Keys);
+
+  std::vector Expected{{"A", "B", "C", "D"}};
+  EXPECT_EQ(Expected, Keys);
+}
+
+TEST_F(StringMapTest, IterMapKeysSmallVector) {
   StringMap Map;
   Map["A"] = 1;
   Map["B"] = 2;
Index: llvm/include/llvm/ADT/StringMap.h
===
--- llvm/include/llvm/ADT/StringMap.h
+++ llvm/include/llvm/ADT/StringMap.h
@@ -478,13 +478,7 @@
   explicit StringMapKeyIterator(StringMapConstIterator Iter)
   : base(std::move(Iter)) {}
 
-  StringRef *() {
-Key = this->wrapped()->getKey();
-return Key;
-  }
-
-private:
-  StringRef Key;
+  StringRef operator*() const { return this->wrapped()->getKey(); }
 };
 
 } // end namespace llvm
Index: clang/lib/Driver/ToolChains/Arch/X86.cpp
===
--- clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,9 +59,8 @@
 }
 StringRef CPU = ArchMap.lookup(A->getValue());
 if (CPU.empty()) {
-  std::vector ValidArchs;
-  for (StringRef Key : ArchMap.keys())
-ValidArchs.push_back(Key);
+  std::vector ValidArchs{ArchMap.keys().begin(),
+ArchMap.keys().end()};
   sort(ValidArchs);
   D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
   << A->getValue() << (Triple.getArch() == llvm::Triple::x86)


Index: llvm/unittests/ADT/StringMapTest.cpp
===
--- llvm/unittests/ADT/StringMapTest.cpp
+++ llvm/unittests/ADT/StringMapTest.cpp
@@ -308,7 +308,21 @@
   EXPECT_EQ(0, try1.first->second.copy);
 }
 
-TEST_F(StringMapTest, IterMapKeys) {
+TEST_F(StringMapTest, IterMapKeysVector) {
+  StringMap Map;
+  Map["A"] = 1;
+  Map["B"] = 2;
+  Map["C"] = 3;
+  Map["D"] = 3;
+
+  std::vector Keys{Map.keys().begin(), Map.keys().end()};
+  llvm::sort(Keys);
+
+  std::vector Expected{{"A", "B", "C", "D"}};
+  EXPECT_EQ(Expected, Keys);
+}
+
+TEST_F(StringMapTest, IterMapKeysSmallVector) {
   StringMap Map;
   Map["A"] = 1;
   Map["B"] = 2;
Index: llvm/include/llvm/ADT/StringMap.h
===
--- llvm/include/llvm/ADT/StringMap.h
+++ llvm/include/llvm/ADT/StringMap.h
@@ -478,13 +478,7 @@
   explicit StringMapKeyIterator(StringMapConstIterator Iter)
   : base(std::move(Iter)) {}
 
-  StringRef *() {
-Key = this->wrapped()->getKey();
-return Key;
-  }
-
-private:
-  StringRef Key;
+  StringRef operator*() const { return this->wrapped()->getKey(); }
 };
 
 } // end namespace llvm
Index: clang/lib/Driver/ToolChains/Arch/X86.cpp
===
--- clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,9 +59,8 @@
 }
 StringRef CPU = ArchMap.lookup(A->getValue());
 if (CPU.empty()) {
-  std::vector ValidArchs;
-  for (StringRef Key : ArchMap.keys())
-ValidArchs.push_back(Key);
+  std::vector ValidArchs{ArchMap.keys().begin(),
+ArchMap.keys().end()};
   sort(ValidArchs);
   D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
   << A->getValue() << (Triple.getArch() == llvm::Triple::x86)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] cc2d4dc - Reland "Try to unbreak Win build differently after 973519826edb76""

2021-09-02 Thread Geoffrey Martin-Noble via cfe-commits

Author: Nico Weber
Date: 2021-09-02T16:19:58-07:00
New Revision: cc2d4dc3e0ccb50e341f4ea301087bdd14be78a7

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

LOG: Reland "Try to unbreak Win build differently after 973519826edb76""

Build should be fixed by
https://github.com/llvm/llvm-project/commit/9d22754389

This reverts commit df052e1732ab57f5d9c684ceeaed3ab39073cd9f.

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/X86.cpp
llvm/include/llvm/ADT/StringMap.h
llvm/unittests/ADT/StringMapTest.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp 
b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index 2e43c455b28fd..bfa008f964e19 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,9 +59,8 @@ std::string x86::getX86TargetCPU(const Driver , const 
ArgList ,
 }
 StringRef CPU = ArchMap.lookup(A->getValue());
 if (CPU.empty()) {
-  std::vector ValidArchs;
-  for (StringRef Key : ArchMap.keys())
-ValidArchs.push_back(Key);
+  std::vector ValidArchs{ArchMap.keys().begin(),
+ArchMap.keys().end()};
   sort(ValidArchs);
   D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
   << A->getValue() << (Triple.getArch() == llvm::Triple::x86)

diff  --git a/llvm/include/llvm/ADT/StringMap.h 
b/llvm/include/llvm/ADT/StringMap.h
index 003e62d98ec23..669956d41e0c5 100644
--- a/llvm/include/llvm/ADT/StringMap.h
+++ b/llvm/include/llvm/ADT/StringMap.h
@@ -478,13 +478,7 @@ class StringMapKeyIterator
   explicit StringMapKeyIterator(StringMapConstIterator Iter)
   : base(std::move(Iter)) {}
 
-  StringRef *() {
-Key = this->wrapped()->getKey();
-return Key;
-  }
-
-private:
-  StringRef Key;
+  StringRef operator*() const { return this->wrapped()->getKey(); }
 };
 
 } // end namespace llvm

diff  --git a/llvm/unittests/ADT/StringMapTest.cpp 
b/llvm/unittests/ADT/StringMapTest.cpp
index 6a3cca5a4a324..f38a60452e3c7 100644
--- a/llvm/unittests/ADT/StringMapTest.cpp
+++ b/llvm/unittests/ADT/StringMapTest.cpp
@@ -308,7 +308,21 @@ TEST_F(StringMapTest, InsertOrAssignTest) {
   EXPECT_EQ(0, try1.first->second.copy);
 }
 
-TEST_F(StringMapTest, IterMapKeys) {
+TEST_F(StringMapTest, IterMapKeysVector) {
+  StringMap Map;
+  Map["A"] = 1;
+  Map["B"] = 2;
+  Map["C"] = 3;
+  Map["D"] = 3;
+
+  std::vector Keys{Map.keys().begin(), Map.keys().end()};
+  llvm::sort(Keys);
+
+  std::vector Expected{{"A", "B", "C", "D"}};
+  EXPECT_EQ(Expected, Keys);
+}
+
+TEST_F(StringMapTest, IterMapKeysSmallVector) {
   StringMap Map;
   Map["A"] = 1;
   Map["B"] = 2;



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


[PATCH] D109199: [compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain

2021-09-02 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment.

In D109199#2981174 , @phosek wrote:

> @leonardchan would it be possible to break this up into 3 changes?

Can do.




Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:123
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_CAN_EXECUTE_TESTS ON CACHE BOOL "")

phosek wrote:
> This shouldn't be needed.
So while we do build builtins, this is actually needed to run builtins tests: 
https://github.com/llvm/llvm-project/blob/ad7e12226f6b1ebf91511899016cdfb29aa8919e/compiler-rt/test/CMakeLists.txt#L59



Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:141
+set(RUNTIMES_${target}_SANITIZER_COMMON_TEST_TARGET_CFLAGS 
"--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_TSAN_TEST_TARGET_CFLAGS "--unwindlib=libunwind" 
CACHE STRING "")
+set(RUNTIMES_${target}_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE BOOL 
"")

phosek wrote:
> Don't we need the `-static-libgcc` flag here as well?
When testing locally, there was actually a tsan test that wasn't working if 
`-static-libgcc` was here. I can try to reproduce it. I believe it had to do 
with static linking in an archive, but a particular object file in that archive 
wasn't getting linked in which changed some runtime logic and caused the test 
to fail.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109199

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


[PATCH] D109181: Reland "Try to unbreak Win build differently after 973519826edb76""

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

In D109181#2981093 , @GMNGeoffrey 
wrote:

> Hmmm so pre-merge checks on Linux are failing
>
> https://buildkite.com/llvm-project/premerge-checks/builds/54955#8fea4a06-e971-48ad-a6d7-31173315d83d

I can't repro this locally. I re-ran pre-merge checks here D109200 
 (=> 
https://buildkite.com/llvm-project/premerge-checks/builds/54996#5ef72074-ab0b-4e31-8194-6c460afc4b6b)
 and only the tests mentioned on https://reviews.llvm.org/D108884#2981158 are 
failing in that run, so I think that's probably some unrelated flake.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109181

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


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

2021-09-02 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai updated this revision to Diff 370440.
HsiangKai added a comment.

Address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105092

Files:
  llvm/include/llvm/IR/IntrinsicsRISCV.td
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
  llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
  llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
  llvm/test/CodeGen/RISCV/rvv/common-shuffle-patterns.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-shuffles.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll
  llvm/test/CodeGen/RISCV/rvv/interleave-crash.ll
  llvm/test/CodeGen/RISCV/rvv/mgather-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/tail-agnostic-impdef-copy.mir
  llvm/test/CodeGen/RISCV/rvv/vaadd-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vaadd-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vaaddu-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vaaddu-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vadd-policy.ll
  llvm/test/CodeGen/RISCV/rvv/vadd-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vadd-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vand-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vand-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vasub-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vasub-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vasubu-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vasubu-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vdiv-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vdiv-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vdivu-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vdivu-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfadd-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfadd-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-x-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-x-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-xu-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-xu-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-rtz-x-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-rtz-x-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-rtz-xu-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-rtz-xu-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-x-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-x-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-xu-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-xu-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfdiv-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfdiv-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfmax-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfmax-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfmin-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfmin-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfmul-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfmul-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-x-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-x-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-xu-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-xu-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rod-f-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rod-f-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rtz-x-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rtz-x-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rtz-xu-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rtz-xu-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-x-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-x-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-xu-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-xu-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfrdiv-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfrdiv-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfrec7-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfrec7-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfrsqrt7-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfrsqrt7-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfrsub-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfrsub-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnj-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnj-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnjn-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnjn-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnjx-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnjx-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfslide1down-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfslide1down-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfslide1up-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfslide1up-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfsqrt-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfsqrt-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfsub-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfsub-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfwadd-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfwadd-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfwadd.w-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfwadd.w-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-f-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-f-f-rv64.ll
  

[PATCH] D109199: [compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain

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

@leonardchan would it be possible to break this up into 3 changes?




Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:123
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_CAN_EXECUTE_TESTS ON CACHE BOOL "")

This shouldn't be needed.



Comment at: clang/cmake/caches/Fuchsia-stage2.cmake:141
+set(RUNTIMES_${target}_SANITIZER_COMMON_TEST_TARGET_CFLAGS 
"--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_TSAN_TEST_TARGET_CFLAGS "--unwindlib=libunwind" 
CACHE STRING "")
+set(RUNTIMES_${target}_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE BOOL 
"")

Don't we need the `-static-libgcc` flag here as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109199

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


[PATCH] D108302: [PowerPC] Fixed the crash due to early if conversion with fixed CR fields.

2021-09-02 Thread Victor Huang via Phabricator via cfe-commits
NeHuang updated this revision to Diff 370428.
NeHuang added a comment.

Address review comments

- typo update
- use proper mcpu in the test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108302

Files:
  llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
  llvm/test/CodeGen/PowerPC/ifcvt_cr_field.ll


Index: llvm/test/CodeGen/PowerPC/ifcvt_cr_field.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/ifcvt_cr_field.ll
@@ -0,0 +1,64 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 
-verify-machineinstrs | FileCheck %s
+; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 
-verify-machineinstrs | FileCheck %s
+; RUN: llc < %s -mtriple=powerpc64-unknown-aix -mcpu=pwr9 
-verify-machineinstrs | FileCheck %s --check-prefix=CHECK-AIX-64
+; RUN: llc < %s -mtriple=powerpc-unknown-aix -mcpu=pwr9 -verify-machineinstrs 
| FileCheck %s --check-prefix=CHECK-AIX-32
+
+define dso_local signext i32 @test(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) 
local_unnamed_addr {
+; CHECK-LABEL: test:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vcmpgtsw. 2, 2, 3
+; CHECK-NEXT:bge 6, .LBB0_2
+; CHECK-NEXT:  # %bb.1: # %land.rhs
+; CHECK-NEXT:vcmpgtsw. 2, 4, 3
+; CHECK-NEXT:mfocrf 3, 2
+; CHECK-NEXT:rlwinm 3, 3, 25, 31, 31
+; CHECK-NEXT:clrldi 3, 3, 32
+; CHECK-NEXT:blr
+; CHECK-NEXT:  .LBB0_2:
+; CHECK-NEXT:li 3, 0
+; CHECK-NEXT:blr
+;
+; CHECK-AIX-64-LABEL: test:
+; CHECK-AIX-64:   # %bb.0: # %entry
+; CHECK-AIX-64-NEXT:vcmpgtsw. 2, 2, 3
+; CHECK-AIX-64-NEXT:bge 6, L..BB0_2
+; CHECK-AIX-64-NEXT:  # %bb.1: # %land.rhs
+; CHECK-AIX-64-NEXT:vcmpgtsw. 2, 4, 3
+; CHECK-AIX-64-NEXT:mfocrf 3, 2
+; CHECK-AIX-64-NEXT:rlwinm 3, 3, 25, 31, 31
+; CHECK-AIX-64-NEXT:clrldi 3, 3, 32
+; CHECK-AIX-64-NEXT:blr
+; CHECK-AIX-64-NEXT:  L..BB0_2:
+; CHECK-AIX-64-NEXT:li 3, 0
+; CHECK-AIX-64-NEXT:blr
+;
+; CHECK-AIX-32-LABEL: test:
+; CHECK-AIX-32:   # %bb.0: # %entry
+; CHECK-AIX-32-NEXT:vcmpgtsw. 2, 2, 3
+; CHECK-AIX-32-NEXT:bge 6, L..BB0_2
+; CHECK-AIX-32-NEXT:  # %bb.1: # %land.rhs
+; CHECK-AIX-32-NEXT:vcmpgtsw. 2, 4, 3
+; CHECK-AIX-32-NEXT:mfocrf 3, 2
+; CHECK-AIX-32-NEXT:rlwinm 3, 3, 25, 31, 31
+; CHECK-AIX-32-NEXT:blr
+; CHECK-AIX-32-NEXT:  L..BB0_2:
+; CHECK-AIX-32-NEXT:li 3, 0
+; CHECK-AIX-32-NEXT:blr
+entry:
+  %0 = tail call i32 @llvm.ppc.altivec.vcmpgtsw.p(i32 2, <4 x i32> %a, <4 x 
i32> %b)
+  %tobool.not = icmp eq i32 %0, 0
+  br i1 %tobool.not, label %land.end, label %land.rhs
+
+land.rhs: ; preds = %entry
+  %1 = tail call i32 @llvm.ppc.altivec.vcmpgtsw.p(i32 2, <4 x i32> %c, <4 x 
i32> %b)
+  %tobool1 = icmp ne i32 %1, 0
+  %phi.cast = zext i1 %tobool1 to i32
+  br label %land.end
+
+land.end: ; preds = %land.rhs, %entry
+  %2 = phi i32 [ 0, %entry ], [ %phi.cast, %land.rhs ]
+  ret i32 %2
+}
+
+declare i32 @llvm.ppc.altivec.vcmpgtsw.p(i32, <4 x i32>, <4 x i32>)
Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
===
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -1541,6 +1541,11 @@
   if (Cond[1].getReg() == PPC::CTR || Cond[1].getReg() == PPC::CTR8)
 return false;
 
+  // If the conditional branch uses a physical register, then it cannot be
+  // turned into a select.
+  if (Register::isPhysicalRegister(Cond[1].getReg()))
+return false;
+
   // Check register classes.
   const MachineRegisterInfo  = MBB.getParent()->getRegInfo();
   const TargetRegisterClass *RC =


Index: llvm/test/CodeGen/PowerPC/ifcvt_cr_field.ll
===
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/ifcvt_cr_field.ll
@@ -0,0 +1,64 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 -verify-machineinstrs | FileCheck %s
+; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -verify-machineinstrs | FileCheck %s
+; RUN: llc < %s -mtriple=powerpc64-unknown-aix -mcpu=pwr9 -verify-machineinstrs | FileCheck %s --check-prefix=CHECK-AIX-64
+; RUN: llc < %s -mtriple=powerpc-unknown-aix -mcpu=pwr9 -verify-machineinstrs | FileCheck %s --check-prefix=CHECK-AIX-32
+
+define dso_local signext i32 @test(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c) local_unnamed_addr {
+; CHECK-LABEL: test:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vcmpgtsw. 2, 2, 3
+; CHECK-NEXT:bge 6, .LBB0_2
+; CHECK-NEXT:  # %bb.1: # %land.rhs
+; CHECK-NEXT:vcmpgtsw. 2, 4, 3
+; CHECK-NEXT:mfocrf 3, 2
+; CHECK-NEXT:rlwinm 3, 3, 25, 31, 31
+; CHECK-NEXT:clrldi 3, 3, 32
+; 

Maintenance works in llvm lab today at 5PM

2021-09-02 Thread Galina Kistanova via cfe-commits
Hello,

LLVM lab and build master will be unavailable today September 2 for about
30 minutes starting 5PM PST due maintenance works in the lab.
Thank you for understanding.

Thanks

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


[PATCH] D108794: Fully qualify template template parameters when printing

2021-09-02 Thread David Blaikie via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
dblaikie marked an inline comment as done.
Closed by commit rG5fb3f43778f8: Fully qualify template template parameters 
when printing (authored by dblaikie).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108794

Files:
  clang-tools-extra/clangd/DumpAST.cpp
  clang/include/clang/AST/TemplateName.h
  clang/lib/AST/NestedNameSpecifier.cpp
  clang/lib/AST/TemplateBase.cpp
  clang/lib/AST/TemplateName.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CXX/drs/dr10xx.cpp
  clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
  clang/test/Index/print-type.cpp
  clang/test/Misc/diag-template.cpp
  clang/test/SemaTemplate/temp_arg_template.cpp

Index: clang/test/SemaTemplate/temp_arg_template.cpp
===
--- clang/test/SemaTemplate/temp_arg_template.cpp
+++ clang/test/SemaTemplate/temp_arg_template.cpp
@@ -59,7 +59,7 @@
 0 << a.const_ref(); // expected-error{{invalid operands to binary expression ('int' and 'X')}}
   }
 
-  void f0( Y y){ 1 << y; } // expected-note{{in instantiation of function template specialization 'N::operator<<' requested here}}
+  void f0( Y y){ 1 << y; } // expected-note{{in instantiation of function template specialization 'N::operator<<' requested here}}
 }
 
 // PR12179
Index: clang/test/Misc/diag-template.cpp
===
--- clang/test/Misc/diag-template.cpp
+++ clang/test/Misc/diag-template.cpp
@@ -34,8 +34,8 @@
 f(Q<>()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}}
 f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}}
 f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q<>'}}
-f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
-f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
-f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
+f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
+f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
+f(Q()).g(); // expected-error {{no member named 'g' in 'default_args::Q'}}
   }
 }
Index: clang/test/Index/print-type.cpp
===
--- clang/test/Index/print-type.cpp
+++ clang/test/Index/print-type.cpp
@@ -132,7 +132,7 @@
 // CHECK: TypedefDecl=OtherType:26:18 (Definition) [type=outer::inner::Bar::OtherType] [typekind=Typedef] [canonicaltype=double] [canonicaltypekind=Double] [isPOD=1]
 // CHECK: TypedefDecl=ArrayType:27:15 (Definition) [type=outer::inner::Bar::ArrayType] [typekind=Typedef] [canonicaltype=int [5]] [canonicaltypekind=ConstantArray] [isPOD=1]
 // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
-// CHECK: FieldDecl=baz:28:20 (Definition) [type=Baz] [typekind=Unexposed] [templateargs/3= [type=int] [typekind=Int]] [canonicaltype=outer::Baz] [canonicaltypekind=Record] [canonicaltemplateargs/3= [type=int] [typekind=Int]] [isPOD=1]
+// CHECK: FieldDecl=baz:28:20 (Definition) [type=Baz] [typekind=Unexposed] [templateargs/3= [type=int] [typekind=Int]] [canonicaltype=outer::Baz] [canonicaltypekind=Record] [canonicaltemplateargs/3= [type=int] [typekind=Int]] [isPOD=1]
 // CHECK: TemplateRef=Baz:9:8 [type=] [typekind=Invalid] [isPOD=0]
 // CHECK: IntegerLiteral= [type=int] [typekind=Int] [isPOD=1]
 // CHECK: TemplateRef=Foo:4:8 [type=] [typekind=Invalid] [isPOD=0]
Index: clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
===
--- clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
+++ clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
@@ -93,7 +93,7 @@
 }
 
 namespace DeduceWithDefaultArgs {
-  template class Container> void f(Container); // expected-note {{deduced type 'X<[...], (default) int>' of 1st parameter does not match adjusted type 'X<[...], double>' of argument [with Container = X]}}
+  template class Container> void f(Container); // expected-note {{deduced type 'X<[...], (default) int>' of 1st parameter does not match adjusted type 'X<[...], double>' of argument [with Container = DeduceWithDefaultArgs::X]}}
   template struct X {};
   void g() {
 // OK, use default argument for the second template parameter.
Index: clang/test/CXX/drs/dr10xx.cpp
===
--- clang/test/CXX/drs/dr10xx.cpp
+++ clang/test/CXX/drs/dr10xx.cpp
@@ -17,8 +17,8 @@
   template struct B1 {};
   template class> struct B2 {};
   template void f(); // expected-note {{[with X = dr1004::A]}}
-  template class X> void f(); // expected-note {{[with X = A]}}
-  template class X> void g(); // 

[clang-tools-extra] 5fb3f43 - Fully qualify template template parameters when printing

2021-09-02 Thread David Blaikie via cfe-commits

Author: David Blaikie
Date: 2021-09-02T15:04:34-07:00
New Revision: 5fb3f43778f85ebea48e880eef9493d188253890

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

LOG: Fully qualify template template parameters when printing

I discovered this quirk when working on some DWARF - AST printing prints
type template parameters fully qualified, but printed template template
parameters the way they were written syntactically, or wholely
unqualified - instead, we should print them consistently with the way we
print type template parameters: fully qualified.

The one place this got weird was for partial specializations like in
ast-print-temp-class.cpp - hence the need for checking for
TemplateNameDependenceScope::DependentInstantiation template template
parameters. (not 100% sure that's the right solution to that, though -
open to ideas)

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

Added: 


Modified: 
clang-tools-extra/clangd/DumpAST.cpp
clang/include/clang/AST/TemplateName.h
clang/lib/AST/NestedNameSpecifier.cpp
clang/lib/AST/TemplateBase.cpp
clang/lib/AST/TemplateName.cpp
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CXX/drs/dr10xx.cpp
clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
clang/test/Index/print-type.cpp
clang/test/Misc/diag-template.cpp
clang/test/SemaTemplate/temp_arg_template.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/DumpAST.cpp 
b/clang-tools-extra/clangd/DumpAST.cpp
index 36d61aca70fa6..22bad6f915142 100644
--- a/clang-tools-extra/clangd/DumpAST.cpp
+++ b/clang-tools-extra/clangd/DumpAST.cpp
@@ -295,7 +295,7 @@ class DumpVisitor : public RecursiveASTVisitor 
{
   }
   std::string getDetail(const TemplateName ) {
 return toString([&](raw_ostream ) {
-  TN.print(OS, Ctx.getPrintingPolicy(), /*SuppressNNS=*/true);
+  TN.print(OS, Ctx.getPrintingPolicy(), TemplateName::Qualified::None);
 });
   }
   std::string getDetail(const Attr *A) {

diff  --git a/clang/include/clang/AST/TemplateName.h 
b/clang/include/clang/AST/TemplateName.h
index 010b813dc5253..2befb5c1b45e0 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -309,16 +309,17 @@ class TemplateName {
   /// unexpanded parameter pack (for C++0x variadic templates).
   bool containsUnexpandedParameterPack() const;
 
+  enum class Qualified { None, AsWritten, Fully };
   /// Print the template name.
   ///
   /// \param OS the output stream to which the template name will be
   /// printed.
   ///
-  /// \param SuppressNNS if true, don't print the
-  /// nested-name-specifier that precedes the template name (if it has
-  /// one).
+  /// \param Qual print the (Qualified::None) simple name,
+  /// (Qualified::AsWritten) any written (possibly partial) qualifier, or
+  /// (Qualified::Fully) the fully qualified name.
   void print(raw_ostream , const PrintingPolicy ,
- bool SuppressNNS = false) const;
+ Qualified Qual = Qualified::AsWritten) const;
 
   /// Debugging aid that dumps the template name.
   void dump(raw_ostream ) const;

diff  --git a/clang/lib/AST/NestedNameSpecifier.cpp 
b/clang/lib/AST/NestedNameSpecifier.cpp
index 21afdd1570f4b..8f19d80cbdc58 100644
--- a/clang/lib/AST/NestedNameSpecifier.cpp
+++ b/clang/lib/AST/NestedNameSpecifier.cpp
@@ -311,7 +311,8 @@ void NestedNameSpecifier::print(raw_ostream , const 
PrintingPolicy ,
   = dyn_cast(T)) {
   // Print the template name without its corresponding
   // nested-name-specifier.
-  SpecType->getTemplateName().print(OS, InnerPolicy, true);
+  SpecType->getTemplateName().print(OS, InnerPolicy,
+TemplateName::Qualified::None);
 
   // Print the template argument list.
   printTemplateArgumentList(OS, SpecType->template_arguments(),

diff  --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
index f44230d1bd03d..619ce42f9dd1d 100644
--- a/clang/lib/AST/TemplateBase.cpp
+++ b/clang/lib/AST/TemplateBase.cpp
@@ -452,7 +452,7 @@ void TemplateArgument::print(const PrintingPolicy , 
raw_ostream ,
 break;
 
   case Template:
-getAsTemplate().print(Out, Policy);
+getAsTemplate().print(Out, Policy, TemplateName::Qualified::Fully);
 break;
 
   case TemplateExpansion:

diff  --git a/clang/lib/AST/TemplateName.cpp b/clang/lib/AST/TemplateName.cpp
index 22cfa9acbe1b2..c8bd74f0b5bb4 100644
--- a/clang/lib/AST/TemplateName.cpp
+++ b/clang/lib/AST/TemplateName.cpp
@@ -220,19 +220,28 @@ bool TemplateName::containsUnexpandedParameterPack() 
const {
   return getDependence() & TemplateNameDependence::UnexpandedPack;
 }
 
-void
-TemplateName::print(raw_ostream , const PrintingPolicy ,
-   

[PATCH] D109181: Reland "Try to unbreak Win build differently after 973519826edb76""

2021-09-02 Thread Geoffrey Martin-Noble via Phabricator via cfe-commits
GMNGeoffrey added a comment.

Hmmm so pre-merge checks on Linux are failing

https://buildkite.com/llvm-project/premerge-checks/builds/54955#8fea4a06-e971-48ad-a6d7-31173315d83d

  FAIL: libomp :: lock/omp_init_lock.c (84929 of 87948)
   TEST 'libomp :: lock/omp_init_lock.c' FAILED 

  Script:
  --
  : 'RUN: at line 1';   
/var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang -fopenmp 
-pthread -fno-experimental-isel  -I 
/var/lib/buildkite-agent/builds/llvm-project/openmp/runtime/test -I 
/var/lib/buildkite-agent/builds/llvm-project/build/projects/openmp/runtime/src 
-L /var/lib/buildkite-agent/builds/llvm-project/build/lib  -I 
/var/lib/buildkite-agent/builds/llvm-project/openmp/runtime/test/ompt 
/var/lib/buildkite-agent/builds/llvm-project/openmp/runtime/test/lock/omp_init_lock.c
 -o 
/var/lib/buildkite-agent/builds/llvm-project/build/projects/openmp/runtime/test/lock/Output/omp_init_lock.c.tmp
 -lm -latomic && 
/var/lib/buildkite-agent/builds/llvm-project/build/projects/openmp/runtime/test/lock/Output/omp_init_lock.c.tmp
  --
  Exit Code: -11
   
  Command Output (stdout):
  --
  $ ":" "RUN: at line 1"
  $ "/var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang" "-fopenmp" 
"-pthread" "-fno-experimental-isel" "-I" 
"/var/lib/buildkite-agent/builds/llvm-project/openmp/runtime/test" "-I" 
"/var/lib/buildkite-agent/builds/llvm-project/build/projects/openmp/runtime/src"
 "-L" "/var/lib/buildkite-agent/builds/llvm-project/build/lib" "-I" 
"/var/lib/buildkite-agent/builds/llvm-project/openmp/runtime/test/ompt" 
"/var/lib/buildkite-agent/builds/llvm-project/openmp/runtime/test/lock/omp_init_lock.c"
 "-o" 
"/var/lib/buildkite-agent/builds/llvm-project/build/projects/openmp/runtime/test/lock/Output/omp_init_lock.c.tmp"
 "-lm" "-latomic"
  $ 
"/var/lib/buildkite-agent/builds/llvm-project/build/projects/openmp/runtime/test/lock/Output/omp_init_lock.c.tmp"
  note: command had no output on stdout or stderr
  error: command failed with exit status: -11


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109181

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


[PATCH] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D109175#2981054 , @jdoerfert wrote:

> In D109175#2980905 , @weiwang wrote:
>
>> In D109175#2980900 , @jdoerfert 
>> wrote:
>>
>>> In D109175#2980806 , @weiwang 
>>> wrote:
>>>
 In D109175#2980744 , @jdoerfert 
 wrote:

> Why do we need this flag, is the absence of -fopenmp-targets not 
> sufficient?

 Just double checked, this is the full omp related options currently in use:

   "-fopenmp"
   "-fopenmp-version=31"
   "-fopenmp-version=31"
   "-fopenmp-cuda-parallel-target-regions"

 We saw a huge number of `DECLS_TO_CHECK_FOR_DEFERRED_DIAGS` records. I 
 don't know if this has anything to do with omp version being 31, since 
 prior 5.0, everything is available on host.
>>>
>>> I don't think we are selective right now. As I was saying, disable deferred 
>>> parsing if fopenmp-targets is missing, no need for this option.
>>
>> Sure I can certainly make the change. To make sure I understand you 
>> correctly: if -fopenmp-targets (or maybe fopenmp-is-device too) is not given 
>> from cmdline, we can just skip the deferred diags like this option does?
>
> I thought so, @ABataev wdyt?

Yes, deferred diags are used only for target-dependent compilation, so should 
be enough to check if `IsTargetSpecified` is `false`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109175

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


[PATCH] D109191: [clang] fix error recovery ICE on copy elision when returing invalid variable

2021-09-02 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov created this revision.
mizvekov published this revision for review.
mizvekov added reviewers: rsmith, rtrieu.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

See PR51708.

Attempting copy elision in dependent contexts with invalid variable,
such as a variable with incomplete type, would cause a crash when attempting
to calculate it's alignment.

The fix is to just skip this optimization on invalid VarDecl, as otherwise this
provides no benefit to error recovery: This functionality does not try to
diagnose anything, it only calculates a flag which will affect where the
variable will be allocated during codegen.

Signed-off-by: Matheus Izvekov 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109191

Files:
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp


Index: clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
===
--- clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
+++ clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
@@ -518,3 +518,37 @@
 template X test_dependent_invalid_decl(); // expected-note 
{{requested here}}
 
 } // namespace test_auto_variables
+
+namespace PR51708 {
+
+class a1;  // expected-note 4 {{forward declaration of 
'PR51708::a1'}}
+template  class A2; // expected-note 4 {{template is declared here}}
+using a2 = A2;
+
+template  b f() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function 
definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  b d;
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  return d;
+}
+template a1 f(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+template a2 f(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+
+template  b g() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function 
definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  b d __attribute__((aligned(1)));
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  return d;
+}
+template a1 g(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+template a2 g(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+
+} // namespace PR51708
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1087,7 +1087,7 @@
 
   SemaRef.BuildVariableInstantiation(Var, D, TemplateArgs, LateAttrs, Owner,
  StartingScope, InstantiatingVarTemplate);
-  if (D->isNRVOVariable()) {
+  if (D->isNRVOVariable() && !Var->isInvalidDecl()) {
 QualType RT;
 if (auto *F = dyn_cast(DC))
   RT = F->getReturnType();


Index: clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
===
--- clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
+++ clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
@@ -518,3 +518,37 @@
 template X test_dependent_invalid_decl(); // expected-note {{requested here}}
 
 } // namespace test_auto_variables
+
+namespace PR51708 {
+
+class a1;  // expected-note 4 {{forward declaration of 'PR51708::a1'}}
+template  class A2; // expected-note 4 {{template is declared here}}
+using a2 = A2;
+
+template  b f() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 'PR51708::A2}}
+
+  b d;
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 'PR51708::A2}}
+
+  return d;
+}
+template a1 f(); // expected-note-re {{in instantiation {{.*}} requested here}}
+template a2 f(); // expected-note-re {{in instantiation {{.*}} requested here}}
+
+template  b g() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 'PR51708::A2}}
+
+  b d __attribute__((aligned(1)));
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 'PR51708::A2}}
+
+  return d;
+}
+template a1 g(); // expected-note-re {{in instantiation {{.*}} requested here}}
+template a2 g(); // expected-note-re {{in instantiation {{.*}} requested here}}
+
+} // namespace PR51708
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

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

2021-09-02 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp:526
+  union {
+int K;
+  };

Can you add a `CHECK-FIXES-NOT` that we're not adding the fix for this case?



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp:529
+  union {
+int Z;
+int Y;

Same here.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp:534
+
+union U2 {
+  U2() {}

A related interesting test would be:
```
union U3 {
  U3() {}

  struct {
int B;
  } b;
  int A;
};
```
I would expect `A` or `b` to need initialization for the union, and `B` to need 
initialization for the struct.


Repository:
  rG LLVM Github Monorepo

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] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a subscriber: ABataev.
jdoerfert added a comment.

In D109175#2980905 , @weiwang wrote:

> In D109175#2980900 , @jdoerfert 
> wrote:
>
>> In D109175#2980806 , @weiwang 
>> wrote:
>>
>>> In D109175#2980744 , @jdoerfert 
>>> wrote:
>>>
 Why do we need this flag, is the absence of -fopenmp-targets not 
 sufficient?
>>>
>>> Just double checked, this is the full omp related options currently in use:
>>>
>>>   "-fopenmp"
>>>   "-fopenmp-version=31"
>>>   "-fopenmp-version=31"
>>>   "-fopenmp-cuda-parallel-target-regions"
>>>
>>> We saw a huge number of `DECLS_TO_CHECK_FOR_DEFERRED_DIAGS` records. I 
>>> don't know if this has anything to do with omp version being 31, since 
>>> prior 5.0, everything is available on host.
>>
>> I don't think we are selective right now. As I was saying, disable deferred 
>> parsing if fopenmp-targets is missing, no need for this option.
>
> Sure I can certainly make the change. To make sure I understand you 
> correctly: if -fopenmp-targets (or maybe fopenmp-is-device too) is not given 
> from cmdline, we can just skip the deferred diags like this option does?

I thought so, @ABataev wdyt?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109175

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


[PATCH] D109199: [compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain

2021-09-02 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan created this revision.
leonardchan added reviewers: phosek, mcgrathr.
leonardchan added a project: Sanitizers.
Herald added subscribers: mgorny, dberris.
leonardchan requested review of this revision.
Herald added a project: clang.
Herald added subscribers: Sanitizers, cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109199

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake
  compiler-rt/cmake/Modules/AddCompilerRT.cmake
  compiler-rt/lib/fuzzer/tests/CMakeLists.txt


Index: compiler-rt/lib/fuzzer/tests/CMakeLists.txt
===
--- compiler-rt/lib/fuzzer/tests/CMakeLists.txt
+++ compiler-rt/lib/fuzzer/tests/CMakeLists.txt
@@ -33,7 +33,8 @@
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
COMPILER_RT_LIBCXX_PATH AND
COMPILER_RT_LIBCXXABI_PATH)
-  list(APPEND LIBFUZZER_UNITTEST_CFLAGS -nostdinc++)
+  list(APPEND LIBFUZZER_UNITTEST_CFLAGS -nostdinc++ -fno-exceptions)
+  list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -nostdlib++ -fno-exceptions)
 endif()
 
 if ("-fvisibility=hidden" IN_LIST LIBFUZZER_CFLAGS)
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -490,7 +490,7 @@
   endif()
   add_custom_command(
 OUTPUT "${output_bin}"
-COMMAND ${COMPILER_RT_TEST_COMPILER} ${TEST_OBJECTS} -o "${output_bin}"
+COMMAND ${COMPILER_RT_TEST_CXX_COMPILER} ${TEST_OBJECTS} -o "${output_bin}"
 ${TEST_LINK_FLAGS}
 DEPENDS ${TEST_DEPS}
 )
Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -60,7 +60,6 @@
   set(COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
 
   set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
-  set(LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
   set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
   set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
   set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
@@ -121,9 +120,10 @@
 set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE 
STRING "")
 set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING 
"")
 set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_CAN_EXECUTE_TESTS ON CACHE BOOL "")
 set(RUNTIMES_${target}_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
 set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
-set(RUNTIMES_${target}_LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
 set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
 set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
 set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
@@ -136,6 +136,10 @@
 set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "")
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
 set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
+set(RUNTIMES_${target}_COMPILER_RT_TEST_COMPILER_CFLAGS 
"--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_SANITIZER_COMMON_TEST_TARGET_CFLAGS 
"--unwindlib=libunwind -static-libgcc" CACHE STRING "")
+set(RUNTIMES_${target}_TSAN_TEST_TARGET_CFLAGS "--unwindlib=libunwind" 
CACHE STRING "")
+set(RUNTIMES_${target}_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE BOOL 
"")
 set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES 
"compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
 
 # Use .build-id link.


Index: compiler-rt/lib/fuzzer/tests/CMakeLists.txt
===
--- compiler-rt/lib/fuzzer/tests/CMakeLists.txt
+++ compiler-rt/lib/fuzzer/tests/CMakeLists.txt
@@ -33,7 +33,8 @@
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
COMPILER_RT_LIBCXX_PATH AND
COMPILER_RT_LIBCXXABI_PATH)
-  list(APPEND LIBFUZZER_UNITTEST_CFLAGS -nostdinc++)
+  list(APPEND LIBFUZZER_UNITTEST_CFLAGS -nostdinc++ -fno-exceptions)
+  list(APPEND LIBFUZZER_UNITTEST_LINK_FLAGS -nostdlib++ -fno-exceptions)
 endif()
 
 if ("-fvisibility=hidden" IN_LIST LIBFUZZER_CFLAGS)
Index: compiler-rt/cmake/Modules/AddCompilerRT.cmake
===
--- compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -490,7 +490,7 @@
   endif()
   add_custom_command(
 OUTPUT "${output_bin}"
-COMMAND ${COMPILER_RT_TEST_COMPILER} ${TEST_OBJECTS} -o "${output_bin}"
+COMMAND ${COMPILER_RT_TEST_CXX_COMPILER} ${TEST_OBJECTS} -o "${output_bin}"
 ${TEST_LINK_FLAGS}
 DEPENDS ${TEST_DEPS}
 )
Index: 

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

2021-09-02 Thread Xun Li via Phabricator via cfe-commits
lxfind accepted this revision.
lxfind added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!


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] D108291: [clang-nvlink-wrapper] Wrapper around nvlink for archive files

2021-09-02 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/tools/clang-nvlink-wrapper/ClangNvlinkWrapper.cpp:63
+  ErrorOr> BufOrErr =
+  MemoryBuffer::getFileOrSTDIN(Filename, -1, false);
+  if (std::error_code EC = BufOrErr.getError())

The `-1` is odd here -- this argument is a Boolean for whether the buffer is 
text or not, and this introduced a new MSVC warning (`'argument': truncation 
from 'int' to 'bool'`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108291

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


[PATCH] D108761: [OpenCL] Remove decls for scalar vloada_half and vstorea_half* fns

2021-09-02 Thread Stuart Brady via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG32955be6bf7d: [OpenCL] Remove decls for scalar vloada_half 
and vstorea_half* fns (authored by stuart).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108761

Files:
  clang/lib/Headers/opencl-c.h
  clang/lib/Sema/OpenCLBuiltins.td

Index: clang/lib/Sema/OpenCLBuiltins.td
===
--- clang/lib/Sema/OpenCLBuiltins.td
+++ clang/lib/Sema/OpenCLBuiltins.td
@@ -836,7 +836,6 @@
 multiclass VloadVstoreHalf addrspaces, bit defStores> {
   foreach AS = addrspaces in {
 def : Builtin<"vload_half", [Float, Size, PointerType, AS>]>;
-def : Builtin<"vloada_half", [Float, Size, PointerType, AS>]>;
 foreach VSize = [2, 3, 4, 8, 16] in {
   foreach name = ["vload_half" # VSize] in {
 def : Builtin, Size, PointerType, AS>]>;
@@ -844,7 +843,7 @@
 }
 if defStores then {
   foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
-foreach name = ["vstore_half" # rnd, "vstorea_half" # rnd] in {
+foreach name = ["vstore_half" # rnd] in {
   def : Builtin]>;
   def : Builtin]>;
 }
Index: clang/lib/Headers/opencl-c.h
===
--- clang/lib/Headers/opencl-c.h
+++ clang/lib/Headers/opencl-c.h
@@ -12070,33 +12070,28 @@
  * The address computed as (p + (offset * 4))
  * must be aligned to sizeof (half) * 4 bytes.
  */
-float __ovld vloada_half(size_t offset, const __constant half *p);
 float2 __ovld vloada_half2(size_t offset, const __constant half *p);
 float3 __ovld vloada_half3(size_t offset, const __constant half *p);
 float4 __ovld vloada_half4(size_t offset, const __constant half *p);
 float8 __ovld vloada_half8(size_t offset, const __constant half *p);
 float16 __ovld vloada_half16(size_t offset, const __constant half *p);
 #if defined(__opencl_c_generic_address_space)
-float __ovld vloada_half(size_t offset, const half *p);
 float2 __ovld vloada_half2(size_t offset, const half *p);
 float3 __ovld vloada_half3(size_t offset, const half *p);
 float4 __ovld vloada_half4(size_t offset, const half *p);
 float8 __ovld vloada_half8(size_t offset, const half *p);
 float16 __ovld vloada_half16(size_t offset, const half *p);
 #else
-float __ovld vloada_half(size_t offset, const __global half *p);
 float2 __ovld vloada_half2(size_t offset, const __global half *p);
 float3 __ovld vloada_half3(size_t offset, const __global half *p);
 float4 __ovld vloada_half4(size_t offset, const __global half *p);
 float8 __ovld vloada_half8(size_t offset, const __global half *p);
 float16 __ovld vloada_half16(size_t offset, const __global half *p);
-float __ovld vloada_half(size_t offset, const __local half *p);
 float2 __ovld vloada_half2(size_t offset, const __local half *p);
 float3 __ovld vloada_half3(size_t offset, const __local half *p);
 float4 __ovld vloada_half4(size_t offset, const __local half *p);
 float8 __ovld vloada_half8(size_t offset, const __local half *p);
 float16 __ovld vloada_half16(size_t offset, const __local half *p);
-float __ovld vloada_half(size_t offset, const __private half *p);
 float2 __ovld vloada_half2(size_t offset, const __private half *p);
 float3 __ovld vloada_half3(size_t offset, const __private half *p);
 float4 __ovld vloada_half4(size_t offset, const __private half *p);
@@ -12121,35 +12116,30 @@
  * round to nearest even.
  */
 #if defined(__opencl_c_generic_address_space)
-void __ovld vstorea_half(float data, size_t offset, half *p);
 void __ovld vstorea_half2(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rte(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rte(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rte(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4_rte(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8_rte(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16_rte(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rtz(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rtz(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rtz(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4_rtz(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8_rtz(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16_rtz(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rtp(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rtp(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rtp(float3 

[PATCH] D108560: [clang-tidy] Add support for NOLINTBEGIN ... NOLINTEND comments to suppress clang-tidy warnings over multiple lines

2021-09-02 Thread Salman Javed via Phabricator via cfe-commits
salman-javed-nz added subscribers: gonzalobg, toklinke.
salman-javed-nz added a comment.

@gonzalobg, @toklinke - I think you two might be interested in this because you 
have made proposals about this feature before.

gonzalobg - your Bugzilla ticket: https://bugs.llvm.org/show_bug.cgi?id=3
toklinke - your message on cfe-dev: 
https://lists.llvm.org/pipermail/cfe-dev/2019-November/063989.html

Thank you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108560

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


[clang] 32955be - [OpenCL] Remove decls for scalar vloada_half and vstorea_half* fns

2021-09-02 Thread Stuart Brady via cfe-commits

Author: Stuart Brady
Date: 2021-09-02T22:08:09+01:00
New Revision: 32955be6bf7d8401ea8271e1097bf783bf492eb9

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

LOG: [OpenCL] Remove decls for scalar vloada_half and vstorea_half* fns

These functions are not part of the OpenCL C specification.

See https://github.com/KhronosGroup/OpenCL-Docs/issues/648 for a
clarification regarding the vloada_half declarations.

Reviewed By: Anastasia

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

Added: 


Modified: 
clang/lib/Headers/opencl-c.h
clang/lib/Sema/OpenCLBuiltins.td

Removed: 




diff  --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index 501126bf13ecd..bb3ca6aae20a2 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -12070,33 +12070,28 @@ void __ovld vstore_half16_rtn(double16 data, size_t 
offset, __private half *p);
  * The address computed as (p + (offset * 4))
  * must be aligned to sizeof (half) * 4 bytes.
  */
-float __ovld vloada_half(size_t offset, const __constant half *p);
 float2 __ovld vloada_half2(size_t offset, const __constant half *p);
 float3 __ovld vloada_half3(size_t offset, const __constant half *p);
 float4 __ovld vloada_half4(size_t offset, const __constant half *p);
 float8 __ovld vloada_half8(size_t offset, const __constant half *p);
 float16 __ovld vloada_half16(size_t offset, const __constant half *p);
 #if defined(__opencl_c_generic_address_space)
-float __ovld vloada_half(size_t offset, const half *p);
 float2 __ovld vloada_half2(size_t offset, const half *p);
 float3 __ovld vloada_half3(size_t offset, const half *p);
 float4 __ovld vloada_half4(size_t offset, const half *p);
 float8 __ovld vloada_half8(size_t offset, const half *p);
 float16 __ovld vloada_half16(size_t offset, const half *p);
 #else
-float __ovld vloada_half(size_t offset, const __global half *p);
 float2 __ovld vloada_half2(size_t offset, const __global half *p);
 float3 __ovld vloada_half3(size_t offset, const __global half *p);
 float4 __ovld vloada_half4(size_t offset, const __global half *p);
 float8 __ovld vloada_half8(size_t offset, const __global half *p);
 float16 __ovld vloada_half16(size_t offset, const __global half *p);
-float __ovld vloada_half(size_t offset, const __local half *p);
 float2 __ovld vloada_half2(size_t offset, const __local half *p);
 float3 __ovld vloada_half3(size_t offset, const __local half *p);
 float4 __ovld vloada_half4(size_t offset, const __local half *p);
 float8 __ovld vloada_half8(size_t offset, const __local half *p);
 float16 __ovld vloada_half16(size_t offset, const __local half *p);
-float __ovld vloada_half(size_t offset, const __private half *p);
 float2 __ovld vloada_half2(size_t offset, const __private half *p);
 float3 __ovld vloada_half3(size_t offset, const __private half *p);
 float4 __ovld vloada_half4(size_t offset, const __private half *p);
@@ -12121,35 +12116,30 @@ float16 __ovld vloada_half16(size_t offset, const 
__private half *p);
  * round to nearest even.
  */
 #if defined(__opencl_c_generic_address_space)
-void __ovld vstorea_half(float data, size_t offset, half *p);
 void __ovld vstorea_half2(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rte(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rte(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rte(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4_rte(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8_rte(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16_rte(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rtz(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rtz(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rtz(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4_rtz(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8_rtz(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16_rtz(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rtp(float data, size_t offset, half *p);
 void __ovld vstorea_half2_rtp(float2 data, size_t offset, half *p);
 void __ovld vstorea_half3_rtp(float3 data, size_t offset, half *p);
 void __ovld vstorea_half4_rtp(float4 data, size_t offset, half *p);
 void __ovld vstorea_half8_rtp(float8 data, size_t offset, half *p);
 void __ovld vstorea_half16_rtp(float16 data, size_t offset, half *p);
 
-void __ovld vstorea_half_rtn(float data, size_t 

[PATCH] D108794: Fully qualify template template parameters when printing

2021-09-02 Thread Richard Trieu via Phabricator via cfe-commits
rtrieu accepted this revision.
rtrieu added a comment.
This revision is now accepted and ready to land.

In D108794#2978134 , @dblaikie wrote:

> Ping
>
> In D108794#2976063 , @rtrieu wrote:
>
>> It looks like a strict improvement on printing and most callers using the 
>> default args won't need to be updated.
>>
>> There's one more function call that should be updated:
>> https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clangd/DumpAST.cpp#L298
>>
>> Fixing that and the comment and this should be good to go in.
>
> Ah, thanks for catching that (just running `check-clang` doesn't catch this, 
> and it doesn't seem like there's a `check-clang-tools-extra` - any idea if 
> there's something narrower than `check-all` that would run clang-tools-extra 
> tests?). Updated that caller to preserve the existing unqualified behavior.

I don't know if there is a better way to check.  I found it by doing a quick 
search over the code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108794

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


[PATCH] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Wei Wang via Phabricator via cfe-commits
weiwang added a comment.

In D109175#2980900 , @jdoerfert wrote:

> In D109175#2980806 , @weiwang wrote:
>
>> In D109175#2980744 , @jdoerfert 
>> wrote:
>>
>>> Why do we need this flag, is the absence of -fopenmp-targets not sufficient?
>>
>> Just double checked, this is the full omp related options currently in use:
>>
>>   "-fopenmp"
>>   "-fopenmp-version=31"
>>   "-fopenmp-version=31"
>>   "-fopenmp-cuda-parallel-target-regions"
>>
>> We saw a huge number of `DECLS_TO_CHECK_FOR_DEFERRED_DIAGS` records. I don't 
>> know if this has anything to do with omp version being 31, since prior 5.0, 
>> everything is available on host.
>
> I don't think we are selective right now. As I was saying, disable deferred 
> parsing if fopenmp-targets is missing, no need for this option.

Sure I can certainly make the change. To make sure I understand you correctly: 
if -fopenmp-targets (or maybe fopenmp-is-device too) is not given from cmdline, 
we can just skip the deferred diags like this option does?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109175

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


[PATCH] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D109175#2980806 , @weiwang wrote:

> In D109175#2980744 , @jdoerfert 
> wrote:
>
>> Why do we need this flag, is the absence of -fopenmp-targets not sufficient?
>
> Just double checked, this is the full omp related options currently in use:
>
>   "-fopenmp"
>   "-fopenmp-version=31"
>   "-fopenmp-version=31"
>   "-fopenmp-cuda-parallel-target-regions"
>
> We saw a huge number of `DECLS_TO_CHECK_FOR_DEFERRED_DIAGS` records. I don't 
> know if this has anything to do with omp version being 31, since prior 5.0, 
> everything is available on host.

I don't think we are selective right now. As I was saying, disable deferred 
parsing if fopenmp-targets is missing, no need for this option.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109175

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


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

2021-09-02 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/include/llvm/IR/IntrinsicsRISCV.td:169
+ llvm_anyint_ty, LLVMMatchType<1>],
 [NoCapture>, IntrReadMem]>, RISCVVIntrinsic;
   // For unit stride fault-only-first load with mask

This needs ImmArg>. Similar for the rest. That will guarantee it is 
a constant and will make SelectionDAGBuilder create a target constant instead 
of a regular constant.



Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:248
+// Policy must be a constant.
+auto *PolicyNode = cast(Node->getOperand(CurOp++));
+SDValue PolicyOp =

Can we use

```
uint64_t Policy = Node->getConstantOperandVal(CurOp++);
```



Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:4761
+  if (!IsUnmasked)
+Ops.push_back(DAG.getConstant(RISCVII::TAIL_AGNOSTIC, DL, XLenVT));
 

TargetConstant?



Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td:647
GPR:$rs1,
-   VMaskOp:$vm, AVL:$vl, ixlenimm:$sew),[]>,
+   VMaskOp:$vm, AVL:$vl, ixlenimm:$sew, uimm5:$policy),[]>,
   RISCVVPseudo,

Why uimm5? I think VPseudoTernaryNoMaskWithPolicy is using ixlenimm like $sew


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] D109127: Fix python 2-vs-3 issues in add_new_check.py and rename_check.py

2021-09-02 Thread Matt Beardsley via Phabricator via cfe-commits
mattbeardsley added a comment.

No worries! Figured I'd start the conversation with the easy fix, but was fully 
prepared to hear that we can't let go of python 2 just yet, as much as we may 
want to :). 
Let me know if this fix looks suitable. Thanks for your time!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109127

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


[PATCH] D109127: Fix python 2-vs-3 issues in add_new_check.py and rename_check.py

2021-09-02 Thread Matt Beardsley via Phabricator via cfe-commits
mattbeardsley updated this revision to Diff 370393.
mattbeardsley retitled this revision from "Use python 3 in add_new_check.py and 
rename_check.py" to "Fix python 2-vs-3 issues in add_new_check.py and 
rename_check.py".
mattbeardsley edited the summary of this revision.
mattbeardsley added a comment.

Reverted python-3-only enforcement, fixed both scripts to work with both python 
2 and python 3
(generally based on the guidance here: 
https://python-future.org/compatible_idioms.html#strings-and-bytes)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109127

Files:
  clang-tools-extra/clang-tidy/add_new_check.py
  clang-tools-extra/clang-tidy/rename_check.py

Index: clang-tools-extra/clang-tidy/rename_check.py
===
--- clang-tools-extra/clang-tidy/rename_check.py
+++ clang-tools-extra/clang-tidy/rename_check.py
@@ -8,6 +8,8 @@
 #
 #===---===#
 
+from __future__ import unicode_literals
+
 import argparse
 import glob
 import io
@@ -117,7 +119,7 @@
   return False
 
   print('Updating %s...' % filename)
-  with io.open(filename, 'wb', encoding='utf8') as f:
+  with io.open(filename, 'w', encoding='utf8') as f:
 cpp_found = False
 file_added = False
 for line in lines:
@@ -125,21 +127,23 @@
   if (not file_added) and (cpp_line or cpp_found):
 cpp_found = True
 if (line.strip() > cpp_file) or (not cpp_line):
-  f.write(('  ' + cpp_file + '\n').encode())
+  f.write('  ' + cpp_file + '\n')
   file_added = True
-  f.write(line.encode())
+  f.write(line)
 
   return True
 
 # Modifies the module to include the new check.
 def adapt_module(module_path, module, check_name, check_name_camel):
-  modulecpp = next(filter(lambda p: p.lower() == module.lower() + 'tidymodule.cpp', os.listdir(module_path)))
+  modulecpp = next(iter(filter(
+  lambda p: p.lower() == module.lower() + 'tidymodule.cpp',
+  os.listdir(module_path
   filename = os.path.join(module_path, modulecpp)
   with io.open(filename, 'r', encoding='utf8') as f:
 lines = f.readlines()
 
   print('Updating %s...' % filename)
-  with io.open(filename, 'wb', encoding='utf8') as f:
+  with io.open(filename, 'w', encoding='utf8') as f:
 header_added = False
 header_found = False
 check_added = False
@@ -153,21 +157,21 @@
   header_found = True
   if match.group(1) > check_name_camel:
 header_added = True
-f.write(('#include "' + check_name_camel + '.h"\n').encode())
+f.write('#include "' + check_name_camel + '.h"\n')
 elif header_found:
   header_added = True
-  f.write(('#include "' + check_name_camel + '.h"\n').encode())
+  f.write('#include "' + check_name_camel + '.h"\n')
 
   if not check_added:
 if line.strip() == '}':
   check_added = True
-  f.write(check_decl.encode())
+  f.write(check_decl)
 else:
   match = re.search('registerCheck<(.*)>', line)
   if match and match.group(1) > check_name_camel:
 check_added = True
-f.write(check_decl.encode())
-  f.write(line.encode())
+f.write(check_decl)
+  f.write(line)
 
 
 # Adds a release notes entry.
@@ -182,7 +186,7 @@
   checkMatcher = re.compile('- The \'(.*)')
 
   print('Updating %s...' % filename)
-  with io.open(filename, 'wb', encoding='utf8') as f:
+  with io.open(filename, 'w', encoding='utf8') as f:
 note_added = False
 header_found = False
 add_note_here = False
@@ -202,22 +206,22 @@
 
 if match:
   header_found = True
-  f.write(line.encode())
+  f.write(line)
   continue
 
 if line.startswith(''):
-  f.write(line.encode())
+  f.write(line)
   continue
 
 if header_found and add_note_here:
   if not line.startswith(''):
-f.write(("""- The '%s' check was renamed to :doc:`%s
+f.write("""- The '%s' check was renamed to :doc:`%s
   `
 
-""" % (old_check_name, new_check_name, new_check_name)).encode())
+""" % (old_check_name, new_check_name, new_check_name))
 note_added = True
 
-  f.write(line.encode())
+  f.write(line)
 
 def main():
   parser = argparse.ArgumentParser(description='Rename clang-tidy check.')
@@ -263,9 +267,9 @@
 (check_name_camel, cmake_lists))
   return 1
 
-modulecpp = next(filter(
+modulecpp = next(iter(filter(
 lambda p: p.lower() == old_module.lower() + 'tidymodule.cpp',
-os.listdir(old_module_path)))
+os.listdir(old_module_path
 deleteMatchingLines(os.path.join(old_module_path, modulecpp),
   '\\b' + check_name_camel + '|\\b' + args.old_check_name)
 
Index: 

[PATCH] D108302: [PowerPC] Fixed the crash due to early if conversion with fixed CR fields.

2021-09-02 Thread Kamau Bridgeman via Phabricator via cfe-commits
kamaub accepted this revision as: kamaub.
kamaub added a comment.

This LGTM, small nit on the comment, but that can be fixed on commit




Comment at: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1544
 
+  // If the condition branch uses a physical register, then it cannot be turned
+  // into a select.

nit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108302

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


[PATCH] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Wei Wang via Phabricator via cfe-commits
weiwang added a comment.

In D109175#2980744 , @jdoerfert wrote:

> Why do we need this flag, is the absence of -fopenmp-targets not sufficient?

Just double checked, this is the full omp related options currently in use:

  "-fopenmp"
  "-fopenmp-version=31"
  "-fopenmp-version=31"
  "-fopenmp-cuda-parallel-target-regions"

We saw a huge number of `DECLS_TO_CHECK_FOR_DEFERRED_DIAGS` records. I don't 
know if this has anything to do with omp version being 31, since prior 5.0, 
everything is available on host and `getEmissionStatus` would return 
`FunctionEmissionStatus::Unknown` in this case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109175

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


[PATCH] D107430: [OMPIRBuilder] Add ordered directive to OMPIRBuilder

2021-09-02 Thread Kiran Chandramohan via Phabricator via cfe-commits
kiranchandramohan accepted this revision.
kiranchandramohan added a comment.

LGTM.


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

https://reviews.llvm.org/D107430

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


[PATCH] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

Why do we need this flag, is the absence of -fopenmp-targets not sufficient?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109175

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


[PATCH] D106813: [clang-repl] Build and install clang-repl by default

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

Maybe add this to the release notes of clang 13 or 14?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106813

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


[PATCH] D108291: [clang-nvlink-wrapper] Wrapper around nvlink for archive files

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

Maybe add this to the release notes of clang 14?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108291

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


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-09-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added reviewers: vsapsai, dexonsmith.
dexonsmith requested changes to this revision.
dexonsmith added a subscriber: vsapsai.
dexonsmith added a comment.
This revision now requires changes to proceed.

I think @vsapsai was looking at this as well.

This mostly LGTM, but I think this can be pretty easily unit tested. Please add 
something to the tests in llvm/unittests/Support/VirtualFileSystemTest.cpp. 
Also a nit inline.




Comment at: llvm/lib/Support/VirtualFileSystem.cpp:2006
 ErrorOr>
 RedirectingFileSystem::openFileForRead(const Twine _) {
   SmallString<256> Path;

I suggest giving this a real name if it's being used for anything. Maybe 
`PathAsWritten`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109128

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


[PATCH] D109174: [MSP430][Clang] Infer CPU type from -mcpu= or -mmcu=

2021-09-02 Thread Jozef Lawrynowicz via Phabricator via cfe-commits
jozefl updated this revision to Diff 370370.
jozefl added a comment.

Updated patch to use hasFeature() to check for msp430x support, instead of a
new function.

Fixed use of tools::getCPUName() after rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109174

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Basic/Targets/MSP430.cpp
  clang/lib/Basic/Targets/MSP430.h
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/MSP430.cpp
  clang/lib/Driver/ToolChains/MSP430.h
  clang/test/Driver/msp430-cpu.c
  clang/test/Driver/msp430-mmcu.c
  clang/test/Driver/msp430-toolchain.c
  clang/test/Misc/target-invalid-cpu-note.c
  clang/test/Preprocessor/msp430-defs.c
  llvm/lib/Target/MSP430/MSP430.td
  llvm/lib/Target/MSP430/MSP430Subtarget.cpp
  llvm/lib/Target/MSP430/MSP430Subtarget.h
  llvm/test/CodeGen/MSP430/build-attrs.ll

Index: llvm/test/CodeGen/MSP430/build-attrs.ll
===
--- llvm/test/CodeGen/MSP430/build-attrs.ll
+++ llvm/test/CodeGen/MSP430/build-attrs.ll
@@ -8,6 +8,8 @@
 ; RUN:   | llvm-readelf -A - | FileCheck %s --check-prefixes COMMON,MSP430,SMALL
 ; RUN: llc -mtriple=msp430 -mcpu=msp430x -filetype=obj < %s \
 ; RUN:   | llvm-readelf -A - | FileCheck %s --check-prefixes COMMON,MSP430X,SMALL
+; RUN: llc -mtriple=msp430 -mcpu=msp430xv2 -filetype=obj < %s \
+; RUN:   | llvm-readelf -A - | FileCheck %s --check-prefixes COMMON,MSP430X,SMALL
 
 ; COMMON: BuildAttributes {
 ; COMMON: FormatVersion: 0x41
Index: llvm/lib/Target/MSP430/MSP430Subtarget.h
===
--- llvm/lib/Target/MSP430/MSP430Subtarget.h
+++ llvm/lib/Target/MSP430/MSP430Subtarget.h
@@ -36,7 +36,7 @@
 
 private:
   virtual void anchor();
-  bool ExtendedInsts = false;
+  bool MSP430X = false;
   HWMultEnum HWMultMode = NoHWMult;
   MSP430FrameLowering FrameLowering;
   MSP430InstrInfo InstrInfo;
@@ -60,6 +60,8 @@
   bool hasHWMult32() const { return HWMultMode == HWMult32; }
   bool hasHWMultF5() const { return HWMultMode == HWMultF5; }
 
+  bool hasMSP430X() const { return MSP430X; }
+
   const TargetFrameLowering *getFrameLowering() const override {
 return 
   }
Index: llvm/lib/Target/MSP430/MSP430Subtarget.cpp
===
--- llvm/lib/Target/MSP430/MSP430Subtarget.cpp
+++ llvm/lib/Target/MSP430/MSP430Subtarget.cpp
@@ -40,9 +40,6 @@
 
 MSP430Subtarget &
 MSP430Subtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
-  ExtendedInsts = false;
-  HWMultMode = NoHWMult;
-
   StringRef CPUName = CPU;
   if (CPUName.empty())
 CPUName = "msp430";
Index: llvm/lib/Target/MSP430/MSP430.td
===
--- llvm/lib/Target/MSP430/MSP430.td
+++ llvm/lib/Target/MSP430/MSP430.td
@@ -18,8 +18,8 @@
 // Subtarget Features. 
 //===--===//
 def FeatureX
- : SubtargetFeature<"ext", "ExtendedInsts", "true",
-"Enable MSP430-X extensions">;
+ : SubtargetFeature<"msp430x", "MSP430X", "true",
+"Enable MSP430X extensions">;
 
 def FeatureHWMult16
  : SubtargetFeature<"hwmult16", "HWMultMode", "HWMult16",
@@ -42,6 +42,7 @@
 def : Proc<"generic", []>;
 def : Proc<"msp430",  []>;
 def : Proc<"msp430x", [FeatureX]>;
+def : Proc<"msp430xv2",   [FeatureX]>;
 
 //===--===//
 // Register File Description
Index: clang/test/Preprocessor/msp430-defs.c
===
--- /dev/null
+++ clang/test/Preprocessor/msp430-defs.c
@@ -0,0 +1,20 @@
+// Check the correct macros are defined for each CPU.
+
+// RUN: %clang -target msp430 -x c -E -dM %s -o - | FileCheck  %s
+// RUN: %clang -target msp430 -mcpu=generic -x c -E -dM %s -o - | FileCheck %s
+// RUN: %clang -target msp430 -mcpu=msp430 -x c -E -dM %s -o - | FileCheck %s
+
+// CHECK: MSP430
+// CHECK: __ELF__
+// CHECK-NOT: __MSP430X__
+// CHECK: __MSP430__
+
+// RUN: %clang -target msp430 -mcpu=msp430x -x c -E -dM %s -o - \
+// RUN:   | FileCheck --check-prefix=MSP430X %s
+// RUN: %clang -target msp430 -mcpu=msp430xv2 -x c -E -dM %s -o - \
+// RUN:   | FileCheck --check-prefix=MSP430X %s
+
+// MSP430X: MSP430
+// MSP430X: __ELF__
+// MSP430X: __MSP430X__
+// MSP430X: __MSP430__
Index: clang/test/Misc/target-invalid-cpu-note.c
===
--- clang/test/Misc/target-invalid-cpu-note.c
+++ clang/test/Misc/target-invalid-cpu-note.c
@@ -205,3 +205,7 @@
 // RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
 // TUNE-RISCV64: error: unknown 

[PATCH] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Wenlei He via Phabricator via cfe-commits
wenlei added a comment.

In D109175#2980446 , @lebedev.ri 
wrote:

> In D109175#2980333 , @weiwang wrote:
>
>> Our internal codebase never uses the target directive. Once the deferred 
>> diags is bypassed, we observed 18% e2e build time improvement.
>
> Is that with `-fopenmp` or without?
> That seems, kinda a lot more than i would have expected,
> perhaps there are some other ways to reduce the overhead other than this 
> approach?

Yeah, though the slow down in build time is blocking us from moving to newer 
llvm for many projects. Currently I think it makes sense to give user the 
option to decide whether they want faster build or better diagnostics. Of 
course if the slow down is fully addressed in the future, the switch could be 
removed too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109175

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


[PATCH] D109167: Try to unbreak Win build differently after 973519826edb76

2021-09-02 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

> @goncharov @mehdi_amini is there a way to change the way the phab UI or the 
> pre-merge checks work here to make failing pre-merge checks clearer? This 
> isn't the first time I've seen someone be very confused about this UI

I asked the same thing a few days ago and @goncharov said something was cooking 
in this area!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109167

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


[PATCH] D109167: Try to unbreak Win build differently after 973519826edb76

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

In D109167#2980604 , @GMNGeoffrey 
wrote:

>> I had fixed this in 
>> https://github.com/llvm/llvm-project/commit/9d227543890e721b95303430ee1427ce5aa7292f
>>  . Precommit bot on this change was green though as far as I can tell.
>
> Harbormaster comments with a green check mark that build has completed, but 
> if you look at the top of the revision it has the build results.

Thanks, I didn't realize this. I thought this passed precommit, else I wouldn't 
have landed it.

Perfectly fine to revert things that break the build of course. Timing was a 
bit unfortunate, but reverting broken things is of course A-ok (especially with 
failing pre-merge testing). Thanks for relanding :)

> For some reason that I don't understand, the actual status at the top 
> disappears as soon as the commit has landed, which is... very unhelpful. If 
> you click on the Harbormaster comment now, you can see that they failed. I've 
> reopened a diff with https://reviews.llvm.org/D109181 and will reland if 
> premerge checks pass. Sorry that my revert went past the fix. AFAIU, I was 
> following the guidelines in 
> https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy. I think it 
> would be nice to comment on the review that you are already preparing a fix 
> (but I have no idea what the standard practice is). If I had known you were 
> then I wouldn't have reverted.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109167

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


[PATCH] D109158: [clang][deps] Test diagnostic options are being respected

2021-09-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

The test LGTM. I'd prefer you to squash this into 
https://reviews.llvm.org/D108974 though, since it seems to contain the 
necessary bits to make the test pass.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109158

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


[PATCH] D109167: Try to unbreak Win build differently after 973519826edb76

2021-09-02 Thread Geoffrey Martin-Noble via Phabricator via cfe-commits
GMNGeoffrey added subscribers: goncharov, mehdi_amini.
GMNGeoffrey added a comment.

In D109167#2980604 , @GMNGeoffrey 
wrote:

>> I had fixed this in 
>> https://github.com/llvm/llvm-project/commit/9d227543890e721b95303430ee1427ce5aa7292f
>>  . Precommit bot on this change was green though as far as I can tell.
>
> Harbormaster comments with a green check mark that build has completed, but 
> if you look at the top of the revision it has the build results. For some 
> reason that I don't understand, the actual status at the top disappears as 
> soon as the commit has landed, which is... very unhelpful. If you click on 
> the Harbormaster comment now, you can see that they failed. I've reopened a 
> diff with https://reviews.llvm.org/D109181 and will reland if premerge checks 
> pass. Sorry that my revert went past the fix. AFAIU, I was following the 
> guidelines in 
> https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy. I think it 
> would be nice to comment on the review that you are already preparing a fix 
> (but I have no idea what the standard practice is). If I had known you were 
> then I wouldn't have reverted.

@goncharov @mehdi_amini is there a way to change the way the phab UI or the 
pre-merge checks work here to make failing pre-merge checks clearer? This isn't 
the first time I've seen someone be very confused about this UI


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109167

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


[PATCH] D108974: [clang][tooling] Properly initialize DiagnosticsEngine for cc1 command-line construction

2021-09-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

(If you can squash the changes from https://reviews.llvm.org/D109158 into here, 
even better.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108974

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


[PATCH] D108979: [clang][deps] NFC: Stop going through ClangTool

2021-09-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

Thanks for explaining why ToolInvocation fits well here. SGTM.

In D108979#2979484 , @jansvoboda11 
wrote:

> I think we can move that conversion into the current constructor that accepts 
> `std::vector`, add another constructor that takes 
> `ArrayRef` and use that from the dependency scanner.

Yeah, that makes sense. (No reason to block this though... can be done later.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108979

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


[PATCH] D109167: Try to unbreak Win build differently after 973519826edb76

2021-09-02 Thread Geoffrey Martin-Noble via Phabricator via cfe-commits
GMNGeoffrey added a comment.

> I had fixed this in 
> https://github.com/llvm/llvm-project/commit/9d227543890e721b95303430ee1427ce5aa7292f
>  . Precommit bot on this change was green though as far as I can tell.

Harbormaster comments with a green check mark that build has completed, but if 
you look at the top of the revision it has the build results. For some reason 
that I don't understand, the actual status at the top disappears as soon as the 
commit has landed, which is... very unhelpful. If you click on the Harbormaster 
comment now, you can see that they failed. I've reopened a diff with 
https://reviews.llvm.org/D109181 and will reland if premerge checks pass. Sorry 
that my revert went past the fix. AFAIU, I was following the guidelines in 
https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy. I think it 
would be nice to comment on the review that you are already preparing a fix 
(but I have no idea what the standard practice is). If I had known you were 
then I wouldn't have reverted.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109167

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


[PATCH] D109181: Reland "Try to unbreak Win build differently after 973519826edb76""

2021-09-02 Thread Nico Weber via Phabricator via cfe-commits
thakis accepted this revision.
thakis 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/D109181/new/

https://reviews.llvm.org/D109181

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


[PATCH] D108482: [Clang] Fix instantiation of OpaqueValueExprs (Bug #45964)

2021-09-02 Thread Jason Rice via Phabricator via cfe-commits
ricejasonf updated this revision to Diff 370353.
ricejasonf marked 2 inline comments as done.
ricejasonf added a comment.

Fixed minor formatting issue.  (Perhaps this should be in the tests included 
with check-clang?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108482

Files:
  clang/lib/Sema/TreeTransform.h
  clang/test/CodeGenCXX/pr45964-decomp-transform.cpp


Index: clang/test/CodeGenCXX/pr45964-decomp-transform.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/pr45964-decomp-transform.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -std=c++1z -triple x86_64-linux-gnu -emit-llvm -o - %s | 
FileCheck %s
+
+int a[1];
+// CHECK: @a = global [1 x i32] zeroinitializer
+template 
+void test_transform() {
+  auto [b] = a;
+}
+void (*d)(){test_transform<0>};
+// CHECK-LABEL: define {{.*}} @_Z14test_transformILi0EEvv
+// CHECK:   [[ENTRY:.*]]:
+// CHECK-NEXT:  [[ARR:%.*]] = alloca [1 x i32]
+// CHECK-NEXT:  [[BEGIN:%.*]] = getelementptr inbounds [1 x i32], [1 x i32]* 
[[ARR]], i64 0, i64 0
+// CHECK-NEXT:  br label %[[BODY:.*]]
+// CHECK-EMPTY:
+// CHECK-NEXT:  [[BODY]]:
+// CHECK-NEXT:  [[CUR:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[NEXT:%.*]], 
%[[BODY]] ]
+// CHECK-NEXT:  [[DEST:%.*]] = getelementptr inbounds i32, i32* [[BEGIN]], i64 
[[CUR]]
+// CHECK-NEXT:  [[SRC:%.*]] = getelementptr inbounds [1 x i32], [1 x i32]* @a, 
i64 0, i64 [[CUR]]
+// CHECK-NEXT:  [[X:%.*]] = load i32, i32* [[SRC]]
+// CHECK-NEXT:  store i32 [[X]], i32* [[DEST]]
+// CHECK-NEXT:  [[NEXT]] = add nuw i64 [[CUR]], 1
+// CHECK-NEXT:  [[EQ:%.*]] = icmp eq i64 [[NEXT]], 1
+// CHECK-NEXT:  br i1 [[EQ]], label %[[FIN:.*]], label %[[BODY]]
+// CHECK-EMPTY:
+// CHECK-NEXT:  [[FIN]]:
+// CHECK-NEXT:  ret void
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -3840,8 +3840,10 @@
   if (auto *FE = dyn_cast(Init))
 Init = FE->getSubExpr();
 
-  if (auto *AIL = dyn_cast(Init))
-Init = AIL->getCommonExpr();
+  if (auto *AIL = dyn_cast(Init)) {
+OpaqueValueExpr *OVE = cast(AIL->getCommonExpr());
+Init = OVE->getSourceExpr();
+  }
 
   if (MaterializeTemporaryExpr *MTE = dyn_cast(Init))
 Init = MTE->getSubExpr();


Index: clang/test/CodeGenCXX/pr45964-decomp-transform.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/pr45964-decomp-transform.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -std=c++1z -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+
+int a[1];
+// CHECK: @a = global [1 x i32] zeroinitializer
+template 
+void test_transform() {
+  auto [b] = a;
+}
+void (*d)(){test_transform<0>};
+// CHECK-LABEL: define {{.*}} @_Z14test_transformILi0EEvv
+// CHECK:   [[ENTRY:.*]]:
+// CHECK-NEXT:  [[ARR:%.*]] = alloca [1 x i32]
+// CHECK-NEXT:  [[BEGIN:%.*]] = getelementptr inbounds [1 x i32], [1 x i32]* [[ARR]], i64 0, i64 0
+// CHECK-NEXT:  br label %[[BODY:.*]]
+// CHECK-EMPTY:
+// CHECK-NEXT:  [[BODY]]:
+// CHECK-NEXT:  [[CUR:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[NEXT:%.*]], %[[BODY]] ]
+// CHECK-NEXT:  [[DEST:%.*]] = getelementptr inbounds i32, i32* [[BEGIN]], i64 [[CUR]]
+// CHECK-NEXT:  [[SRC:%.*]] = getelementptr inbounds [1 x i32], [1 x i32]* @a, i64 0, i64 [[CUR]]
+// CHECK-NEXT:  [[X:%.*]] = load i32, i32* [[SRC]]
+// CHECK-NEXT:  store i32 [[X]], i32* [[DEST]]
+// CHECK-NEXT:  [[NEXT]] = add nuw i64 [[CUR]], 1
+// CHECK-NEXT:  [[EQ:%.*]] = icmp eq i64 [[NEXT]], 1
+// CHECK-NEXT:  br i1 [[EQ]], label %[[FIN:.*]], label %[[BODY]]
+// CHECK-EMPTY:
+// CHECK-NEXT:  [[FIN]]:
+// CHECK-NEXT:  ret void
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -3840,8 +3840,10 @@
   if (auto *FE = dyn_cast(Init))
 Init = FE->getSubExpr();
 
-  if (auto *AIL = dyn_cast(Init))
-Init = AIL->getCommonExpr();
+  if (auto *AIL = dyn_cast(Init)) {
+OpaqueValueExpr *OVE = cast(AIL->getCommonExpr());
+Init = OVE->getSourceExpr();
+  }
 
   if (MaterializeTemporaryExpr *MTE = dyn_cast(Init))
 Init = MTE->getSubExpr();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109181: Reland "Try to unbreak Win build differently after 973519826edb76""

2021-09-02 Thread Geoffrey Martin-Noble via Phabricator via cfe-commits
GMNGeoffrey created this revision.
Herald added subscribers: dexonsmith, mgrang.
GMNGeoffrey requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Build should be fixed by
https://github.com/llvm/llvm-project/commit/9d22754389

This reverts commit df052e1732ab57f5d9c684ceeaed3ab39073cd9f 
.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109181

Files:
  clang/lib/Driver/ToolChains/Arch/X86.cpp
  llvm/include/llvm/ADT/StringMap.h
  llvm/unittests/ADT/StringMapTest.cpp


Index: llvm/unittests/ADT/StringMapTest.cpp
===
--- llvm/unittests/ADT/StringMapTest.cpp
+++ llvm/unittests/ADT/StringMapTest.cpp
@@ -308,7 +308,21 @@
   EXPECT_EQ(0, try1.first->second.copy);
 }
 
-TEST_F(StringMapTest, IterMapKeys) {
+TEST_F(StringMapTest, IterMapKeysVector) {
+  StringMap Map;
+  Map["A"] = 1;
+  Map["B"] = 2;
+  Map["C"] = 3;
+  Map["D"] = 3;
+
+  std::vector Keys{Map.keys().begin(), Map.keys().end()};
+  llvm::sort(Keys);
+
+  std::vector Expected{{"A", "B", "C", "D"}};
+  EXPECT_EQ(Expected, Keys);
+}
+
+TEST_F(StringMapTest, IterMapKeysSmallVector) {
   StringMap Map;
   Map["A"] = 1;
   Map["B"] = 2;
Index: llvm/include/llvm/ADT/StringMap.h
===
--- llvm/include/llvm/ADT/StringMap.h
+++ llvm/include/llvm/ADT/StringMap.h
@@ -478,13 +478,7 @@
   explicit StringMapKeyIterator(StringMapConstIterator Iter)
   : base(std::move(Iter)) {}
 
-  StringRef *() {
-Key = this->wrapped()->getKey();
-return Key;
-  }
-
-private:
-  StringRef Key;
+  StringRef operator*() const { return this->wrapped()->getKey(); }
 };
 
 } // end namespace llvm
Index: clang/lib/Driver/ToolChains/Arch/X86.cpp
===
--- clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,9 +59,8 @@
 }
 StringRef CPU = ArchMap.lookup(A->getValue());
 if (CPU.empty()) {
-  std::vector ValidArchs;
-  for (StringRef Key : ArchMap.keys())
-ValidArchs.push_back(Key);
+  std::vector ValidArchs{ArchMap.keys().begin(),
+ArchMap.keys().end()};
   sort(ValidArchs);
   D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
   << A->getValue() << (Triple.getArch() == llvm::Triple::x86)


Index: llvm/unittests/ADT/StringMapTest.cpp
===
--- llvm/unittests/ADT/StringMapTest.cpp
+++ llvm/unittests/ADT/StringMapTest.cpp
@@ -308,7 +308,21 @@
   EXPECT_EQ(0, try1.first->second.copy);
 }
 
-TEST_F(StringMapTest, IterMapKeys) {
+TEST_F(StringMapTest, IterMapKeysVector) {
+  StringMap Map;
+  Map["A"] = 1;
+  Map["B"] = 2;
+  Map["C"] = 3;
+  Map["D"] = 3;
+
+  std::vector Keys{Map.keys().begin(), Map.keys().end()};
+  llvm::sort(Keys);
+
+  std::vector Expected{{"A", "B", "C", "D"}};
+  EXPECT_EQ(Expected, Keys);
+}
+
+TEST_F(StringMapTest, IterMapKeysSmallVector) {
   StringMap Map;
   Map["A"] = 1;
   Map["B"] = 2;
Index: llvm/include/llvm/ADT/StringMap.h
===
--- llvm/include/llvm/ADT/StringMap.h
+++ llvm/include/llvm/ADT/StringMap.h
@@ -478,13 +478,7 @@
   explicit StringMapKeyIterator(StringMapConstIterator Iter)
   : base(std::move(Iter)) {}
 
-  StringRef *() {
-Key = this->wrapped()->getKey();
-return Key;
-  }
-
-private:
-  StringRef Key;
+  StringRef operator*() const { return this->wrapped()->getKey(); }
 };
 
 } // end namespace llvm
Index: clang/lib/Driver/ToolChains/Arch/X86.cpp
===
--- clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,9 +59,8 @@
 }
 StringRef CPU = ArchMap.lookup(A->getValue());
 if (CPU.empty()) {
-  std::vector ValidArchs;
-  for (StringRef Key : ArchMap.keys())
-ValidArchs.push_back(Key);
+  std::vector ValidArchs{ArchMap.keys().begin(),
+ArchMap.keys().end()};
   sort(ValidArchs);
   D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
   << A->getValue() << (Triple.getArch() == llvm::Triple::x86)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D109167: Try to unbreak Win build differently after 973519826edb76

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

In D109167#2980560 , @GMNGeoffrey 
wrote:

> I'm seeing a build failure coming out of this:
>
>> llvm-project/lld/wasm/Writer.cpp:521:16: error: non-const lvalue reference 
>> to type 'llvm::StringRef' cannot bind to a temporary of type 
>> 'llvm::StringRef'
>>
>>   for (auto  : used.keys()) {
>
> Looks like pre-merge checks failed with the same error: 
> https://buildkite.com/llvm-project/premerge-checks/builds/54930#07373971-3d37-49cf-9def-22c0d724ee23

I had fixed this in 
https://github.com/llvm/llvm-project/commit/9d227543890e721b95303430ee1427ce5aa7292f
 . Precommit bot on this change was green though as far as I can tell.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109167

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


[clang] df052e1 - Revert "Try to unbreak Win build differently after 973519826edb76"

2021-09-02 Thread Geoffrey Martin-Noble via cfe-commits

Author: Geoffrey Martin-Noble
Date: 2021-09-02T12:05:33-07:00
New Revision: df052e1732ab57f5d9c684ceeaed3ab39073cd9f

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

LOG: Revert "Try to unbreak Win build differently after 973519826edb76"

Breaks the build and failed pre-merge checks:
https://buildkite.com/llvm-project/premerge-checks/builds/54930#07373971-3d37-49cf-9def-22c0d724ee23

> llvm-project/lld/wasm/Writer.cpp:521:16: error: non-const lvalue reference to
>  type 'llvm::StringRef' cannot bind to a temporary of type 'llvm::StringRef'
>for (auto  : used.keys()) {

This reverts commit 5881dcff7e76a68323edc8bb3c6e14420ad9cf7c.

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/X86.cpp
llvm/include/llvm/ADT/StringMap.h
llvm/unittests/ADT/StringMapTest.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp 
b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index bfa008f964e19..2e43c455b28fd 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,8 +59,9 @@ std::string x86::getX86TargetCPU(const Driver , const 
ArgList ,
 }
 StringRef CPU = ArchMap.lookup(A->getValue());
 if (CPU.empty()) {
-  std::vector ValidArchs{ArchMap.keys().begin(),
-ArchMap.keys().end()};
+  std::vector ValidArchs;
+  for (StringRef Key : ArchMap.keys())
+ValidArchs.push_back(Key);
   sort(ValidArchs);
   D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
   << A->getValue() << (Triple.getArch() == llvm::Triple::x86)

diff  --git a/llvm/include/llvm/ADT/StringMap.h 
b/llvm/include/llvm/ADT/StringMap.h
index fa99ecd81106e..003e62d98ec23 100644
--- a/llvm/include/llvm/ADT/StringMap.h
+++ b/llvm/include/llvm/ADT/StringMap.h
@@ -478,9 +478,13 @@ class StringMapKeyIterator
   explicit StringMapKeyIterator(StringMapConstIterator Iter)
   : base(std::move(Iter)) {}
 
-  StringRef operator*() const {
-return this->wrapped()->getKey();
+  StringRef *() {
+Key = this->wrapped()->getKey();
+return Key;
   }
+
+private:
+  StringRef Key;
 };
 
 } // end namespace llvm

diff  --git a/llvm/unittests/ADT/StringMapTest.cpp 
b/llvm/unittests/ADT/StringMapTest.cpp
index f38a60452e3c7..6a3cca5a4a324 100644
--- a/llvm/unittests/ADT/StringMapTest.cpp
+++ b/llvm/unittests/ADT/StringMapTest.cpp
@@ -308,21 +308,7 @@ TEST_F(StringMapTest, InsertOrAssignTest) {
   EXPECT_EQ(0, try1.first->second.copy);
 }
 
-TEST_F(StringMapTest, IterMapKeysVector) {
-  StringMap Map;
-  Map["A"] = 1;
-  Map["B"] = 2;
-  Map["C"] = 3;
-  Map["D"] = 3;
-
-  std::vector Keys{Map.keys().begin(), Map.keys().end()};
-  llvm::sort(Keys);
-
-  std::vector Expected{{"A", "B", "C", "D"}};
-  EXPECT_EQ(Expected, Keys);
-}
-
-TEST_F(StringMapTest, IterMapKeysSmallVector) {
+TEST_F(StringMapTest, IterMapKeys) {
   StringMap Map;
   Map["A"] = 1;
   Map["B"] = 2;



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


[PATCH] D109167: Try to unbreak Win build differently after 973519826edb76

2021-09-02 Thread Geoffrey Martin-Noble via Phabricator via cfe-commits
GMNGeoffrey added a comment.

I'm seeing a build failure coming out of this:

> llvm-project/lld/wasm/Writer.cpp:521:16: error: non-const lvalue reference to 
> type 'llvm::StringRef' cannot bind to a temporary of type 'llvm::StringRef'
>
>   for (auto  : used.keys()) {

Looks like pre-merge checks failed with the same error: 
https://buildkite.com/llvm-project/premerge-checks/builds/54930#07373971-3d37-49cf-9def-22c0d724ee23


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109167

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


[PATCH] D109174: [MSP430][Clang] Infer CPU type from -mcpu= or -mmcu=

2021-09-02 Thread Jozef Lawrynowicz via Phabricator via cfe-commits
jozefl updated this revision to Diff 370350.
jozefl added a comment.

Rebased onto current upstream.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109174

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Basic/Targets/MSP430.cpp
  clang/lib/Basic/Targets/MSP430.h
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/MSP430.cpp
  clang/lib/Driver/ToolChains/MSP430.h
  clang/test/Driver/msp430-cpu.c
  clang/test/Driver/msp430-mmcu.c
  clang/test/Driver/msp430-toolchain.c
  clang/test/Misc/target-invalid-cpu-note.c
  clang/test/Preprocessor/msp430-defs.c
  llvm/lib/Target/MSP430/MSP430.td
  llvm/lib/Target/MSP430/MSP430Subtarget.cpp
  llvm/lib/Target/MSP430/MSP430Subtarget.h
  llvm/test/CodeGen/MSP430/build-attrs.ll

Index: llvm/test/CodeGen/MSP430/build-attrs.ll
===
--- llvm/test/CodeGen/MSP430/build-attrs.ll
+++ llvm/test/CodeGen/MSP430/build-attrs.ll
@@ -8,6 +8,8 @@
 ; RUN:   | llvm-readelf -A - | FileCheck %s --check-prefixes COMMON,MSP430,SMALL
 ; RUN: llc -mtriple=msp430 -mcpu=msp430x -filetype=obj < %s \
 ; RUN:   | llvm-readelf -A - | FileCheck %s --check-prefixes COMMON,MSP430X,SMALL
+; RUN: llc -mtriple=msp430 -mcpu=msp430xv2 -filetype=obj < %s \
+; RUN:   | llvm-readelf -A - | FileCheck %s --check-prefixes COMMON,MSP430X,SMALL
 
 ; COMMON: BuildAttributes {
 ; COMMON: FormatVersion: 0x41
Index: llvm/lib/Target/MSP430/MSP430Subtarget.h
===
--- llvm/lib/Target/MSP430/MSP430Subtarget.h
+++ llvm/lib/Target/MSP430/MSP430Subtarget.h
@@ -36,7 +36,7 @@
 
 private:
   virtual void anchor();
-  bool ExtendedInsts = false;
+  bool MSP430X = false;
   HWMultEnum HWMultMode = NoHWMult;
   MSP430FrameLowering FrameLowering;
   MSP430InstrInfo InstrInfo;
@@ -60,6 +60,8 @@
   bool hasHWMult32() const { return HWMultMode == HWMult32; }
   bool hasHWMultF5() const { return HWMultMode == HWMultF5; }
 
+  bool hasMSP430X() const { return MSP430X; }
+
   const TargetFrameLowering *getFrameLowering() const override {
 return 
   }
Index: llvm/lib/Target/MSP430/MSP430Subtarget.cpp
===
--- llvm/lib/Target/MSP430/MSP430Subtarget.cpp
+++ llvm/lib/Target/MSP430/MSP430Subtarget.cpp
@@ -40,9 +40,6 @@
 
 MSP430Subtarget &
 MSP430Subtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
-  ExtendedInsts = false;
-  HWMultMode = NoHWMult;
-
   StringRef CPUName = CPU;
   if (CPUName.empty())
 CPUName = "msp430";
Index: llvm/lib/Target/MSP430/MSP430.td
===
--- llvm/lib/Target/MSP430/MSP430.td
+++ llvm/lib/Target/MSP430/MSP430.td
@@ -18,8 +18,8 @@
 // Subtarget Features. 
 //===--===//
 def FeatureX
- : SubtargetFeature<"ext", "ExtendedInsts", "true",
-"Enable MSP430-X extensions">;
+ : SubtargetFeature<"msp430x", "MSP430X", "true",
+"Enable MSP430X extensions">;
 
 def FeatureHWMult16
  : SubtargetFeature<"hwmult16", "HWMultMode", "HWMult16",
@@ -42,6 +42,7 @@
 def : Proc<"generic", []>;
 def : Proc<"msp430",  []>;
 def : Proc<"msp430x", [FeatureX]>;
+def : Proc<"msp430xv2",   [FeatureX]>;
 
 //===--===//
 // Register File Description
Index: clang/test/Preprocessor/msp430-defs.c
===
--- /dev/null
+++ clang/test/Preprocessor/msp430-defs.c
@@ -0,0 +1,20 @@
+// Check the correct macros are defined for each CPU.
+
+// RUN: %clang -target msp430 -x c -E -dM %s -o - | FileCheck  %s
+// RUN: %clang -target msp430 -mcpu=generic -x c -E -dM %s -o - | FileCheck %s
+// RUN: %clang -target msp430 -mcpu=msp430 -x c -E -dM %s -o - | FileCheck %s
+
+// CHECK: MSP430
+// CHECK: __ELF__
+// CHECK-NOT: __MSP430X__
+// CHECK: __MSP430__
+
+// RUN: %clang -target msp430 -mcpu=msp430x -x c -E -dM %s -o - \
+// RUN:   | FileCheck --check-prefix=MSP430X %s
+// RUN: %clang -target msp430 -mcpu=msp430xv2 -x c -E -dM %s -o - \
+// RUN:   | FileCheck --check-prefix=MSP430X %s
+
+// MSP430X: MSP430
+// MSP430X: __ELF__
+// MSP430X: __MSP430X__
+// MSP430X: __MSP430__
Index: clang/test/Misc/target-invalid-cpu-note.c
===
--- clang/test/Misc/target-invalid-cpu-note.c
+++ clang/test/Misc/target-invalid-cpu-note.c
@@ -205,3 +205,7 @@
 // RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
 // TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
 // TUNE-RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, 

[PATCH] D109178: [PowerPC] Disable vector types when not supported by subtarget features

2021-09-02 Thread Lei Huang via Phabricator via cfe-commits
lei updated this revision to Diff 370349.
lei added a comment.

fix spelling in commit message.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109178

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Headers/altivec.h
  clang/lib/Sema/DeclSpec.cpp
  clang/test/CodeGen/builtins-ppc-int128.c
  clang/test/CodeGen/builtins-ppc-vsx.c
  clang/test/Parser/altivec-bool-128.c
  clang/test/Parser/altivec.c
  clang/test/Parser/cxx-altivec-bool-128.cpp
  clang/test/Parser/cxx-altivec.cpp
  clang/test/Sema/altivec-generic-overload.c
  clang/test/Sema/builtins-ppc.c

Index: clang/test/Sema/builtins-ppc.c
===
--- clang/test/Sema/builtins-ppc.c
+++ clang/test/Sema/builtins-ppc.c
@@ -6,6 +6,9 @@
 // RUN: %clang_cc1 -target-feature +altivec -target-feature +crypto\
 // RUN: -triple powerpc64le-unknown-unknown -DTEST_CRYPTO -fsyntax-only  \
 // RUN: -verify %s
+// RUN: %clang_cc1 -target-feature +altivec -target-feature +crypto \
+// RUN: -triple powerpc64le-unknown-unknown -DTEST_CRYPTO -fsyntax-only \
+// RUN: -target-feature +vsx -verify %s
 
 #ifdef TEST_HTM
 void test_htm() {
@@ -37,6 +40,7 @@
   return __builtin_crypto_vshasigmaw(a, 1, 15);
 }
 
+#ifdef __VSX__
 vector unsigned long long test_vshasigmad_or(void)
 {
   vector unsigned long long a = D_INIT
@@ -46,6 +50,7 @@
   vector unsigned long long e = __builtin_crypto_vshasigmad(a, 1, -15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
   return __builtin_crypto_vshasigmad(a, 0, 15);
 }
+#endif
 
 #endif
 
Index: clang/test/Sema/altivec-generic-overload.c
===
--- clang/test/Sema/altivec-generic-overload.c
+++ clang/test/Sema/altivec-generic-overload.c
@@ -1,4 +1,8 @@
-// RUN: %clang_cc1 %s -triple=powerpc64le-unknown-linux -target-feature +altivec -target-feature +vsx -verify -verify-ignore-unexpected=note -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -triple=powerpc64le-unknown-linux -target-feature +altivec \
+// RUN:  -target-feature +vsx -verify -verify-ignore-unexpected=note -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -triple=powerpc64le-unknown-linux -target-feature +altivec \
+// RUN:  -target-feature +vsx -verify -verify-ignore-unexpected=note -pedantic -fsyntax-only \
+// RUN:  -target-cpu pwr8
 
 typedef signed char __v16sc __attribute__((__vector_size__(16)));
 typedef unsigned char __v16uc __attribute__((__vector_size__(16)));
@@ -20,9 +24,6 @@
 __v4si *__attribute__((__overloadable__)) convert1(vector signed int);
 __v4ui *__attribute__((__overloadable__)) convert1(vector unsigned int);
 __v2sll *__attribute__((__overloadable__)) convert1(vector signed long long);
-__v2ull *__attribute__((__overloadable__)) convert1(vector unsigned long long);
-__v1slll *__attribute__((__overloadable__)) convert1(vector signed __int128);
-__v1ulll *__attribute__((__overloadable__)) convert1(vector unsigned __int128);
 __v4f *__attribute__((__overloadable__)) convert1(vector float);
 __v2d *__attribute__((__overloadable__)) convert1(vector double);
 void __attribute__((__overloadable__)) convert1(vector bool int);
@@ -36,11 +37,17 @@
 vector unsigned int *__attribute__((__overloadable__)) convert2(__v4ui);
 vector signed long long *__attribute__((__overloadable__)) convert2(__v2sll);
 vector unsigned long long *__attribute__((__overloadable__)) convert2(__v2ull);
-vector signed __int128 *__attribute__((__overloadable__)) convert2(__v1slll);
-vector unsigned __int128 *__attribute__((__overloadable__)) convert2(__v1ulll);
 vector float *__attribute__((__overloadable__)) convert2(__v4f);
 vector double *__attribute__((__overloadable__)) convert2(__v2d);
 
+#ifdef __POWER8_VECTOR__
+__v1slll *__attribute__((__overloadable__)) convert1(vector signed __int128);
+__v1ulll *__attribute__((__overloadable__)) convert1(vector unsigned __int128);
+__v2ull *__attribute__((__overloadable__)) convert1(vector unsigned long long);
+vector signed __int128 *__attribute__((__overloadable__)) convert2(__v1slll);
+vector unsigned __int128 *__attribute__((__overloadable__)) convert2(__v1ulll);
+#endif
+
 void test() {
   __v16sc gv1;
   __v16uc gv2;
@@ -49,11 +56,14 @@
   __v4si gv5;
   __v4ui gv6;
   __v2sll gv7;
+  __v4f gv11;
+  __v2d gv12;
+
+#ifdef __POWER8_VECTOR__
   __v2ull gv8;
   __v1slll gv9;
   __v1ulll gv10;
-  __v4f gv11;
-  __v2d gv12;
+#endif
 
   vector signed char av1;
   vector unsigned char av2;
@@ -63,8 +73,10 @@
   vector unsigned int av6;
   vector signed long long av7;
   vector unsigned long long av8;
+#ifdef __POWER8_VECTOR__
   vector signed __int128 av9;
   vector unsigned __int128 av10;
+#endif
   vector float av11;
   vector double av12;
   vector bool int av13;
@@ -77,9 +89,11 @@
   __v4si *gv5_p = convert1(gv5);
   __v4ui *gv6_p = convert1(gv6);
   __v2sll *gv7_p = 

[PATCH] D109167: Try to unbreak Win build differently after 973519826edb76

2021-09-02 Thread Nico Weber 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 rG5881dcff7e76: Try to unbreak Win build differently after 
973519826edb76 (authored by thakis).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109167

Files:
  clang/lib/Driver/ToolChains/Arch/X86.cpp
  llvm/include/llvm/ADT/StringMap.h
  llvm/unittests/ADT/StringMapTest.cpp


Index: llvm/unittests/ADT/StringMapTest.cpp
===
--- llvm/unittests/ADT/StringMapTest.cpp
+++ llvm/unittests/ADT/StringMapTest.cpp
@@ -308,7 +308,21 @@
   EXPECT_EQ(0, try1.first->second.copy);
 }
 
-TEST_F(StringMapTest, IterMapKeys) {
+TEST_F(StringMapTest, IterMapKeysVector) {
+  StringMap Map;
+  Map["A"] = 1;
+  Map["B"] = 2;
+  Map["C"] = 3;
+  Map["D"] = 3;
+
+  std::vector Keys{Map.keys().begin(), Map.keys().end()};
+  llvm::sort(Keys);
+
+  std::vector Expected{{"A", "B", "C", "D"}};
+  EXPECT_EQ(Expected, Keys);
+}
+
+TEST_F(StringMapTest, IterMapKeysSmallVector) {
   StringMap Map;
   Map["A"] = 1;
   Map["B"] = 2;
Index: llvm/include/llvm/ADT/StringMap.h
===
--- llvm/include/llvm/ADT/StringMap.h
+++ llvm/include/llvm/ADT/StringMap.h
@@ -478,13 +478,9 @@
   explicit StringMapKeyIterator(StringMapConstIterator Iter)
   : base(std::move(Iter)) {}
 
-  StringRef *() {
-Key = this->wrapped()->getKey();
-return Key;
+  StringRef operator*() const {
+return this->wrapped()->getKey();
   }
-
-private:
-  StringRef Key;
 };
 
 } // end namespace llvm
Index: clang/lib/Driver/ToolChains/Arch/X86.cpp
===
--- clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,9 +59,8 @@
 }
 StringRef CPU = ArchMap.lookup(A->getValue());
 if (CPU.empty()) {
-  std::vector ValidArchs;
-  for (StringRef Key : ArchMap.keys())
-ValidArchs.push_back(Key);
+  std::vector ValidArchs{ArchMap.keys().begin(),
+ArchMap.keys().end()};
   sort(ValidArchs);
   D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
   << A->getValue() << (Triple.getArch() == llvm::Triple::x86)


Index: llvm/unittests/ADT/StringMapTest.cpp
===
--- llvm/unittests/ADT/StringMapTest.cpp
+++ llvm/unittests/ADT/StringMapTest.cpp
@@ -308,7 +308,21 @@
   EXPECT_EQ(0, try1.first->second.copy);
 }
 
-TEST_F(StringMapTest, IterMapKeys) {
+TEST_F(StringMapTest, IterMapKeysVector) {
+  StringMap Map;
+  Map["A"] = 1;
+  Map["B"] = 2;
+  Map["C"] = 3;
+  Map["D"] = 3;
+
+  std::vector Keys{Map.keys().begin(), Map.keys().end()};
+  llvm::sort(Keys);
+
+  std::vector Expected{{"A", "B", "C", "D"}};
+  EXPECT_EQ(Expected, Keys);
+}
+
+TEST_F(StringMapTest, IterMapKeysSmallVector) {
   StringMap Map;
   Map["A"] = 1;
   Map["B"] = 2;
Index: llvm/include/llvm/ADT/StringMap.h
===
--- llvm/include/llvm/ADT/StringMap.h
+++ llvm/include/llvm/ADT/StringMap.h
@@ -478,13 +478,9 @@
   explicit StringMapKeyIterator(StringMapConstIterator Iter)
   : base(std::move(Iter)) {}
 
-  StringRef *() {
-Key = this->wrapped()->getKey();
-return Key;
+  StringRef operator*() const {
+return this->wrapped()->getKey();
   }
-
-private:
-  StringRef Key;
 };
 
 } // end namespace llvm
Index: clang/lib/Driver/ToolChains/Arch/X86.cpp
===
--- clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,9 +59,8 @@
 }
 StringRef CPU = ArchMap.lookup(A->getValue());
 if (CPU.empty()) {
-  std::vector ValidArchs;
-  for (StringRef Key : ArchMap.keys())
-ValidArchs.push_back(Key);
+  std::vector ValidArchs{ArchMap.keys().begin(),
+ArchMap.keys().end()};
   sort(ValidArchs);
   D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
   << A->getValue() << (Triple.getArch() == llvm::Triple::x86)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 5881dcf - Try to unbreak Win build differently after 973519826edb76

2021-09-02 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2021-09-02T14:45:56-04:00
New Revision: 5881dcff7e76a68323edc8bb3c6e14420ad9cf7c

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

LOG: Try to unbreak Win build differently after 973519826edb76

Looks like the MS STL wants StringMapKeyIterator::operator*() to be const.
Return the result by copy instead of reference to do that.
Assigning to a hash map key iterator doesn't make sense anyways.

Also reverts 123f811fe5b0b which is now hopefully no longer needed.

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/X86.cpp
llvm/include/llvm/ADT/StringMap.h
llvm/unittests/ADT/StringMapTest.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp 
b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index 2e43c455b28fd..bfa008f964e19 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,9 +59,8 @@ std::string x86::getX86TargetCPU(const Driver , const 
ArgList ,
 }
 StringRef CPU = ArchMap.lookup(A->getValue());
 if (CPU.empty()) {
-  std::vector ValidArchs;
-  for (StringRef Key : ArchMap.keys())
-ValidArchs.push_back(Key);
+  std::vector ValidArchs{ArchMap.keys().begin(),
+ArchMap.keys().end()};
   sort(ValidArchs);
   D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
   << A->getValue() << (Triple.getArch() == llvm::Triple::x86)

diff  --git a/llvm/include/llvm/ADT/StringMap.h 
b/llvm/include/llvm/ADT/StringMap.h
index 003e62d98ec23..fa99ecd81106e 100644
--- a/llvm/include/llvm/ADT/StringMap.h
+++ b/llvm/include/llvm/ADT/StringMap.h
@@ -478,13 +478,9 @@ class StringMapKeyIterator
   explicit StringMapKeyIterator(StringMapConstIterator Iter)
   : base(std::move(Iter)) {}
 
-  StringRef *() {
-Key = this->wrapped()->getKey();
-return Key;
+  StringRef operator*() const {
+return this->wrapped()->getKey();
   }
-
-private:
-  StringRef Key;
 };
 
 } // end namespace llvm

diff  --git a/llvm/unittests/ADT/StringMapTest.cpp 
b/llvm/unittests/ADT/StringMapTest.cpp
index 6a3cca5a4a324..f38a60452e3c7 100644
--- a/llvm/unittests/ADT/StringMapTest.cpp
+++ b/llvm/unittests/ADT/StringMapTest.cpp
@@ -308,7 +308,21 @@ TEST_F(StringMapTest, InsertOrAssignTest) {
   EXPECT_EQ(0, try1.first->second.copy);
 }
 
-TEST_F(StringMapTest, IterMapKeys) {
+TEST_F(StringMapTest, IterMapKeysVector) {
+  StringMap Map;
+  Map["A"] = 1;
+  Map["B"] = 2;
+  Map["C"] = 3;
+  Map["D"] = 3;
+
+  std::vector Keys{Map.keys().begin(), Map.keys().end()};
+  llvm::sort(Keys);
+
+  std::vector Expected{{"A", "B", "C", "D"}};
+  EXPECT_EQ(Expected, Keys);
+}
+
+TEST_F(StringMapTest, IterMapKeysSmallVector) {
   StringMap Map;
   Map["A"] = 1;
   Map["B"] = 2;



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


[PATCH] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Wei Wang via Phabricator via cfe-commits
weiwang added a comment.

In D109175#2980446 , @lebedev.ri 
wrote:

> In D109175#2980333 , @weiwang wrote:
>
>> Our internal codebase never uses the target directive. Once the deferred 
>> diags is bypassed, we observed 18% e2e build time improvement.
>
> Is that with `-fopenmp` or without?
> That seems, kinda a lot more than i would have expected,
> perhaps there are some other ways to reduce the overhead other than this 
> approach?

This is with -fopenmp and no other omp related flags. I'd prefer a more generic 
way of fixing this, but right now this seems to be most direct way.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109175

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


[PATCH] D109178: [PowerPC] Disable vector types when not supported by subtarget features

2021-09-02 Thread Lei Huang via Phabricator via cfe-commits
lei created this revision.
lei added reviewers: hubert.reinterpretcast, nemanjai, power-llvm-team.
Herald added a subscriber: shchenz.
lei requested review of this revision.
Herald added a project: clang.

Update clang to treat vector unsigned long long and friends as invalid
for AlttiVec without VSX.

Reported in: https://bugs.llvm.org/show_bug.cgi?id=47782


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109178

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Headers/altivec.h
  clang/lib/Sema/DeclSpec.cpp
  clang/test/CodeGen/builtins-ppc-int128.c
  clang/test/CodeGen/builtins-ppc-vsx.c
  clang/test/Parser/altivec-bool-128.c
  clang/test/Parser/altivec.c
  clang/test/Parser/cxx-altivec-bool-128.cpp
  clang/test/Parser/cxx-altivec.cpp
  clang/test/Sema/altivec-generic-overload.c
  clang/test/Sema/builtins-ppc.c

Index: clang/test/Sema/builtins-ppc.c
===
--- clang/test/Sema/builtins-ppc.c
+++ clang/test/Sema/builtins-ppc.c
@@ -6,6 +6,9 @@
 // RUN: %clang_cc1 -target-feature +altivec -target-feature +crypto\
 // RUN: -triple powerpc64le-unknown-unknown -DTEST_CRYPTO -fsyntax-only  \
 // RUN: -verify %s
+// RUN: %clang_cc1 -target-feature +altivec -target-feature +crypto \
+// RUN: -triple powerpc64le-unknown-unknown -DTEST_CRYPTO -fsyntax-only \
+// RUN: -target-feature +vsx -verify %s
 
 #ifdef TEST_HTM
 void test_htm() {
@@ -37,6 +40,7 @@
   return __builtin_crypto_vshasigmaw(a, 1, 15);
 }
 
+#ifdef __VSX__
 vector unsigned long long test_vshasigmad_or(void)
 {
   vector unsigned long long a = D_INIT
@@ -46,6 +50,7 @@
   vector unsigned long long e = __builtin_crypto_vshasigmad(a, 1, -15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
   return __builtin_crypto_vshasigmad(a, 0, 15);
 }
+#endif
 
 #endif
 
Index: clang/test/Sema/altivec-generic-overload.c
===
--- clang/test/Sema/altivec-generic-overload.c
+++ clang/test/Sema/altivec-generic-overload.c
@@ -1,4 +1,8 @@
-// RUN: %clang_cc1 %s -triple=powerpc64le-unknown-linux -target-feature +altivec -target-feature +vsx -verify -verify-ignore-unexpected=note -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -triple=powerpc64le-unknown-linux -target-feature +altivec \
+// RUN:  -target-feature +vsx -verify -verify-ignore-unexpected=note -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -triple=powerpc64le-unknown-linux -target-feature +altivec \
+// RUN:  -target-feature +vsx -verify -verify-ignore-unexpected=note -pedantic -fsyntax-only \
+// RUN:  -target-cpu pwr8
 
 typedef signed char __v16sc __attribute__((__vector_size__(16)));
 typedef unsigned char __v16uc __attribute__((__vector_size__(16)));
@@ -20,9 +24,6 @@
 __v4si *__attribute__((__overloadable__)) convert1(vector signed int);
 __v4ui *__attribute__((__overloadable__)) convert1(vector unsigned int);
 __v2sll *__attribute__((__overloadable__)) convert1(vector signed long long);
-__v2ull *__attribute__((__overloadable__)) convert1(vector unsigned long long);
-__v1slll *__attribute__((__overloadable__)) convert1(vector signed __int128);
-__v1ulll *__attribute__((__overloadable__)) convert1(vector unsigned __int128);
 __v4f *__attribute__((__overloadable__)) convert1(vector float);
 __v2d *__attribute__((__overloadable__)) convert1(vector double);
 void __attribute__((__overloadable__)) convert1(vector bool int);
@@ -36,11 +37,17 @@
 vector unsigned int *__attribute__((__overloadable__)) convert2(__v4ui);
 vector signed long long *__attribute__((__overloadable__)) convert2(__v2sll);
 vector unsigned long long *__attribute__((__overloadable__)) convert2(__v2ull);
-vector signed __int128 *__attribute__((__overloadable__)) convert2(__v1slll);
-vector unsigned __int128 *__attribute__((__overloadable__)) convert2(__v1ulll);
 vector float *__attribute__((__overloadable__)) convert2(__v4f);
 vector double *__attribute__((__overloadable__)) convert2(__v2d);
 
+#ifdef __POWER8_VECTOR__
+__v1slll *__attribute__((__overloadable__)) convert1(vector signed __int128);
+__v1ulll *__attribute__((__overloadable__)) convert1(vector unsigned __int128);
+__v2ull *__attribute__((__overloadable__)) convert1(vector unsigned long long);
+vector signed __int128 *__attribute__((__overloadable__)) convert2(__v1slll);
+vector unsigned __int128 *__attribute__((__overloadable__)) convert2(__v1ulll);
+#endif
+
 void test() {
   __v16sc gv1;
   __v16uc gv2;
@@ -49,11 +56,14 @@
   __v4si gv5;
   __v4ui gv6;
   __v2sll gv7;
+  __v4f gv11;
+  __v2d gv12;
+
+#ifdef __POWER8_VECTOR__
   __v2ull gv8;
   __v1slll gv9;
   __v1ulll gv10;
-  __v4f gv11;
-  __v2d gv12;
+#endif
 
   vector signed char av1;
   vector unsigned char av2;
@@ -63,8 +73,10 @@
   vector unsigned int av6;
   vector signed long long av7;
   vector unsigned long long av8;
+#ifdef __POWER8_VECTOR__
   vector signed __int128 av9;
   vector unsigned __int128 

[PATCH] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In D109175#2980333 , @weiwang wrote:

> Our internal codebase never uses the target directive. Once the deferred 
> diags is bypassed, we observed 18% e2e build time improvement.

Is that with `-fopenmp` or without?
That seems, kinda a lot more than i would have expected,
perhaps there are some other ways to reduce the overhead other than this 
approach?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109175

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


[PATCH] D109139: [AIX][RFC] Undefine __STDC_NO_ATOMICS__ to enable c11 atomics functionality

2021-09-02 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

Hmm, I'm not sure that the limitations you outline in the description are the 
only problems that cause us to define the macro in the first place (though the 
lack of libc implementation was part of it). I'll try to dig up the original 
issues.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109139

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


[PATCH] D107547: [CodeGen] More bits for calling convention

2021-09-02 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D107547

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


[PATCH] D91944: OpenMP 5.0 metadirective

2021-09-02 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen added a comment.

I'm guessing the tests were not pass on buildbot but passed on the author's 
side is due to the assertion was disabled on the author's side.
Here is the patch for avoiding all the assertion errors and I'm able to get all 
the metadirective tests passed (and no regression for the existing omp tests) 
with this change:

  diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
  index 5ac6dd0fb55a..3313efe524f3 100644
  --- a/clang/lib/Parse/ParseOpenMP.cpp
  +++ b/clang/lib/Parse/ParseOpenMP.cpp
  @@ -2277,8 +2277,10 @@ Parser::DeclGroupPtrTy 
Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
   ///
   StmtResult
   Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext 
StmtCtx) {
  -  assert(Tok.is(tok::annot_pragma_openmp) && "Not an OpenMP directive!");
 static bool ReadDirectiveWithinMetadirective = false;
  +  if (!ReadDirectiveWithinMetadirective)
  +assert(Tok.isOneOf(tok::annot_pragma_openmp, tok::annot_attr_openmp) &&
  +   "Not an OpenMP directive!");
 ParsingOpenMPDirectiveRAII DirScope(*this);
 ParenBraceBracketBalancer BalancerRAIIObj(*this);
 SmallVector Clauses;
  @@ -2288,7 +2290,7 @@ 
Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext StmtCtx) {
 unsigned ScopeFlags = Scope::FnScope | Scope::DeclScope |
   Scope::CompoundStmtScope | 
Scope::OpenMPDirectiveScope;
 if (!ReadDirectiveWithinMetadirective)
  -  ConsumeAnnotationToken();
  +ConsumeAnnotationToken();
 SourceLocation Loc = Tok.getLocation(), EndLoc;
 OpenMPDirectiveKind DKind = parseOpenMPDirectiveKind(*this);
 if (ReadDirectiveWithinMetadirective && DKind == OMPD_unknown) {
  @@ -2331,6 +2333,7 @@ 
Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext StmtCtx) {
   parseOMPContextSelectors(Loc, TI);
   if (TI.Sets.size() == 0) {
 Diag(Tok, diag::err_omp_expected_context_selector) << "when 
clause";
  +  TPA.Commit();
 return Directive;
   }
  
  @@ -2339,6 +2342,7 @@ 
Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext StmtCtx) {
 ConsumeAnyToken();
   else {
 Diag(Tok, diag::err_omp_expected_colon) << "when clause";
  +  TPA.Commit();
 return Directive;
   }
 }
  @@ -2352,6 +2356,8 @@ 
Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext StmtCtx) {
   if (Tok.is(tok::annot_pragma_openmp_end)) {
 Diag(Tok, diag::err_omp_expected_punc)
 << getOpenMPClauseName(CKind) << 0;
  +  T.skipToEnd();
  +  TPA.Commit();
 return Directive;
   }
   ConsumeAnyToken();
  @@ -2627,7 +2633,7 @@ 
Parser::ParseOpenMPDeclarativeOrExecutableDirective(ParsedStmtContext StmtCtx) {
 // ends with a ')'.
 if (ReadDirectiveWithinMetadirective && Tok.is(tok::r_paren)) {
   while (Tok.isNot(tok::annot_pragma_openmp_end))
  -  ConsumeToken();
  +  ConsumeAnyToken();
   break;
 }
 bool HasImplicitClause = false;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91944

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


[PATCH] D108976: [clang][tooling] Accept custom diagnostic options in ToolInvocation

2021-09-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.

In D108976#2979598 , @jansvoboda11 
wrote:

> Tests that cover this functionality were moved into a follow-up patch D108974 
> . The reason is to avoid temporary 
> regression pointed out here .

Please document in the commit message that tests are coming later and why. With 
that, LGTM too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108976

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


[PATCH] D108974: [clang][tooling] Properly initialize DiagnosticsEngine for cc1 command-line construction

2021-09-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108974

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


[PATCH] D108982: [clang][deps] Use correct DiagnosticOptions for command-line handling

2021-09-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

LGTM too, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108982

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


[PATCH] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Wei Wang via Phabricator via cfe-commits
weiwang added a comment.

Our internal codebase never uses the target directive. Once the deferred diags 
is bypassed, we observed 18% e2e build time improvement.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109175

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


[PATCH] D36850: [ThinLTO] Add norecurse function attribute propagation

2021-09-02 Thread Di Mo via Phabricator via cfe-commits
modimo added a comment.

gentle ping @tejohnson


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] D109175: [openmp] Add clang cc1 option -fopenmp-skip-deferred-diags

2021-09-02 Thread Wei Wang via Phabricator via cfe-commits
weiwang created this revision.
Herald added subscribers: hoy, dexonsmith, wenlei, dang, guansong, yaxunl.
weiwang requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

There are cases where no target compilation/offloading would ever happen, but
we are still paying the price for handling deferred diags. The new cc1 option
allows user to explictly skip deferred diags handling in FE.

This results in considerable build time improvement from our internal
workloads.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109175

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/OpenMP/declare_target_messages.cpp


Index: clang/test/OpenMP/declare_target_messages.cpp
===
--- clang/test/OpenMP/declare_target_messages.cpp
+++ clang/test/OpenMP/declare_target_messages.cpp
@@ -6,6 +6,9 @@
 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 
-verify=expected,omp5,host5 -fopenmp-simd -fopenmp-is-device -fnoopenmp-use-tls 
-ferror-limit 100 -o - %s
 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp45 
-fopenmp-version=45 -fopenmp-simd -fnoopenmp-use-tls -ferror-limit 100 -o - %s
 
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp5,dev5 
-fopenmp -fopenmp-is-device -fopenmp-targets=x86_64-apple-macos10.7.0 
-aux-triple x86_64-apple-macos10.7.0 -fnoopenmp-use-tls 
-fopenmp-skip-deferred-diags -ferror-limit 100 -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 
-verify=expected,omp5,host5 -fopenmp-simd -fopenmp-is-device -fnoopenmp-use-tls 
-fopenmp-skip-deferred-diags -ferror-limit 100 -o - %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify=expected,omp5 
-fopenmp -fnoopenmp-use-tls -fopenmp-skip-deferred-diags -ferror-limit 100 -o - 
%s
 #pragma omp end declare target // expected-error {{unexpected OpenMP directive 
'#pragma omp end declare target'}}
 
 int a, b, z; // omp5-error {{variable captured in declare target region must 
appear in a to clause}}
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -12609,7 +12609,8 @@
 VDecl->setInitStyle(VarDecl::ListInit);
   }
 
-  if (LangOpts.OpenMP && VDecl->isFileVarDecl())
+  if (LangOpts.OpenMP && !LangOpts.OpenMPSkipDeferredDiags &&
+  VDecl->isFileVarDecl())
 DeclsToCheckForDeferredDiags.insert(VDecl);
   CheckCompleteVariableDeclaration(VDecl);
 }
@@ -14839,7 +14840,8 @@
 DiscardCleanupsInEvaluationContext();
   }
 
-  if (FD && (LangOpts.OpenMP || LangOpts.CUDA || LangOpts.SYCLIsDevice)) {
+  if (FD && ((LangOpts.OpenMP && !LangOpts.OpenMPSkipDeferredDiags) ||
+ LangOpts.CUDA || LangOpts.SYCLIsDevice)) {
 auto ES = getEmissionStatus(FD);
 if (ES == Sema::FunctionEmissionStatus::Emitted ||
 ES == Sema::FunctionEmissionStatus::Unknown)
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3489,6 +3489,9 @@
   if (Opts.OpenMPCUDAForceFullRuntime)
 GenerateArg(Args, OPT_fopenmp_cuda_force_full_runtime, SA);
 
+  if (Opts.OpenMPSkipDeferredDiags)
+GenerateArg(Args, OPT_fopenmp_skip_deferred_diags, SA);
+
   // The arguments used to set Optimize, OptimizeSize and NoInlineDefine are
   // generated from CodeGenOptions.
 
@@ -3928,6 +3931,10 @@
   Opts.OpenMPIsDevice && (T.isNVPTX() || T.isAMDGCN()) &&
   Args.hasArg(options::OPT_fopenmp_cuda_force_full_runtime);
 
+  Opts.OpenMPSkipDeferredDiags =
+  Opts.OpenMP && !Opts.OpenMPSimd && !IsTargetSpecified &&
+  Args.hasArg(options::OPT_fopenmp_skip_deferred_diags);
+
   // FIXME: Eliminate this dependency.
   unsigned Opt = getOptimizationLevel(Args, IK, Diags),
OptSize = getOptimizationLevelSize(Args);
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5799,6 +5799,8 @@
   HelpText<"Generate code only for an OpenMP target device.">;
 def fopenmp_host_ir_file_path : Separate<["-"], "fopenmp-host-ir-file-path">,
   HelpText<"Path to the IR file produced by the frontend for the host.">;
+def fopenmp_skip_deferred_diags : Flag<["-"], "fopenmp-skip-deferred-diags">,
+  HelpText<"Do not generate deferred diagnostics for function host/device 
availability. Use this flag only when no offloading or omp target directive is 
used.">;
 
 
//===--===//
 // SYCL Options
Index: 

[PATCH] D108917: [AIX][PowerPC] Define __powerpc and __PPC macros

2021-09-02 Thread Jake Egan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG37f23ea97fde: [AIX][PowerPC] Define __powerpc and __PPC 
macros (authored by Jake-Egan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108917

Files:
  clang/lib/Basic/Targets/PPC.cpp
  clang/test/Preprocessor/init-ppc.c


Index: clang/test/Preprocessor/init-ppc.c
===
--- clang/test/Preprocessor/init-ppc.c
+++ clang/test/Preprocessor/init-ppc.c
@@ -322,6 +322,7 @@
 // PPC:#define __NATURAL_ALIGNMENT__ 1
 // PPC:#define __POINTER_WIDTH__ 32
 // PPC:#define __POWERPC__ 1
+// PPC-NOT:#define __PPC 1
 // PPC:#define __PPC__ 1
 // PPC:#define __PTRDIFF_TYPE__ long int
 // PPC:#define __PTRDIFF_WIDTH__ 32
@@ -386,6 +387,7 @@
 // PPC:#define __WCHAR_WIDTH__ 32
 // PPC:#define __WINT_TYPE__ int
 // PPC:#define __WINT_WIDTH__ 32
+// PPC-NOT:#define __powerpc 1
 // PPC:#define __ppc__ 1
 
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 
-fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix 
PPC-AIX %s
@@ -520,6 +522,7 @@
 // PPC-AIX-NOT:#define __NATURAL_ALIGNMENT__ 1
 // PPC-AIX:#define __POINTER_WIDTH__ 32
 // PPC-AIX:#define __POWERPC__ 1
+// PPC-AIX:#define __PPC 1
 // PPC-AIX:#define __PPC__ 1
 // PPC-AIX:#define __PTRDIFF_TYPE__ long int
 // PPC-AIX:#define __PTRDIFF_WIDTH__ 32
@@ -587,6 +590,7 @@
 // PPC-AIX:#define __WCHAR_WIDTH__ 16
 // PPC-AIX:#define __WINT_TYPE__ int
 // PPC-AIX:#define __WINT_WIDTH__ 32
+// PPC-AIX:#define __powerpc 1
 // PPC-AIX:#define __powerpc__ 1
 // PPC-AIX:#define __ppc__ 1
 
Index: clang/lib/Basic/Targets/PPC.cpp
===
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -264,6 +264,9 @@
   }
   if (getTriple().isOSAIX()) {
 Builder.defineMacro("__THW_PPC__");
+// Define __PPC and __powerpc for AIX XL C/C++ compatibility
+Builder.defineMacro("__PPC");
+Builder.defineMacro("__powerpc");
   }
 
   // Target properties.


Index: clang/test/Preprocessor/init-ppc.c
===
--- clang/test/Preprocessor/init-ppc.c
+++ clang/test/Preprocessor/init-ppc.c
@@ -322,6 +322,7 @@
 // PPC:#define __NATURAL_ALIGNMENT__ 1
 // PPC:#define __POINTER_WIDTH__ 32
 // PPC:#define __POWERPC__ 1
+// PPC-NOT:#define __PPC 1
 // PPC:#define __PPC__ 1
 // PPC:#define __PTRDIFF_TYPE__ long int
 // PPC:#define __PTRDIFF_WIDTH__ 32
@@ -386,6 +387,7 @@
 // PPC:#define __WCHAR_WIDTH__ 32
 // PPC:#define __WINT_TYPE__ int
 // PPC:#define __WINT_WIDTH__ 32
+// PPC-NOT:#define __powerpc 1
 // PPC:#define __ppc__ 1
 
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX %s
@@ -520,6 +522,7 @@
 // PPC-AIX-NOT:#define __NATURAL_ALIGNMENT__ 1
 // PPC-AIX:#define __POINTER_WIDTH__ 32
 // PPC-AIX:#define __POWERPC__ 1
+// PPC-AIX:#define __PPC 1
 // PPC-AIX:#define __PPC__ 1
 // PPC-AIX:#define __PTRDIFF_TYPE__ long int
 // PPC-AIX:#define __PTRDIFF_WIDTH__ 32
@@ -587,6 +590,7 @@
 // PPC-AIX:#define __WCHAR_WIDTH__ 16
 // PPC-AIX:#define __WINT_TYPE__ int
 // PPC-AIX:#define __WINT_WIDTH__ 32
+// PPC-AIX:#define __powerpc 1
 // PPC-AIX:#define __powerpc__ 1
 // PPC-AIX:#define __ppc__ 1
 
Index: clang/lib/Basic/Targets/PPC.cpp
===
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -264,6 +264,9 @@
   }
   if (getTriple().isOSAIX()) {
 Builder.defineMacro("__THW_PPC__");
+// Define __PPC and __powerpc for AIX XL C/C++ compatibility
+Builder.defineMacro("__PPC");
+Builder.defineMacro("__powerpc");
   }
 
   // Target properties.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 37f23ea - [AIX][PowerPC] Define __powerpc and __PPC macros

2021-09-02 Thread Jake Egan via cfe-commits

Author: Jake Egan
Date: 2021-09-02T13:32:35-04:00
New Revision: 37f23ea97fdef4484ef33877c6d8464beafd3b0f

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

LOG: [AIX][PowerPC] Define __powerpc and __PPC macros

%%%
This patch defines the macros __powerpc and __PPC on AIX to be consistent with 
XL for AIX. See: 
https://www.ibm.com/docs/en/xl-c-and-cpp-aix/13.1.0?topic=macros-related-platform

Note: GCC does not currently define __powerpc and __PPC so users should prefer 
the __powerpc__ and __PPC__ forms.
%%%

Reviewed By: cebowleratibm

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

Added: 


Modified: 
clang/lib/Basic/Targets/PPC.cpp
clang/test/Preprocessor/init-ppc.c

Removed: 




diff  --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp
index c8afb71e7dfd1..8f16f3d9b475c 100644
--- a/clang/lib/Basic/Targets/PPC.cpp
+++ b/clang/lib/Basic/Targets/PPC.cpp
@@ -264,6 +264,9 @@ void PPCTargetInfo::getTargetDefines(const LangOptions 
,
   }
   if (getTriple().isOSAIX()) {
 Builder.defineMacro("__THW_PPC__");
+// Define __PPC and __powerpc for AIX XL C/C++ compatibility
+Builder.defineMacro("__PPC");
+Builder.defineMacro("__powerpc");
   }
 
   // Target properties.

diff  --git a/clang/test/Preprocessor/init-ppc.c 
b/clang/test/Preprocessor/init-ppc.c
index 4f1c33b1dcc3a..611b16dfb8f7e 100644
--- a/clang/test/Preprocessor/init-ppc.c
+++ b/clang/test/Preprocessor/init-ppc.c
@@ -322,6 +322,7 @@
 // PPC:#define __NATURAL_ALIGNMENT__ 1
 // PPC:#define __POINTER_WIDTH__ 32
 // PPC:#define __POWERPC__ 1
+// PPC-NOT:#define __PPC 1
 // PPC:#define __PPC__ 1
 // PPC:#define __PTRDIFF_TYPE__ long int
 // PPC:#define __PTRDIFF_WIDTH__ 32
@@ -386,6 +387,7 @@
 // PPC:#define __WCHAR_WIDTH__ 32
 // PPC:#define __WINT_TYPE__ int
 // PPC:#define __WINT_WIDTH__ 32
+// PPC-NOT:#define __powerpc 1
 // PPC:#define __ppc__ 1
 
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 
-fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix 
PPC-AIX %s
@@ -520,6 +522,7 @@
 // PPC-AIX-NOT:#define __NATURAL_ALIGNMENT__ 1
 // PPC-AIX:#define __POINTER_WIDTH__ 32
 // PPC-AIX:#define __POWERPC__ 1
+// PPC-AIX:#define __PPC 1
 // PPC-AIX:#define __PPC__ 1
 // PPC-AIX:#define __PTRDIFF_TYPE__ long int
 // PPC-AIX:#define __PTRDIFF_WIDTH__ 32
@@ -587,6 +590,7 @@
 // PPC-AIX:#define __WCHAR_WIDTH__ 16
 // PPC-AIX:#define __WINT_TYPE__ int
 // PPC-AIX:#define __WINT_WIDTH__ 32
+// PPC-AIX:#define __powerpc 1
 // PPC-AIX:#define __powerpc__ 1
 // PPC-AIX:#define __ppc__ 1
 



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


[PATCH] D109174: [MSP430][Clang] Infer CPU type from -mcpu= or -mmcu=

2021-09-02 Thread Jozef Lawrynowicz via Phabricator via cfe-commits
jozefl created this revision.
jozefl added reviewers: asl, atrosinenko.
Herald added a subscriber: hiraditya.
jozefl requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

clang::driver::tools::getCPUName can now infer the CPU being used by
examining either the MCU specified with the -mmcu= option, or the CPU
directly specified with -mcpu=.

This means Clang will now pass the correct "-target-cpu" to downstream
tools, enabling CPU-specific features in LLVM.

The MSP430X CPU can now be selected, in addition to the "generic" MSP430
CPU.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109174

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Basic/Targets/MSP430.cpp
  clang/lib/Basic/Targets/MSP430.h
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/MSP430.cpp
  clang/lib/Driver/ToolChains/MSP430.h
  clang/test/Driver/msp430-cpu.c
  clang/test/Driver/msp430-mmcu.c
  clang/test/Driver/msp430-toolchain.c
  clang/test/Misc/target-invalid-cpu-note.c
  clang/test/Preprocessor/msp430-defs.c
  llvm/lib/Target/MSP430/MSP430.td
  llvm/lib/Target/MSP430/MSP430Subtarget.cpp
  llvm/lib/Target/MSP430/MSP430Subtarget.h
  llvm/test/CodeGen/MSP430/build-attrs.ll

Index: llvm/test/CodeGen/MSP430/build-attrs.ll
===
--- llvm/test/CodeGen/MSP430/build-attrs.ll
+++ llvm/test/CodeGen/MSP430/build-attrs.ll
@@ -8,6 +8,8 @@
 ; RUN:   | llvm-readelf -A - | FileCheck %s --check-prefixes COMMON,MSP430,SMALL
 ; RUN: llc -mtriple=msp430 -mcpu=msp430x -filetype=obj < %s \
 ; RUN:   | llvm-readelf -A - | FileCheck %s --check-prefixes COMMON,MSP430X,SMALL
+; RUN: llc -mtriple=msp430 -mcpu=msp430xv2 -filetype=obj < %s \
+; RUN:   | llvm-readelf -A - | FileCheck %s --check-prefixes COMMON,MSP430X,SMALL
 
 ; COMMON: BuildAttributes {
 ; COMMON: FormatVersion: 0x41
Index: llvm/lib/Target/MSP430/MSP430Subtarget.h
===
--- llvm/lib/Target/MSP430/MSP430Subtarget.h
+++ llvm/lib/Target/MSP430/MSP430Subtarget.h
@@ -36,7 +36,7 @@
 
 private:
   virtual void anchor();
-  bool ExtendedInsts = false;
+  bool MSP430X = false;
   HWMultEnum HWMultMode = NoHWMult;
   MSP430FrameLowering FrameLowering;
   MSP430InstrInfo InstrInfo;
@@ -60,6 +60,8 @@
   bool hasHWMult32() const { return HWMultMode == HWMult32; }
   bool hasHWMultF5() const { return HWMultMode == HWMultF5; }
 
+  bool hasMSP430X() const { return MSP430X; }
+
   const TargetFrameLowering *getFrameLowering() const override {
 return 
   }
Index: llvm/lib/Target/MSP430/MSP430Subtarget.cpp
===
--- llvm/lib/Target/MSP430/MSP430Subtarget.cpp
+++ llvm/lib/Target/MSP430/MSP430Subtarget.cpp
@@ -40,9 +40,6 @@
 
 MSP430Subtarget &
 MSP430Subtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
-  ExtendedInsts = false;
-  HWMultMode = NoHWMult;
-
   StringRef CPUName = CPU;
   if (CPUName.empty())
 CPUName = "msp430";
Index: llvm/lib/Target/MSP430/MSP430.td
===
--- llvm/lib/Target/MSP430/MSP430.td
+++ llvm/lib/Target/MSP430/MSP430.td
@@ -18,8 +18,8 @@
 // Subtarget Features. 
 //===--===//
 def FeatureX
- : SubtargetFeature<"ext", "ExtendedInsts", "true",
-"Enable MSP430-X extensions">;
+ : SubtargetFeature<"msp430x", "MSP430X", "true",
+"Enable MSP430X extensions">;
 
 def FeatureHWMult16
  : SubtargetFeature<"hwmult16", "HWMultMode", "HWMult16",
@@ -42,6 +42,7 @@
 def : Proc<"generic", []>;
 def : Proc<"msp430",  []>;
 def : Proc<"msp430x", [FeatureX]>;
+def : Proc<"msp430xv2",   [FeatureX]>;
 
 //===--===//
 // Register File Description
Index: clang/test/Preprocessor/msp430-defs.c
===
--- /dev/null
+++ clang/test/Preprocessor/msp430-defs.c
@@ -0,0 +1,20 @@
+// Check the correct macros are defined for each CPU.
+
+// RUN: %clang -target msp430 -x c -E -dM %s -o - | FileCheck  %s
+// RUN: %clang -target msp430 -mcpu=generic -x c -E -dM %s -o - | FileCheck %s
+// RUN: %clang -target msp430 -mcpu=msp430 -x c -E -dM %s -o - | FileCheck %s
+
+// CHECK: MSP430
+// CHECK: __ELF__
+// CHECK-NOT: __MSP430X__
+// CHECK: __MSP430__
+
+// RUN: %clang -target msp430 -mcpu=msp430x -x c -E -dM %s -o - \
+// RUN:   | FileCheck --check-prefix=MSP430X %s
+// RUN: %clang -target msp430 -mcpu=msp430xv2 -x c -E -dM %s -o - \
+// RUN:   | FileCheck --check-prefix=MSP430X %s
+
+// MSP430X: MSP430
+// MSP430X: __ELF__
+// MSP430X: __MSP430X__
+// MSP430X: __MSP430__
Index: clang/test/Misc/target-invalid-cpu-note.c

[libunwind] 1bc175d - [Unwind] Cast exception class pointer for strcpy

2021-09-02 Thread Hans Wennborg via cfe-commits

Author: Hans Wennborg
Date: 2021-09-02T19:01:30+02:00
New Revision: 1bc175d486b5bf2ae5dd46c1e85342f2f2734b1f

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

LOG: [Unwind] Cast exception class pointer for strcpy

Follow-up to f5b997e6b706, see comment on
https://reviews.llvm.org/D109047

Differential revision: https://reviews.llvm.org/D109168

Added: 


Modified: 
libunwind/src/UnwindLevel1-gcc-ext.c

Removed: 




diff  --git a/libunwind/src/UnwindLevel1-gcc-ext.c 
b/libunwind/src/UnwindLevel1-gcc-ext.c
index c3fa8b6655713..4172540ef0874 100644
--- a/libunwind/src/UnwindLevel1-gcc-ext.c
+++ b/libunwind/src/UnwindLevel1-gcc-ext.c
@@ -109,7 +109,7 @@ _Unwind_Backtrace(_Unwind_Trace_Fn callback, void *ref) {
   // Create a mock exception object for force unwinding.
   _Unwind_Exception ex;
   memset(, '\0', sizeof(ex));
-  strcpy(_class, "CLNGUNW");
+  strcpy((char *)_class, "CLNGUNW");
 #endif
 
   // walk each frame



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


[PATCH] D109078: [clang][driver][AIX] Add system libc++ header paths to driver

2021-09-02 Thread Zarko Todorovski via Phabricator via cfe-commits
ZarkoCA added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:237
+addSystemInclude(DriverArgs, CC1Args, PathCPP.str());
+CC1Args.push_back("-D__LIBC_NO_CPP_MATH_OVERLOADS__");
+return;

Maybe a comment as to why we need this, something like:
```
// Required  order to suppress conflicting C++ overloads in the system libc 
headers that were used by XL C++
```



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:240-242
+  case ToolChain::CST_Libstdcxx:
+llvm::report_fatal_error(
+"picking up libstdc++ headers is unimplemented on AIX");

nit: it would be my preference to have the error case first but I also that 
`AIX::AddCXXStdlibLibArgs` is set up the same way so keeping them consistent 
may be more important.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109078

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


[PATCH] D108560: [clang-tidy] Add support for NOLINTBEGIN ... NOLINTEND comments to suppress clang-tidy warnings over multiple lines

2021-09-02 Thread Salman Javed via Phabricator via cfe-commits
salman-javed-nz updated this revision to Diff 370293.
salman-javed-nz added a comment.

Add additional checks in `test/clang-tidy/infrastructure/nolintbeginend.cpp` to 
check that error suppressions in one file are carried over when the file is 
`#included` in another file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108560

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  
clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/error_in_include.inc
  
clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/nolint_in_include.inc
  clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp

Index: clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp
@@ -0,0 +1,82 @@
+// RUN: %check_clang_tidy %s google-explicit-constructor %t -- --header-filter=.* -system-headers -- -isystem %S/Inputs/nolintbeginend
+
+class A { A(int i); };
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit
+
+// NOLINTBEGIN
+class B { B(int i); };
+// NOLINTEND
+
+// NOLINTBEGIN
+// NOLINTEND
+// NOLINTBEGIN
+class B1 { B1(int i); };
+// NOLINTEND
+
+// NOLINTBEGIN
+// NOLINTEND
+class B2 { B2(int i); };
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must be marked explicit
+
+// NOLINTBEGIN(google-explicit-constructor)
+class C { C(int i); };
+// NOLINTEND(google-explicit-constructor)
+
+// NOLINTBEGIN(*)
+class C1 { C1(int i); };
+// NOLINTEND(*)
+
+// NOLINTBEGIN(some-other-check)
+class C2 { C2(int i); };
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must be marked explicit
+// NOLINTEND(some-other-check)
+
+// NOLINTBEGIN(some-other-check, google-explicit-constructor)
+class C3 { C3(int i); };
+// NOLINTEND(some-other-check, google-explicit-constructor)
+
+// NOLINTBEGIN(some-other-check, google-explicit-constructor)
+// NOLINTEND(some-other-check)
+class C4 { C4(int i); };
+// NOLINTEND(google-explicit-constructor)
+
+// NOLINTBEGIN(some-other-check, google-explicit-constructor)
+// NOLINTEND(google-explicit-constructor)
+class C5 { C5(int i); };
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must be marked explicit
+// NOLINTEND(some-other-check)
+
+// NOLINTBEGIN(google-explicit-constructor)
+// NOLINTBEGIN(some-other-check)
+class C6 { C6(int i); };
+// NOLINTEND(some-other-check)
+// NOLINTEND(google-explicit-constructor)
+
+// NOLINTBEGIN(not-closed-bracket-is-treated-as-skip-all
+class C7 { C7(int i); };
+// NOLINTEND(not-closed-bracket-is-treated-as-skip-all
+
+// NOLINTBEGIN without-brackets-skip-all, another-check
+class C8 { C8(int i); };
+// NOLINTEND without-brackets-skip-all, another-check
+
+#define MACRO(X) class X { X(int i); };
+
+MACRO(D1)
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: single-argument constructors must be marked explicit
+
+// NOLINTBEGIN
+MACRO(D2)
+// NOLINTEND
+
+#define MACRO_NOARG class E { E(int i); };
+// NOLINTBEGIN
+MACRO_NOARG
+// NOLINTEND
+
+#include "error_in_include.inc"
+// CHECK-MESSAGES: warning: single-argument constructors must be marked explicit
+
+#include "nolint_in_include.inc"
+
+// CHECK-MESSAGES: Suppressed 12 warnings (12 NOLINT)
Index: clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/nolint_in_include.inc
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/nolint_in_include.inc
@@ -0,0 +1,3 @@
+// NOLINTBEGIN
+class G { G(int i); };
+// NOLINTEND
Index: clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/error_in_include.inc
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/error_in_include.inc
@@ -0,0 +1 @@
+class F { F(int i); };
Index: clang-tools-extra/docs/clang-tidy/index.rst
===
--- clang-tools-extra/docs/clang-tidy/index.rst
+++ clang-tools-extra/docs/clang-tidy/index.rst
@@ -295,17 +295,19 @@
 
 If a specific suppression mechanism is not available for a certain warning, or
 its use is not desired for some reason, :program:`clang-tidy` has a generic
-mechanism to suppress diagnostics using ``NOLINT`` or ``NOLINTNEXTLINE``
-comments.
+mechanism to suppress diagnostics using ``NOLINT``, ``NOLINTNEXTLINE``, and
+``NOLINTBEGIN`` ... ``NOLINTEND`` comments.
 
 The ``NOLINT`` comment instructs :program:`clang-tidy` to ignore warnings on the
 *same line* (it doesn't apply to a function, a block of code or any other
 language 

[clang] e5438f3 - clang/win: Add __readfsdword to intrin.h

2021-09-02 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2021-09-02T12:22:07-04:00
New Revision: e5438f386854136d848989315f53788808afa37a

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

LOG: clang/win: Add __readfsdword to intrin.h

When using __readfsdword(), clang used to warn that one has
to include  -- no matter if that was already included
or not.

Now it only warns if it's not yet included.

To verify that this was the only intrin with this problem, I ran:

$ for f in $(grep intrin.h clang/include/clang/Basic/BuiltinsX86* |
 egrep -o '\([^,]+,' | egrep -o '[^(,]*'); do
if ! grep -q $f clang/lib/Headers/intrin.h; then echo $f; fi;
  done

This printed 9 more functions, but those are all in emmintrin.h,
xsaveintrin.h (which are included by intrin.h based on /arch: flags).
So this is indeed the only built-in that was missing in intrin.h.

Fixes PR51188.

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

Added: 


Modified: 
clang/lib/Headers/intrin.h
clang/test/CodeGen/X86/ms-x86-intrinsics.c

Removed: 




diff  --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h
index 34ec79d6acbc6..4803277472ee8 100644
--- a/clang/lib/Headers/intrin.h
+++ b/clang/lib/Headers/intrin.h
@@ -97,8 +97,9 @@ unsigned long __readcr8(void);
 unsigned int __readdr(unsigned int);
 #ifdef __i386__
 unsigned char __readfsbyte(unsigned long);
-unsigned __int64 __readfsqword(unsigned long);
 unsigned short __readfsword(unsigned long);
+unsigned long __readfsdword(unsigned long);
+unsigned __int64 __readfsqword(unsigned long);
 #endif
 unsigned __int64 __readmsr(unsigned long);
 unsigned __int64 __readpmc(unsigned long);

diff  --git a/clang/test/CodeGen/X86/ms-x86-intrinsics.c 
b/clang/test/CodeGen/X86/ms-x86-intrinsics.c
index 6f745ff00f54e..0eca455bb5c32 100644
--- a/clang/test/CodeGen/X86/ms-x86-intrinsics.c
+++ b/clang/test/CodeGen/X86/ms-x86-intrinsics.c
@@ -1,10 +1,12 @@
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
 // RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-I386
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
 // RUN: -triple x86_64--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64
 
+#include 
+
 #if defined(__i386__)
 char test__readfsbyte(unsigned long Offset) {
   return __readfsbyte(++Offset);



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


[PATCH] D109085: clang/win: Add __readfsdword to intrin.h

2021-09-02 Thread Nico Weber 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 rGe5438f386854: clang/win: Add __readfsdword to intrin.h 
(authored by thakis).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109085

Files:
  clang/lib/Headers/intrin.h
  clang/test/CodeGen/X86/ms-x86-intrinsics.c


Index: clang/test/CodeGen/X86/ms-x86-intrinsics.c
===
--- clang/test/CodeGen/X86/ms-x86-intrinsics.c
+++ clang/test/CodeGen/X86/ms-x86-intrinsics.c
@@ -1,10 +1,12 @@
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
 // RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-I386
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility 
-fms-compatibility-version=17.00 \
 // RUN: -triple x86_64--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64
 
+#include 
+
 #if defined(__i386__)
 char test__readfsbyte(unsigned long Offset) {
   return __readfsbyte(++Offset);
Index: clang/lib/Headers/intrin.h
===
--- clang/lib/Headers/intrin.h
+++ clang/lib/Headers/intrin.h
@@ -97,8 +97,9 @@
 unsigned int __readdr(unsigned int);
 #ifdef __i386__
 unsigned char __readfsbyte(unsigned long);
-unsigned __int64 __readfsqword(unsigned long);
 unsigned short __readfsword(unsigned long);
+unsigned long __readfsdword(unsigned long);
+unsigned __int64 __readfsqword(unsigned long);
 #endif
 unsigned __int64 __readmsr(unsigned long);
 unsigned __int64 __readpmc(unsigned long);


Index: clang/test/CodeGen/X86/ms-x86-intrinsics.c
===
--- clang/test/CodeGen/X86/ms-x86-intrinsics.c
+++ clang/test/CodeGen/X86/ms-x86-intrinsics.c
@@ -1,10 +1,12 @@
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
 // RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-I386
-// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
+// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
 // RUN: -triple x86_64--windows -Oz -emit-llvm %s -o - \
 // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64
 
+#include 
+
 #if defined(__i386__)
 char test__readfsbyte(unsigned long Offset) {
   return __readfsbyte(++Offset);
Index: clang/lib/Headers/intrin.h
===
--- clang/lib/Headers/intrin.h
+++ clang/lib/Headers/intrin.h
@@ -97,8 +97,9 @@
 unsigned int __readdr(unsigned int);
 #ifdef __i386__
 unsigned char __readfsbyte(unsigned long);
-unsigned __int64 __readfsqword(unsigned long);
 unsigned short __readfsword(unsigned long);
+unsigned long __readfsdword(unsigned long);
+unsigned __int64 __readfsqword(unsigned long);
 #endif
 unsigned __int64 __readmsr(unsigned long);
 unsigned __int64 __readpmc(unsigned long);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] e1bb54b - [clangd, llvm] Remove redundant calls to c_str() (NFC)

2021-09-02 Thread Kazu Hirata via cfe-commits

Author: Kazu Hirata
Date: 2021-09-02T09:07:13-07:00
New Revision: e1bb54b5930544b48c3a94069c037648a6adfc65

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

LOG: [clangd, llvm] Remove redundant calls to c_str() (NFC)

Identified with readability-redundant-string-cstr.

Added: 


Modified: 
clang-tools-extra/clangd/PathMapping.cpp
llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp
llvm/tools/bugpoint/OptimizerDriver.cpp
llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
llvm/tools/llvm-lto/llvm-lto.cpp
llvm/tools/llvm-readobj/ELFDumper.cpp

Removed: 




diff  --git a/clang-tools-extra/clangd/PathMapping.cpp 
b/clang-tools-extra/clangd/PathMapping.cpp
index 0cd9d22b998ca..cc98025393841 100644
--- a/clang-tools-extra/clangd/PathMapping.cpp
+++ b/clang-tools-extra/clangd/PathMapping.cpp
@@ -40,7 +40,7 @@ llvm::Optional doPathMapping(llvm::StringRef S,
 llvm::StringRef Body = Uri->body();
 if (Body.consume_front(From) && (Body.empty() || Body.front() == '/')) {
   std::string MappedBody = (To + Body).str();
-  return URI(Uri->scheme(), Uri->authority(), MappedBody.c_str())
+  return URI(Uri->scheme(), Uri->authority(), MappedBody)
   .toString();
 }
   }

diff  --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp 
b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp
index fe335f154703c..1cbd650bdf064 100644
--- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp
+++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXTargetStreamer.cpp
@@ -26,7 +26,7 @@ NVPTXTargetStreamer::~NVPTXTargetStreamer() = default;
 
 void NVPTXTargetStreamer::outputDwarfFileDirectives() {
   for (const std::string  : DwarfFiles)
-getStreamer().emitRawText(S.data());
+getStreamer().emitRawText(S);
   DwarfFiles.clear();
 }
 

diff  --git a/llvm/tools/bugpoint/OptimizerDriver.cpp 
b/llvm/tools/bugpoint/OptimizerDriver.cpp
index ca78735202fcb..848baf90965be 100644
--- a/llvm/tools/bugpoint/OptimizerDriver.cpp
+++ b/llvm/tools/bugpoint/OptimizerDriver.cpp
@@ -223,8 +223,8 @@ bool BugDriver::runPasses(Module ,
   for (std::vector::const_iterator I = pass_args.begin(),
 E = pass_args.end();
I != E; ++I)
-Args.push_back(I->c_str());
-  Args.push_back(Temp->TmpName.c_str());
+Args.push_back(*I);
+  Args.push_back(Temp->TmpName);
   Args.append(ExtraArgs.begin(), ExtraArgs.end());
 
   LLVM_DEBUG(errs() << "\nAbout to run:\t";

diff  --git a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp 
b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
index fbb882e4d2a8f..83c83197118d5 100644
--- a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
+++ b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
@@ -337,7 +337,7 @@ static llvm::Error handleObjectFile(ObjectFile ,
   // Save the GSYM file to disk.
   support::endianness Endian =
   Obj.makeTriple().isLittleEndian() ? support::little : support::big;
-  if (auto Err = Gsym.save(OutFile.c_str(), Endian))
+  if (auto Err = Gsym.save(OutFile, Endian))
 return Err;
 
   // Verify the DWARF if requested. This will ensure all the info in the DWARF
@@ -359,7 +359,7 @@ static llvm::Error handleBuffer(StringRef Filename, 
MemoryBufferRef Buffer,
 Triple ObjTriple(Obj->makeTriple());
 auto ArchName = ObjTriple.getArchName();
 outs() << "Output file (" << ArchName << "): " << OutFile << "\n";
-if (auto Err = handleObjectFile(*Obj, OutFile.c_str()))
+if (auto Err = handleObjectFile(*Obj, OutFile))
   return Err;
   } else if (auto *Fat = dyn_cast(BinOrErr->get())) {
 // Iterate over all contained architectures and filter out any that were

diff  --git a/llvm/tools/llvm-lto/llvm-lto.cpp 
b/llvm/tools/llvm-lto/llvm-lto.cpp
index 183798634a8be..5332ef28d94e7 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -1059,7 +1059,7 @@ int main(int argc, char **argv) {
 CodeGen.addMustPreserveSymbol(KeptDSOSyms[i]);
 
   // Set cpu and attrs strings for the default target/subtarget.
-  CodeGen.setCpu(codegen::getMCPU().c_str());
+  CodeGen.setCpu(codegen::getMCPU());
 
   CodeGen.setOptLevel(OptLevel - '0');
   CodeGen.setAttrs(codegen::getMAttrs());

diff  --git a/llvm/tools/llvm-readobj/ELFDumper.cpp 
b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 1073f22ddd091..273fa8ae9b439 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -4362,7 +4362,7 @@ template  void 
GNUELFDumper::printDynamicTable() {
   for (auto Entry : Table) {
 uintX_t Tag = Entry.getTag();
 std::string Type =
-std::string("(") + this->Obj.getDynamicTagAsString(Tag).c_str() + ")";
+std::string("(") + this->Obj.getDynamicTagAsString(Tag) + ")";
 std::string Value 

[clang] 123f811 - Try to unbreak Win build after 973519826edb76

2021-09-02 Thread Nico Weber via cfe-commits

Author: Nico Weber
Date: 2021-09-02T12:06:53-04:00
New Revision: 123f811fe5b0ba33f271c1c6172e6dff1463717a

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

LOG: Try to unbreak Win build after 973519826edb76

Apparently some versions of the MS STL don't like constructing a
vector from a StringMapKeyIterator<>: http://45.33.8.238/win/44999/step_4.txt
It builds fine with the MS STL on my Windows box, so just sidestep the issue.

Full error for posterity:

VC\Tools\MSVC\14.14.26428\include\xmemory(218,75):
  error: indirection requires pointer operand ('const 
llvm::StringMapKeyIterator' invalid)
  _Uses_default_construct_t<_Alloc, decltype(_Unfancy(_UDest)), 
decltype(*_UFirst)>(;
VC\Tools\MSVC\14.14.26428\include\vector(1922,11):
  note: in instantiation of function template specialization 
'std::_Uninitialized_copy<...>' requested here
return (_Uninitialized_copy(_First, _Last, _Dest, 
this->_Getal()));
VC\Tools\MSVC\14.14.26428\include\vector(757,22):
  note: in instantiation of function template specialization

'std::vector::_Ucopy>'
 requested here
this->_Mylast() = _Ucopy(_First, _Last, 
this->_Myfirst());
VC\Tools\MSVC\14.14.26428\include\vector(772,3):
  note: in instantiation of function template specialization

'std::vector::_Range_construct_or_tidy>'
 requested here
_Range_construct_or_tidy(_Unchecked(_First), 
_Unchecked(_Last), _Iter_cat_t<_Iter>{});
../../clang/lib/Driver/ToolChains/Arch/X86.cpp(62,30):
  note: in instantiation of function template specialization

'std::vector::vector,
 void>' requested here
  std::vector ValidArchs{ArchMap.keys().begin(),

Added: 


Modified: 
clang/lib/Driver/ToolChains/Arch/X86.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp 
b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index bfa008f964e19..2e43c455b28fd 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -59,8 +59,9 @@ std::string x86::getX86TargetCPU(const Driver , const 
ArgList ,
 }
 StringRef CPU = ArchMap.lookup(A->getValue());
 if (CPU.empty()) {
-  std::vector ValidArchs{ArchMap.keys().begin(),
-ArchMap.keys().end()};
+  std::vector ValidArchs;
+  for (StringRef Key : ArchMap.keys())
+ValidArchs.push_back(Key);
   sort(ValidArchs);
   D.Diag(diag::warn_drv_invalid_arch_name_with_suggestion)
   << A->getValue() << (Triple.getArch() == llvm::Triple::x86)



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


[PATCH] D109128: [VFS] Use original path when falling back to external FS

2021-09-02 Thread Varun Gandhi via Phabricator via cfe-commits
varungandhi-apple added a comment.

cc @JDevlieghere


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109128

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


[PATCH] D107430: [OMPIRBuilder] Add ordered directive to OMPIRBuilder

2021-09-02 Thread Kiran Chandramohan via Phabricator via cfe-commits
kiranchandramohan added a comment.

Thanks @peixin. I am going through the patch today and will accept or provide 
some comments.


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

https://reviews.llvm.org/D107430

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


[PATCH] D109127: Use python 3 in add_new_check.py and rename_check.py

2021-09-02 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added a comment.

Hey, thanks for noticing!

Ugh, I think that's not good, I was trying to make sure the `io.open` piece 
really works with Python 2 and Python 3 as this was the purpose fo the patch :( 
I need t check that again, I think it's really unfortunate to lose Python 2 
support if that's the only reason here. Personally, I think moving to Python 3 
completely is a great idea but I would anticipate many buildbots and some older 
distro versions not having it/being reluctant. As of right now, we still have 
the >= 2.7 requirement so I think the best option is to keep both somehow :(

Thanks for bringing it up!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109127

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


[PATCH] D107430: [OMPIRBuilder] Add ordered directive to OMPIRBuilder

2021-09-02 Thread Peixin Qiao via Phabricator via cfe-commits
peixin added a comment.

Here is the PR for codegen of ordered construct for LLVM Flang: 
https://github.com/flang-compiler/f18-llvm-project/pull/1027.
I create the PR on fir-dev branch since the test of lowering parse-tree to MLIR 
for LLVM Flang is still not supported in upstream llvm-project.


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

https://reviews.llvm.org/D107430

___
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-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment.

Now this patch supports only one-dimensional arrays. Previously there were a 
bug when didn't take into account array's dimension.


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] D107430: [OMPIRBuilder] Add ordered directive to OMPIRBuilder

2021-09-02 Thread Peixin Qiao via Phabricator via cfe-commits
peixin added a comment.

@Meinersbur  Thanks a lot for your review and accepting this patch.
BTW, I finished the implementation of the codegen of ordered construct for LLVM 
Flang and the OpenMP IRBuilder of ordered construct in this patch also works 
well for LLVM Flang. Is it OK to land this patch now or does it need more 
review?


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

https://reviews.llvm.org/D107430

___
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-02 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov updated this revision to Diff 370284.
ASDenysPetrov retitled this revision from "[analyzer][AST] Retrieve value by 
direct index from list initialization of constant array declaration." to 
"[analyzer] Retrieve a value from list initialization of constant array 
declaration in a global scope.".
ASDenysPetrov edited the summary of this revision.
ASDenysPetrov added a comment.

Changed the Title. Changed the Summary.


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

https://reviews.llvm.org/D104285

Files:
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp
  clang/test/Analysis/initialization.c
  clang/test/Analysis/initialization.cpp

Index: clang/test/Analysis/initialization.cpp
===
--- clang/test/Analysis/initialization.cpp
+++ clang/test/Analysis/initialization.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++14 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.builtin,debug.ExprInspection -verify %s
+// RUN: %clang_cc1 -std=c++14 -triple i386-apple-darwin10 -analyze -analyzer-config eagerly-assume=false -analyzer-checker=core.uninitialized.Assign,core.builtin,debug.ExprInspection,core.uninitialized.UndefReturn -verify %s
 
 void clang_analyzer_eval(int);
 
@@ -18,3 +18,113 @@
   // FIXME: Should recognize that it is 0.
   clang_analyzer_eval(arr[i][0]); // expected-warning{{UNKNOWN}}
 }
+
+int const glob_arr1[3] = {};
+void glob_array_index1() {
+  clang_analyzer_eval(glob_arr1[0] == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(glob_arr1[1] == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(glob_arr1[2] == 0); // expected-warning{{TRUE}}
+}
+
+void glob_invalid_index1() {
+  const int *ptr = glob_arr1;
+  int idx = -42;
+  auto x = ptr[idx]; // expected-warning{{garbage or undefined}}
+}
+
+int const glob_arr2[4] = {1, 2};
+void glob_ptr_index1() {
+  int const *ptr = glob_arr2;
+  clang_analyzer_eval(ptr[0] == 1); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[1] == 2); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[2] == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[3] == 0); // expected-warning{{TRUE}}
+  clang_analyzer_eval(ptr[4] == 0); // expected-warning{{UNDEFINED}}
+}
+
+void glob_invalid_index2() {
+  const int *ptr = glob_arr2;
+  int idx = 42;
+  auto x = ptr[idx]; // expected-warning{{garbage or undefined}}
+}
+
+const float glob_arr3[] = {
+0., 0.0235, 0.0470, 0.0706, 0.0941, 0.1176};
+float no_warn_garbage_value() {
+  return glob_arr3[0]; // no-warning (garbage or undefined)
+}
+
+// TODO: Support multidimensional array.
+int const glob_arr4[4][2] = {};
+void glob_array_index2() {
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(glob_arr4[1][0] == 0); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(glob_arr4[1][1] == 0); // expected-warning{{UNKNOWN}}
+}
+
+// TODO: Support multidimensional array.
+void glob_invalid_index3() {
+  int idx = -42;
+  // FIXME: Should warn {{garbage or undefined}}.
+  auto x = glob_arr4[1][idx]; // no-warning
+}
+
+// TODO: Support multidimensional array.
+void glob_invalid_index4() {
+  const int *ptr = glob_arr4[1];
+  int idx = -42;
+  // FIXME: Should warn {{garbage or undefined}}.
+  auto x = ptr[idx]; // no-warning
+}
+
+// TODO: Support multidimensional array.
+int const glob_arr5[4][2] = {{1}, 3, 4, 5};
+void glob_array_index3() {
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(glob_arr5[0][0] == 1); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(glob_arr5[0][1] == 0); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(glob_arr5[1][0] == 3); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(glob_arr5[1][1] == 4); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(glob_arr5[2][0] == 5); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(glob_arr5[2][1] == 0); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(glob_arr5[3][0] == 0); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(glob_arr5[3][1] == 0); // expected-warning{{UNKNOWN}}
+}
+
+// TODO: Support multidimensional array.
+void glob_ptr_index2() {
+  int const *ptr = glob_arr5[1];
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(ptr[0] == 3); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be TRUE.
+  clang_analyzer_eval(ptr[1] == 4); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be UNDEFINED.
+  clang_analyzer_eval(ptr[2] == 5); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be UNDEFINED.
+  clang_analyzer_eval(ptr[3] == 0); // expected-warning{{UNKNOWN}}
+  // FIXME: Should be UNDEFINED.
+  clang_analyzer_eval(ptr[4] == 0); // expected-warning{{UNKNOWN}}
+}
+
+// TODO: Support multidimensional array.
+void glob_invalid_index5() {
+  int idx = -42;
+  // 

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

2021-09-02 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai updated this revision to Diff 370285.
HsiangKai added a comment.

Update.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105092

Files:
  llvm/include/llvm/IR/IntrinsicsRISCV.td
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
  llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
  llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
  llvm/test/CodeGen/RISCV/rvv/common-shuffle-patterns.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-buildvec.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-shuffles.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll
  llvm/test/CodeGen/RISCV/rvv/interleave-crash.ll
  llvm/test/CodeGen/RISCV/rvv/mgather-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/tail-agnostic-impdef-copy.mir
  llvm/test/CodeGen/RISCV/rvv/vaadd-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vaadd-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vaaddu-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vaaddu-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vadd-policy.ll
  llvm/test/CodeGen/RISCV/rvv/vadd-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vadd-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vand-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vand-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vasub-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vasub-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vasubu-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vasubu-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vdiv-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vdiv-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vdivu-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vdivu-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfadd-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfadd-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-x-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-x-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-xu-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-xu-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-rtz-x-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-rtz-x-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-rtz-xu-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-rtz-xu-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-x-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-x-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-xu-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-xu-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfdiv-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfdiv-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfmax-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfmax-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfmin-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfmin-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfmul-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfmul-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-x-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-x-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-xu-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-xu-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rod-f-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rod-f-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rtz-x-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rtz-x-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rtz-xu-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-rtz-xu-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-x-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-x-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-xu-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-xu-f-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfrdiv-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfrdiv-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfrec7-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfrec7-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfrsqrt7-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfrsqrt7-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfrsub-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfrsub-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnj-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnj-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnjn-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnjn-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnjx-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfsgnjx-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfslide1down-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfslide1down-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfslide1up-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfslide1up-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfsqrt-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfsqrt-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfsub-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfsub-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfwadd-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfwadd-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfwadd.w-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfwadd.w-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-f-f-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-f-f-rv64.ll
  

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

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

Hi, Could anyone please review this diff?


Repository:
  rG LLVM Github Monorepo

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] D108982: [clang][deps] Use correct DiagnosticOptions for command-line handling

2021-09-02 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman accepted this revision.
arphaman added a comment.

LGTM, thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108982

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


[PATCH] D108976: [clang][tooling] Accept custom diagnostic options in ToolInvocation

2021-09-02 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

In D108976#2979867 , @arphaman wrote:

> Could you add a test case for this change? Maybe a unit test?

Ah I see, you mentioned that the tests are in a follow-up patch. Sorry about 
that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108976

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


  1   2   >