[PATCH] D154543: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-07-05 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian created this revision.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
IncludeGuardian requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, MaskRay.
Herald added projects: clang, LLVM.

Add missing parts that caused https://reviews.llvm.org/D153229 to fail compile 
on main.

Move the implementation of the `toString` function from
`llvm/Support/Error.h` to the source file, which allows us to move
`#include "llvm/ADT/StringExtras.h"` to the source file as well.

As `Error.h` is present in a large number of translation units this
means we are unnecessarily bringing in the contents of
`StringExtras.h` - itself a large file with lots of includes - and
slowing down compilation.

Also move the `#include "llvm/ADT/SmallVector.h"` directive to the
source file as it's no longer needed, but this does not give as much of
a benefit.

This reduces the total number of preprocessing tokens across the LLVM
source files in lib from (roughly) 1,920,413,050 to 1,903,629,230 - a
reduction of ~0.87%. This should result in a small improvement in
compilation time.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154543

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  llvm/include/llvm/Support/Error.h
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/Support/Error.cpp
  llvm/lib/Transforms/IPO/Internalize.cpp
  llvm/lib/Transforms/Scalar/MergeICmps.cpp
  llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp

Index: llvm/lib/Transforms/Utils/ModuleUtils.cpp
===
--- llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -12,6 +12,7 @@

 #include "llvm/Transforms/Utils/ModuleUtils.h"
 #include "llvm/Analysis/VectorUtils.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuilder.h"
@@ -19,15 +20,16 @@
 #include "llvm/IR/Module.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/xxhash.h"
