[llvm-branch-commits] [flang] [llvm] [mlir] [MLIR][OpenMP] Make omp.simdloop into a loop wrapper (PR #87365)

2024-04-09 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak updated 
https://github.com/llvm/llvm-project/pull/87365

>From 3bcb4198c25d08ff7b4a220715fbe5e27e12414c Mon Sep 17 00:00:00 2001
From: Sergio Afonso 
Date: Tue, 2 Apr 2024 17:20:37 +0100
Subject: [PATCH] [MLIR][Flang][OpenMP] Make omp.simdloop into a loop wrapper

This patch updates the definition of `omp.simdloop` to enforce the restrictions
of a wrapper operation. It has been renamed to `omp.simd`, to better reflect
the naming used in the spec. All uses of "simdloop" in function names have been
updated accordingly.

Some changes to Flang lowering and OpenMP to LLVM IR translation are introduced
to prevent the introduction of compilation/test failures. The eventual long
term solution might be different.
---
 flang/lib/Lower/OpenMP/OpenMP.cpp | 100 +
 .../Fir/convert-to-llvm-openmp-and-fir.fir| 101 +
 flang/test/Lower/OpenMP/FIR/if-clause.f90 |  23 +-
 flang/test/Lower/OpenMP/FIR/loop-combined.f90 |   2 +-
 .../OpenMP/FIR/parallel-private-clause.f90|   3 +-
 flang/test/Lower/OpenMP/FIR/simd.f90  | 109 +-
 flang/test/Lower/OpenMP/if-clause.f90 |  23 +-
 flang/test/Lower/OpenMP/loop-combined.f90 |   2 +-
 .../Lower/OpenMP/parallel-private-clause.f90  |   3 +-
 flang/test/Lower/OpenMP/simd.f90  | 123 ++-
 .../Frontend/OpenMPIRBuilderTest.cpp  |   2 +-
 mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td |  56 ++---
 .../Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp  |  34 +--
 mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp  |  12 +-
 .../OpenMP/OpenMPToLLVMIRTranslation.cpp  |  40 ++--
 .../OpenMPToLLVM/convert-to-llvmir.mlir   |  31 +--
 mlir/test/Dialect/OpenMP/invalid.mlir | 159 --
 mlir/test/Dialect/OpenMP/ops.mlir | 203 +-
 mlir/test/Target/LLVMIR/openmp-llvm.mlir  | 157 +++---
 19 files changed, 634 insertions(+), 549 deletions(-)

diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 340921c867246c..1800fcb19dcd2e 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -521,7 +521,7 @@ struct OpWithBodyGenInfo {
 /// \param [in]   op - the operation the body belongs to.
 /// \param [in] info - options controlling code-gen for the construction.
 template 
-static void createBodyOfOp(Op &op, OpWithBodyGenInfo &info) {
+static void createBodyOfOp(mlir::Operation &op, OpWithBodyGenInfo &info) {
   fir::FirOpBuilder &firOpBuilder = info.converter.getFirOpBuilder();
 
   auto insertMarker = [](fir::FirOpBuilder &builder) {
@@ -537,10 +537,10 @@ static void createBodyOfOp(Op &op, OpWithBodyGenInfo 
&info) {
   auto regionArgs =
   [&]() -> llvm::SmallVector {
 if (info.genRegionEntryCB != nullptr) {
-  return info.genRegionEntryCB(op);
+  return info.genRegionEntryCB(&op);
 }
 
-firOpBuilder.createBlock(&op.getRegion());
+firOpBuilder.createBlock(&op.getRegion(0));
 return {};
   }();
   // Mark the earliest insertion point.
@@ -556,7 +556,7 @@ static void createBodyOfOp(Op &op, OpWithBodyGenInfo &info) 
{
   // Start with privatization, so that the lowering of the nested
   // code will use the right symbols.
   constexpr bool isLoop = std::is_same_v ||
-  std::is_same_v;
+  std::is_same_v;
   bool privatize = info.clauses && !info.outerCombined;
 
   firOpBuilder.setInsertionPoint(marker);
@@ -582,9 +582,9 @@ static void createBodyOfOp(Op &op, OpWithBodyGenInfo &info) 
{
 // a lot of complications for our approach if the terminator generation
 // is delayed past this point. Insert a temporary terminator here, then
 // delete it.
-firOpBuilder.setInsertionPointToEnd(&op.getRegion().back());
-auto *temp = Fortran::lower::genOpenMPTerminator(
-firOpBuilder, op.getOperation(), info.loc);
+firOpBuilder.setInsertionPointToEnd(&op.getRegion(0).back());
+auto *temp =
+Fortran::lower::genOpenMPTerminator(firOpBuilder, &op, info.loc);
 firOpBuilder.setInsertionPointAfter(marker);
 genNestedEvaluations(info.converter, info.eval);
 temp->erase();
@@ -626,23 +626,36 @@ static void createBodyOfOp(Op &op, OpWithBodyGenInfo 
&info) {
 return exit;
   };
 
-  if (auto *exitBlock = getUniqueExit(op.getRegion())) {
+  if (auto *exitBlock = getUniqueExit(op.getRegion(0))) {
 firOpBuilder.setInsertionPointToEnd(exitBlock);
-auto *term = Fortran::lower::genOpenMPTerminator(
-firOpBuilder, op.getOperation(), info.loc);
+auto *term =
+Fortran::lower::genOpenMPTerminator(firOpBuilder, &op, info.loc);
 // Only insert lastprivate code when there actually is an exit block.
 // Such a block may not exist if the nested code produced an infinite
 // loop (this may not make sense in production code, but a user could
 // write that and we should handle it).
 firOpBuilder.setInsertionPoint(term);
 if (priva

[llvm-branch-commits] [flang] [llvm] [mlir] [MLIR][OpenMP] Make omp.simdloop into a loop wrapper (PR #87365)

2024-04-09 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak edited 
https://github.com/llvm/llvm-project/pull/87365
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [llvm] [mlir] [MLIR][Flang][OpenMP] Make omp.simdloop into a loop wrapper (PR #87365)

2024-04-09 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak edited 
https://github.com/llvm/llvm-project/pull/87365
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [llvm] [mlir] [MLIR][Flang][OpenMP] Make omp.simdloop into a loop wrapper (PR #87365)

2024-04-09 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak ready_for_review 
https://github.com/llvm/llvm-project/pull/87365
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [llvm] [mlir] [MLIR][Flang][OpenMP] Make omp.simdloop into a loop wrapper (PR #87365)

2024-04-09 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-mlir-llvm

Author: Sergio Afonso (skatrak)


Changes

This patch updates the definition of `omp.simdloop` to enforce the restrictions 
of a wrapper operation. It has been renamed to `omp.simd`, to better reflect 
the naming used in the spec. All uses of "simdloop" in function names have been 
updated accordingly.

Some changes to Flang lowering and OpenMP to LLVM IR translation are introduced 
to prevent the introduction of compilation/test failures. The eventual long 
term solution might be different.

---

Patch is 95.59 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/87365.diff


19 Files Affected:

- (modified) flang/lib/Lower/OpenMP/OpenMP.cpp (+60-40) 
- (modified) flang/test/Fir/convert-to-llvm-openmp-and-fir.fir (+54-47) 
- (modified) flang/test/Lower/OpenMP/FIR/if-clause.f90 (+11-12) 
- (modified) flang/test/Lower/OpenMP/FIR/loop-combined.f90 (+1-1) 
- (modified) flang/test/Lower/OpenMP/FIR/parallel-private-clause.f90 (+2-1) 
- (modified) flang/test/Lower/OpenMP/FIR/simd.f90 (+59-50) 
- (modified) flang/test/Lower/OpenMP/if-clause.f90 (+11-12) 
- (modified) flang/test/Lower/OpenMP/loop-combined.f90 (+1-1) 
- (modified) flang/test/Lower/OpenMP/parallel-private-clause.f90 (+2-1) 
- (modified) flang/test/Lower/OpenMP/simd.f90 (+66-57) 
- (modified) llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp (+1-1) 
- (modified) mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td (+22-34) 
- (modified) mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp (+18-16) 
- (modified) mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp (+8-4) 
- (modified) 
mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp (+21-19) 
- (modified) mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir (+17-14) 
- (modified) mlir/test/Dialect/OpenMP/invalid.mlir (+91-68) 
- (modified) mlir/test/Dialect/OpenMP/ops.mlir (+105-98) 
- (modified) mlir/test/Target/LLVMIR/openmp-llvm.mlir (+84-73) 


``diff
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 340921c867246c..1800fcb19dcd2e 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -521,7 +521,7 @@ struct OpWithBodyGenInfo {
 /// \param [in]   op - the operation the body belongs to.
 /// \param [in] info - options controlling code-gen for the construction.
 template 
-static void createBodyOfOp(Op &op, OpWithBodyGenInfo &info) {
+static void createBodyOfOp(mlir::Operation &op, OpWithBodyGenInfo &info) {
   fir::FirOpBuilder &firOpBuilder = info.converter.getFirOpBuilder();
 
   auto insertMarker = [](fir::FirOpBuilder &builder) {
@@ -537,10 +537,10 @@ static void createBodyOfOp(Op &op, OpWithBodyGenInfo 
&info) {
   auto regionArgs =
   [&]() -> llvm::SmallVector {
 if (info.genRegionEntryCB != nullptr) {
-  return info.genRegionEntryCB(op);
+  return info.genRegionEntryCB(&op);
 }
 
-firOpBuilder.createBlock(&op.getRegion());
+firOpBuilder.createBlock(&op.getRegion(0));
 return {};
   }();
   // Mark the earliest insertion point.
@@ -556,7 +556,7 @@ static void createBodyOfOp(Op &op, OpWithBodyGenInfo &info) 
{
   // Start with privatization, so that the lowering of the nested
   // code will use the right symbols.
   constexpr bool isLoop = std::is_same_v ||
-  std::is_same_v;
+  std::is_same_v;
   bool privatize = info.clauses && !info.outerCombined;
 
   firOpBuilder.setInsertionPoint(marker);
@@ -582,9 +582,9 @@ static void createBodyOfOp(Op &op, OpWithBodyGenInfo &info) 
{
 // a lot of complications for our approach if the terminator generation
 // is delayed past this point. Insert a temporary terminator here, then
 // delete it.
-firOpBuilder.setInsertionPointToEnd(&op.getRegion().back());
-auto *temp = Fortran::lower::genOpenMPTerminator(
-firOpBuilder, op.getOperation(), info.loc);
+firOpBuilder.setInsertionPointToEnd(&op.getRegion(0).back());
+auto *temp =
+Fortran::lower::genOpenMPTerminator(firOpBuilder, &op, info.loc);
 firOpBuilder.setInsertionPointAfter(marker);
 genNestedEvaluations(info.converter, info.eval);
 temp->erase();
@@ -626,23 +626,36 @@ static void createBodyOfOp(Op &op, OpWithBodyGenInfo 
&info) {
 return exit;
   };
 
-  if (auto *exitBlock = getUniqueExit(op.getRegion())) {
+  if (auto *exitBlock = getUniqueExit(op.getRegion(0))) {
 firOpBuilder.setInsertionPointToEnd(exitBlock);
-auto *term = Fortran::lower::genOpenMPTerminator(
-firOpBuilder, op.getOperation(), info.loc);
+auto *term =
+Fortran::lower::genOpenMPTerminator(firOpBuilder, &op, info.loc);
 // Only insert lastprivate code when there actually is an exit block.
 // Such a block may not exist if the nested code produced an infinite
 // loop (this may not make sense in production code, but a user could
 // write that and we should handle it).
 f

[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87967

>From c856716bbb987e09ee86b31287808736ef4f2f9b Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Tue, 9 Apr 2024 04:52:43 -0700
Subject: [PATCH] Added test

Created using spr 1.3.4
---
 bolt/include/bolt/Core/BinaryFunction.h |  3 ++-
 bolt/lib/Core/BinaryEmitter.cpp |  4 ++--
 bolt/test/X86/patch-entries.test| 23 ++-
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/bolt/include/bolt/Core/BinaryFunction.h 
b/bolt/include/bolt/Core/BinaryFunction.h
index bc047fefa3151c..26d2d01f862671 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -1402,7 +1402,8 @@ class BinaryFunction {
 
   /// Return true if the function has CFI instructions
   bool hasCFI() const {
-return !FrameInstructions.empty() || !CIEFrameInstructions.empty();
+return !FrameInstructions.empty() || !CIEFrameInstructions.empty() ||
+   IsInjected;
   }
 
   /// Return unique number associated with the function.
diff --git a/bolt/lib/Core/BinaryEmitter.cpp b/bolt/lib/Core/BinaryEmitter.cpp
index 56bd65a51600d1..97d19b75200f51 100644
--- a/bolt/lib/Core/BinaryEmitter.cpp
+++ b/bolt/lib/Core/BinaryEmitter.cpp
@@ -347,7 +347,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
   }
 
   // Emit CFI start
-  if (Function.hasCFI() || Function.isInjected()) {
+  if (Function.hasCFI()) {
 Streamer.emitCFIStartProc(/*IsSimple=*/false);
 if (Function.getPersonalityFunction() != nullptr)
   Streamer.emitCFIPersonality(Function.getPersonalityFunction(),
@@ -394,7 +394,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
 Streamer.emitBytes(BC.MIB->getTrapFillValue());
 
   // Emit CFI end
-  if (Function.hasCFI() || Function.isInjected())
+  if (Function.hasCFI())
 Streamer.emitCFIEndProc();
 
   MCSymbol *EndSymbol = Function.getFunctionEndLabel(FF.getFragmentNum());
diff --git a/bolt/test/X86/patch-entries.test b/bolt/test/X86/patch-entries.test
index 54f358f273e793..331f8a312f4820 100644
--- a/bolt/test/X86/patch-entries.test
+++ b/bolt/test/X86/patch-entries.test
@@ -7,4 +7,25 @@ REQUIRES: system-linux
 
 RUN: %clang %cflags -no-pie -g %p/Inputs/patch-entries.c -fuse-ld=lld -o 
%t.exe \
 RUN:   -Wl,-q -I%p/../Inputs
-RUN: llvm-bolt -relocs %t.exe -o %t.out --update-debug-sections --force-patch
+RUN: llvm-bolt -relocs %t.exe -o %t.out --update-debug-sections --force-patch \
+RUN:   --enable-bat
+
+# Check that patched functions can be disassembled (override FDE from the
+# original function)
+# PREAGG: B X:0 #foo.org.0# 1 0
+RUN: link_fdata %s %t.out %t.preagg PREAGG
+RUN: perf2bolt %t.out -p %t.preagg --pa -o %t.yaml --profile-format=yaml \
+RUN:   -print-disasm -print-only=foo.org.0/1 2>&1 | FileCheck %s
+CHECK-NOT: BOLT-WARNING: sizes differ for function foo.org.0/1. FDE : 23; 
symbol table : 5. Using max size.
+CHECK: Binary Function "foo.org.0/1(*2)" after disassembly {
+
+# Check the expected eh_frame contents
+RUN: llvm-nm --print-size %t.out > %t.foo
+RUN: llvm-objdump %t.out --dwarf=frames >> %t.foo
+RUN: FileCheck %s --input-file %t.foo --check-prefix=CHECK-FOO
+CHECK-FOO: [[#FOO:]] {{.*}} foo
+CHECK-FOO: [[#ORG:]] {{.*}} foo.org.0
+# patched FDE comes first
+CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]...00[[#ORG+5]]
+# original FDE comes second
+CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]...00[[#ORG+23]]

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


[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/87967
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov ready_for_review 
https://github.com/llvm/llvm-project/pull/87967
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Reland "[compiler-rt] Allow running tests without installing first" (PR #88075)

2024-04-09 Thread Martin Storsjö via llvm-branch-commits

mstorsjo wrote:

> @mstorsjo It would be great if you could test this on windows.

Thanks, this does seem to run fine in my configuration!

https://github.com/llvm/llvm-project/pull/88075
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Amir Ayupov via llvm-branch-commits

aaupov wrote:

> Let's make `hasCFI()` return true for injected functions.

Given that this change increases the size of eh_frame section, should we make 
it dependent on `enable-bat`, i.e. when we expect to feed the binary back to 
BOLT?

Because otherwise this "fix" is a pure size regression.

https://github.com/llvm/llvm-project/pull/87967
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Reland "[compiler-rt] Allow running tests without installing first" (PR #88075)

2024-04-09 Thread Alexander Richardson via llvm-branch-commits

arichardson wrote:

> > @mstorsjo It would be great if you could test this on windows.
> 
> Thanks, this does seem to run fine in my configuration!

Thank you very much for testing!

https://github.com/llvm/llvm-project/pull/88075
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] Reland "[compiler-rt] Allow running tests without installing first" (PR #88075)

2024-04-09 Thread Alexander Richardson via llvm-branch-commits

https://github.com/arichardson updated 
https://github.com/llvm/llvm-project/pull/88075


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


[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)

2024-04-09 Thread Ilya Biryukov via llvm-branch-commits

ilya-biryukov wrote:

We have hit quite a few issues when trying this out. I have spent a day trying 
to reduce to a small repro that I can share, but haven't not fully succeeded 
yet, I will continue tomorrow.
Still wanted to share the error descriptions in case that would allow to make 
progress in the meanwhile.

* Crash with the following assertion failure:

```
assert.h assertion failed at 
third_party/llvm/llvm-project/clang/include/clang/AST/DeclCXX.h:464 in struct 
DefinitionData &clang::CXXRecordDecl::data() const: DD && "queried property of 
class with no definition"
*** Check failure stack trace: ***
@ 0x55fb619aaea4  absl::log_internal::LogMessage::SendToLog()
@ 0x55fb619aad04  absl::log_internal::LogMessage::Flush()
@ 0x55fb619ab209  
absl::log_internal::LogMessageFatal::~LogMessageFatal()
@ 0x55fb6199a3e4  __assert_fail
@ 0x55fb5bd8d400  clang::CXXRecordDecl::data()
@ 0x55fb5e24de0d  clang::CXXBasePaths::lookupInBases()
@ 0x55fb5e24e388  clang::CXXBasePaths::lookupInBases()
@ 0x55fb5e24d55c  clang::CXXRecordDecl::lookupInBases()
@ 0x55fb5da8bd60  clang::Sema::LookupQualifiedName()
@ 0x55fb5dc747f3  clang::Sema::CheckTypenameType()
@ 0x55fb5de19e72  clang::TreeTransform<>::TransformDependentNameType()
@ 0x55fb5ddee35c  clang::TreeTransform<>::TransformType()
@ 0x55fb5ddedd3f  clang::TreeTransform<>::TransformType()
@ 0x55fb5dded94d  clang::Sema::SubstType()
@ 0x55fb5dc62c9f  SubstDefaultTemplateArgument()
@ 0x55fb5dc58761  clang::Sema::CheckTemplateArgumentList()
@ 0x55fb5dc5720b  clang::Sema::CheckTemplateIdType()
@ 0x55fb5de19086  
clang::TreeTransform<>::TransformTemplateSpecializationType()
@ 0x55fb5de2115d  
clang::TreeTransform<>::TransformTemplateSpecializationType()
@ 0x55fb5ddee280  clang::TreeTransform<>::TransformType()
@ 0x55fb5de1dc1a  clang::TreeTransform<>::TransformElaboratedType()
@ 0x55fb5ddee3c4  clang::TreeTransform<>::TransformType()
@ 0x55fb5ddedd3f  clang::TreeTransform<>::TransformType()
@ 0x55fb5dded94d  clang::Sema::SubstType()
@ 0x55fb5dc62c9f  SubstDefaultTemplateArgument()
@ 0x55fb5dc62632  clang::Sema::SubstDefaultTemplateArgumentIfAvailable()
@ 0x55fb5dd7056b  clang::Sema::FinishTemplateArgumentDeduction()
@ 0x55fb5dde5796  llvm::function_ref<>::callback_fn<>()
@ 0x55fb5d420dcf  clang::Sema::runWithSufficientStackSpace()
@ 0x55fb5dd729f4  clang::Sema::DeduceTemplateArguments()
@ 0x55fb5dbc00d5  clang::Sema::AddTemplateOverloadCandidate()
@ 0x55fb5da7065d  ResolveConstructorOverload()
@ 0x55fb5da52dd8  TryConstructorInitialization()
@ 0x55fb5da50e7a  TryDefaultInitialization()
@ 0x55fb5da4e6b1  clang::InitializationSequence::InitializeFrom()
@ 0x55fb5d72c3ed  CollectFieldInitializer()
@ 0x55fb5d72a972  clang::Sema::SetCtorInitializers()
@ 0x55fb5d72ef65  clang::Sema::ActOnDefaultCtorInitializers()
@ 0x55fb5d2401b0  clang::Parser::ParseLexedMethodDef()
@ 0x55fb5d23e77a  clang::Parser::ParseLexedMethodDefs()
@ 0x55fb5d1b50e0  clang::Parser::ParseCXXMemberSpecification()
@ 0x55fb5d1b2744  clang::Parser::ParseClassSpecifier()
@ 0x55fb5d1d8ef0  clang::Parser::ParseDeclarationSpecifiers()
@ 0x55fb5d15ea4a  clang::Parser::ParseDeclOrFunctionDefInternal()
@ 0x55fb5d15e5b6  clang::Parser::ParseDeclarationOrFunctionDefinition()
@ 0x55fb5d15d2ea  clang::Parser::ParseExternalDeclaration()
@ 0x55fb5d1a8c73  clang::Parser::ParseInnerNamespace()
@ 0x55fb5d1a7e4f  clang::Parser::ParseNamespace()
@ 0x55fb5d1d2bde  clang::Parser::ParseDeclaration()
@ 0x55fb5d15ceb6  clang::Parser::ParseExternalDeclaration()
@ 0x55fb5d1a8c73  clang::Parser::ParseInnerNamespace()
@ 0x55fb5d1a7e4f  clang::Parser::ParseNamespace()
@ 0x55fb5d1d2bde  clang::Parser::ParseDeclaration()
@ 0x55fb5d15ceb6  clang::Parser::ParseExternalDeclaration()
@ 0x55fb5d15b04b  clang::Parser::ParseTopLevelDecl()
@ 0x55fb5d154d2e  clang::ParseAST()
@ 0x55fb5cea31e3  clang::FrontendAction::Execute()
@ 0x55fb5ce1c62d  clang::CompilerInstance::ExecuteAction()
@ 0x55fb5bd4a20e  clang::ExecuteCompilerInvocation()
@ 0x55fb5bd3e106  cc1_main()
@ 0x55fb5bd3b9a6  ExecuteCC1Tool()
```

* Invalid errors about absence or presence of certain members in 
std::pointer_traits and other types:

```
third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/pointer_traits.h:161:3:
 error: 'std::pointer_traits::pointer_to' 
from module '/
/third_party/crosstool/v18/stable:stl_cc_library.third_party/stl/cxx17/optional'
 is not present in definition of 'std::pointer_traits' provided earlier
  161 |   pointer_to(__conditional_t::value, __nat, 
elemen

[llvm-branch-commits] [llvm] release/18.x: [lit][ci] Publish lit wheels (#88072) (PR #88155)

2024-04-09 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/88155

Backport 8a8ab8f70cbb5507d1aa55efcd9c6e61ad4e891c

Requested by: @seldridge

>From 4e7b0b41a2688800aad36afbefa72575c95e3214 Mon Sep 17 00:00:00 2001
From: Schuyler Eldridge 
Date: Tue, 9 Apr 2024 11:55:17 -0400
Subject: [PATCH] [lit][ci] Publish lit wheels (#88072)

Add wheel publishing in addition to existing source distribution
publishing of lit.

Fixes #63369. This also uses the exact fix proposed by @EFord36 in
#63369.

Signed-off-by: Schuyler Eldridge 
(cherry picked from commit 8a8ab8f70cbb5507d1aa55efcd9c6e61ad4e891c)
---
 .github/workflows/release-lit.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/release-lit.yml 
b/.github/workflows/release-lit.yml
index 36b0b6edd518fc..0316ba406041d6 100644
--- a/.github/workflows/release-lit.yml
+++ b/.github/workflows/release-lit.yml
@@ -58,7 +58,7 @@ jobs:
   cd llvm/utils/lit
   # Remove 'dev' suffix from lit version.
   sed -i 's/ + "dev"//g' lit/__init__.py
-  python3 setup.py sdist
+  python3 setup.py sdist bdist_wheel
 
   - name: Upload lit to test.pypi.org
 uses: pypa/gh-action-pypi-publish@release/v1

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


[llvm-branch-commits] [llvm] release/18.x: [lit][ci] Publish lit wheels (#88072) (PR #88155)

2024-04-09 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/88155
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: [lit][ci] Publish lit wheels (#88072) (PR #88155)

2024-04-09 Thread via llvm-branch-commits

llvmbot wrote:

@tru What do you think about merging this PR to the release branch?

https://github.com/llvm/llvm-project/pull/88155
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/18.x: [lit][ci] Publish lit wheels (#88072) (PR #88155)

2024-04-09 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-github-workflow

Author: None (llvmbot)


Changes

Backport 8a8ab8f70cbb5507d1aa55efcd9c6e61ad4e891c

Requested by: @seldridge

---
Full diff: https://github.com/llvm/llvm-project/pull/88155.diff


1 Files Affected:

- (modified) .github/workflows/release-lit.yml (+1-1) 


``diff
diff --git a/.github/workflows/release-lit.yml 
b/.github/workflows/release-lit.yml
index 36b0b6edd518fc..0316ba406041d6 100644
--- a/.github/workflows/release-lit.yml
+++ b/.github/workflows/release-lit.yml
@@ -58,7 +58,7 @@ jobs:
   cd llvm/utils/lit
   # Remove 'dev' suffix from lit version.
   sed -i 's/ + "dev"//g' lit/__init__.py
-  python3 setup.py sdist
+  python3 setup.py sdist bdist_wheel
 
   - name: Upload lit to test.pypi.org
 uses: pypa/gh-action-pypi-publish@release/v1

``




https://github.com/llvm/llvm-project/pull/88155
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 6c25843 - Revert "[ADT] Use `adl_*` wrappers across STLExtras (#87936)"

2024-04-09 Thread via llvm-branch-commits

Author: Jakub Kuderski
Date: 2024-04-09T13:18:20-04:00
New Revision: 6c25843c67e4bf5d14e864dabdb0c80500d12535

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

LOG: Revert "[ADT] Use `adl_*` wrappers across STLExtras (#87936)"

This reverts commit 9e418c94cd1393408d201f215be8631d1f41e857.

Added: 


Modified: 
llvm/include/llvm/ADT/STLExtras.h

Removed: 




diff  --git a/llvm/include/llvm/ADT/STLExtras.h 
b/llvm/include/llvm/ADT/STLExtras.h
index f906f7acfc1c4a..08a708e5c5871e 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -320,8 +320,7 @@ template  class Callable {
 
 /// Returns true if the given container only contains a single element.
 template  bool hasSingleElement(ContainerTy &&C) {
-  auto B = adl_begin(C);
-  auto E = adl_end(C);
+  auto B = std::begin(C), E = std::end(C);
   return B != E && std::next(B) == E;
 }
 
@@ -376,7 +375,8 @@ inline mapped_iterator map_iterator(ItTy I, 
FuncTy F) {
 
 template 
 auto map_range(ContainerTy &&C, FuncTy F) {
-  return make_range(map_iterator(adl_begin(C), F), map_iterator(adl_end(C), 
F));
+  return make_range(map_iterator(std::begin(C), F),
+map_iterator(std::end(C), F));
 }
 
 /// A base type of mapped iterator, that is useful for building derived
@@ -572,11 +572,11 @@ 
iterator_range, PredicateT>>
 make_filter_range(RangeT &&Range, PredicateT Pred) {
   using FilterIteratorT =
   filter_iterator, PredicateT>;
-  return make_range(FilterIteratorT(adl_begin(std::forward(Range)),
-adl_end(std::forward(Range)), 
Pred),
-FilterIteratorT(adl_end(std::forward(Range)),
-adl_end(std::forward(Range)),
-Pred));
+  return make_range(
+  FilterIteratorT(std::begin(std::forward(Range)),
+  std::end(std::forward(Range)), Pred),
+  FilterIteratorT(std::end(std::forward(Range)),
+  std::end(std::forward(Range)), Pred));
 }
 
 /// A pseudo-iterator adaptor that is designed to implement "early increment"
@@ -656,8 +656,8 @@ 
iterator_range>>
 make_early_inc_range(RangeT &&Range) {
   using EarlyIncIteratorT =
   early_inc_iterator_impl>;
-  return make_range(EarlyIncIteratorT(adl_begin(std::forward(Range))),
-EarlyIncIteratorT(adl_end(std::forward(Range;
+  return make_range(EarlyIncIteratorT(std::begin(std::forward(Range))),
+EarlyIncIteratorT(std::end(std::forward(Range;
 }
 
 // Forward declarations required by 
zip_shortest/zip_equal/zip_first/zip_longest
@@ -1097,8 +1097,8 @@ class concat_iterator
   /// We need the full range to know how to switch between each of the
   /// iterators.
   template 
-  explicit concat_iterator(RangeTs &&...Ranges)
-  : Begins(adl_begin(Ranges)...), Ends(adl_end(Ranges)...) {}
+  explicit concat_iterator(RangeTs &&... Ranges)
+  : Begins(std::begin(Ranges)...), Ends(std::end(Ranges)...) {}
 
   using BaseT::operator++;
 
@@ -1127,12 +1127,13 @@ template  class 
concat_range {
 public:
   using iterator =
   concat_iterator()))...>;
+  decltype(std::begin(std::declval()))...>;
 
 private:
   std::tuple Ranges;
 
-  template  iterator begin_impl(std::index_sequence) {
+  template 
+  iterator begin_impl(std::index_sequence) {
 return iterator(std::get(Ranges)...);
   }
   template 
@@ -1140,12 +1141,12 @@ template  class 
concat_range {
 return iterator(std::get(Ranges)...);
   }
   template  iterator end_impl(std::index_sequence) {
-return iterator(make_range(adl_end(std::get(Ranges)),
-   adl_end(std::get(Ranges)))...);
+return iterator(make_range(std::end(std::get(Ranges)),
+   std::end(std::get(Ranges)))...);
   }
   template  iterator end_impl(std::index_sequence) const {
-return iterator(make_range(adl_end(std::get(Ranges)),
-   adl_end(std::get(Ranges)))...);
+return iterator(make_range(std::end(std::get(Ranges)),
+   std::end(std::get(Ranges)))...);
   }
 
 public:
@@ -1419,7 +1420,7 @@ template  class 
first_or_second_type {
 
 /// Given a container of pairs, return a range over the first elements.
 template  auto make_first_range(ContainerTy &&c) {
-  using EltTy = decltype((*adl_begin(c)));
+  using EltTy = decltype((*std::begin(c)));
   return llvm::map_range(std::forward(c),
  [](EltTy elt) -> typename 
detail::first_or_second_type<
EltTy, decltype((elt.first))>::type 
{
@@ -1429,7 +1430,7 @@ template  auto 
make_first_range(ContainerTy &&c) {
 
 /// Given a container of pai

[llvm-branch-commits] [llvm] release/18.x: [lit][ci] Publish lit wheels (#88072) (PR #88155)

2024-04-09 Thread Tobias Hieta via llvm-branch-commits

https://github.com/tru approved this pull request.


https://github.com/llvm/llvm-project/pull/88155
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] 7c83625 - Revert "[Flang] [OpenMP] [Semantics] [MLIR] [Lowering] Add lowering support f…"

2024-04-09 Thread via llvm-branch-commits

Author: Raghu Maddhipatla
Date: 2024-04-09T16:18:05-05:00
New Revision: 7c83625771a8746865c1026d17b35c126a4f1f88

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

LOG: Revert "[Flang] [OpenMP] [Semantics] [MLIR] [Lowering] Add lowering 
support f…"

This reverts commit 9d9560facb5597e0232ab15716a7915a33d4f0a6.

Added: 


Modified: 
flang/lib/Lower/OpenMP/ClauseProcessor.cpp
flang/lib/Lower/OpenMP/ClauseProcessor.h
flang/lib/Lower/OpenMP/OpenMP.cpp
flang/test/Lower/OpenMP/FIR/target.f90
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
mlir/test/Dialect/OpenMP/invalid.mlir
mlir/test/Dialect/OpenMP/ops.mlir

Removed: 




diff  --git a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp 
b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
index fb24c8d1fe3eb0..0a57a1496289f4 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.cpp
@@ -751,20 +751,6 @@ bool ClauseProcessor::processDepend(
   });
 }
 
-bool ClauseProcessor::processHasDeviceAddr(
-llvm::SmallVectorImpl &operands,
-llvm::SmallVectorImpl &isDeviceTypes,
-llvm::SmallVectorImpl &isDeviceLocs,
-llvm::SmallVectorImpl &isDeviceSymbols)
-const {
-  return findRepeatableClause(
-  [&](const omp::clause::HasDeviceAddr &devAddrClause,
-  const Fortran::parser::CharBlock &) {
-addUseDeviceClause(converter, devAddrClause.v, operands, isDeviceTypes,
-   isDeviceLocs, isDeviceSymbols);
-  });
-}
-
 bool ClauseProcessor::processIf(
 omp::clause::If::DirectiveNameModifier directiveName,
 mlir::Value &result) const {
@@ -785,20 +771,6 @@ bool ClauseProcessor::processIf(
   return found;
 }
 
-bool ClauseProcessor::processIsDevicePtr(
-llvm::SmallVectorImpl &operands,
-llvm::SmallVectorImpl &isDeviceTypes,
-llvm::SmallVectorImpl &isDeviceLocs,
-llvm::SmallVectorImpl &isDeviceSymbols)
-const {
-  return findRepeatableClause(
-  [&](const omp::clause::IsDevicePtr &devPtrClause,
-  const Fortran::parser::CharBlock &) {
-addUseDeviceClause(converter, devPtrClause.v, operands, isDeviceTypes,
-   isDeviceLocs, isDeviceSymbols);
-  });
-}
-
 bool ClauseProcessor::processLink(
 llvm::SmallVectorImpl &result) const {
   return findRepeatableClause(
@@ -1021,7 +993,6 @@ bool ClauseProcessor::processUseDevicePtr(
useDeviceLocs, useDeviceSymbols);
   });
 }
-
 } // namespace omp
 } // namespace lower
 } // namespace Fortran

diff  --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h 
b/flang/lib/Lower/OpenMP/ClauseProcessor.h
index df8f4f5310fcb6..d31d6a5c20623a 100644
--- a/flang/lib/Lower/OpenMP/ClauseProcessor.h
+++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h
@@ -66,12 +66,6 @@ class ClauseProcessor {
   bool processDeviceType(mlir::omp::DeclareTargetDeviceType &result) const;
   bool processFinal(Fortran::lower::StatementContext &stmtCtx,
 mlir::Value &result) const;
-  bool
-  processHasDeviceAddr(llvm::SmallVectorImpl &operands,
-   llvm::SmallVectorImpl &isDeviceTypes,
-   llvm::SmallVectorImpl &isDeviceLocs,
-   llvm::SmallVectorImpl
-   &isDeviceSymbols) const;
   bool processHint(mlir::IntegerAttr &result) const;
   bool processMergeable(mlir::UnitAttr &result) const;
   bool processNowait(mlir::UnitAttr &result) const;
@@ -110,12 +104,6 @@ class ClauseProcessor {
   bool processIf(omp::clause::If::DirectiveNameModifier directiveName,
  mlir::Value &result) const;
   bool
-  processIsDevicePtr(llvm::SmallVectorImpl &operands,
- llvm::SmallVectorImpl &isDeviceTypes,
- llvm::SmallVectorImpl &isDeviceLocs,
- llvm::SmallVectorImpl
- &isDeviceSymbols) const;
-  bool
   processLink(llvm::SmallVectorImpl &result) const;
 
   // This method is used to process a map clause.

diff  --git a/flang/lib/Lower/OpenMP/OpenMP.cpp 
b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 50ad889052ab05..340921c867246c 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -1294,11 +1294,6 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
   llvm::SmallVector mapSymTypes;
   llvm::SmallVector mapSymLocs;
   llvm::SmallVector mapSymbols;
-  llvm::SmallVector devicePtrOperands, deviceAddrOperands;
-  llvm::SmallVector devicePtrTypes, deviceAddrTypes;
-  llvm::SmallVector devicePtrLocs, deviceAddrLocs;
-  llvm::SmallVector devicePtrSymbols,
-  deviceAddrSymbols;
 
   ClauseProcessor cp(converter, semaCtx, clauseList);
   cp.processIf(llvm::omp::Directive::OMPD_target, ifClauseOperand);
@@ -1308,15

[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Maksim Panchenko via llvm-branch-commits

maksfb wrote:

> > Let's make `hasCFI()` return true for injected functions.
> 
> Given that this change increases the size of eh_frame section, should we make 
> it dependent on `enable-bat`, i.e. when we expect to feed the binary back to 
> BOLT?
> 
> Because otherwise this "fix" is a pure size regression.

Creating a proper FDE entry is the right thing to do regardless of BAT. How 
large is the regression?

https://github.com/llvm/llvm-project/pull/87967
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/18.x: [Headers] Don't declare unreachable() from stddef.h in C++ (#86748) (PR #87696)

2024-04-09 Thread Ian Anderson via llvm-branch-commits

ian-twilightcoder wrote:

@tstellar is there anything else I need to do for this one?

https://github.com/llvm/llvm-project/pull/87696
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Amir Ayupov via llvm-branch-commits

aaupov wrote:

> > > Let's make `hasCFI()` return true for injected functions.
> > 
> > 
> > Given that this change increases the size of eh_frame section, should we 
> > make it dependent on `enable-bat`, i.e. when we expect to feed the binary 
> > back to BOLT?
> > Because otherwise this "fix" is a pure size regression.
> 
> Creating a proper FDE entry is the right thing to do regardless of BAT. How 
> large is the regression?

The largest I've seen is 34M->39M (HHVM instrumentation).

https://github.com/llvm/llvm-project/pull/87967
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87967

>From c856716bbb987e09ee86b31287808736ef4f2f9b Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Tue, 9 Apr 2024 04:52:43 -0700
Subject: [PATCH 1/2] Added test

Created using spr 1.3.4
---
 bolt/include/bolt/Core/BinaryFunction.h |  3 ++-
 bolt/lib/Core/BinaryEmitter.cpp |  4 ++--
 bolt/test/X86/patch-entries.test| 23 ++-
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/bolt/include/bolt/Core/BinaryFunction.h 
b/bolt/include/bolt/Core/BinaryFunction.h
index bc047fefa3151c..26d2d01f862671 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -1402,7 +1402,8 @@ class BinaryFunction {
 
   /// Return true if the function has CFI instructions
   bool hasCFI() const {
-return !FrameInstructions.empty() || !CIEFrameInstructions.empty();
+return !FrameInstructions.empty() || !CIEFrameInstructions.empty() ||
+   IsInjected;
   }
 
   /// Return unique number associated with the function.
diff --git a/bolt/lib/Core/BinaryEmitter.cpp b/bolt/lib/Core/BinaryEmitter.cpp
index 56bd65a51600d1..97d19b75200f51 100644
--- a/bolt/lib/Core/BinaryEmitter.cpp
+++ b/bolt/lib/Core/BinaryEmitter.cpp
@@ -347,7 +347,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
   }
 
   // Emit CFI start
-  if (Function.hasCFI() || Function.isInjected()) {
+  if (Function.hasCFI()) {
 Streamer.emitCFIStartProc(/*IsSimple=*/false);
 if (Function.getPersonalityFunction() != nullptr)
   Streamer.emitCFIPersonality(Function.getPersonalityFunction(),
@@ -394,7 +394,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
 Streamer.emitBytes(BC.MIB->getTrapFillValue());
 
   // Emit CFI end
-  if (Function.hasCFI() || Function.isInjected())
+  if (Function.hasCFI())
 Streamer.emitCFIEndProc();
 
   MCSymbol *EndSymbol = Function.getFunctionEndLabel(FF.getFragmentNum());
diff --git a/bolt/test/X86/patch-entries.test b/bolt/test/X86/patch-entries.test
index 54f358f273e793..331f8a312f4820 100644
--- a/bolt/test/X86/patch-entries.test
+++ b/bolt/test/X86/patch-entries.test
@@ -7,4 +7,25 @@ REQUIRES: system-linux
 
 RUN: %clang %cflags -no-pie -g %p/Inputs/patch-entries.c -fuse-ld=lld -o 
%t.exe \
 RUN:   -Wl,-q -I%p/../Inputs
-RUN: llvm-bolt -relocs %t.exe -o %t.out --update-debug-sections --force-patch
+RUN: llvm-bolt -relocs %t.exe -o %t.out --update-debug-sections --force-patch \
+RUN:   --enable-bat
+
+# Check that patched functions can be disassembled (override FDE from the
+# original function)
+# PREAGG: B X:0 #foo.org.0# 1 0
+RUN: link_fdata %s %t.out %t.preagg PREAGG
+RUN: perf2bolt %t.out -p %t.preagg --pa -o %t.yaml --profile-format=yaml \
+RUN:   -print-disasm -print-only=foo.org.0/1 2>&1 | FileCheck %s
+CHECK-NOT: BOLT-WARNING: sizes differ for function foo.org.0/1. FDE : 23; 
symbol table : 5. Using max size.
+CHECK: Binary Function "foo.org.0/1(*2)" after disassembly {
+
+# Check the expected eh_frame contents
+RUN: llvm-nm --print-size %t.out > %t.foo
+RUN: llvm-objdump %t.out --dwarf=frames >> %t.foo
+RUN: FileCheck %s --input-file %t.foo --check-prefix=CHECK-FOO
+CHECK-FOO: [[#FOO:]] {{.*}} foo
+CHECK-FOO: [[#ORG:]] {{.*}} foo.org.0
+# patched FDE comes first
+CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]...00[[#ORG+5]]
+# original FDE comes second
+CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]...00[[#ORG+23]]

>From ed991a81eb7975c41c5db75fa772329752911c00 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Tue, 9 Apr 2024 15:23:28 -0700
Subject: [PATCH 2/2] Fix test

Created using spr 1.3.4
---
 bolt/test/X86/patch-entries.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bolt/test/X86/patch-entries.test b/bolt/test/X86/patch-entries.test
index 331f8a312f4820..2821501fd9baad 100644
--- a/bolt/test/X86/patch-entries.test
+++ b/bolt/test/X86/patch-entries.test
@@ -16,7 +16,7 @@ RUN:   --enable-bat
 RUN: link_fdata %s %t.out %t.preagg PREAGG
 RUN: perf2bolt %t.out -p %t.preagg --pa -o %t.yaml --profile-format=yaml \
 RUN:   -print-disasm -print-only=foo.org.0/1 2>&1 | FileCheck %s
-CHECK-NOT: BOLT-WARNING: sizes differ for function foo.org.0/1. FDE : 23; 
symbol table : 5. Using max size.
+CHECK-NOT: BOLT-WARNING: sizes differ for function foo.org.0/1
 CHECK: Binary Function "foo.org.0/1(*2)" after disassembly {
 
 # Check the expected eh_frame contents
@@ -28,4 +28,4 @@ CHECK-FOO: [[#ORG:]] {{.*}} foo.org.0
 # patched FDE comes first
 CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]...00[[#ORG+5]]
 # original FDE comes second
-CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]...00[[#ORG+23]]
+CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]

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


[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Maksim Panchenko via llvm-branch-commits

maksfb wrote:

> > Creating a proper FDE entry is the right thing to do regardless of BAT. How 
> > large is the regression?
> 
> The largest I've seen is 34M->39M (HHVM instrumentation).

Did you check if we patch every single function in he original `.text`? How 
many functions are there?

https://github.com/llvm/llvm-project/pull/87967
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Amir Ayupov via llvm-branch-commits

aaupov wrote:

> > > Creating a proper FDE entry is the right thing to do regardless of BAT. 
> > > How large is the regression?
> > 
> > 
> > The largest I've seen is 34M->39M (HHVM instrumentation).
> 
> Did you check if we patch every single function in he original `.text`? How 
> many functions are there?

I'm not sure how to confirm this, but I'm pretty sure we do patch every 
function in regular instrumentation mode. There are 406308 functions 
instrumented.

https://github.com/llvm/llvm-project/pull/87967
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Maksim Panchenko via llvm-branch-commits

maksfb wrote:

Okay. That explains the increase.

https://github.com/llvm/llvm-project/pull/87967
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Maksim Panchenko via llvm-branch-commits

https://github.com/maksfb approved this pull request.


https://github.com/llvm/llvm-project/pull/87967
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [BOLT] Emit empty FDE for injected functions (PR #87967)

2024-04-09 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/87967

>From c856716bbb987e09ee86b31287808736ef4f2f9b Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Tue, 9 Apr 2024 04:52:43 -0700
Subject: [PATCH 1/3] Added test

Created using spr 1.3.4
---
 bolt/include/bolt/Core/BinaryFunction.h |  3 ++-
 bolt/lib/Core/BinaryEmitter.cpp |  4 ++--
 bolt/test/X86/patch-entries.test| 23 ++-
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/bolt/include/bolt/Core/BinaryFunction.h 
b/bolt/include/bolt/Core/BinaryFunction.h
index bc047fefa3151c..26d2d01f862671 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -1402,7 +1402,8 @@ class BinaryFunction {
 
   /// Return true if the function has CFI instructions
   bool hasCFI() const {
-return !FrameInstructions.empty() || !CIEFrameInstructions.empty();
+return !FrameInstructions.empty() || !CIEFrameInstructions.empty() ||
+   IsInjected;
   }
 
   /// Return unique number associated with the function.
diff --git a/bolt/lib/Core/BinaryEmitter.cpp b/bolt/lib/Core/BinaryEmitter.cpp
index 56bd65a51600d1..97d19b75200f51 100644
--- a/bolt/lib/Core/BinaryEmitter.cpp
+++ b/bolt/lib/Core/BinaryEmitter.cpp
@@ -347,7 +347,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
   }
 
   // Emit CFI start
-  if (Function.hasCFI() || Function.isInjected()) {
+  if (Function.hasCFI()) {
 Streamer.emitCFIStartProc(/*IsSimple=*/false);
 if (Function.getPersonalityFunction() != nullptr)
   Streamer.emitCFIPersonality(Function.getPersonalityFunction(),
@@ -394,7 +394,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
 Streamer.emitBytes(BC.MIB->getTrapFillValue());
 
   // Emit CFI end
-  if (Function.hasCFI() || Function.isInjected())
+  if (Function.hasCFI())
 Streamer.emitCFIEndProc();
 
   MCSymbol *EndSymbol = Function.getFunctionEndLabel(FF.getFragmentNum());
diff --git a/bolt/test/X86/patch-entries.test b/bolt/test/X86/patch-entries.test
index 54f358f273e793..331f8a312f4820 100644
--- a/bolt/test/X86/patch-entries.test
+++ b/bolt/test/X86/patch-entries.test
@@ -7,4 +7,25 @@ REQUIRES: system-linux
 
 RUN: %clang %cflags -no-pie -g %p/Inputs/patch-entries.c -fuse-ld=lld -o 
%t.exe \
 RUN:   -Wl,-q -I%p/../Inputs
-RUN: llvm-bolt -relocs %t.exe -o %t.out --update-debug-sections --force-patch
+RUN: llvm-bolt -relocs %t.exe -o %t.out --update-debug-sections --force-patch \
+RUN:   --enable-bat
+
+# Check that patched functions can be disassembled (override FDE from the
+# original function)
+# PREAGG: B X:0 #foo.org.0# 1 0
+RUN: link_fdata %s %t.out %t.preagg PREAGG
+RUN: perf2bolt %t.out -p %t.preagg --pa -o %t.yaml --profile-format=yaml \
+RUN:   -print-disasm -print-only=foo.org.0/1 2>&1 | FileCheck %s
+CHECK-NOT: BOLT-WARNING: sizes differ for function foo.org.0/1. FDE : 23; 
symbol table : 5. Using max size.
+CHECK: Binary Function "foo.org.0/1(*2)" after disassembly {
+
+# Check the expected eh_frame contents
+RUN: llvm-nm --print-size %t.out > %t.foo
+RUN: llvm-objdump %t.out --dwarf=frames >> %t.foo
+RUN: FileCheck %s --input-file %t.foo --check-prefix=CHECK-FOO
+CHECK-FOO: [[#FOO:]] {{.*}} foo
+CHECK-FOO: [[#ORG:]] {{.*}} foo.org.0
+# patched FDE comes first
+CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]...00[[#ORG+5]]
+# original FDE comes second
+CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]...00[[#ORG+23]]

>From ed991a81eb7975c41c5db75fa772329752911c00 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Tue, 9 Apr 2024 15:23:28 -0700
Subject: [PATCH 2/3] Fix test

Created using spr 1.3.4
---
 bolt/test/X86/patch-entries.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bolt/test/X86/patch-entries.test b/bolt/test/X86/patch-entries.test
index 331f8a312f4820..2821501fd9baad 100644
--- a/bolt/test/X86/patch-entries.test
+++ b/bolt/test/X86/patch-entries.test
@@ -16,7 +16,7 @@ RUN:   --enable-bat
 RUN: link_fdata %s %t.out %t.preagg PREAGG
 RUN: perf2bolt %t.out -p %t.preagg --pa -o %t.yaml --profile-format=yaml \
 RUN:   -print-disasm -print-only=foo.org.0/1 2>&1 | FileCheck %s
-CHECK-NOT: BOLT-WARNING: sizes differ for function foo.org.0/1. FDE : 23; 
symbol table : 5. Using max size.
+CHECK-NOT: BOLT-WARNING: sizes differ for function foo.org.0/1
 CHECK: Binary Function "foo.org.0/1(*2)" after disassembly {
 
 # Check the expected eh_frame contents
@@ -28,4 +28,4 @@ CHECK-FOO: [[#ORG:]] {{.*}} foo.org.0
 # patched FDE comes first
 CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]...00[[#ORG+5]]
 # original FDE comes second
-CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]...00[[#ORG+23]]
+CHECK-FOO: FDE {{.*}} pc=00[[#ORG]]

>From cb1096ef2e86d7f7ff628e033cf88a46268533d6 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Tue, 9 Apr 2024 16:40:21 -0700
Subject: [PATCH 3/3] Update test

Created using spr 1.3.4
---
 bolt/test/X86/patch-entries.test | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git

[llvm-branch-commits] [libc] 434bbc9 - Revert "[libc] implement ioctl (#85890)"

2024-04-09 Thread via llvm-branch-commits

Author: lntue
Date: 2024-04-09T23:46:21-04:00
New Revision: 434bbc9b750a19e78da91e864749ca37995b42e7

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

LOG: Revert "[libc] implement ioctl (#85890)"

This reverts commit 289a2c380e47d64a1e626259c53fc8c7d6c2be66.

Added: 


Modified: 
libc/config/linux/aarch64/entrypoints.txt
libc/config/linux/riscv/entrypoints.txt
libc/config/linux/x86_64/entrypoints.txt
libc/spec/linux.td
libc/src/sys/CMakeLists.txt

Removed: 
libc/src/sys/ioctl/CMakeLists.txt
libc/src/sys/ioctl/ioctl.h
libc/src/sys/ioctl/linux/CMakeLists.txt
libc/src/sys/ioctl/linux/ioctl.cpp
libc/test/src/sys/ioctl/CMakeLists.txt
libc/test/src/sys/ioctl/linux/CMakeLists.txt
libc/test/src/sys/ioctl/linux/ioctl_test.cpp



diff  --git a/libc/config/linux/aarch64/entrypoints.txt 
b/libc/config/linux/aarch64/entrypoints.txt
index 5649e3ca29f91f..f5f5c437685a21 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -204,9 +204,6 @@ set(TARGET_LIBC_ENTRYPOINTS
 #libc.src.stdio.scanf
 #libc.src.stdio.fscanf
 
-# sys/ioctl.h entrypoints
-libc.src.sys.ioctl.ioctl
-
 # sys/mman.h entrypoints
 libc.src.sys.mman.madvise
 libc.src.sys.mman.mmap

diff  --git a/libc/config/linux/riscv/entrypoints.txt 
b/libc/config/linux/riscv/entrypoints.txt
index 6c719320b0847a..71289789158f4b 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -209,9 +209,6 @@ set(TARGET_LIBC_ENTRYPOINTS
 libc.src.stdio.scanf
 libc.src.stdio.fscanf
 
-# sys/ioctl.h entrypoints
-libc.src.sys.ioctl.ioctl
-
 # sys/mman.h entrypoints
 libc.src.sys.mman.madvise
 libc.src.sys.mman.mmap

diff  --git a/libc/config/linux/x86_64/entrypoints.txt 
b/libc/config/linux/x86_64/entrypoints.txt
index 5880ad55b71cee..6bb53cb76220fc 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -221,9 +221,6 @@ set(TARGET_LIBC_ENTRYPOINTS
 # https://github.com/llvm/llvm-project/issues/80060
 # libc.src.sys.epoll.epoll_pwait2
 
-# sys/ioctl.h entrypoints
-libc.src.sys.ioctl.ioctl
-
 # sys/mman.h entrypoints
 libc.src.sys.mman.madvise
 libc.src.sys.mman.mmap

diff  --git a/libc/spec/linux.td b/libc/spec/linux.td
index 6e9b64f5a6b4af..f91f55ddac7846 100644
--- a/libc/spec/linux.td
+++ b/libc/spec/linux.td
@@ -79,24 +79,6 @@ def Linux : StandardSpec<"Linux"> {
   []  // Functions
   >;
 
-  HeaderSpec SysIoctl = HeaderSpec<
-  "sys/ioctl.h",
-  [Macro<"MAP_ANONYMOUS">],
-  [], // Types
-  [], // Enumerations
-  [
-FunctionSpec<
-"ioctl",
-RetValSpec,
-[
-  ArgSpec,
-  ArgSpec,
-  ArgSpec,
-]
->,
-  ]  // Functions
-  >;
-
   HeaderSpec SysMMan = HeaderSpec<
   "sys/mman.h",
   [Macro<"MAP_ANONYMOUS">],

diff  --git a/libc/src/sys/CMakeLists.txt b/libc/src/sys/CMakeLists.txt
index ac54df35284a7b..adc666b94202f7 100644
--- a/libc/src/sys/CMakeLists.txt
+++ b/libc/src/sys/CMakeLists.txt
@@ -1,6 +1,5 @@
 add_subdirectory(auxv)
 add_subdirectory(epoll)
-add_subdirectory(ioctl)
 add_subdirectory(mman)
 add_subdirectory(random)
 add_subdirectory(resource)

diff  --git a/libc/src/sys/ioctl/CMakeLists.txt 
b/libc/src/sys/ioctl/CMakeLists.txt
deleted file mode 100644
index 4b50c278c7871a..00
--- a/libc/src/sys/ioctl/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
-  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
-endif()
-
-add_entrypoint_object(
-  ioctl
-  ALIAS
-  DEPENDS
-.${LIBC_TARGET_OS}.ioctl
-)
-
-

diff  --git a/libc/src/sys/ioctl/ioctl.h b/libc/src/sys/ioctl/ioctl.h
deleted file mode 100644
index 8365678276a428..00
--- a/libc/src/sys/ioctl/ioctl.h
+++ /dev/null
@@ -1,17 +0,0 @@
-//===-- Implementation header for mmap function -*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLVM_LIBC_SRC_SYS_IOCTL_IOCTL_H
-#define LLVM_LIBC_SRC_SYS_IOCTL_IOCTL_H
-namespace LIBC_NAMESPACE {
-
-int ioctl(int fd, unsigned long request, ...);
-
-} // namespace LIBC_NAMESPACE
-
-#endif // LLVM_LIBC_SRC_SYS_IOCTL_IOCTL_H

diff  --git a/libc/src/sys/ioctl/linux/CMakeLists.txt 
b/libc/src/sys/ioctl/linux/CMakeLists.txt
deleted file mode 100644
index 8a23505d4e9d19..00
--- a/libc

[llvm-branch-commits] [clang] 293c27f - Revert "Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF fo…"

2024-04-09 Thread via llvm-branch-commits

Author: Phoebe Wang
Date: 2024-04-10T14:36:38+08:00
New Revision: 293c27f9137ea45a401ac74d84799d11b193fefd

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

LOG: Revert "Reland "[Win32][ELF] Make CodeView a DebugInfoFormat only for COFF 
fo…"

This reverts commit 4a93872a4f57d2f205826052150fadc36490445f.

Added: 


Modified: 
clang/lib/Driver/ToolChains/MSVC.h
clang/test/Driver/gcodeview-command-line.c

Removed: 
clang/test/Misc/win32-elf.c



diff  --git a/clang/lib/Driver/ToolChains/MSVC.h 
b/clang/lib/Driver/ToolChains/MSVC.h
index 3950a8ed38e8b4..48369e030aade2 100644
--- a/clang/lib/Driver/ToolChains/MSVC.h
+++ b/clang/lib/Driver/ToolChains/MSVC.h
@@ -61,8 +61,9 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public 
ToolChain {
   /// formats, and to DWARF otherwise. Users can use -gcodeview and -gdwarf to
   /// override the default.
   llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override 
{
-return getTriple().isOSBinFormatCOFF() ? llvm::codegenoptions::DIF_CodeView
-   : llvm::codegenoptions::DIF_DWARF;
+return getTriple().isOSBinFormatMachO()
+   ? llvm::codegenoptions::DIF_DWARF
+   : llvm::codegenoptions::DIF_CodeView;
   }
 
   /// Set the debugger tuning to "default", since we're definitely not tuning

diff  --git a/clang/test/Driver/gcodeview-command-line.c 
b/clang/test/Driver/gcodeview-command-line.c
index 83542fc71aece4..da8708af322480 100644
--- a/clang/test/Driver/gcodeview-command-line.c
+++ b/clang/test/Driver/gcodeview-command-line.c
@@ -1,6 +1,5 @@
 // Note: %s must be preceded by --, otherwise it may be interpreted as a
 // command-line option, e.g. on Mac where %s is commonly under /Users.
-// REQUIRES: 
aarch64-registered-target,arm-registered-target,x86-registered-target
 
 // ON-NOT: "-gno-codview-commandline"
 // OFF: "-gno-codeview-command-line"

diff  --git a/clang/test/Misc/win32-elf.c b/clang/test/Misc/win32-elf.c
deleted file mode 100644
index f75281dc418727..00
--- a/clang/test/Misc/win32-elf.c
+++ /dev/null
@@ -1,5 +0,0 @@
-// Check that basic use of win32-elf targets works.
-// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf %s
-
-// RUN: %clang -fsyntax-only -target x86_64-pc-win32-elf -g %s -### 2>&1 | 
FileCheck %s -check-prefix=DEBUG-INFO
-// DEBUG-INFO: -dwarf-version={{.*}}



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