+
 using namespace llvm;

 #define DEBUG_TYPE "moduleutils"

 static void appendToGlobalArray(StringRef ArrayName, Module &M, Function *F,
 int Priority, Constant *Data) {
   IRBuilder<> IRB(M.getContext());
   FunctionType *FnTy = FunctionType::get(IRB.getVoidTy(), false);

   // Get the current set of static global constructors and add the new ctor
   // to the list.
   SmallVector CurrentCtors;
Index: llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
===
--- llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
+++ llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
@@ -11,22 +11,23 @@
 //===--===//

 #include "llvm/Transforms/Utils/MemoryOpRemark.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Analysis/OptimizationRemarkEmitter.h"
 #include "llvm/Analysis/ValueTracking.h"
 #include "llvm/IR/DebugInfo.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include 

 using namespace llvm;
 using namespace llvm::ore;

 MemoryOpRemark::~MemoryOpRemark() = default;

 bool MemoryOpRemark::canHandle(const Instruction *I, const TargetLibraryInfo &TLI) {
   if (isa(I))
 return true;

   if (auto *II = dyn_cast(I)) {
 switch (II->getIntrinsicID()) {
 case Intrinsic::memcpy_inline:
Index: llvm/lib/Transforms/Scalar/MergeICmps.cpp
===
--- llvm/lib/Transforms/Scalar/MergeICmps.cpp
+++ llvm/lib/Transforms/Scalar/MergeICmps.cpp
@@ -42,6 +42,7 @@
 //===--===//

 #include "llvm/Transforms/Scalar/MergeICmps.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Analysis/DomTreeUpdater.h"
 #include "llvm/Analysis/GlobalsModRef.h"
 #include "llvm/Analysis/Loads.h"
Index: llvm/lib/Transforms/IPO/Internalize.cpp
===
--- llvm/lib/Transforms/IPO/Internalize.cpp
+++ llvm/lib/Transforms/IPO/Internalize.cpp
@@ -19,6 +19,7 @@
 //===--===//

 #include "llvm/Transforms/IPO/Internalize.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Analysis/CallGraph.h"
Index: llvm/lib/Support/Error.cpp
===
--- llvm/lib/Support/Error.cpp
+++ llvm/lib/Support/Error.cpp
@@ -7,27 +7,29 @@
 //===--===//

 #include "llvm/Support/Error.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/ErrorHandling.h"
 #include 

 using namespace llvm;

 nam

[PATCH] D154543: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-07-06 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 537886.
IncludeGuardian added a comment.

Fix `CompressionTest.cpp`


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

https://reviews.llvm.org/D154543

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  llvm/include/llvm/Support/Error.h
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/Support/Error.cpp
  llvm/lib/Transforms/IPO/Internalize.cpp
  llvm/lib/Transforms/Scalar/MergeICmps.cpp
  llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp
  llvm/unittests/Support/CompressionTest.cpp

Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -12,99 +12,100 @@

 #include "llvm/Support/Compression.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Error.h"
 #include "gtest/gtest.h"

 using namespace llvm;
 using namespace llvm::compression;

 namespace {

 #if LLVM_ENABLE_ZLIB
 static void testZlibCompression(StringRef Input, int Level) {
   SmallVector Compressed;
   SmallVector Uncompressed;
   zlib::compress(arrayRefFromStringRef(Input), Compressed, Level);

   // Check that uncompressed buffer is the same as original.
   Error E = zlib::decompress(Compressed, Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   // decompress with Z dispatches to zlib::decompress.
   E = compression::decompress(DebugCompressionType::Zlib, Compressed,
   Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   if (Input.size() > 0) {
 // Decompression fails if expected length is too short.
 E = zlib::decompress(Compressed, Uncompressed, Input.size() - 1);
 EXPECT_EQ("zlib error: Z_BUF_ERROR", llvm::toString(std::move(E)));
   }
 }

 TEST(CompressionTest, Zlib) {
   testZlibCompression("", zlib::DefaultCompression);

   testZlibCompression("hello, world!", zlib::NoCompression);
   testZlibCompression("hello, world!", zlib::BestSizeCompression);
   testZlibCompression("hello, world!", zlib::BestSpeedCompression);
   testZlibCompression("hello, world!", zlib::DefaultCompression);

   const size_t kSize = 1024;
   char BinaryData[kSize];
   for (size_t i = 0; i < kSize; ++i)
 BinaryData[i] = i & 255;
   StringRef BinaryDataStr(BinaryData, kSize);

   testZlibCompression(BinaryDataStr, zlib::NoCompression);
   testZlibCompression(BinaryDataStr, zlib::BestSizeCompression);
   testZlibCompression(BinaryDataStr, zlib::BestSpeedCompression);
   testZlibCompression(BinaryDataStr, zlib::DefaultCompression);
 }
 #endif

 #if LLVM_ENABLE_ZSTD
 static void testZstdCompression(StringRef Input, int Level) {
   SmallVector Compressed;
   SmallVector Uncompressed;
   zstd::compress(arrayRefFromStringRef(Input), Compressed, Level);

   // Check that uncompressed buffer is the same as original.
   Error E = zstd::decompress(Compressed, Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   // decompress with Zstd dispatches to zstd::decompress.
   E = compression::decompress(DebugCompressionType::Zstd, Compressed,
   Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   if (Input.size() > 0) {
 // Decompression fails if expected length is too short.
 E = zstd::decompress(Compressed, Uncompressed, Input.size() - 1);
 EXPECT_EQ("Destination buffer is too small", llvm::toString(std::move(E)));
   }
 }

 TEST(CompressionTest, Zstd) {
   testZstdCompression("", zstd::DefaultCompression);

   testZstdCompression("hello, world!", zstd::NoCompression);
   testZstdCompression("hello, world!", zstd::BestSizeCompression);
   testZstdCompression("hello, world!", zstd::BestSpeedCompression);
   testZstdCompression("hello, world!", zstd::DefaultCompression);

   const size_t kSize = 1024;
   char BinaryData[kSize];
   for (size_t i = 0; i < kSize; ++i)
 BinaryData[i] = i & 255;
   StringRef BinaryDataStr(BinaryData, kSize);

   testZstdCompression(BinaryDataStr, zstd::NoCompression);
   testZstdCompression(BinaryDataStr, zstd::BestSizeCompression);
   testZstdCompression(BinaryDataStr, zstd::BestSpeedCompression);
Index: llvm/lib/Transforms/Utils/ModuleUtils.cpp
===
--- llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -12,6 +12,7 @@

 #include "llvm/Transforms/Utils/ModuleUtils.h"
 #include "llvm/Analysis/VectorUtils.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuil

[PATCH] D154543: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-07-07 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 538047.
IncludeGuardian added a comment.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.

Fix `XCOFFDump.cpp`


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

https://reviews.llvm.org/D154543

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  llvm/include/llvm/Support/Error.h
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/Support/Error.cpp
  llvm/lib/Transforms/IPO/Internalize.cpp
  llvm/lib/Transforms/Scalar/MergeICmps.cpp
  llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp
  llvm/tools/llvm-objdump/XCOFFDump.cpp
  llvm/unittests/Support/CompressionTest.cpp

Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -12,99 +12,100 @@

 #include "llvm/Support/Compression.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Error.h"
 #include "gtest/gtest.h"

 using namespace llvm;
 using namespace llvm::compression;

 namespace {

 #if LLVM_ENABLE_ZLIB
 static void testZlibCompression(StringRef Input, int Level) {
   SmallVector Compressed;
   SmallVector Uncompressed;
   zlib::compress(arrayRefFromStringRef(Input), Compressed, Level);

   // Check that uncompressed buffer is the same as original.
   Error E = zlib::decompress(Compressed, Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   // decompress with Z dispatches to zlib::decompress.
   E = compression::decompress(DebugCompressionType::Zlib, Compressed,
   Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   if (Input.size() > 0) {
 // Decompression fails if expected length is too short.
 E = zlib::decompress(Compressed, Uncompressed, Input.size() - 1);
 EXPECT_EQ("zlib error: Z_BUF_ERROR", llvm::toString(std::move(E)));
   }
 }

 TEST(CompressionTest, Zlib) {
   testZlibCompression("", zlib::DefaultCompression);

   testZlibCompression("hello, world!", zlib::NoCompression);
   testZlibCompression("hello, world!", zlib::BestSizeCompression);
   testZlibCompression("hello, world!", zlib::BestSpeedCompression);
   testZlibCompression("hello, world!", zlib::DefaultCompression);

   const size_t kSize = 1024;
   char BinaryData[kSize];
   for (size_t i = 0; i < kSize; ++i)
 BinaryData[i] = i & 255;
   StringRef BinaryDataStr(BinaryData, kSize);

   testZlibCompression(BinaryDataStr, zlib::NoCompression);
   testZlibCompression(BinaryDataStr, zlib::BestSizeCompression);
   testZlibCompression(BinaryDataStr, zlib::BestSpeedCompression);
   testZlibCompression(BinaryDataStr, zlib::DefaultCompression);
 }
 #endif

 #if LLVM_ENABLE_ZSTD
 static void testZstdCompression(StringRef Input, int Level) {
   SmallVector Compressed;
   SmallVector Uncompressed;
   zstd::compress(arrayRefFromStringRef(Input), Compressed, Level);

   // Check that uncompressed buffer is the same as original.
   Error E = zstd::decompress(Compressed, Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   // decompress with Zstd dispatches to zstd::decompress.
   E = compression::decompress(DebugCompressionType::Zstd, Compressed,
   Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   if (Input.size() > 0) {
 // Decompression fails if expected length is too short.
 E = zstd::decompress(Compressed, Uncompressed, Input.size() - 1);
 EXPECT_EQ("Destination buffer is too small", llvm::toString(std::move(E)));
   }
 }

 TEST(CompressionTest, Zstd) {
   testZstdCompression("", zstd::DefaultCompression);

   testZstdCompression("hello, world!", zstd::NoCompression);
   testZstdCompression("hello, world!", zstd::BestSizeCompression);
   testZstdCompression("hello, world!", zstd::BestSpeedCompression);
   testZstdCompression("hello, world!", zstd::DefaultCompression);

   const size_t kSize = 1024;
   char BinaryData[kSize];
   for (size_t i = 0; i < kSize; ++i)
 BinaryData[i] = i & 255;
   StringRef BinaryDataStr(BinaryData, kSize);

   testZstdCompression(BinaryDataStr, zstd::NoCompression);
   testZstdCompression(BinaryDataStr, zstd::BestSizeCompression);
   testZstdCompression(BinaryDataStr, zstd::BestSpeedCompression);
Index: llvm/tools/llvm-objdump/XCOFFDump.cpp
===
--- llvm/tools/llvm-objdump/XCOFFDump.cpp
+++ llvm/tools/llvm-objdump/XCOFFDump.cpp
@@ -14,11 +14,12 @@
 #include "XCOFFDump.h"

 #include "llvm-objdump.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Demangle/Demangl

[PATCH] D154543: [Support] Move StringExtras.h include from Error.h to Error.cpp

2023-07-07 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.

@MaskRay Thanks. I have updated the title to use `[Support]` and I will land 
the additional includes separately to the removal.  This was very good advice 
last attempt as it I did have to revert the change.


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

https://reviews.llvm.org/D154543

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


[PATCH] D154543: [Support] Move StringExtras.h include from Error.h to Error.cpp

2023-07-07 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 538238.
IncludeGuardian added a comment.

Rebasing on `main`


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

https://reviews.llvm.org/D154543

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  llvm/include/llvm/Support/Error.h
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/Support/Error.cpp
  llvm/lib/Transforms/IPO/Internalize.cpp
  llvm/lib/Transforms/Scalar/MergeICmps.cpp
  llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp
  llvm/tools/llvm-objdump/XCOFFDump.cpp
  llvm/unittests/Support/CompressionTest.cpp

Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -12,99 +12,100 @@

 #include "llvm/Support/Compression.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Error.h"
 #include "gtest/gtest.h"

 using namespace llvm;
 using namespace llvm::compression;

 namespace {

 #if LLVM_ENABLE_ZLIB
 static void testZlibCompression(StringRef Input, int Level) {
   SmallVector Compressed;
   SmallVector Uncompressed;
   zlib::compress(arrayRefFromStringRef(Input), Compressed, Level);

   // Check that uncompressed buffer is the same as original.
   Error E = zlib::decompress(Compressed, Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   // decompress with Z dispatches to zlib::decompress.
   E = compression::decompress(DebugCompressionType::Zlib, Compressed,
   Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   if (Input.size() > 0) {
 // Decompression fails if expected length is too short.
 E = zlib::decompress(Compressed, Uncompressed, Input.size() - 1);
 EXPECT_EQ("zlib error: Z_BUF_ERROR", llvm::toString(std::move(E)));
   }
 }

 TEST(CompressionTest, Zlib) {
   testZlibCompression("", zlib::DefaultCompression);

   testZlibCompression("hello, world!", zlib::NoCompression);
   testZlibCompression("hello, world!", zlib::BestSizeCompression);
   testZlibCompression("hello, world!", zlib::BestSpeedCompression);
   testZlibCompression("hello, world!", zlib::DefaultCompression);

   const size_t kSize = 1024;
   char BinaryData[kSize];
   for (size_t i = 0; i < kSize; ++i)
 BinaryData[i] = i & 255;
   StringRef BinaryDataStr(BinaryData, kSize);

   testZlibCompression(BinaryDataStr, zlib::NoCompression);
   testZlibCompression(BinaryDataStr, zlib::BestSizeCompression);
   testZlibCompression(BinaryDataStr, zlib::BestSpeedCompression);
   testZlibCompression(BinaryDataStr, zlib::DefaultCompression);
 }
 #endif

 #if LLVM_ENABLE_ZSTD
 static void testZstdCompression(StringRef Input, int Level) {
   SmallVector Compressed;
   SmallVector Uncompressed;
   zstd::compress(arrayRefFromStringRef(Input), Compressed, Level);

   // Check that uncompressed buffer is the same as original.
   Error E = zstd::decompress(Compressed, Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   // decompress with Zstd dispatches to zstd::decompress.
   E = compression::decompress(DebugCompressionType::Zstd, Compressed,
   Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   if (Input.size() > 0) {
 // Decompression fails if expected length is too short.
 E = zstd::decompress(Compressed, Uncompressed, Input.size() - 1);
 EXPECT_EQ("Destination buffer is too small", llvm::toString(std::move(E)));
   }
 }

 TEST(CompressionTest, Zstd) {
   testZstdCompression("", zstd::DefaultCompression);

   testZstdCompression("hello, world!", zstd::NoCompression);
   testZstdCompression("hello, world!", zstd::BestSizeCompression);
   testZstdCompression("hello, world!", zstd::BestSpeedCompression);
   testZstdCompression("hello, world!", zstd::DefaultCompression);

   const size_t kSize = 1024;
   char BinaryData[kSize];
   for (size_t i = 0; i < kSize; ++i)
 BinaryData[i] = i & 255;
   StringRef BinaryDataStr(BinaryData, kSize);

   testZstdCompression(BinaryDataStr, zstd::NoCompression);
   testZstdCompression(BinaryDataStr, zstd::BestSizeCompression);
   testZstdCompression(BinaryDataStr, zstd::BestSpeedCompression);
Index: llvm/tools/llvm-objdump/XCOFFDump.cpp
===
--- llvm/tools/llvm-objdump/XCOFFDump.cpp
+++ llvm/tools/llvm-objdump/XCOFFDump.cpp
@@ -14,6 +14,7 @@
 #include "XCOFFDump.h"

 #include "llvm-objdump.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Demangle/Demangle.h"
 #include "llvm/MC/MCInstPrinter.h"
 #include "llvm/MC/MCSubtargetInf

[PATCH] D154543: [Support] Move StringExtras.h include from Error.h to Error.cpp

2023-07-08 Thread Elliot Goodrich 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 rG39d8e6e22cd1: Add missing StringExtras.h includes (authored 
by IncludeGuardian).

Changed prior to commit:
  https://reviews.llvm.org/D154543?vs=538238&id=538337#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154543

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/Transforms/IPO/Internalize.cpp
  llvm/lib/Transforms/Scalar/MergeICmps.cpp
  llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp
  llvm/tools/llvm-objdump/XCOFFDump.cpp
  llvm/unittests/Support/CompressionTest.cpp

Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/Support/Compression.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Error.h"
Index: llvm/tools/llvm-objdump/XCOFFDump.cpp
===
--- llvm/tools/llvm-objdump/XCOFFDump.cpp
+++ llvm/tools/llvm-objdump/XCOFFDump.cpp
@@ -14,6 +14,7 @@
 #include "XCOFFDump.h"
 
 #include "llvm-objdump.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Demangle/Demangle.h"
 #include "llvm/MC/MCInstPrinter.h"
 #include "llvm/MC/MCSubtargetInfo.h"
Index: llvm/lib/Transforms/Utils/ModuleUtils.cpp
===
--- llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/Transforms/Utils/ModuleUtils.h"
 #include "llvm/Analysis/VectorUtils.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuilder.h"
@@ -19,6 +20,7 @@
 #include "llvm/IR/Module.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/xxhash.h"
+
 using namespace llvm;
 
 #define DEBUG_TYPE "moduleutils"
Index: llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
===
--- llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
+++ llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
@@ -11,6 +11,7 @@
 //===--===//
 
 #include "llvm/Transforms/Utils/MemoryOpRemark.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Analysis/OptimizationRemarkEmitter.h"
 #include "llvm/Analysis/ValueTracking.h"
 #include "llvm/IR/DebugInfo.h"
Index: llvm/lib/Transforms/Scalar/MergeICmps.cpp
===
--- llvm/lib/Transforms/Scalar/MergeICmps.cpp
+++ llvm/lib/Transforms/Scalar/MergeICmps.cpp
@@ -42,6 +42,7 @@
 //===--===//
 
 #include "llvm/Transforms/Scalar/MergeICmps.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Analysis/DomTreeUpdater.h"
 #include "llvm/Analysis/GlobalsModRef.h"
 #include "llvm/Analysis/Loads.h"
Index: llvm/lib/Transforms/IPO/Internalize.cpp
===
--- llvm/lib/Transforms/IPO/Internalize.cpp
+++ llvm/lib/Transforms/IPO/Internalize.cpp
@@ -19,6 +19,7 @@
 //===--===//
 
 #include "llvm/Transforms/IPO/Internalize.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Analysis/CallGraph.h"
Index: llvm/lib/Analysis/VectorUtils.cpp
===
--- llvm/lib/Analysis/VectorUtils.cpp
+++ llvm/lib/Analysis/VectorUtils.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/Analysis/VectorUtils.h"
 #include "llvm/ADT/EquivalenceClasses.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Analysis/DemandedBits.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Analysis/LoopIterator.h"
Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -18,6 +18,7 @@
 #include "clang/Driver/DriverDiagnostic.h"
 #include "clang/Driver/MultilibBuilder.h"
 #include "clang/Driver/Options.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/VirtualFileSystem.h"
Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -26,6 +26,7 @@
 #in

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-06-18 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.

This is good to review now.  Phabricator has become a bit confused after 
rebasing on top of https://reviews.llvm.org/D151557, I don't know whether it's 
worth creating a new, cleaner review and close this on?


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

https://reviews.llvm.org/D150997

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


[PATCH] D153229: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-06-18 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian created this revision.
Herald added subscribers: bviyer, luke, Moerafaat, kmitropoulou, zero9178, 
steakhal, mtrofin, bzcheeseman, mattd, gchakrabarti, pmatos, asb, sdasgup3, 
asavonic, jeroen.dobbelaere, wenzhicui, wrengr, ormris, foad, ChuanqiXu, cota, 
teijeong, frasercrmck, rdzhabarov, tatianashp, okura, jdoerfert, msifontes, 
jurahul, kuter, Kayjukh, grosul1, martong, Joonsoo, kerbowa, liufengdb, 
aartbik, mgester, arpith-jacob, csigg, antiagainst, shauheen, rriddle, 
mehdi_amini, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, 
asbirlea, thopre, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, 
edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, 
kbarton, hiraditya, arichardson, sbc100, jvesely, nemanjai, arsenm.
Herald added a reviewer: alexander-shaposhnikov.
Herald added a reviewer: jhenderson.
Herald added a reviewer: NoQ.
Herald added a project: All.
IncludeGuardian requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, wangpc, 
stephenneuendorffer, nicolasvasilache, MaskRay, aheejin, jholewinski.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added projects: clang, MLIR, LLVM.

Move the implementation of the `toString` function from `llvm/Support/Error.h` 
to the source file, 
which allows us to move `#include "llvm/ADT/StringExtras.h"` to the source file 
as well.

As `Error.h` is present in a large number of translation units this means we 
are unnecessarily bringing in the 
contents of `StringExtras.h` - itself a large file with lots of includes - and 
slowing down compilation.

Includes have been added to source/header files that are needed but were being 
transitively included. The 
majority needed `StringExtras.h` but a few only required a smaller header: 
`APInt.h`, `APSInt.h`, or 
`SmallString.h`.

This reduces the total number of preprocessing tokens across the LLVM source 
files in lib from (roughly) 
1,920,413,050 to 1,903,629,230 - a reduction of ~0.87%. This should result in a 
small improvement in compilation 
time.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153229

Files:
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/Basic/Sarif.cpp
  clang/lib/Driver/Job.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaModule.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
  clang/tools/clang-offload-packager/ClangOffloadPackager.cpp
  clang/tools/driver/cc1as_main.cpp
  llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
  llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
  llvm/include/llvm/Debuginfod/HTTPClient.h
  llvm/include/llvm/ProfileData/GCOV.h
  llvm/include/llvm/Support/Error.h
  llvm/lib/Analysis/AliasSetTracker.cpp
  llvm/lib/Analysis/CallGraphSCCPass.cpp
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
  llvm/lib/CodeGen/MachineBasicBlock.cpp
  llvm/lib/CodeGen/MachineCheckDebugify.cpp
  llvm/lib/CodeGen/RegisterBankInfo.cpp
  llvm/lib/DWARFLinker/DWARFLinker.cpp
  llvm/lib/DWARFLinker/DWARFLinkerCompileUnit.cpp
  llvm/lib/DWARFLinkerParallel/DWARFLinkerUnit.h
  llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
  llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
  llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
  llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
  llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
  llvm/lib/FileCheck/FileCheck.cpp
  llvm/lib/IR/DIBuilder.cpp
  llvm/lib/MC/ELFObjectWriter.cpp
  llvm/lib/MC/MCAsmInfo.cpp
  llvm/lib/MC/MCParser/ELFAsmParser.cpp
  llvm/lib/MC/MCParser/WasmAsmParser.cpp
  llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp
  llvm/lib/Object/Decompressor.cpp
  llvm/lib/Object/ELF.cpp
  llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
  llvm/lib/Remarks/YAMLRemarkParser.cpp
  llvm/lib/Support/BinaryStreamWriter.cpp
  llvm/lib/Support/DataExtractor.cpp
  llvm/lib/Support/Error.cpp
  llvm/lib/Support/JSON.cpp
  llvm/lib/Support/Path.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
  llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h
  llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
  llvm/l

[PATCH] D153229: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-06-18 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.
Herald added a subscriber: jsetoain.

This was found with IncludeGuardian 0.0.8.

The line that suggested this can be found in the output here 
.

The count of preprocessing tokens before and after this change can be found in 
before.yaml 

 and after.yaml 
.
 Note that both these were run on top of https://reviews.llvm.org/D150997, 
which is yet to make it into the main branch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153229

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


[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-06-21 Thread Elliot Goodrich via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcea0eea28e71: [llvm] Split out DenseMapInfo 
specialization (authored by IncludeGuardian).
Herald added a project: Flang.

Changed prior to commit:
  https://reviews.llvm.org/D150997?vs=532038&id=533470#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  flang/include/flang/Optimizer/HLFIR/HLFIROps.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseMapInfoVariant.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  llvm/unittests/ADT/DenseMapTest.cpp
  mlir/include/mlir/IR/AsmState.h
  mlir/include/mlir/Transforms/SROA.h

Index: mlir/include/mlir/Transforms/SROA.h
===
--- mlir/include/mlir/Transforms/SROA.h
+++ mlir/include/mlir/Transforms/SROA.h
@@ -13,6 +13,7 @@
 #include "mlir/Interfaces/MemorySlotInterfaces.h"
 #include "mlir/Support/LogicalResult.h"
 #include "llvm/ADT/Statistic.h"
+#include 
 
 namespace mlir {
 
Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/StringMap.h"
 
 #include 
+#include 
 
 namespace mlir {
 class AsmResourcePrinter;
Index: llvm/unittests/ADT/DenseMapTest.cpp
===
--- llvm/unittests/ADT/DenseMapTest.cpp
+++ llvm/unittests/ADT/DenseMapTest.cpp
@@ -8,6 +8,7 @@
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/DenseMapInfoVariant.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,6 +21,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 
 
 namespace llvm {
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,6 +21,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 
 
 namespace llvm {
 namespace object {
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,6 +22,7 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 
 
 namespace llvm {
 namespace orc {
Index: llvm/include/llvm/CodeGen/CallingConvLower.h
===
--- llvm/include/llvm/CodeGen/CallingConvLower.h
+++ llvm/include/llvm/CodeGen/CallingConvLower.h
@@ -19,6 +19,8 @@
 #include "llvm/CodeGen/TargetCallingConv.h"
 #include "llvm/IR/CallingConv.h"
 #include "llvm/Support/Alignment.h"
+#include 
+#include 
 
 namespace llvm {
 
Index: llvm/include/llvm/ADT/DenseMapInfoVariant.h
===
--- /dev/null
+++ llvm/include/llvm/ADT/DenseMapInfoVariant.h
@@ -0,0 +1,71 @@
+//===- DenseMapInfoVariant.h - Type traits for DenseMap *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// This file defines DenseMapInfo traits for DenseMap>.
+///
+//===--===//
+
+#ifndef LLVM_ADT_DENSEMAPINFOVARIANT_H
+#define LLVM_ADT_DENSEMAPINFOVARIANT_H
+
+#include "llvm/ADT/DenseMapInfo.h"
+#include 
+#include 
+
+namespace llvm {
+
+// Provide DenseMapInfo for variants whose all alternatives have DenseMapInfo.
+template  struct DenseMapInfo> {
+  using Variant = std::variant;
+  using FirstT = std::variant_alternative_t<0, Variant>;
+
+  static inline Variant getEmptyKey() {
+return Variant(std::in_place_index<0>, DenseMapInfo::getEmptyKey());
+  }
+
+  static inline Variant getTombstoneKey() {
+return Variant(std::in_place_index<0>,
+   DenseMapInfo::getTombstoneKey());
+  }
+
+  static unsigned getHashValue(const Variant &Val) {

[PATCH] D153229: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-06-23 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 533941.
IncludeGuardian added a comment.
Herald added subscribers: vkmr, kadircet, arphaman, emaste.
Herald added a reviewer: bollu.
Herald added a reviewer: aartbik.
Herald added a reviewer: MaskRay.
Herald added a project: clang-tools-extra.

Fix compile issues


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153229

Files:
  clang-tools-extra/clangd/ConfigCompile.cpp
  clang-tools-extra/clangd/FileDistance.cpp
  clang-tools-extra/clangd/Protocol.cpp
  clang-tools-extra/clangd/index/SymbolID.cpp
  clang-tools-extra/clangd/unittests/TestIndex.cpp
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/Basic/Sarif.cpp
  clang/lib/Driver/Job.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaModule.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
  clang/tools/clang-offload-packager/ClangOffloadPackager.cpp
  clang/tools/driver/cc1as_main.cpp
  lld/COFF/Chunks.cpp
  lld/COFF/DebugTypes.cpp
  lld/COFF/DriverUtils.cpp
  lld/Common/Strings.cpp
  lld/Common/Timer.cpp
  lld/ELF/AArch64ErrataFix.cpp
  lld/ELF/InputSection.h
  lld/ELF/Target.h
  lld/wasm/WriterUtils.cpp
  llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp
  llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
  llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
  llvm/include/llvm/Debuginfod/HTTPClient.h
  llvm/include/llvm/ProfileData/GCOV.h
  llvm/include/llvm/Support/Error.h
  llvm/lib/Analysis/AliasSetTracker.cpp
  llvm/lib/Analysis/CallGraphSCCPass.cpp
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
  llvm/lib/CodeGen/MachineBasicBlock.cpp
  llvm/lib/CodeGen/MachineCheckDebugify.cpp
  llvm/lib/CodeGen/RegisterBankInfo.cpp
  llvm/lib/DWARFLinker/DWARFLinker.cpp
  llvm/lib/DWARFLinker/DWARFLinkerCompileUnit.cpp
  llvm/lib/DWARFLinkerParallel/DWARFLinkerUnit.h
  llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
  llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
  llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
  llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
  llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFAArch64.h
  llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h
  llvm/lib/FileCheck/FileCheck.cpp
  llvm/lib/IR/DIBuilder.cpp
  llvm/lib/MC/ELFObjectWriter.cpp
  llvm/lib/MC/MCAsmInfo.cpp
  llvm/lib/MC/MCParser/ELFAsmParser.cpp
  llvm/lib/MC/MCParser/WasmAsmParser.cpp
  llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp
  llvm/lib/Object/Decompressor.cpp
  llvm/lib/Object/ELF.cpp
  llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
  llvm/lib/Remarks/YAMLRemarkParser.cpp
  llvm/lib/Support/BinaryStreamWriter.cpp
  llvm/lib/Support/DataExtractor.cpp
  llvm/lib/Support/Error.cpp
  llvm/lib/Support/JSON.cpp
  llvm/lib/Support/Path.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
  llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h
  llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
  llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp
  llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
  llvm/lib/Target/NVPTX/NVPTXCtorDtorLowering.cpp
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
  llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
  llvm/lib/Target/X86/X86MCInstLower.cpp
  llvm/lib/Target/X86/X86PreAMXConfig.cpp
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/tools/llvm-cov/CoverageReport.cpp
  llvm/tools/llvm-debuginfod-find/llvm-debuginfod-find.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/tools/llvm-opt-report/OptReport.cpp
  llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
  llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
  llvm/tools/

[PATCH] D153229: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-06-23 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.

@barannikov88 no it's not. I was going to commit separately to keep the change 
small, but it turns out that if I move this to the source file there are no 
additional changes needed. SmallVector.h has now been moved to Error.cpp as 
well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153229

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


[PATCH] D153229: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-06-23 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 533966.
IncludeGuardian added a comment.

Fix missing include


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153229

Files:
  llvm/unittests/Support/CompressionTest.cpp


Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/Support/Compression.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Error.h"


Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/Support/Compression.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Error.h"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D153229: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-06-23 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 533968.
IncludeGuardian added a comment.

Add back all includes (bad arc change)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153229

Files:
  clang-tools-extra/clangd/ConfigCompile.cpp
  clang-tools-extra/clangd/FileDistance.cpp
  clang-tools-extra/clangd/Protocol.cpp
  clang-tools-extra/clangd/index/SymbolID.cpp
  clang-tools-extra/clangd/unittests/TestIndex.cpp
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/Basic/Sarif.cpp
  clang/lib/Driver/Job.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaModule.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
  clang/tools/clang-offload-packager/ClangOffloadPackager.cpp
  clang/tools/driver/cc1as_main.cpp
  lld/COFF/Chunks.cpp
  lld/COFF/DebugTypes.cpp
  lld/COFF/DriverUtils.cpp
  lld/Common/Strings.cpp
  lld/Common/Timer.cpp
  lld/ELF/AArch64ErrataFix.cpp
  lld/ELF/InputSection.h
  lld/ELF/Target.h
  lld/wasm/WriterUtils.cpp
  llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp
  llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
  llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
  llvm/include/llvm/Debuginfod/HTTPClient.h
  llvm/include/llvm/ProfileData/GCOV.h
  llvm/include/llvm/Support/Error.h
  llvm/lib/Analysis/AliasSetTracker.cpp
  llvm/lib/Analysis/CallGraphSCCPass.cpp
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
  llvm/lib/CodeGen/MachineBasicBlock.cpp
  llvm/lib/CodeGen/MachineCheckDebugify.cpp
  llvm/lib/CodeGen/RegisterBankInfo.cpp
  llvm/lib/DWARFLinker/DWARFLinker.cpp
  llvm/lib/DWARFLinker/DWARFLinkerCompileUnit.cpp
  llvm/lib/DWARFLinkerParallel/DWARFLinkerUnit.h
  llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
  llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
  llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
  llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
  llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFAArch64.h
  llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h
  llvm/lib/FileCheck/FileCheck.cpp
  llvm/lib/IR/DIBuilder.cpp
  llvm/lib/MC/ELFObjectWriter.cpp
  llvm/lib/MC/MCAsmInfo.cpp
  llvm/lib/MC/MCParser/ELFAsmParser.cpp
  llvm/lib/MC/MCParser/WasmAsmParser.cpp
  llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp
  llvm/lib/Object/Decompressor.cpp
  llvm/lib/Object/ELF.cpp
  llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
  llvm/lib/Remarks/YAMLRemarkParser.cpp
  llvm/lib/Support/BinaryStreamWriter.cpp
  llvm/lib/Support/DataExtractor.cpp
  llvm/lib/Support/Error.cpp
  llvm/lib/Support/JSON.cpp
  llvm/lib/Support/Path.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
  llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h
  llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
  llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp
  llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
  llvm/lib/Target/NVPTX/NVPTXCtorDtorLowering.cpp
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
  llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
  llvm/lib/Target/X86/X86MCInstLower.cpp
  llvm/lib/Target/X86/X86PreAMXConfig.cpp
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/tools/llvm-cov/CoverageReport.cpp
  llvm/tools/llvm-debuginfod-find/llvm-debuginfod-find.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/tools/llvm-opt-report/OptReport.cpp
  llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
  llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
  llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp
  llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp
  llvm/tools/llvm-rc/ResourceScriptParser.cpp
  llvm/tools/llvm-strings/llvm-strings.cpp
  llvm/

[PATCH] D153229: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-06-23 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 533989.
IncludeGuardian added a comment.

Fix missing includes for Windows-only files


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153229

Files:
  clang-tools-extra/clangd/ConfigCompile.cpp
  clang-tools-extra/clangd/FileDistance.cpp
  clang-tools-extra/clangd/Protocol.cpp
  clang-tools-extra/clangd/index/SymbolID.cpp
  clang-tools-extra/clangd/unittests/TestIndex.cpp
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/JSONNodeDumper.cpp
  clang/lib/Basic/Sarif.cpp
  clang/lib/Driver/Job.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/lib/Sema/SemaCast.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaModule.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/StaticAnalyzer/Core/CheckerContext.cpp
  clang/tools/clang-offload-packager/ClangOffloadPackager.cpp
  clang/tools/driver/cc1as_main.cpp
  lld/COFF/Chunks.cpp
  lld/COFF/DebugTypes.cpp
  lld/COFF/DriverUtils.cpp
  lld/Common/Strings.cpp
  lld/Common/Timer.cpp
  lld/ELF/AArch64ErrataFix.cpp
  lld/ELF/InputSection.h
  lld/ELF/Target.h
  lld/wasm/WriterUtils.cpp
  llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp
  llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
  llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
  llvm/include/llvm/Debuginfod/HTTPClient.h
  llvm/include/llvm/ProfileData/GCOV.h
  llvm/include/llvm/Support/Error.h
  llvm/lib/Analysis/AliasSetTracker.cpp
  llvm/lib/Analysis/CallGraphSCCPass.cpp
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
  llvm/lib/CodeGen/MachineBasicBlock.cpp
  llvm/lib/CodeGen/MachineCheckDebugify.cpp
  llvm/lib/CodeGen/RegisterBankInfo.cpp
  llvm/lib/DWARFLinker/DWARFLinker.cpp
  llvm/lib/DWARFLinker/DWARFLinkerCompileUnit.cpp
  llvm/lib/DWARFLinkerParallel/DWARFLinkerUnit.h
  llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
  llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
  llvm/lib/DebugInfo/PDB/Native/InputFile.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp
  llvm/lib/DebugInfo/PDB/Native/NativeSourceFile.cpp
  llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
  llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFAArch64.h
  llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h
  llvm/lib/FileCheck/FileCheck.cpp
  llvm/lib/IR/DIBuilder.cpp
  llvm/lib/MC/ELFObjectWriter.cpp
  llvm/lib/MC/MCAsmInfo.cpp
  llvm/lib/MC/MCParser/ELFAsmParser.cpp
  llvm/lib/MC/MCParser/WasmAsmParser.cpp
  llvm/lib/ObjCopy/COFF/COFFObjcopy.cpp
  llvm/lib/Object/Decompressor.cpp
  llvm/lib/Object/ELF.cpp
  llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
  llvm/lib/Remarks/YAMLRemarkParser.cpp
  llvm/lib/Support/BinaryStreamWriter.cpp
  llvm/lib/Support/DataExtractor.cpp
  llvm/lib/Support/Error.cpp
  llvm/lib/Support/JSON.cpp
  llvm/lib/Support/Path.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
  llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h
  llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
  llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp
  llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
  llvm/lib/Target/NVPTX/NVPTXCtorDtorLowering.cpp
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
  llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
  llvm/lib/Target/X86/X86MCInstLower.cpp
  llvm/lib/Target/X86/X86PreAMXConfig.cpp
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/lib/WindowsDriver/MSVCPaths.cpp
  llvm/tools/llvm-cov/CoverageReport.cpp
  llvm/tools/llvm-debuginfod-find/llvm-debuginfod-find.cpp
  llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
  llvm/tools/llvm-opt-report/OptReport.cpp
  llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
  llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
  llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp
  llvm/tools/llvm-pdbutil/PrettyCompilandDumper.cpp
  llvm/tools/llvm-rc/ResourceScriptParser.cpp
  llvm

[PATCH] D153229: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-06-25 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.

@MaskRay good idea, I have split into 2 commits and pushed to the `main`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153229

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


[PATCH] D153229: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-06-25 Thread Elliot Goodrich via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2fa0dbd7bf35: [llvm] Move StringExtras.h include from 
Error.h to Error.cpp (authored by IncludeGuardian).

Changed prior to commit:
  https://reviews.llvm.org/D153229?vs=533989&id=534347#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153229

Files:
  llvm/include/llvm/Support/Error.h
  llvm/lib/Support/Error.cpp


Index: llvm/lib/Support/Error.cpp
===
--- llvm/lib/Support/Error.cpp
+++ llvm/lib/Support/Error.cpp
@@ -7,6 +7,8 @@
 
//===--===//
 
 #include "llvm/Support/Error.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/ErrorHandling.h"
 #include 
@@ -70,6 +72,15 @@
   });
 }
 
+/// Write all error messages (if any) in E to a string. The newline character
+/// is used to separate error messages.
+std::string toString(Error E) {
+  SmallVector Errors;
+  handleAllErrors(std::move(E), [&Errors](const ErrorInfoBase &EI) {
+Errors.push_back(EI.message());
+  });
+  return join(Errors.begin(), Errors.end(), "\n");
+}
 
 std::error_code ErrorList::convertToErrorCode() const {
   return std::error_code(static_cast(ErrorErrorCode::MultipleErrors),
Index: llvm/include/llvm/Support/Error.h
===
--- llvm/include/llvm/Support/Error.h
+++ llvm/include/llvm/Support/Error.h
@@ -14,8 +14,6 @@
 #define LLVM_SUPPORT_ERROR_H
 
 #include "llvm-c/Error.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/AlignOf.h"
@@ -1025,13 +1023,7 @@
 
 /// Write all error messages (if any) in E to a string. The newline character
 /// is used to separate error messages.
-inline std::string toString(Error E) {
-  SmallVector Errors;
-  handleAllErrors(std::move(E), [&Errors](const ErrorInfoBase &EI) {
-Errors.push_back(EI.message());
-  });
-  return join(Errors.begin(), Errors.end(), "\n");
-}
+std::string toString(Error E);
 
 /// Consume a Error without doing anything. This method should be used
 /// only where an error can be considered a reasonable and expected return


Index: llvm/lib/Support/Error.cpp
===
--- llvm/lib/Support/Error.cpp
+++ llvm/lib/Support/Error.cpp
@@ -7,6 +7,8 @@
 //===--===//
 
 #include "llvm/Support/Error.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/ErrorHandling.h"
 #include 
@@ -70,6 +72,15 @@
   });
 }
 
+/// Write all error messages (if any) in E to a string. The newline character
+/// is used to separate error messages.
+std::string toString(Error E) {
+  SmallVector Errors;
+  handleAllErrors(std::move(E), [&Errors](const ErrorInfoBase &EI) {
+Errors.push_back(EI.message());
+  });
+  return join(Errors.begin(), Errors.end(), "\n");
+}
 
 std::error_code ErrorList::convertToErrorCode() const {
   return std::error_code(static_cast(ErrorErrorCode::MultipleErrors),
Index: llvm/include/llvm/Support/Error.h
===
--- llvm/include/llvm/Support/Error.h
+++ llvm/include/llvm/Support/Error.h
@@ -14,8 +14,6 @@
 #define LLVM_SUPPORT_ERROR_H
 
 #include "llvm-c/Error.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/AlignOf.h"
@@ -1025,13 +1023,7 @@
 
 /// Write all error messages (if any) in E to a string. The newline character
 /// is used to separate error messages.
-inline std::string toString(Error E) {
-  SmallVector Errors;
-  handleAllErrors(std::move(E), [&Errors](const ErrorInfoBase &EI) {
-Errors.push_back(EI.message());
-  });
-  return join(Errors.begin(), Errors.end(), "\n");
-}
+std::string toString(Error E);
 
 /// Consume a Error without doing anything. This method should be used
 /// only where an error can be considered a reasonable and expected return
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D153728: [llvm] Move AttributeMask to a separate header

2023-06-25 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian created this revision.
IncludeGuardian added a reviewer: aaron.ballman.
Herald added subscribers: mtrofin, Enna1, ormris, foad, jdoerfert, kerbowa, 
hiraditya, jvesely, arsenm, qcolombet, MatzeB.
Herald added a project: All.
IncludeGuardian requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Move `AttributeMask` out of `llvm/IR/Attributes.h` to a new file
`llvm/IR/AttributeMask.h`.  After doing this we can remove the
`#include ` and `#include ` directives from `Attributes.h`.
Since there are many headers including `Attributes.h`, but not needing
the definition of `AttributeMask`, this causes unnecessary bloating of
the translation units and slows down compilation.

Additionally, the `llvm/ADT/SmallString.h` include directive was not
needed and has been removed.

This commit adds the include directive for `llvm/IR/AttributeMask.h`
to the handful of source files that need to see the definition.

This reduces the total number of preprocessing tokens across the LLVM
source files in lib from (roughly) 1,917,509,187 to 1,902,982,273 - a
reduction of ~0.76%. This should result in a small improvement in
compilation time.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153728

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  llvm/include/llvm/IR/AttributeMask.h
  llvm/include/llvm/IR/Attributes.h
  llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/IR/Instruction.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
  llvm/lib/Target/DirectX/DXILPrepare.cpp
  llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
  llvm/lib/Transforms/IPO/SCCP.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
  llvm/unittests/IR/AttributesTest.cpp

Index: llvm/unittests/IR/AttributesTest.cpp
===
--- llvm/unittests/IR/AttributesTest.cpp
+++ llvm/unittests/IR/AttributesTest.cpp
@@ -8,6 +8,7 @@
 
 #include "llvm/IR/Attributes.h"
 #include "llvm/AsmParser/Parser.h"
+#include "llvm/IR/AttributeMask.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/InstrTypes.h"
 #include "llvm/IR/LLVMContext.h"
Index: llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
===
--- llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
+++ llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
@@ -14,6 +14,7 @@
 #include "ReduceInstructions.h"
 #include "Utils.h"
 #include "llvm/IR/Constants.h"
+#include 
 
 using namespace llvm;
 
Index: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
===
--- llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -19,6 +19,7 @@
 #include "llvm/Analysis/Loads.h"
 #include "llvm/Analysis/OptimizationRemarkEmitter.h"
 #include "llvm/Analysis/ValueTracking.h"
+#include "llvm/IR/AttributeMask.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuilder.h"
Index: llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
===
--- llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
+++ llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
@@ -14,6 +14,7 @@
 #include "llvm/Transforms/Utils/CallPromotionUtils.h"
 #include "llvm/Analysis/Loads.h"
 #include "llvm/Analysis/TypeMetadataUtils.h"
+#include "llvm/IR/AttributeMask.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
Index: llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
===
--- llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -27,6 +27,7 @@
 #include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/IR/Argument.h"
+#include "llvm/IR/AttributeMask.h"
 #include "llvm/IR/Attributes.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/CallingConv.h"
Index: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -160,6 +160,7 @@
 #include "llvm/Analysis/TargetLibraryInfo.h"
 

[PATCH] D153728: [llvm] Move AttributeMask to a separate header

2023-06-25 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.

This was found with IncludeGuardian 0.0.8 and the recommendation was given here 
https://gist.github.com/IncludeGuardian/4132d5149576a55e0560fae6f8ff4a38#file-before-yaml-L4053-L4055

The estimates of token count were run before and after this commit and can be 
seen here before.yaml (1,917,509,187) 

  and after.yaml (1,902,982,273) 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153728

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


[PATCH] D153728: [llvm] Move AttributeMask to a separate header

2023-06-27 Thread Elliot Goodrich via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf0fa2d7c2928: [llvm] Move AttributeMask to a separate header 
(authored by IncludeGuardian).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153728

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  llvm/include/llvm/IR/AttributeMask.h
  llvm/include/llvm/IR/Attributes.h
  llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp
  llvm/lib/IR/Attributes.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/IR/Instruction.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
  llvm/lib/Target/DirectX/DXILPrepare.cpp
  llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
  llvm/lib/Transforms/IPO/SCCP.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
  llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
  llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
  llvm/unittests/IR/AttributesTest.cpp

Index: llvm/unittests/IR/AttributesTest.cpp
===
--- llvm/unittests/IR/AttributesTest.cpp
+++ llvm/unittests/IR/AttributesTest.cpp
@@ -8,6 +8,7 @@
 
 #include "llvm/IR/Attributes.h"
 #include "llvm/AsmParser/Parser.h"
+#include "llvm/IR/AttributeMask.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/InstrTypes.h"
 #include "llvm/IR/LLVMContext.h"
Index: llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
===
--- llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
+++ llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
@@ -14,6 +14,7 @@
 #include "ReduceInstructions.h"
 #include "Utils.h"
 #include "llvm/IR/Constants.h"
+#include 
 
 using namespace llvm;
 
Index: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
===
--- llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -19,6 +19,7 @@
 #include "llvm/Analysis/Loads.h"
 #include "llvm/Analysis/OptimizationRemarkEmitter.h"
 #include "llvm/Analysis/ValueTracking.h"
+#include "llvm/IR/AttributeMask.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuilder.h"
Index: llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
===
--- llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
+++ llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
@@ -14,6 +14,7 @@
 #include "llvm/Transforms/Utils/CallPromotionUtils.h"
 #include "llvm/Analysis/Loads.h"
 #include "llvm/Analysis/TypeMetadataUtils.h"
+#include "llvm/IR/AttributeMask.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
Index: llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
===
--- llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -27,6 +27,7 @@
 #include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/IR/Argument.h"
+#include "llvm/IR/AttributeMask.h"
 #include "llvm/IR/Attributes.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/CallingConv.h"
Index: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -160,6 +160,7 @@
 #include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/Analysis/ValueTracking.h"
 #include "llvm/IR/Argument.h"
+#include "llvm/IR/AttributeMask.h"
 #include "llvm/IR/Attributes.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/CallingConv.h"
Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -73,6 +73,7 @@
 #include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/Analysis/ValueTracking.h"
 #include "llvm/IR/Argument.h"
+#include "llvm/IR/AttributeMask.h"
 #include "llvm/IR/Attributes.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Constant.h"
Index: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
===
--- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineC

[PATCH] D147928: [clang] Keep multiple-include optimization for null directives

2023-04-10 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian created this revision.
IncludeGuardian added a reviewer: clang.
IncludeGuardian added a project: clang.
Herald added a project: All.
IncludeGuardian requested review of this revision.
Herald added a subscriber: cfe-commits.

The multiple-include optimization allows Clang to avoid opening a
files when they contain `#pragma once` or a proper include guard.

Both GCC and Microsoft Visual Studio allow null directives outside of
the `#ifndef`/`#endif` pair without disabling this multiple-include
optimization. GCC documents this behavior here
https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html.

> There must be no directives outside the controlling directive pair,
> but the null directive (a line containing nothing other than a
> single '#' and possibly whitespace) is permitted.

However, Clang disables the multiple-include optimization when
encountering the null directive.

In particular, this slows down preprocessing of most projects that
depend on boost as many boost libraries depend on the boost
preprocessor library, which contains null directives outside the
include guard on **every** header file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147928

Files:
  clang/include/clang/Lex/MultipleIncludeOpt.h
  clang/lib/Lex/PPDirectives.cpp
  clang/test/Preprocessor/multiple-inclusion-opt.cpp
  clang/test/Preprocessor/multiple-inclusion-opt.h


Index: clang/test/Preprocessor/multiple-inclusion-opt.h
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.h
@@ -0,0 +1,18 @@
+# // null directive and comments before include guard
+
+#ifndef MULTIPLE_INCLUSION_OPT
+
+int foo();
+
+// The position of the define should not matter
+#define MULTIPLE_INCLUSION_OPT
+
+int bar();
+
+#endif
+
+#
+#
+/* Two null directives
+   and a multiline comment
+   after the #endif */
Index: clang/test/Preprocessor/multiple-inclusion-opt.cpp
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -P -H %s 2>&1 | grep "multiple-inclusion-opt.h" | count 1
+
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -1177,6 +1177,12 @@
 
   switch (Result.getKind()) {
   case tok::eod:
+// Allow the null directive to appear outside of the include guard and 
still
+// keep multiple-include optimization. So if we haven't recorded any tokens
+// yet we can reset MIOpt to forget about the null directive.
+if (!ReadAnyTokensBeforeDirective) {
+  CurPPLexer->MIOpt.ResetReadToken();
+}
 return;   // null directive.
   case tok::code_completion:
 setCodeCompletionReached();
Index: clang/include/clang/Lex/MultipleIncludeOpt.h
===
--- clang/include/clang/Lex/MultipleIncludeOpt.h
+++ clang/include/clang/Lex/MultipleIncludeOpt.h
@@ -108,6 +108,12 @@
 ImmediatelyAfterTopLevelIfndef = false;
   }
 
+  /// ResetReadToken - reset whether we have read any tokens. Called when
+  /// encountering tokens outside of the include guard that have no effect if
+  /// the file in question is is included multiple times (e.g. the null
+  /// directive).
+  void ResetReadToken() { ReadAnyTokens = false; }
+
   /// ExpandedMacro - When a macro is expanded with this lexer as the current
   /// buffer, this method is called to disable the MIOpt if needed.
   void ExpandedMacro() { DidMacroExpansion = true; }


Index: clang/test/Preprocessor/multiple-inclusion-opt.h
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.h
@@ -0,0 +1,18 @@
+# // null directive and comments before include guard
+
+#ifndef MULTIPLE_INCLUSION_OPT
+
+int foo();
+
+// The position of the define should not matter
+#define MULTIPLE_INCLUSION_OPT
+
+int bar();
+
+#endif
+
+#
+#
+/* Two null directives
+   and a multiline comment
+   after the #endif */
Index: clang/test/Preprocessor/multiple-inclusion-opt.cpp
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -P -H %s 2>&1 | grep "multiple-inclusion-opt.h" | count 1
+
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDir

[PATCH] D147928: [clang] Keep multiple-include optimization for null directives

2023-04-10 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.

Differences between the behaviors of compilers can be found here 
https://github.com/IncludeGuardian/multiple-inclusion-optimization-tests

You can see the number of boost preprocessor files failing the include guard 
optimization when running IncludeGuardian  over 
Boost Graph 
https://gist.github.com/IncludeGuardian/0837719e0d1162d5b50e4c8fed4d3c0d#file-boost_graph-yaml-L345-L749

An example boost preprocessor header can be found here 
https://github.com/boostorg/preprocessor/blob/667e87b3392db338a919cbe0213979713aca52e3/include/boost/preprocessor.hpp.
 Note the consistent use of null directives outside of the guard.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147928

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


[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-05-20 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 524024.
IncludeGuardian added a comment.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Fix one missing `` include in tools and add `DenseMapInfoVariant.h`, 
which I forgot previously


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseMapInfoVariant.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h

Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,6 +21,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 
 
 namespace llvm {
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,6 +21,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 
 
 namespace llvm {
 namespace object {
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,6 +22,7 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 
 
 namespace llvm {
 namespace orc {
Index: llvm/include/llvm/CodeGen/CallingConvLower.h
===
--- llvm/include/llvm/CodeGen/CallingConvLower.h
+++ llvm/include/llvm/CodeGen/CallingConvLower.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/TargetCallingConv.h"
 #include "llvm/IR/CallingConv.h"
 #include "llvm/Support/Alignment.h"
+#include 
 
 namespace llvm {
 
Index: llvm/include/llvm/ADT/DenseMapInfoVariant.h
===
--- /dev/null
+++ llvm/include/llvm/ADT/DenseMapInfoVariant.h
@@ -0,0 +1,56 @@
+//===- DenseMapInfoVariant.h - Type traits for DenseMap *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// This file defines DenseMapInfo traits for DenseMap>.
+///
+//===--===//
+
+#ifndef LLVM_ADT_DENSEMAPINFOVARIANT_H
+#define LLVM_ADT_DENSEMAPINFOVARIANT_H
+
+#include "llvm/ADT/DenseMapInfo.h"
+#include 
+#include 
+
+namespace llvm {
+
+// Provide DenseMapInfo for variants whose all alternatives have DenseMapInfo.
+template  struct DenseMapInfo> {
+  using Variant = std::variant;
+  using FirstT = std::variant_alternative_t<0, Variant>;
+
+  static inline Variant getEmptyKey() {
+return Variant(std::in_place_index<0>, DenseMapInfo::getEmptyKey());
+  }
+
+  static inline Variant getTombstoneKey() {
+return Variant(std::in_place_index<0>,
+   DenseMapInfo::getTombstoneKey());
+  }
+
+  static unsigned getHashValue(const Variant &Val) {
+return std::visit(
+[&Val](auto &&Alternative) {
+  using T = std::decay_t;
+  // Include index in hash to make sure same value as different
+  // alternatives don't collide.
+  return DenseMapInfo>::getHashValueFromRef(
+  std::tie(Val.index(), Alternative));
+},
+Val);
+  }
+
+  static bool isEqual(const Variant &LHS, const Variant &RHS) {
+return LHS == RHS;
+  }
+};
+
+} // end namespace llvm
+
+#endif // LLVM_ADT_DENSEMAPINFOVARIANT_H
Index: llvm/include/llvm/ADT/DenseMapInfo.h
===
--- llvm/include/llvm/ADT/DenseMapInfo.h
+++ llvm/include/llvm/ADT/DenseMapInfo.h
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 
 namespace llvm {
 
@@ -234,6 +233,14 @@
 SecondInfo::getHashValue(PairVal.second));
   }
 
+  // Expose an additional function intended to be used by other
+  // specializations of DenseMapInfo without needing to know how
+  // to combine hash values manually
+  static unsigned getHashValueFromRef(const std::pair& PairRef) {
+return detail::combineHashValue(FirstInfo::getHashValue(PairRef.first),
+Seco

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-05-20 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added inline comments.



Comment at: llvm/include/llvm/ADT/DenseMapInfo.h:321
-  static bool isEqual(const Variant &LHS, const Variant &RHS) {
-return LHS == RHS;
-  }

Regardless of this change, I think the equality here needs to be fixed in the 
future to delegate to `DenseMapInfo` for checking equality of the contents of 
the `std::variant`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150997

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


[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-05-20 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 524041.
IncludeGuardian added a comment.

Add missing specialization for clang-include-cleaner/Types.h


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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseMapInfoVariant.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h

Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,6 +21,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 
 
 namespace llvm {
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,6 +21,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 
 
 namespace llvm {
 namespace object {
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,6 +22,7 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 
 
 namespace llvm {
 namespace orc {
Index: llvm/include/llvm/CodeGen/CallingConvLower.h
===
--- llvm/include/llvm/CodeGen/CallingConvLower.h
+++ llvm/include/llvm/CodeGen/CallingConvLower.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/TargetCallingConv.h"
 #include "llvm/IR/CallingConv.h"
 #include "llvm/Support/Alignment.h"
+#include 
 
 namespace llvm {
 
Index: llvm/include/llvm/ADT/DenseMapInfoVariant.h
===
--- /dev/null
+++ llvm/include/llvm/ADT/DenseMapInfoVariant.h
@@ -0,0 +1,56 @@
+//===- DenseMapInfoVariant.h - Type traits for DenseMap *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// This file defines DenseMapInfo traits for DenseMap>.
+///
+//===--===//
+
+#ifndef LLVM_ADT_DENSEMAPINFOVARIANT_H
+#define LLVM_ADT_DENSEMAPINFOVARIANT_H
+
+#include "llvm/ADT/DenseMapInfo.h"
+#include 
+#include 
+
+namespace llvm {
+
+// Provide DenseMapInfo for variants whose all alternatives have DenseMapInfo.
+template  struct DenseMapInfo> {
+  using Variant = std::variant;
+  using FirstT = std::variant_alternative_t<0, Variant>;
+
+  static inline Variant getEmptyKey() {
+return Variant(std::in_place_index<0>, DenseMapInfo::getEmptyKey());
+  }
+
+  static inline Variant getTombstoneKey() {
+return Variant(std::in_place_index<0>,
+   DenseMapInfo::getTombstoneKey());
+  }
+
+  static unsigned getHashValue(const Variant &Val) {
+return std::visit(
+[&Val](auto &&Alternative) {
+  using T = std::decay_t;
+  // Include index in hash to make sure same value as different
+  // alternatives don't collide.
+  return DenseMapInfo>::getHashValueFromRef(
+  std::tie(Val.index(), Alternative));
+},
+Val);
+  }
+
+  static bool isEqual(const Variant &LHS, const Variant &RHS) {
+return LHS == RHS;
+  }
+};
+
+} // end namespace llvm
+
+#endif // LLVM_ADT_DENSEMAPINFOVARIANT_H
Index: llvm/include/llvm/ADT/DenseMapInfo.h
===
--- llvm/include/llvm/ADT/DenseMapInfo.h
+++ llvm/include/llvm/ADT/DenseMapInfo.h
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 
 namespace llvm {
 
@@ -234,6 +233,14 @@
 SecondInfo::getHashValue(PairVal.second));
   }
 
+  // Expose an additional function intended to be used by other
+  // specializations of DenseMapInfo without needing to know how
+  // to combine hash values manually
+  static unsigned getHashValueFromRef(const std::pair& PairRef) {
+return detail::combineHashValue(FirstInfo::getHashValue(PairRef.first),
+SecondInfo::getHashValue(PairRef.second));
+  }
+
   static bool isEqual(const Pair &LHS, const Pair &RHS) {
 return FirstInfo::isEqual(LHS.first, RHS.first)

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-05-21 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 524094.
Herald added subscribers: bviyer, Moerafaat, zero9178, bzcheeseman, sdasgup3, 
wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, 
Kayjukh, grosul1, Joonsoo, stephenneuendorffer, liufengdb, aartbik, mgester, 
arpith-jacob, nicolasvasilache, antiagainst, shauheen, rriddle, mehdi_amini.
Herald added a reviewer: rriddle.
Herald added a project: MLIR.

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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseMapInfoVariant.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  mlir/include/mlir/IR/AsmState.h

Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/StringMap.h"
 
 #include 
+#include 
 
 namespace mlir {
 class AsmResourcePrinter;
Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,6 +21,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 
 
 namespace llvm {
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,6 +21,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 
 
 namespace llvm {
 namespace object {
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,6 +22,7 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 
 
 namespace llvm {
 namespace orc {
Index: llvm/include/llvm/CodeGen/CallingConvLower.h
===
--- llvm/include/llvm/CodeGen/CallingConvLower.h
+++ llvm/include/llvm/CodeGen/CallingConvLower.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/TargetCallingConv.h"
 #include "llvm/IR/CallingConv.h"
 #include "llvm/Support/Alignment.h"
+#include 
 
 namespace llvm {
 
Index: llvm/include/llvm/ADT/DenseMapInfoVariant.h
===
--- /dev/null
+++ llvm/include/llvm/ADT/DenseMapInfoVariant.h
@@ -0,0 +1,56 @@
+//===- DenseMapInfoVariant.h - Type traits for DenseMap *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// This file defines DenseMapInfo traits for DenseMap>.
+///
+//===--===//
+
+#ifndef LLVM_ADT_DENSEMAPINFOVARIANT_H
+#define LLVM_ADT_DENSEMAPINFOVARIANT_H
+
+#include "llvm/ADT/DenseMapInfo.h"
+#include 
+#include 
+
+namespace llvm {
+
+// Provide DenseMapInfo for variants whose all alternatives have DenseMapInfo.
+template  struct DenseMapInfo> {
+  using Variant = std::variant;
+  using FirstT = std::variant_alternative_t<0, Variant>;
+
+  static inline Variant getEmptyKey() {
+return Variant(std::in_place_index<0>, DenseMapInfo::getEmptyKey());
+  }
+
+  static inline Variant getTombstoneKey() {
+return Variant(std::in_place_index<0>,
+   DenseMapInfo::getTombstoneKey());
+  }
+
+  static unsigned getHashValue(const Variant &Val) {
+return std::visit(
+[&Val](auto &&Alternative) {
+  using T = std::decay_t;
+  // Include index in hash to make sure same value as different
+  // alternatives don't collide.
+  return DenseMapInfo>::getHashValuePiecewise(
+  Val.index(), Alternative);
+},
+Val);
+  }
+
+  static bool isEqual(const Variant &LHS, const Variant &RHS) {
+return LHS == RHS;
+  }
+};
+
+} // end namespace llvm
+
+#endif // LLVM_ADT_DENSEMAPINFOVARIANT_H
Index: llvm/include/llvm/ADT/DenseMapInfo.h
===
--- llvm/include/llvm/ADT/DenseMapInfo.h
+++ llvm/include/llvm/ADT/DenseMapInfo.h
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 
 namespace llvm {
 
@@ -234,6 

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-05-21 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 524109.

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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseMapInfoVariant.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  mlir/include/mlir/IR/AsmState.h

Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/StringMap.h"
 
 #include 
+#include 
 
 namespace mlir {
 class AsmResourcePrinter;
Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,6 +21,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 
 
 namespace llvm {
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,6 +21,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 
 
 namespace llvm {
 namespace object {
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,6 +22,7 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 
 
 namespace llvm {
 namespace orc {
Index: llvm/include/llvm/CodeGen/CallingConvLower.h
===
--- llvm/include/llvm/CodeGen/CallingConvLower.h
+++ llvm/include/llvm/CodeGen/CallingConvLower.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/TargetCallingConv.h"
 #include "llvm/IR/CallingConv.h"
 #include "llvm/Support/Alignment.h"
+#include 
 
 namespace llvm {
 
Index: llvm/include/llvm/ADT/DenseMapInfoVariant.h
===
--- /dev/null
+++ llvm/include/llvm/ADT/DenseMapInfoVariant.h
@@ -0,0 +1,56 @@
+//===- DenseMapInfoVariant.h - Type traits for DenseMap *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// This file defines DenseMapInfo traits for DenseMap>.
+///
+//===--===//
+
+#ifndef LLVM_ADT_DENSEMAPINFOVARIANT_H
+#define LLVM_ADT_DENSEMAPINFOVARIANT_H
+
+#include "llvm/ADT/DenseMapInfo.h"
+#include 
+#include 
+
+namespace llvm {
+
+// Provide DenseMapInfo for variants whose all alternatives have DenseMapInfo.
+template  struct DenseMapInfo> {
+  using Variant = std::variant;
+  using FirstT = std::variant_alternative_t<0, Variant>;
+
+  static inline Variant getEmptyKey() {
+return Variant(std::in_place_index<0>, DenseMapInfo::getEmptyKey());
+  }
+
+  static inline Variant getTombstoneKey() {
+return Variant(std::in_place_index<0>,
+   DenseMapInfo::getTombstoneKey());
+  }
+
+  static unsigned getHashValue(const Variant &Val) {
+return std::visit(
+[&Val](auto &&Alternative) {
+  using T = std::decay_t;
+  // Include index in hash to make sure same value as different
+  // alternatives don't collide.
+  return DenseMapInfo>::getHashValuePiecewise(
+  Val.index(), Alternative);
+},
+Val);
+  }
+
+  static bool isEqual(const Variant &LHS, const Variant &RHS) {
+return LHS == RHS;
+  }
+};
+
+} // end namespace llvm
+
+#endif // LLVM_ADT_DENSEMAPINFOVARIANT_H
Index: llvm/include/llvm/ADT/DenseMapInfo.h
===
--- llvm/include/llvm/ADT/DenseMapInfo.h
+++ llvm/include/llvm/ADT/DenseMapInfo.h
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 
 namespace llvm {
 
@@ -234,6 +233,14 @@
 SecondInfo::getHashValue(PairVal.second));
   }
 
+  // Expose an additional function intended to be used by other
+  // specializations of DenseMapInfo without needing to know how
+  // to combine hash values manually
+  static unsigned getHashValuePiecewise(const T& First, const U& Second) {
+return detail::combineHashValu

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-05-21 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 524125.

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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  flang/include/flang/Optimizer/HLFIR/HLFIROps.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseMapInfoVariant.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  mlir/include/mlir/IR/AsmState.h

Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/StringMap.h"
 
 #include 
+#include 
 
 namespace mlir {
 class AsmResourcePrinter;
Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,6 +21,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 
 
 namespace llvm {
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,6 +21,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 
 
 namespace llvm {
 namespace object {
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,6 +22,7 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 
 
 namespace llvm {
 namespace orc {
Index: llvm/include/llvm/CodeGen/CallingConvLower.h
===
--- llvm/include/llvm/CodeGen/CallingConvLower.h
+++ llvm/include/llvm/CodeGen/CallingConvLower.h
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/TargetCallingConv.h"
 #include "llvm/IR/CallingConv.h"
 #include "llvm/Support/Alignment.h"
+#include 
 
 namespace llvm {
 
Index: llvm/include/llvm/ADT/DenseMapInfoVariant.h
===
--- /dev/null
+++ llvm/include/llvm/ADT/DenseMapInfoVariant.h
@@ -0,0 +1,56 @@
+//===- DenseMapInfoVariant.h - Type traits for DenseMap *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// This file defines DenseMapInfo traits for DenseMap>.
+///
+//===--===//
+
+#ifndef LLVM_ADT_DENSEMAPINFOVARIANT_H
+#define LLVM_ADT_DENSEMAPINFOVARIANT_H
+
+#include "llvm/ADT/DenseMapInfo.h"
+#include 
+#include 
+
+namespace llvm {
+
+// Provide DenseMapInfo for variants whose all alternatives have DenseMapInfo.
+template  struct DenseMapInfo> {
+  using Variant = std::variant;
+  using FirstT = std::variant_alternative_t<0, Variant>;
+
+  static inline Variant getEmptyKey() {
+return Variant(std::in_place_index<0>, DenseMapInfo::getEmptyKey());
+  }
+
+  static inline Variant getTombstoneKey() {
+return Variant(std::in_place_index<0>,
+   DenseMapInfo::getTombstoneKey());
+  }
+
+  static unsigned getHashValue(const Variant &Val) {
+return std::visit(
+[&Val](auto &&Alternative) {
+  using T = std::decay_t;
+  // Include index in hash to make sure same value as different
+  // alternatives don't collide.
+  return DenseMapInfo>::getHashValuePiecewise(
+  Val.index(), Alternative);
+},
+Val);
+  }
+
+  static bool isEqual(const Variant &LHS, const Variant &RHS) {
+return LHS == RHS;
+  }
+};
+
+} // end namespace llvm
+
+#endif // LLVM_ADT_DENSEMAPINFOVARIANT_H
Index: llvm/include/llvm/ADT/DenseMapInfo.h
===
--- llvm/include/llvm/ADT/DenseMapInfo.h
+++ llvm/include/llvm/ADT/DenseMapInfo.h
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 
 namespace llvm {
 
@@ -234,6 +233,14 @@
 SecondInfo::getHashValue(PairVal.second));
   }
 
+  // Expose an additional function intended to be used by other
+  // specializations of DenseMapInfo without needing to know how
+  // to combine hash values manually
+  static unsigned getHashValuePiecewise(const T& First, const

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-05-21 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian requested review of this revision.
IncludeGuardian added inline comments.



Comment at: flang/include/flang/Optimizer/HLFIR/HLFIROps.h:22
 #include "mlir/Interfaces/SideEffectInterfaces.h"
+#include 
 

I wasn't sure if it is possible to include `` within `HLFIROps.td` so 
it has been included here instead.


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

https://reviews.llvm.org/D150997

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


[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-05-23 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.

@kadircet Thanks I will run this through the formatter.

Thanks for fixing `isEqual`. I am currently on holiday for a few weeks so 
cannot guarantee when I'll be able to update this PR. I say go ahead with your 
fix and I'll incorporate those changes into this review when I am back.


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

https://reviews.llvm.org/D150997

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


[PATCH] D147928: [clang] Keep multiple-include optimization for null directives

2023-04-18 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added inline comments.



Comment at: clang/lib/Lex/PPDirectives.cpp:1183-1185
+if (!ReadAnyTokensBeforeDirective) {
+  CurPPLexer->MIOpt.ResetReadToken();
+}

aaron.ballman wrote:
> NFC but matches our style guide.
> 
> One thing to consider: making the call a setter instead of a reset would 
> simplify this logic into: 
> `CurPPLexer->SetReadToken(ReadAnyTokensBeforeDirective);` without any 
> branching required. WDYT?
Sounds good. Removing the condition here should look neater.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147928

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


[PATCH] D147928: [clang] Keep multiple-include optimization for null directives

2023-04-19 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 514849.
IncludeGuardian added a comment.

Replace `ResetReadToken` with `SetReadToken` to avoid a conditional


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

https://reviews.llvm.org/D147928

Files:
  clang/include/clang/Lex/MultipleIncludeOpt.h
  clang/lib/Lex/PPDirectives.cpp
  clang/test/Preprocessor/multiple-inclusion-opt.cpp
  clang/test/Preprocessor/multiple-inclusion-opt.h


Index: clang/test/Preprocessor/multiple-inclusion-opt.h
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.h
@@ -0,0 +1,18 @@
+# // null directive and comments before include guard
+
+#ifndef MULTIPLE_INCLUSION_OPT
+
+int foo();
+
+// The position of the define should not matter
+#define MULTIPLE_INCLUSION_OPT
+
+int bar();
+
+#endif
+
+#
+#
+/* Two null directives
+   and a multiline comment
+   after the #endif */
Index: clang/test/Preprocessor/multiple-inclusion-opt.cpp
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -P -H %s 2>&1 | grep "multiple-inclusion-opt.h" | count 1
+
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -1177,6 +1177,10 @@
 
   switch (Result.getKind()) {
   case tok::eod:
+// Ignore the null directive with regards to the multiple-include
+// optimization, i.e. allow the null directive to appear outside of the
+// include guard and still enable the multiple-include optimization.
+CurPPLexer->MIOpt.SetReadToken(ReadAnyTokensBeforeDirective);
 return;   // null directive.
   case tok::code_completion:
 setCodeCompletionReached();
Index: clang/include/clang/Lex/MultipleIncludeOpt.h
===
--- clang/include/clang/Lex/MultipleIncludeOpt.h
+++ clang/include/clang/Lex/MultipleIncludeOpt.h
@@ -108,6 +108,12 @@
 ImmediatelyAfterTopLevelIfndef = false;
   }
 
+  /// SetReadToken - Set whether the value of 'ReadAnyTokens'.  Called to
+  /// override when encountering tokens outside of the include guard that have
+  /// no effect if the file in question is is included multiple times (e.g. the
+  /// null directive).
+  void SetReadToken(bool Value) { ReadAnyTokens = Value; }
+
   /// ExpandedMacro - When a macro is expanded with this lexer as the current
   /// buffer, this method is called to disable the MIOpt if needed.
   void ExpandedMacro() { DidMacroExpansion = true; }


Index: clang/test/Preprocessor/multiple-inclusion-opt.h
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.h
@@ -0,0 +1,18 @@
+# // null directive and comments before include guard
+
+#ifndef MULTIPLE_INCLUSION_OPT
+
+int foo();
+
+// The position of the define should not matter
+#define MULTIPLE_INCLUSION_OPT
+
+int bar();
+
+#endif
+
+#
+#
+/* Two null directives
+   and a multiline comment
+   after the #endif */
Index: clang/test/Preprocessor/multiple-inclusion-opt.cpp
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -P -H %s 2>&1 | grep "multiple-inclusion-opt.h" | count 1
+
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -1177,6 +1177,10 @@
 
   switch (Result.getKind()) {
   case tok::eod:
+// Ignore the null directive with regards to the multiple-include
+// optimization, i.e. allow the null directive to appear outside of the
+// include guard and still enable the multiple-include optimization.
+CurPPLexer->MIOpt.SetReadToken(ReadAnyTokensBeforeDirective);
 return;   // null directive.
   case tok::code_completion:
 setCodeCompletionReached();
Index: clang/include/clang/Lex/MultipleIncludeOpt.h
===
--- clang/include/clang/Lex/MultipleIncludeOpt.h
+++ clang/include/clang/Lex/MultipleIncludeOpt.h
@@ -108,6 +108,12 @@
 ImmediatelyAfterTopLevelIfndef = false;
   }
 
+  /// SetReadToken - Set whether the value of 'ReadAnyTokens'.  Called to
+  /// override when encountering tokens outside of the include guard that have
+  /// no effect if the file in question is is inc

[PATCH] D147928: [clang] Keep multiple-include optimization for null directives

2023-04-26 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 517291.
IncludeGuardian added a comment.

Update Clang release notes


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

https://reviews.llvm.org/D147928

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Lex/MultipleIncludeOpt.h
  clang/lib/Lex/PPDirectives.cpp
  clang/test/Preprocessor/multiple-inclusion-opt.cpp
  clang/test/Preprocessor/multiple-inclusion-opt.h


Index: clang/test/Preprocessor/multiple-inclusion-opt.h
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.h
@@ -0,0 +1,18 @@
+# // null directive and comments before include guard
+
+#ifndef MULTIPLE_INCLUSION_OPT
+
+int foo();
+
+// The position of the define should not matter
+#define MULTIPLE_INCLUSION_OPT
+
+int bar();
+
+#endif
+
+#
+#
+/* Two null directives
+   and a multiline comment
+   after the #endif */
Index: clang/test/Preprocessor/multiple-inclusion-opt.cpp
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -P -H %s 2>&1 | grep "multiple-inclusion-opt.h" | count 1
+
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -1177,6 +1177,10 @@
 
   switch (Result.getKind()) {
   case tok::eod:
+// Ignore the null directive with regards to the multiple-include
+// optimization, i.e. allow the null directive to appear outside of the
+// include guard and still enable the multiple-include optimization.
+CurPPLexer->MIOpt.SetReadToken(ReadAnyTokensBeforeDirective);
 return;   // null directive.
   case tok::code_completion:
 setCodeCompletionReached();
Index: clang/include/clang/Lex/MultipleIncludeOpt.h
===
--- clang/include/clang/Lex/MultipleIncludeOpt.h
+++ clang/include/clang/Lex/MultipleIncludeOpt.h
@@ -108,6 +108,12 @@
 ImmediatelyAfterTopLevelIfndef = false;
   }
 
+  /// SetReadToken - Set whether the value of 'ReadAnyTokens'.  Called to
+  /// override when encountering tokens outside of the include guard that have
+  /// no effect if the file in question is is included multiple times (e.g. the
+  /// null directive).
+  void SetReadToken(bool Value) { ReadAnyTokens = Value; }
+
   /// ExpandedMacro - When a macro is expanded with this lexer as the current
   /// buffer, this method is called to disable the MIOpt if needed.
   void ExpandedMacro() { DidMacroExpansion = true; }
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -148,6 +148,8 @@
 - Clang now supports expressions in ``#pragma clang __debug dump``.
 - Clang now supports declaration of multi-dimensional arrays with
   ``__declspec(property)``.
+- Clang now ignores null directives outside of the include guard when deciding
+  whether a file can be enabled for the multiple-include optimization.
 
 New Compiler Flags
 --


Index: clang/test/Preprocessor/multiple-inclusion-opt.h
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.h
@@ -0,0 +1,18 @@
+# // null directive and comments before include guard
+
+#ifndef MULTIPLE_INCLUSION_OPT
+
+int foo();
+
+// The position of the define should not matter
+#define MULTIPLE_INCLUSION_OPT
+
+int bar();
+
+#endif
+
+#
+#
+/* Two null directives
+   and a multiline comment
+   after the #endif */
Index: clang/test/Preprocessor/multiple-inclusion-opt.cpp
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -P -H %s 2>&1 | grep "multiple-inclusion-opt.h" | count 1
+
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -1177,6 +1177,10 @@
 
   switch (Result.getKind()) {
   case tok::eod:
+// Ignore the null directive with regards to the multiple-include
+// optimization, i.e. allow the null directive to appear outside of the
+// include guard and still enable the multiple-include optimization.
+CurPPLexer->MIOpt.SetReadToken(ReadAnyTokensBeforeDirective);
 return;   // null directive.
   case tok::code_comple

[PATCH] D147928: [clang] Keep multiple-include optimization for null directives

2023-04-26 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian added a comment.

@aaron.ballman If you could commit for me that would be great. Please use 
"Elliot Goodrich" for the name and "elliotgoodr...@gmail.com" for the email - 
thank you!


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

https://reviews.llvm.org/D147928

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


[PATCH] D147928: [clang] Keep multiple-include optimization for null directives

2023-04-26 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 517310.
IncludeGuardian added a comment.

Rebase on upstream to resolve conflicts in release notes


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

https://reviews.llvm.org/D147928

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Lex/MultipleIncludeOpt.h
  clang/lib/Lex/PPDirectives.cpp
  clang/test/Preprocessor/multiple-inclusion-opt.cpp
  clang/test/Preprocessor/multiple-inclusion-opt.h


Index: clang/test/Preprocessor/multiple-inclusion-opt.h
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.h
@@ -0,0 +1,18 @@
+# // null directive and comments before include guard
+
+#ifndef MULTIPLE_INCLUSION_OPT
+
+int foo();
+
+// The position of the define should not matter
+#define MULTIPLE_INCLUSION_OPT
+
+int bar();
+
+#endif
+
+#
+#
+/* Two null directives
+   and a multiline comment
+   after the #endif */
Index: clang/test/Preprocessor/multiple-inclusion-opt.cpp
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -P -H %s 2>&1 | grep "multiple-inclusion-opt.h" | count 1
+
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -1177,6 +1177,10 @@
 
   switch (Result.getKind()) {
   case tok::eod:
+// Ignore the null directive with regards to the multiple-include
+// optimization, i.e. allow the null directive to appear outside of the
+// include guard and still enable the multiple-include optimization.
+CurPPLexer->MIOpt.SetReadToken(ReadAnyTokensBeforeDirective);
 return;   // null directive.
   case tok::code_completion:
 setCodeCompletionReached();
Index: clang/include/clang/Lex/MultipleIncludeOpt.h
===
--- clang/include/clang/Lex/MultipleIncludeOpt.h
+++ clang/include/clang/Lex/MultipleIncludeOpt.h
@@ -108,6 +108,12 @@
 ImmediatelyAfterTopLevelIfndef = false;
   }
 
+  /// SetReadToken - Set whether the value of 'ReadAnyTokens'.  Called to
+  /// override when encountering tokens outside of the include guard that have
+  /// no effect if the file in question is is included multiple times (e.g. the
+  /// null directive).
+  void SetReadToken(bool Value) { ReadAnyTokens = Value; }
+
   /// ExpandedMacro - When a macro is expanded with this lexer as the current
   /// buffer, this method is called to disable the MIOpt if needed.
   void ExpandedMacro() { DidMacroExpansion = true; }
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -157,6 +157,8 @@
 - A new builtin type trait ``__is_trivially_equaltiy_comparable`` has been 
added,
   which checks whether comparing two instances of a type is equivalent to
   ``memcmp(&lhs, &rhs, sizeof(T)) == 0``.
+- Clang now ignores null directives outside of the include guard when deciding
+  whether a file can be enabled for the multiple-include optimization.
 
 New Compiler Flags
 --


Index: clang/test/Preprocessor/multiple-inclusion-opt.h
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.h
@@ -0,0 +1,18 @@
+# // null directive and comments before include guard
+
+#ifndef MULTIPLE_INCLUSION_OPT
+
+int foo();
+
+// The position of the define should not matter
+#define MULTIPLE_INCLUSION_OPT
+
+int bar();
+
+#endif
+
+#
+#
+/* Two null directives
+   and a multiline comment
+   after the #endif */
Index: clang/test/Preprocessor/multiple-inclusion-opt.cpp
===
--- /dev/null
+++ clang/test/Preprocessor/multiple-inclusion-opt.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E -P -H %s 2>&1 | grep "multiple-inclusion-opt.h" | count 1
+
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
+#include "multiple-inclusion-opt.h"
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -1177,6 +1177,10 @@
 
   switch (Result.getKind()) {
   case tok::eod:
+// Ignore the null directive with regards to the multiple-include
+// optimization, i.e. allow the null directive to appear outside of the
+// include guard and still enable the multiple-include optimization.
+CurPPLexer->MIOpt.SetReadToken(ReadAnyTokensBeforeDir

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-06-12 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 530667.
IncludeGuardian added a comment.

Fix missing includes in test, fix formatting, and rebase on top of 
https://reviews.llvm.org/D151557


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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  flang/include/flang/Optimizer/HLFIR/HLFIROps.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/unittests/ADT/DenseMapTest.cpp
  mlir/include/mlir/IR/AsmState.h
  mlir/include/mlir/Transforms/SROA.h

Index: mlir/include/mlir/Transforms/SROA.h
===
--- mlir/include/mlir/Transforms/SROA.h
+++ mlir/include/mlir/Transforms/SROA.h
@@ -13,9 +13,10 @@
 #include "mlir/Interfaces/MemorySlotInterfaces.h"
 #include "mlir/Support/LogicalResult.h"
 #include "llvm/ADT/Statistic.h"
+#include 

 namespace mlir {

 /// Statistics collected while applying SROA.
 struct SROAStatistics {
   /// Total amount of memory slots destructured.
Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,20 +20,21 @@
 #include "llvm/ADT/StringMap.h"

 #include 
+#include 

 namespace mlir {
 class AsmResourcePrinter;
 class AsmDialectResourceHandle;
 class Operation;

 namespace detail {
 class AsmStateImpl;
 } // namespace detail

 //===--===//
 // Resources
 //===--===//

 /// The following classes enable support for parsing and printing resources
 /// within MLIR assembly formats. Resources are a mechanism by which dialects,
 /// and external clients, may attach additional information when parsing or
Index: llvm/unittests/ADT/DenseMapTest.cpp
===
--- llvm/unittests/ADT/DenseMapTest.cpp
+++ llvm/unittests/ADT/DenseMapTest.cpp
@@ -8,20 +8,21 @@

 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/DenseMapInfoVariant.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
 #include 
 #include 
 #include 

 using namespace llvm;

 namespace {

 uint32_t getTestKey(int i, uint32_t *) { return i; }
 uint32_t getTestValue(int i, uint32_t *) { return 42 + i; }

 uint32_t *getTestKey(int i, uint32_t **) {
   static uint32_t dummy_arr1[8192];
   assert(i < 8192 && "Only support 8192 dummy keys.");
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,13 +21,14 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 

 namespace llvm {
 namespace object {

 namespace DirectX {
 class PSVRuntimeInfo {

   // This class provides a view into the underlying resource array. The Resource
   // data is little-endian encoded and may not be properly aligned to read
   // directly from. The dereference operator creates a copy of the data and byte
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,74 +22,75 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 

 namespace llvm {
 namespace orc {

 class LLJITBuilderState;
 class LLLazyJITBuilderState;
 class ObjectTransformLayer;
 class ExecutorProcessControl;

 /// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
 ///
 /// Create instances using LLJITBuilder.
 class LLJIT {
   template  friend class LLJITBuilderSetters;

   friend Expected setUpGenericLLVMIRPlatform(LLJIT &J);

 public:
   /// Initializer support for LLJIT.
   class PlatformSupport {
   public:
 virtual ~PlatformSupport();

 virtual Error initialize(JITDylib &JD) = 0;

 virtual Error deinitialize(JITDylib &JD) = 0;

   protected:
 static void setInitTransform(LLJIT &J,
  IRTransformLayer::TransformFunction T);
   };

   /// Destruct this instance. If a multi-threaded instance, waits for all
   /// compile threads to complete.
   virtual ~LLJIT();

   /// Returns the ExecutionSession for this instance.
   ExecutionSession &getExecutionSession() { return *ES; }

   /// Returns a reference to the triple for this instance.
   const Triple &getTargetTriple() const { return TT; }

   /// Returns a reference to the DataLayout for this instance.
   const DataLayout &g

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-06-12 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 530787.

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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  flang/include/flang/Optimizer/HLFIR/HLFIROps.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/unittests/ADT/DenseMapTest.cpp
  mlir/include/mlir/IR/AsmState.h
  mlir/include/mlir/Transforms/SROA.h

Index: mlir/include/mlir/Transforms/SROA.h
===
--- mlir/include/mlir/Transforms/SROA.h
+++ mlir/include/mlir/Transforms/SROA.h
@@ -13,9 +13,10 @@
 #include "mlir/Interfaces/MemorySlotInterfaces.h"
 #include "mlir/Support/LogicalResult.h"
 #include "llvm/ADT/Statistic.h"
+#include 

 namespace mlir {

 /// Statistics collected while applying SROA.
 struct SROAStatistics {
   /// Total amount of memory slots destructured.
Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,20 +20,21 @@
 #include "llvm/ADT/StringMap.h"

 #include 
+#include 

 namespace mlir {
 class AsmResourcePrinter;
 class AsmDialectResourceHandle;
 class Operation;

 namespace detail {
 class AsmStateImpl;
 } // namespace detail

 //===--===//
 // Resources
 //===--===//

 /// The following classes enable support for parsing and printing resources
 /// within MLIR assembly formats. Resources are a mechanism by which dialects,
 /// and external clients, may attach additional information when parsing or
Index: llvm/unittests/ADT/DenseMapTest.cpp
===
--- llvm/unittests/ADT/DenseMapTest.cpp
+++ llvm/unittests/ADT/DenseMapTest.cpp
@@ -8,20 +8,21 @@

 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/DenseMapInfoVariant.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
 #include 
 #include 
 #include 

 using namespace llvm;

 namespace {

 uint32_t getTestKey(int i, uint32_t *) { return i; }
 uint32_t getTestValue(int i, uint32_t *) { return 42 + i; }

 uint32_t *getTestKey(int i, uint32_t **) {
   static uint32_t dummy_arr1[8192];
   assert(i < 8192 && "Only support 8192 dummy keys.");
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,13 +21,14 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 

 namespace llvm {
 namespace object {

 namespace DirectX {
 class PSVRuntimeInfo {

   // This class provides a view into the underlying resource array. The Resource
   // data is little-endian encoded and may not be properly aligned to read
   // directly from. The dereference operator creates a copy of the data and byte
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,74 +22,75 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 

 namespace llvm {
 namespace orc {

 class LLJITBuilderState;
 class LLLazyJITBuilderState;
 class ObjectTransformLayer;
 class ExecutorProcessControl;

 /// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
 ///
 /// Create instances using LLJITBuilder.
 class LLJIT {
   template  friend class LLJITBuilderSetters;

   friend Expected setUpGenericLLVMIRPlatform(LLJIT &J);

 public:
   /// Initializer support for LLJIT.
   class PlatformSupport {
   public:
 virtual ~PlatformSupport();

 virtual Error initialize(JITDylib &JD) = 0;

 virtual Error deinitialize(JITDylib &JD) = 0;

   protected:
 static void setInitTransform(LLJIT &J,
  IRTransformLayer::TransformFunction T);
   };

   /// Destruct this instance. If a multi-threaded instance, waits for all
   /// compile threads to complete.
   virtual ~LLJIT();

   /// Returns the ExecutionSession for this instance.
   ExecutionSession &getExecutionSession() { return *ES; }

   /// Returns a reference to the triple for this instance.
   const Triple &getTargetTriple() const { return TT; }

   /// Returns a reference to the DataLayout for this instance.
   const DataLayout &getDataLayout() const { return DL; }

   /// Returns a reference to the JITDylib representing the JIT'd main program.
   JITDylib &getMai

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-06-13 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 530819.

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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  flang/include/flang/Optimizer/HLFIR/HLFIROps.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  llvm/unittests/ADT/DenseMapTest.cpp
  mlir/include/mlir/IR/AsmState.h
  mlir/include/mlir/Transforms/SROA.h

Index: mlir/include/mlir/Transforms/SROA.h
===
--- mlir/include/mlir/Transforms/SROA.h
+++ mlir/include/mlir/Transforms/SROA.h
@@ -13,9 +13,10 @@
 #include "mlir/Interfaces/MemorySlotInterfaces.h"
 #include "mlir/Support/LogicalResult.h"
 #include "llvm/ADT/Statistic.h"
+#include 

 namespace mlir {

 /// Statistics collected while applying SROA.
 struct SROAStatistics {
   /// Total amount of memory slots destructured.
Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,20 +20,21 @@
 #include "llvm/ADT/StringMap.h"

 #include 
+#include 

 namespace mlir {
 class AsmResourcePrinter;
 class AsmDialectResourceHandle;
 class Operation;

 namespace detail {
 class AsmStateImpl;
 } // namespace detail

 //===--===//
 // Resources
 //===--===//

 /// The following classes enable support for parsing and printing resources
 /// within MLIR assembly formats. Resources are a mechanism by which dialects,
 /// and external clients, may attach additional information when parsing or
Index: llvm/unittests/ADT/DenseMapTest.cpp
===
--- llvm/unittests/ADT/DenseMapTest.cpp
+++ llvm/unittests/ADT/DenseMapTest.cpp
@@ -8,20 +8,21 @@

 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/DenseMapInfoVariant.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
 #include 
 #include 
 #include 

 using namespace llvm;

 namespace {

 uint32_t getTestKey(int i, uint32_t *) { return i; }
 uint32_t getTestValue(int i, uint32_t *) { return 42 + i; }

 uint32_t *getTestKey(int i, uint32_t **) {
   static uint32_t dummy_arr1[8192];
   assert(i < 8192 && "Only support 8192 dummy keys.");
Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,10 +21,11 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 

 namespace llvm {

 class AllocaInst;
 class LoadInst;
 class StoreInst;
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,13 +21,14 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 

 namespace llvm {
 namespace object {

 namespace DirectX {
 class PSVRuntimeInfo {

   // This class provides a view into the underlying resource array. The Resource
   // data is little-endian encoded and may not be properly aligned to read
   // directly from. The dereference operator creates a copy of the data and byte
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,74 +22,75 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 

 namespace llvm {
 namespace orc {

 class LLJITBuilderState;
 class LLLazyJITBuilderState;
 class ObjectTransformLayer;
 class ExecutorProcessControl;

 /// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
 ///
 /// Create instances using LLJITBuilder.
 class LLJIT {
   template  friend class LLJITBuilderSetters;

   friend Expected setUpGenericLLVMIRPlatform(LLJIT &J);

 public:
   /// Initializer support for LLJIT.
   class PlatformSupport {
   public:
 virtual ~PlatformSupport();

 virtual Error initialize(JITDylib &JD) = 0;

 virtual Error deinitialize(JITDylib &JD) = 0;

   protected:
 static void setInitTransform(LLJIT &J,
  IRTransformLayer::TransformFunction T);
   };

   /// Destruct this instance. If a multi-threaded instance, waits for all
   /// compile threads to complete.

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-06-13 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 530855.

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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  flang/include/flang/Optimizer/HLFIR/HLFIROps.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  llvm/unittests/ADT/DenseMapTest.cpp
  mlir/include/mlir/IR/AsmState.h
  mlir/include/mlir/Transforms/SROA.h

Index: mlir/include/mlir/Transforms/SROA.h
===
--- mlir/include/mlir/Transforms/SROA.h
+++ mlir/include/mlir/Transforms/SROA.h
@@ -13,9 +13,10 @@
 #include "mlir/Interfaces/MemorySlotInterfaces.h"
 #include "mlir/Support/LogicalResult.h"
 #include "llvm/ADT/Statistic.h"
+#include 

 namespace mlir {

 /// Statistics collected while applying SROA.
 struct SROAStatistics {
   /// Total amount of memory slots destructured.
Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,20 +20,21 @@
 #include "llvm/ADT/StringMap.h"

 #include 
+#include 

 namespace mlir {
 class AsmResourcePrinter;
 class AsmDialectResourceHandle;
 class Operation;

 namespace detail {
 class AsmStateImpl;
 } // namespace detail

 //===--===//
 // Resources
 //===--===//

 /// The following classes enable support for parsing and printing resources
 /// within MLIR assembly formats. Resources are a mechanism by which dialects,
 /// and external clients, may attach additional information when parsing or
Index: llvm/unittests/ADT/DenseMapTest.cpp
===
--- llvm/unittests/ADT/DenseMapTest.cpp
+++ llvm/unittests/ADT/DenseMapTest.cpp
@@ -8,20 +8,21 @@

 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/DenseMapInfoVariant.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
 #include 
 #include 
 #include 

 using namespace llvm;

 namespace {

 uint32_t getTestKey(int i, uint32_t *) { return i; }
 uint32_t getTestValue(int i, uint32_t *) { return 42 + i; }

 uint32_t *getTestKey(int i, uint32_t **) {
   static uint32_t dummy_arr1[8192];
   assert(i < 8192 && "Only support 8192 dummy keys.");
Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,10 +21,11 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 

 namespace llvm {

 class AllocaInst;
 class LoadInst;
 class StoreInst;
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,13 +21,14 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 

 namespace llvm {
 namespace object {

 namespace DirectX {
 class PSVRuntimeInfo {

   // This class provides a view into the underlying resource array. The Resource
   // data is little-endian encoded and may not be properly aligned to read
   // directly from. The dereference operator creates a copy of the data and byte
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,74 +22,75 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 

 namespace llvm {
 namespace orc {

 class LLJITBuilderState;
 class LLLazyJITBuilderState;
 class ObjectTransformLayer;
 class ExecutorProcessControl;

 /// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
 ///
 /// Create instances using LLJITBuilder.
 class LLJIT {
   template  friend class LLJITBuilderSetters;

   friend Expected setUpGenericLLVMIRPlatform(LLJIT &J);

 public:
   /// Initializer support for LLJIT.
   class PlatformSupport {
   public:
 virtual ~PlatformSupport();

 virtual Error initialize(JITDylib &JD) = 0;

 virtual Error deinitialize(JITDylib &JD) = 0;

   protected:
 static void setInitTransform(LLJIT &J,
  IRTransformLayer::TransformFunction T);
   };

   /// Destruct this instance. If a multi-threaded instance, waits for all
   /// compile threads to complete.

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-06-13 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 531060.

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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  flang/include/flang/Optimizer/HLFIR/HLFIROps.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseMapInfoVariant.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  llvm/unittests/ADT/DenseMapTest.cpp
  mlir/include/mlir/IR/AsmState.h
  mlir/include/mlir/Transforms/SROA.h

Index: mlir/include/mlir/Transforms/SROA.h
===
--- mlir/include/mlir/Transforms/SROA.h
+++ mlir/include/mlir/Transforms/SROA.h
@@ -13,9 +13,10 @@
 #include "mlir/Interfaces/MemorySlotInterfaces.h"
 #include "mlir/Support/LogicalResult.h"
 #include "llvm/ADT/Statistic.h"
+#include 

 namespace mlir {

 /// Statistics collected while applying SROA.
 struct SROAStatistics {
   /// Total amount of memory slots destructured.
Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,20 +20,21 @@
 #include "llvm/ADT/StringMap.h"

 #include 
+#include 

 namespace mlir {
 class AsmResourcePrinter;
 class AsmDialectResourceHandle;
 class Operation;

 namespace detail {
 class AsmStateImpl;
 } // namespace detail

 //===--===//
 // Resources
 //===--===//

 /// The following classes enable support for parsing and printing resources
 /// within MLIR assembly formats. Resources are a mechanism by which dialects,
 /// and external clients, may attach additional information when parsing or
Index: llvm/unittests/ADT/DenseMapTest.cpp
===
--- llvm/unittests/ADT/DenseMapTest.cpp
+++ llvm/unittests/ADT/DenseMapTest.cpp
@@ -8,20 +8,21 @@

 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/DenseMapInfoVariant.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
 #include 
 #include 
 #include 

 using namespace llvm;

 namespace {

 uint32_t getTestKey(int i, uint32_t *) { return i; }
 uint32_t getTestValue(int i, uint32_t *) { return 42 + i; }

 uint32_t *getTestKey(int i, uint32_t **) {
   static uint32_t dummy_arr1[8192];
   assert(i < 8192 && "Only support 8192 dummy keys.");
Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,10 +21,11 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 

 namespace llvm {

 class AllocaInst;
 class LoadInst;
 class StoreInst;
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,13 +21,14 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 

 namespace llvm {
 namespace object {

 namespace DirectX {
 class PSVRuntimeInfo {

   // This class provides a view into the underlying resource array. The Resource
   // data is little-endian encoded and may not be properly aligned to read
   // directly from. The dereference operator creates a copy of the data and byte
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,74 +22,75 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 

 namespace llvm {
 namespace orc {

 class LLJITBuilderState;
 class LLLazyJITBuilderState;
 class ObjectTransformLayer;
 class ExecutorProcessControl;

 /// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
 ///
 /// Create instances using LLJITBuilder.
 class LLJIT {
   template  friend class LLJITBuilderSetters;

   friend Expected setUpGenericLLVMIRPlatform(LLJIT &J);

 public:
   /// Initializer support for LLJIT.
   class PlatformSupport {
   public:
 virtual ~PlatformSupport();

 virtual Error initialize(JITDylib &JD) = 0;

 virtual Error deinitialize(JITDylib &JD) = 0;

   protected:
 static void setInitTransform(LLJIT &J,
  IRTransformLayer::TransformFunction T);
   };

   /// Destruct this instance. If a multi-threaded instance, wait

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-06-15 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 531895.

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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  flang/include/flang/Optimizer/HLFIR/HLFIROps.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseMapInfoVariant.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  llvm/unittests/ADT/DenseMapTest.cpp
  mlir/include/mlir/IR/AsmState.h
  mlir/include/mlir/Transforms/SROA.h

Index: mlir/include/mlir/Transforms/SROA.h
===
--- mlir/include/mlir/Transforms/SROA.h
+++ mlir/include/mlir/Transforms/SROA.h
@@ -13,9 +13,10 @@
 #include "mlir/Interfaces/MemorySlotInterfaces.h"
 #include "mlir/Support/LogicalResult.h"
 #include "llvm/ADT/Statistic.h"
+#include 

 namespace mlir {

 /// Statistics collected while applying SROA.
 struct SROAStatistics {
   /// Total amount of memory slots destructured.
Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,20 +20,21 @@
 #include "llvm/ADT/StringMap.h"

 #include 
+#include 

 namespace mlir {
 class AsmResourcePrinter;
 class AsmDialectResourceHandle;
 class Operation;

 namespace detail {
 class AsmStateImpl;
 } // namespace detail

 //===--===//
 // Resources
 //===--===//

 /// The following classes enable support for parsing and printing resources
 /// within MLIR assembly formats. Resources are a mechanism by which dialects,
 /// and external clients, may attach additional information when parsing or
Index: llvm/unittests/ADT/DenseMapTest.cpp
===
--- llvm/unittests/ADT/DenseMapTest.cpp
+++ llvm/unittests/ADT/DenseMapTest.cpp
@@ -8,20 +8,21 @@

 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/DenseMapInfoVariant.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
 #include 
 #include 
 #include 

 using namespace llvm;

 namespace {

 uint32_t getTestKey(int i, uint32_t *) { return i; }
 uint32_t getTestValue(int i, uint32_t *) { return 42 + i; }

 uint32_t *getTestKey(int i, uint32_t **) {
   static uint32_t dummy_arr1[8192];
   assert(i < 8192 && "Only support 8192 dummy keys.");
Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,10 +21,11 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 

 namespace llvm {

 class AllocaInst;
 class LoadInst;
 class StoreInst;
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,13 +21,14 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 

 namespace llvm {
 namespace object {

 namespace DirectX {
 class PSVRuntimeInfo {

   // This class provides a view into the underlying resource array. The Resource
   // data is little-endian encoded and may not be properly aligned to read
   // directly from. The dereference operator creates a copy of the data and byte
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,74 +22,75 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 

 namespace llvm {
 namespace orc {

 class LLJITBuilderState;
 class LLLazyJITBuilderState;
 class ObjectTransformLayer;
 class ExecutorProcessControl;

 /// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
 ///
 /// Create instances using LLJITBuilder.
 class LLJIT {
   template  friend class LLJITBuilderSetters;

   friend Expected setUpGenericLLVMIRPlatform(LLJIT &J);

 public:
   /// Initializer support for LLJIT.
   class PlatformSupport {
   public:
 virtual ~PlatformSupport();

 virtual Error initialize(JITDylib &JD) = 0;

 virtual Error deinitialize(JITDylib &JD) = 0;

   protected:
 static void setInitTransform(LLJIT &J,
  IRTransformLayer::TransformFunction T);
   };

   /// Destruct this instance. If a multi-threaded instance, wait

[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-06-16 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 532038.
IncludeGuardian added a comment.

Run clang-format over patch


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

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  flang/include/flang/Optimizer/HLFIR/HLFIROps.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseMapInfoVariant.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  llvm/unittests/ADT/DenseMapTest.cpp
  mlir/include/mlir/IR/AsmState.h
  mlir/include/mlir/Transforms/SROA.h

Index: mlir/include/mlir/Transforms/SROA.h
===
--- mlir/include/mlir/Transforms/SROA.h
+++ mlir/include/mlir/Transforms/SROA.h
@@ -13,9 +13,10 @@
 #include "mlir/Interfaces/MemorySlotInterfaces.h"
 #include "mlir/Support/LogicalResult.h"
 #include "llvm/ADT/Statistic.h"
+#include 

 namespace mlir {

 /// Statistics collected while applying SROA.
 struct SROAStatistics {
   /// Total amount of memory slots destructured.
Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,20 +20,21 @@
 #include "llvm/ADT/StringMap.h"

 #include 
+#include 

 namespace mlir {
 class AsmResourcePrinter;
 class AsmDialectResourceHandle;
 class Operation;

 namespace detail {
 class AsmStateImpl;
 } // namespace detail

 //===--===//
 // Resources
 //===--===//

 /// The following classes enable support for parsing and printing resources
 /// within MLIR assembly formats. Resources are a mechanism by which dialects,
 /// and external clients, may attach additional information when parsing or
Index: llvm/unittests/ADT/DenseMapTest.cpp
===
--- llvm/unittests/ADT/DenseMapTest.cpp
+++ llvm/unittests/ADT/DenseMapTest.cpp
@@ -8,20 +8,21 @@

 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/DenseMapInfoVariant.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
 #include 
 #include 
 #include 

 using namespace llvm;

 namespace {

 uint32_t getTestKey(int i, uint32_t *) { return i; }
 uint32_t getTestValue(int i, uint32_t *) { return 42 + i; }

 uint32_t *getTestKey(int i, uint32_t **) {
   static uint32_t dummy_arr1[8192];
   assert(i < 8192 && "Only support 8192 dummy keys.");
Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,10 +21,11 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 

 namespace llvm {

 class AllocaInst;
 class LoadInst;
 class StoreInst;
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,13 +21,14 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 

 namespace llvm {
 namespace object {

 namespace DirectX {
 class PSVRuntimeInfo {

   // This class provides a view into the underlying resource array. The Resource
   // data is little-endian encoded and may not be properly aligned to read
   // directly from. The dereference operator creates a copy of the data and byte
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,74 +22,75 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 

 namespace llvm {
 namespace orc {

 class LLJITBuilderState;
 class LLLazyJITBuilderState;
 class ObjectTransformLayer;
 class ExecutorProcessControl;

 /// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
 ///
 /// Create instances using LLJITBuilder.
 class LLJIT {
   template  friend class LLJITBuilderSetters;

   friend Expected setUpGenericLLVMIRPlatform(LLJIT &J);

 public:
   /// Initializer support for LLJIT.
   class PlatformSupport {
   public:
 virtual ~PlatformSupport();

 virtual Error initialize(JITDylib &JD) = 0;

 virtual Error deinitialize(JITDylib &JD) = 0;

   protected:
 static void setInitTransform(LLJIT &J,
  IRTransformLayer::TransformFunction T);
   };