[llvm-branch-commits] [libcxx] [libc++] Use clang-tidy version that matches the compiler we use in the CI (PR #85305)

2024-03-15 Thread Mark de Wever via llvm-branch-commits

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

@tstellar due to the new LLVM version number scheme this code would mix LLVM 17 
and LLVM 18. (LLVM 18.1 is not considered to be LLVM 18.) Since these are 
expected not to be ABI stable it seems we ran into ODR violations. For main I 
landed a different fix that has other improvements. These improvements should 
not be backported to LLVM-18. This is the minimal fix needed for LLVM-18.

LGTM!

https://github.com/llvm/llvm-project/pull/85305
___
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-tools-extra] release/18.x: [clangd] [HeuristicResolver] Protect against infinite recursion on DependentNameTypes (#83542) (PR #84117)

2024-03-15 Thread Nathan Ridge via llvm-branch-commits

HighCommander4 wrote:

(Does the backport need to be reviewed separately? Not sure what is the process 
these days.)

https://github.com/llvm/llvm-project/pull/84117
___
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-tools-extra] release/18.x: [clangd] [HeuristicResolver] Protect against infinite recursion on DependentNameTypes (#83542) (PR #84117)

2024-03-15 Thread Younan Zhang via llvm-branch-commits

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

I think this merits a backport as we don't actually want this crash on some std 
libraries delays to 19.0.

> (Does the backport need to be reviewed separately? Not sure what is the 
> process these days.)

@HighCommander4 : Yes. And we shall ping our release manager @tstellar and 
hopefully we can make it in 18.2.



https://github.com/llvm/llvm-project/pull/84117
___
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-tools-extra] release/18.x: [clangd] [HeuristicResolver] Protect against infinite recursion on DependentNameTypes (#83542) (PR #84117)

2024-03-15 Thread Haojian Wu via llvm-branch-commits

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

Backporting this change makes sense to me. I think it needs to be reviewed by 
the release manager.

https://github.com/llvm/llvm-project/pull/84117
___
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-tools-extra] release/18.x: [clangd] [HeuristicResolver] Protect against infinite recursion on DependentNameTypes (#83542) (PR #84117)

2024-03-15 Thread Younan Zhang via llvm-branch-commits

zyn0217 wrote:

Oh, I saw PR https://github.com/llvm/llvm-project/pull/84436 just now. Do you 
think this needs a release note?
(I don't know if you (or we, the members) have access to the backport branch; 
if not, you probably need a separate PR (close this one and open a new manually 
and target that PR to 18.x release branch) for this. )

https://github.com/llvm/llvm-project/pull/84117
___
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-tools-extra] release/18.x: [clangd] [HeuristicResolver] Protect against infinite recursion on DependentNameTypes (#83542) (PR #84117)

2024-03-15 Thread Nathan Ridge via llvm-branch-commits

HighCommander4 wrote:

> Do you think this needs a release note?

There is an umbrella entry in the release notes for "Various stability 
improvements, e.g. crash fixes". I don't think it adds much value to list the 
crash fixes individually (unless maybe it's a particularly widely reported one 
like https://github.com/clangd/clangd/issues/1384).

https://github.com/llvm/llvm-project/pull/84117
___
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: [TSan] Fix atomicrmw xchg with pointer and floats (#85228) (PR #85371)

2024-03-15 Thread via llvm-branch-commits

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

Backport ff2fb2a1d78585944dcdb9061c8487fe1476dfa4

Requested by: @nikic

>From 631dfbf2ad986e4ab006e5fb2565136b2eb4dbaa Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Fri, 15 Mar 2024 09:02:10 +0100
Subject: [PATCH] [TSan] Fix atomicrmw xchg with pointer and floats (#85228)

atomicrmw xchg also accepts pointer and floating-point values. To handle
those, insert necessary casts to and from integer. This is what we do
for cmpxchg as well.

Fixes https://github.com/llvm/llvm-project/issues/85226.

(cherry picked from commit ff2fb2a1d78585944dcdb9061c8487fe1476dfa4)
---
 .../Instrumentation/ThreadSanitizer.cpp   |  9 +
 .../Instrumentation/ThreadSanitizer/atomic.ll | 20 +++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
index 8ee0bca7e354f0..0f42ff79086994 100644
--- a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
@@ -752,11 +752,12 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I, 
const DataLayout &DL) {
 const unsigned ByteSize = 1U << Idx;
 const unsigned BitSize = ByteSize * 8;
 Type *Ty = Type::getIntNTy(IRB.getContext(), BitSize);
-Value *Args[] = {Addr,
- IRB.CreateIntCast(RMWI->getValOperand(), Ty, false),
+Value *Val = RMWI->getValOperand();
+Value *Args[] = {Addr, IRB.CreateBitOrPointerCast(Val, Ty),
  createOrdering(&IRB, RMWI->getOrdering())};
-CallInst *C = CallInst::Create(F, Args);
-ReplaceInstWithInst(I, C);
+Value *C = IRB.CreateCall(F, Args);
+I->replaceAllUsesWith(IRB.CreateBitOrPointerCast(C, Val->getType()));
+I->eraseFromParent();
   } else if (AtomicCmpXchgInst *CASI = dyn_cast(I)) {
 Value *Addr = CASI->getPointerOperand();
 Type *OrigOldValTy = CASI->getNewValOperand()->getType();
diff --git a/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll 
b/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll
index 76afc4bf007c2d..8b387cd4962979 100644
--- a/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll
+++ b/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll
@@ -78,6 +78,26 @@ entry:
 ; CHECK-LABEL: atomic8_xchg_monotonic
 ; CHECK: call i8 @__tsan_atomic8_exchange(ptr %a, i8 0, i32 0), !dbg
 
+define void @atomic8_xchg_monotonic_ptr(ptr %a, ptr %b) nounwind uwtable {
+entry:
+  atomicrmw xchg ptr %a, ptr %b monotonic, !dbg !7
+  ret void, !dbg !7
+}
+; CHECK-LABEL: atomic8_xchg_monotonic_ptr
+; CHECK: [[ARG:%.*]] = ptrtoint ptr %b to i64, !dbg
+; CHECK: [[RES:%.*]] = call i64 @__tsan_atomic64_exchange(ptr %a, i64 [[ARG]], 
i32 0), !dbg
+; CHECK: [[CAST:%.*]] = inttoptr i64 [[RES]] to ptr, !dbg
+
+define void @atomic8_xchg_monotonic_float(ptr %a, float %b) nounwind uwtable {
+entry:
+  atomicrmw xchg ptr %a, float %b monotonic, !dbg !7
+  ret void, !dbg !7
+}
+; CHECK-LABEL: atomic8_xchg_monotonic_float
+; CHECK: [[ARG:%.*]] = bitcast float %b to i32, !dbg
+; CHECK: [[RES:%.*]] = call i32 @__tsan_atomic32_exchange(ptr %a, i32 [[ARG]], 
i32 0), !dbg
+; CHECK: [[CAST:%.*]] = bitcast i32 [[RES]] to float, !dbg
+
 define void @atomic8_add_monotonic(ptr %a) nounwind uwtable {
 entry:
   atomicrmw add ptr %a, i8 0 monotonic, !dbg !7

___
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: [TSan] Fix atomicrmw xchg with pointer and floats (#85228) (PR #85371)

2024-03-15 Thread via llvm-branch-commits

llvmbot wrote:

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

https://github.com/llvm/llvm-project/pull/85371
___
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: [TSan] Fix atomicrmw xchg with pointer and floats (#85228) (PR #85371)

2024-03-15 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/85371
___
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: [TSan] Fix atomicrmw xchg with pointer and floats (#85228) (PR #85371)

2024-03-15 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-compiler-rt-sanitizer

Author: None (llvmbot)


Changes

Backport ff2fb2a1d78585944dcdb9061c8487fe1476dfa4

Requested by: @nikic

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


2 Files Affected:

- (modified) llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp (+5-4) 
- (modified) llvm/test/Instrumentation/ThreadSanitizer/atomic.ll (+20) 


``diff
diff --git a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
index 8ee0bca7e354f0..0f42ff79086994 100644
--- a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
@@ -752,11 +752,12 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I, 
const DataLayout &DL) {
 const unsigned ByteSize = 1U << Idx;
 const unsigned BitSize = ByteSize * 8;
 Type *Ty = Type::getIntNTy(IRB.getContext(), BitSize);
-Value *Args[] = {Addr,
- IRB.CreateIntCast(RMWI->getValOperand(), Ty, false),
+Value *Val = RMWI->getValOperand();
+Value *Args[] = {Addr, IRB.CreateBitOrPointerCast(Val, Ty),
  createOrdering(&IRB, RMWI->getOrdering())};
-CallInst *C = CallInst::Create(F, Args);
-ReplaceInstWithInst(I, C);
+Value *C = IRB.CreateCall(F, Args);
+I->replaceAllUsesWith(IRB.CreateBitOrPointerCast(C, Val->getType()));
+I->eraseFromParent();
   } else if (AtomicCmpXchgInst *CASI = dyn_cast(I)) {
 Value *Addr = CASI->getPointerOperand();
 Type *OrigOldValTy = CASI->getNewValOperand()->getType();
diff --git a/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll 
b/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll
index 76afc4bf007c2d..8b387cd4962979 100644
--- a/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll
+++ b/llvm/test/Instrumentation/ThreadSanitizer/atomic.ll
@@ -78,6 +78,26 @@ entry:
 ; CHECK-LABEL: atomic8_xchg_monotonic
 ; CHECK: call i8 @__tsan_atomic8_exchange(ptr %a, i8 0, i32 0), !dbg
 
+define void @atomic8_xchg_monotonic_ptr(ptr %a, ptr %b) nounwind uwtable {
+entry:
+  atomicrmw xchg ptr %a, ptr %b monotonic, !dbg !7
+  ret void, !dbg !7
+}
+; CHECK-LABEL: atomic8_xchg_monotonic_ptr
+; CHECK: [[ARG:%.*]] = ptrtoint ptr %b to i64, !dbg
+; CHECK: [[RES:%.*]] = call i64 @__tsan_atomic64_exchange(ptr %a, i64 [[ARG]], 
i32 0), !dbg
+; CHECK: [[CAST:%.*]] = inttoptr i64 [[RES]] to ptr, !dbg
+
+define void @atomic8_xchg_monotonic_float(ptr %a, float %b) nounwind uwtable {
+entry:
+  atomicrmw xchg ptr %a, float %b monotonic, !dbg !7
+  ret void, !dbg !7
+}
+; CHECK-LABEL: atomic8_xchg_monotonic_float
+; CHECK: [[ARG:%.*]] = bitcast float %b to i32, !dbg
+; CHECK: [[RES:%.*]] = call i32 @__tsan_atomic32_exchange(ptr %a, i32 [[ARG]], 
i32 0), !dbg
+; CHECK: [[CAST:%.*]] = bitcast i32 [[RES]] to float, !dbg
+
 define void @atomic8_add_monotonic(ptr %a) nounwind uwtable {
 entry:
   atomicrmw add ptr %a, i8 0 monotonic, !dbg !7

``




https://github.com/llvm/llvm-project/pull/85371
___
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-tools-extra] release/18.x: [clangd] [HeuristicResolver] Protect against infinite recursion on DependentNameTypes (#83542) (PR #84117)

2024-03-15 Thread Younan Zhang via llvm-branch-commits

zyn0217 wrote:

> There is an umbrella entry in the release notes for "Various stability 
> improvements, e.g. crash fixes".

Ah, although that sounds a bit unclear. :)
Alright, I think it is probably fine for clangd to not to detail what crashes 
we had fixed, as crashes from clangd itself are pretty rare these days.

https://github.com/llvm/llvm-project/pull/84117
___
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] [flang] run CFG conversion on omp reduction declare ops (PR #84953)

2024-03-15 Thread Tom Eccles via llvm-branch-commits

tblah wrote:

> Wouldn't applying the patterns on the module in a single pass work here as 
> well?

Yes that would work but we would loose parallelism. I wanted to keep that 
because there was talk in the past about breaking up the existing Module passes 
so that different functions (or other container operations) can be processed in 
parallel

https://github.com/llvm/llvm-project/pull/84953
___
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] eba928f - Revert "[RemoveDIs] Read/write DbgRecords directly from/to bitcode (#83251)"

2024-03-15 Thread via llvm-branch-commits

Author: Orlando Cazalet-Hyams
Date: 2024-03-15T11:03:53Z
New Revision: eba928f0b9851e5fa78f152ddc1be2a28564e705

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

LOG: Revert "[RemoveDIs] Read/write DbgRecords directly from/to bitcode 
(#83251)"

This reverts commit d6d3d96b654012d72ad170d272cb2fe2c8def90d.

Added: 


Modified: 
llvm/include/llvm/Bitcode/LLVMBitCodes.h
llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
llvm/lib/IR/BasicBlock.cpp
llvm/lib/Linker/IRMover.cpp
llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
llvm/tools/llvm-as/llvm-as.cpp
llvm/tools/verify-uselistorder/verify-uselistorder.cpp

Removed: 
llvm/test/Bitcode/dbg-record-roundtrip.ll



diff  --git a/llvm/include/llvm/Bitcode/LLVMBitCodes.h 
b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
index 39303e64852141..c0a52d64a101d0 100644
--- a/llvm/include/llvm/Bitcode/LLVMBitCodes.h
+++ b/llvm/include/llvm/Bitcode/LLVMBitCodes.h
@@ -624,17 +624,6 @@ enum FunctionCodes {
   // operation, align, vol,
   // ordering, synchscope]
   FUNC_CODE_BLOCKADDR_USERS = 60, // BLOCKADDR_USERS: [value...]
-
-  FUNC_CODE_DEBUG_RECORD_VALUE =
-  61, // [DILocation, DILocalVariable, DIExpression, ValueAsMetadata]
-  FUNC_CODE_DEBUG_RECORD_DECLARE =
-  62, // [DILocation, DILocalVariable, DIExpression, ValueAsMetadata]
-  FUNC_CODE_DEBUG_RECORD_ASSIGN =
-  63, // [DILocation, DILocalVariable, DIExpression, ValueAsMetadata,
-  //  DIAssignID, DIExpression (addr), ValueAsMetadata (addr)]
-  FUNC_CODE_DEBUG_RECORD_VALUE_SIMPLE =
-  64, // [DILocation, DILocalVariable, DIExpression, Value]
-  FUNC_CODE_DEBUG_RECORD_LABEL = 65, // [DILocation, DILabel]
 };
 
 enum UseListCodes {

diff  --git a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp 
b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
index c085c715179ba6..7005011980ebc9 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
@@ -270,11 +270,6 @@ GetCodeName(unsigned CodeID, unsigned BlockID,
   STRINGIFY_CODE(FUNC_CODE, INST_CMPXCHG)
   STRINGIFY_CODE(FUNC_CODE, INST_CALLBR)
   STRINGIFY_CODE(FUNC_CODE, BLOCKADDR_USERS)
-  STRINGIFY_CODE(FUNC_CODE, DEBUG_RECORD_DECLARE)
-  STRINGIFY_CODE(FUNC_CODE, DEBUG_RECORD_VALUE)
-  STRINGIFY_CODE(FUNC_CODE, DEBUG_RECORD_ASSIGN)
-  STRINGIFY_CODE(FUNC_CODE, DEBUG_RECORD_VALUE_SIMPLE)
-  STRINGIFY_CODE(FUNC_CODE, DEBUG_RECORD_LABEL)
 }
   case bitc::VALUE_SYMTAB_BLOCK_ID:
 switch (CodeID) {

diff  --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp 
b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index d284c9823c9ede..9c63116114f3c5 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -100,6 +100,9 @@ static cl::opt ExpandConstantExprs(
 cl::desc(
 "Expand constant expressions to instructions for testing purposes"));
 
+// Declare external flag for whether we're using the new debug-info format.
+extern llvm::cl::opt UseNewDbgInfoFormat;
+
 namespace {
 
 enum {
@@ -4276,10 +4279,6 @@ Error BitcodeReader::parseGlobalIndirectSymbolRecord(
 Error BitcodeReader::parseModule(uint64_t ResumeBit,
  bool ShouldLazyLoadMetadata,
  ParserCallbacks Callbacks) {
-  // Force the debug-info mode into the old format for now.
-  // FIXME: Remove this once all tools support RemoveDIs.
-  TheModule->IsNewDbgInfoFormat = false;
-
   this->ValueTypeCallback = std::move(Callbacks.ValueType);
   if (ResumeBit) {
 if (Error JumpFailed = Stream.JumpToBit(ResumeBit))
@@ -6399,89 +6398,6 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
   InstructionList.push_back(I);
   break;
 }
-case bitc::FUNC_CODE_DEBUG_RECORD_LABEL: {
-  // DPLabels are placed after the Instructions that they are attached to.
-  Instruction *Inst = getLastInstruction();
-  if (!Inst)
-return error("Invalid dbg record: missing instruction");
-  DILocation *DIL = cast(getFnMetadataByID(Record[0]));
-  DILabel *Label = cast(getFnMetadataByID(Record[1]));
-  Inst->getParent()->insertDbgRecordBefore(
-  new DPLabel(Label, DebugLoc(DIL)), Inst->getIterator());
-  continue; // This isn't an instruction.
-}
-case bitc::FUNC_CODE_DEBUG_RECORD_VALUE_SIMPLE:
-case bitc::FUNC_CODE_DEBUG_RECORD_VALUE:
-case bitc::FUNC_CODE_DEBUG_RECORD_DECLARE:
-case bitc::FUNC_CODE_DEBUG_RECORD_ASSIGN: {
-  // DPValu

[llvm-branch-commits] [flang] [flang][CodeGen] Run PreCGRewrite on omp reduction declare ops (PR #84954)

2024-03-15 Thread Tom Eccles via llvm-branch-commits

https://github.com/tblah updated https://github.com/llvm/llvm-project/pull/84954

>From f951d16cf6cb1ab221f47ca2e712020b9af0af87 Mon Sep 17 00:00:00 2001
From: Tom Eccles 
Date: Fri, 1 Mar 2024 16:59:09 +
Subject: [PATCH 1/5] [flang][CodeGen] Run PreCGRewrite on omp reduction
 declare ops

OpenMP reduction declare operations can contain FIR code which needs to
be lowered to LLVM. With array reductions, these regions can contain
more complicated operations which need PreCGRewriting. A similar extra
case was already needed for fir::GlobalOp.
---
 flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp | 5 +
 1 file changed, 5 insertions(+)

diff --git a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp 
b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
index 0170b56367cf3c..dd935e71762355 100644
--- a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
@@ -22,6 +22,7 @@
 #include "mlir/Transforms/RegionUtils.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
+#include 
 
 namespace fir {
 #define GEN_PASS_DEF_CODEGENREWRITE
@@ -319,6 +320,10 @@ class CodeGenRewrite : public 
fir::impl::CodeGenRewriteBase {
   runOn(func, func.getBody());
 for (auto global : mod.getOps())
   runOn(global, global.getRegion());
+for (auto omp : mod.getOps()) {
+  runOn(omp, omp.getInitializerRegion());
+  runOn(omp, omp.getReductionRegion());
+}
   }
 };
 

>From b909193418789d1bcb572b69070fdca9c2d35a7c Mon Sep 17 00:00:00 2001
From: Tom Eccles 
Date: Thu, 14 Mar 2024 07:54:12 +
Subject: [PATCH 2/5] Fix include

---
 flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp 
b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
index dd935e71762355..097845e447842b 100644
--- a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
@@ -18,11 +18,11 @@
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "flang/Optimizer/Dialect/Support/FIRContext.h"
+#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "mlir/Transforms/RegionUtils.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Debug.h"
-#include 
 
 namespace fir {
 #define GEN_PASS_DEF_CODEGENREWRITE

>From 9d5026a16f4de4037d1fefa77d5c913085183150 Mon Sep 17 00:00:00 2001
From: Tom Eccles 
Date: Thu, 14 Mar 2024 08:02:40 +
Subject: [PATCH 3/5] Run PreCGRewrite on all regions in the module

---
 flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp 
b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
index 097845e447842b..410e6400c9be14 100644
--- a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
@@ -284,7 +284,7 @@ class DeclareOpConversion : public 
mlir::OpRewritePattern {
 
 class CodeGenRewrite : public fir::impl::CodeGenRewriteBase {
 public:
-  void runOn(mlir::Operation *op, mlir::Region ®ion) {
+  void runOn(mlir::Operation *op) {
 auto &context = getContext();
 mlir::ConversionTarget target(context);
 target.addLegalDialect {
 
   void runOnOperation() override final {
 // Call runOn on all top level regions that may contain 
emboxOp/arrayCoorOp.
-auto mod = getOperation();
-for (auto func : mod.getOps())
-  runOn(func, func.getBody());
-for (auto global : mod.getOps())
-  runOn(global, global.getRegion());
-for (auto omp : mod.getOps()) {
-  runOn(omp, omp.getInitializerRegion());
-  runOn(omp, omp.getReductionRegion());
-}
+mlir::ModuleOp mod = getOperation();
+runOn(mod);
   }
 };
 

>From c7ffde450f0d3480be4532c4b21ed5a036fb8424 Mon Sep 17 00:00:00 2001
From: Tom Eccles 
Date: Thu, 14 Mar 2024 14:03:13 +
Subject: [PATCH 4/5] Remove unessecary include

---
 flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp 
b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
index 410e6400c9be14..4a05ad717f02f2 100644
--- a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
@@ -18,7 +18,6 @@
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "flang/Optimizer/Dialect/Support/FIRContext.h"
-#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
 #include "mlir/Transforms/DialectConversion.h"
 #include "mlir/Transforms/RegionUtils.h"
 #include "llvm/ADT/STLExtras.h"

>From 790025615d31ad0352f2befdd937f8e5d94f6c67 Mon Sep 17 00:00:00 2001
From: Tom Eccles 
Date: Fri, 15 Mar 2024 11:28:30 +
Subject: [PATCH 5/5] Remove runOn

---
 flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/flang/li

[llvm-branch-commits] [mlir] [mlir][LLVM] erase call mappings in forgetMapping() (PR #84955)

2024-03-15 Thread Tom Eccles via llvm-branch-commits

https://github.com/tblah updated https://github.com/llvm/llvm-project/pull/84955

>From c62b31262bc619145866a304e10925a35462f5bf Mon Sep 17 00:00:00 2001
From: Tom Eccles 
Date: Wed, 21 Feb 2024 14:22:39 +
Subject: [PATCH 1/2] [mlir][LLVM] erase call mappings in forgetMapping()

It looks like the mappings for call instructions were forgotten here.
This fixes a bug in OpenMP when inlining a region containing call
operations multiple times.
---
 mlir/lib/Target/LLVMIR/ModuleTranslation.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp 
b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index c00628a420a000..995544238e4a3c 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -716,6 +716,8 @@ void ModuleTranslation::forgetMapping(Region ®ion) {
   branchMapping.erase(&op);
 if (isa(op))
   globalsMapping.erase(&op);
+if (isa(op))
+  callMapping.erase(&op);
 llvm::append_range(
 toProcess,
 llvm::map_range(op.getRegions(), [](Region &r) { return &r; }));

>From 83b87ec9057dc9fbe529c652b5020452fb9585bb Mon Sep 17 00:00:00 2001
From: Tom Eccles 
Date: Fri, 15 Mar 2024 14:05:53 +
Subject: [PATCH 2/2] Add test

---
 .../Target/LLVMIR/openmp-reduction-call.mlir  | 47 +++
 1 file changed, 47 insertions(+)
 create mode 100644 mlir/test/Target/LLVMIR/openmp-reduction-call.mlir

diff --git a/mlir/test/Target/LLVMIR/openmp-reduction-call.mlir 
b/mlir/test/Target/LLVMIR/openmp-reduction-call.mlir
new file mode 100644
index 00..60419a85f66aa2
--- /dev/null
+++ b/mlir/test/Target/LLVMIR/openmp-reduction-call.mlir
@@ -0,0 +1,47 @@
+// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
+
+// Test that we don't crash when there is a call operation in the combiner
+
+omp.reduction.declare @add_f32 : f32
+init {
+^bb0(%arg: f32):
+  %0 = llvm.mlir.constant(0.0 : f32) : f32
+  omp.yield (%0 : f32)
+}
+combiner {
+^bb1(%arg0: f32, %arg1: f32):
+// test this call here:
+  llvm.call @test_call() : () -> ()
+  %1 = llvm.fadd %arg0, %arg1 : f32
+  omp.yield (%1 : f32)
+}
+atomic {
+^bb2(%arg2: !llvm.ptr, %arg3: !llvm.ptr):
+  %2 = llvm.load %arg3 : !llvm.ptr -> f32
+  llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr, f32
+  omp.yield
+}
+
+llvm.func @simple_reduction(%lb : i64, %ub : i64, %step : i64) {
+  %c1 = llvm.mlir.constant(1 : i32) : i32
+  %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr
+  omp.parallel {
+omp.wsloop reduction(@add_f32 %0 -> %prv : !llvm.ptr)
+for (%iv) : i64 = (%lb) to (%ub) step (%step) {
+  %1 = llvm.mlir.constant(2.0 : f32) : f32
+  %2 = llvm.load %prv : !llvm.ptr -> f32
+  %3 = llvm.fadd %1, %2 : f32
+  llvm.store %3, %prv : f32, !llvm.ptr
+  omp.yield
+}
+omp.terminator
+  }
+  llvm.return
+}
+
+llvm.func @test_call() -> ()
+
+// Call to the troublesome function will have been inlined twice: once into
+// main and once into the outlined function
+// CHECK: call void @test_call()
+// CHECK: call void @test_call()

___
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] [InstallAPI] Verify that declarations in headers map to exports found in dylib (PR #85348)

2024-03-15 Thread Juergen Ributzka via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/85348
___
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] [flang][OpenMP] Convert DataSharingProcessor to omp::Clause (PR #81629)

2024-03-15 Thread Krzysztof Parzyszek via llvm-branch-commits


@@ -1384,30 +1386,28 @@ void DataSharingProcessor::copyLastPrivateSymbol(
 }
 
 void DataSharingProcessor::collectOmpObjectListSymbol(
-const Fortran::parser::OmpObjectList &ompObjectList,
+const omp::ObjectList &objects,
 llvm::SetVector &symbolSet) {
-  for (const Fortran::parser::OmpObject &ompObject : ompObjectList.v) {
-Fortran::semantics::Symbol *sym = getOmpObjectSymbol(ompObject);
+  for (const omp::Object &object : objects) {
+Fortran::semantics::Symbol *sym = object.sym;

kparzysz wrote:

Done.

https://github.com/llvm/llvm-project/pull/81629
___
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] [flang][OpenMP] Convert DataSharingProcessor to omp::Clause (PR #81629)

2024-03-15 Thread Krzysztof Parzyszek via llvm-branch-commits


@@ -1278,14 +1278,15 @@ class DataSharingProcessor {
   llvm::SetVector symbolsInNestedRegions;
   llvm::SetVector symbolsInParentRegions;
   Fortran::lower::AbstractConverter &converter;
+  Fortran::semantics::SemanticsContext &semaCtx;

kparzysz wrote:

Removed.

https://github.com/llvm/llvm-project/pull/81629
___
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] [flang][OpenMP] lower simple array reductions (PR #84958)

2024-03-15 Thread David Truby via llvm-branch-commits


@@ -390,15 +559,35 @@ void ReductionProcessor::addReductionDecl(
 
   // initial pass to collect all recuction vars so we can figure out if this
   // should happen byref
+  fir::FirOpBuilder &builder = converter.getFirOpBuilder();
   for (const Fortran::parser::OmpObject &ompObject : objectList.v) {
 if (const auto *name{
 Fortran::parser::Unwrap(ompObject)}) {
   if (const Fortran::semantics::Symbol * symbol{name->symbol}) {
 if (reductionSymbols)
   reductionSymbols->push_back(symbol);
 mlir::Value symVal = converter.getSymbolAddress(*symbol);
-if (auto declOp = symVal.getDefiningOp())
+auto redType = mlir::cast(symVal.getType());

DavidTruby wrote:

Is this cast definitely safe? Will symVal always be a reference type here? 

https://github.com/llvm/llvm-project/pull/84958
___
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] workflows: Add workaround for lld failures on MacOS (#85021) (PR #85110)

2024-03-15 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/85110
___
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] Backport #85277 (PR #85422)

2024-03-15 Thread Patryk Wychowaniec via llvm-branch-commits

https://github.com/Patryk27 created 
https://github.com/llvm/llvm-project/pull/85422

Backporting #85277, at the request of 
https://github.com/rust-lang/llvm-project/pull/171#issuecomment-143797.

>From bb49a9f39c5643ed7503c78b56bfc28388e21709 Mon Sep 17 00:00:00 2001
From: Patryk Wychowaniec 
Date: Fri, 15 Mar 2024 12:07:54 +0100
Subject: [PATCH] [AVR] Remove earlyclobber from LDDRdPtrQ (#85277)

LDDRdPtrQ was marked as `earlyclobber`, which doesn't play well with
GreedyRA (which can generate this instruction through `loadRegFromStackSlot()`).

This seems to be the same case as:

https://github.com/llvm/llvm-project/blob/a99b912c9b74f6ef91786b4dfbc25160c27d3b41/llvm/lib/Target/AVR/AVRInstrInfo.td#L1421

Closes https://github.com/llvm/llvm-project/issues/81911.
---
 llvm/lib/Target/AVR/AVRInstrInfo.td |   2 +-
 llvm/test/CodeGen/AVR/bug-81911.ll  | 163 
 2 files changed, 164 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/CodeGen/AVR/bug-81911.ll

diff --git a/llvm/lib/Target/AVR/AVRInstrInfo.td 
b/llvm/lib/Target/AVR/AVRInstrInfo.td
index efaaec32ee6bb1..0a77c7c1d418a1 100644
--- a/llvm/lib/Target/AVR/AVRInstrInfo.td
+++ b/llvm/lib/Target/AVR/AVRInstrInfo.td
@@ -1398,7 +1398,7 @@ let mayLoad = 1, hasSideEffects = 0,
 
 // Load indirect with displacement operations.
 let canFoldAsLoad = 1, isReMaterializable = 1 in {
-  let Constraints = "@earlyclobber $reg" in def LDDRdPtrQ
+  def LDDRdPtrQ
   : FSTDLDD<0,
 (outs GPR8
  : $reg),
diff --git a/llvm/test/CodeGen/AVR/bug-81911.ll 
b/llvm/test/CodeGen/AVR/bug-81911.ll
new file mode 100644
index 00..2a22666a1ff927
--- /dev/null
+++ b/llvm/test/CodeGen/AVR/bug-81911.ll
@@ -0,0 +1,163 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=avr -mcpu=atmega328 -O1 -verify-machineinstrs | 
FileCheck %s
+
+define internal i8 @main() {
+; CHECK-LABEL: main:
+; CHECK:   ; %bb.0: ; %bb0
+; CHECK-NEXT:push r2
+; CHECK-NEXT:push r3
+; CHECK-NEXT:push r4
+; CHECK-NEXT:push r5
+; CHECK-NEXT:push r6
+; CHECK-NEXT:push r7
+; CHECK-NEXT:push r8
+; CHECK-NEXT:push r9
+; CHECK-NEXT:push r10
+; CHECK-NEXT:push r11
+; CHECK-NEXT:push r12
+; CHECK-NEXT:push r13
+; CHECK-NEXT:push r14
+; CHECK-NEXT:push r15
+; CHECK-NEXT:push r16
+; CHECK-NEXT:push r17
+; CHECK-NEXT:push r28
+; CHECK-NEXT:push r29
+; CHECK-NEXT:in r28, 61
+; CHECK-NEXT:in r29, 62
+; CHECK-NEXT:sbiw r28, 13
+; CHECK-NEXT:in r0, 63
+; CHECK-NEXT:cli
+; CHECK-NEXT:out 62, r29
+; CHECK-NEXT:out 63, r0
+; CHECK-NEXT:out 61, r28
+; CHECK-NEXT:ldi r16, 0
+; CHECK-NEXT:ldi r17, 0
+; CHECK-NEXT:ldi r18, -1
+; CHECK-NEXT:;APP
+; CHECK-NEXT:ldi r24, 123
+; CHECK-NEXT:;NO_APP
+; CHECK-NEXT:std Y+1, r24 ; 1-byte Folded Spill
+; CHECK-NEXT:movw r24, r28
+; CHECK-NEXT:adiw r24, 6
+; CHECK-NEXT:std Y+3, r25 ; 2-byte Folded Spill
+; CHECK-NEXT:std Y+2, r24 ; 2-byte Folded Spill
+; CHECK-NEXT:movw r8, r16
+; CHECK-NEXT:movw r6, r16
+; CHECK-NEXT:movw r4, r16
+; CHECK-NEXT:movw r2, r16
+; CHECK-NEXT:rjmp .LBB0_2
+; CHECK-NEXT:  .LBB0_1: ; %bb1
+; CHECK-NEXT:; in Loop: Header=BB0_2 Depth=1
+; CHECK-NEXT:andi r30, 1
+; CHECK-NEXT:ldd r31, Y+4 ; 1-byte Folded Reload
+; CHECK-NEXT:dec r31
+; CHECK-NEXT:cpi r30, 0
+; CHECK-NEXT:movw r8, r18
+; CHECK-NEXT:movw r6, r20
+; CHECK-NEXT:movw r4, r22
+; CHECK-NEXT:movw r2, r24
+; CHECK-NEXT:mov r18, r31
+; CHECK-NEXT:brne .LBB0_2
+; CHECK-NEXT:rjmp .LBB0_4
+; CHECK-NEXT:  .LBB0_2: ; %bb1
+; CHECK-NEXT:; =>This Inner Loop Header: Depth=1
+; CHECK-NEXT:std Y+4, r18 ; 1-byte Folded Spill
+; CHECK-NEXT:movw r18, r8
+; CHECK-NEXT:movw r20, r6
+; CHECK-NEXT:movw r22, r4
+; CHECK-NEXT:movw r24, r2
+; CHECK-NEXT:ldi r26, 10
+; CHECK-NEXT:ldi r27, 0
+; CHECK-NEXT:movw r10, r26
+; CHECK-NEXT:movw r12, r16
+; CHECK-NEXT:movw r14, r16
+; CHECK-NEXT:call __udivdi3
+; CHECK-NEXT:std Y+13, r25
+; CHECK-NEXT:std Y+12, r24
+; CHECK-NEXT:std Y+11, r23
+; CHECK-NEXT:std Y+10, r22
+; CHECK-NEXT:std Y+9, r21
+; CHECK-NEXT:std Y+8, r20
+; CHECK-NEXT:std Y+7, r19
+; CHECK-NEXT:std Y+6, r18
+; CHECK-NEXT:ldd r30, Y+2 ; 2-byte Folded Reload
+; CHECK-NEXT:ldd r31, Y+3 ; 2-byte Folded Reload
+; CHECK-NEXT:;APP
+; CHECK-NEXT:;NO_APP
+; CHECK-NEXT:ldi r30, 1
+; CHECK-NEXT:cp r8, r1
+; CHECK-NEXT:cpc r9, r1
+; CHECK-NEXT:cpc r6, r16
+; CHECK-NEXT:cpc r7, r17
+; CHECK-NEXT:cpc r4, r16
+; CHECK-NEXT:cpc r5, r17
+; CHECK-NEXT:cpc r2, r16
+; CHECK-NEXT:cpc r3, r17
+; CHECK-NEXT:breq .LBB0_3
+; CHECK-NEXT:rjmp .LBB0_1
+; CHECK-NEXT:  .LBB0_3: ; %bb1
+; CHECK-NEXT:; in Loop: Header=BB0_2 Depth=1
+; CHECK-NEXT

[llvm-branch-commits] [llvm] Backport #85277 (PR #85422)

2024-03-15 Thread Patryk Wychowaniec via llvm-branch-commits

Patryk27 wrote:

cc @benshi001 - not sure if you can approve backports as well, but maybe you'll 
know who to ping if so 😅 

https://github.com/llvm/llvm-project/pull/85422
___
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] Backport #85277 (PR #85422)

2024-03-15 Thread Nikita Popov via llvm-branch-commits

https://github.com/nikic milestoned 
https://github.com/llvm/llvm-project/pull/85422
___
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] [flang][OpenMP] lower simple array reductions (PR #84958)

2024-03-15 Thread Tom Eccles via llvm-branch-commits


@@ -390,15 +559,35 @@ void ReductionProcessor::addReductionDecl(
 
   // initial pass to collect all recuction vars so we can figure out if this
   // should happen byref
+  fir::FirOpBuilder &builder = converter.getFirOpBuilder();
   for (const Fortran::parser::OmpObject &ompObject : objectList.v) {
 if (const auto *name{
 Fortran::parser::Unwrap(ompObject)}) {
   if (const Fortran::semantics::Symbol * symbol{name->symbol}) {
 if (reductionSymbols)
   reductionSymbols->push_back(symbol);
 mlir::Value symVal = converter.getSymbolAddress(*symbol);
-if (auto declOp = symVal.getDefiningOp())
+auto redType = mlir::cast(symVal.getType());

tblah wrote:

The existing upstream code already does this, I was mostly moving code around 
here. See line 434 in the old version of the code.

This even predates the by-ref reduction changes. See 
https://github.com/llvm/llvm-project/blob/f18d78b477c76bc09dc580cdaedd55e121f5ebf5/flang/lib/Lower/OpenMP/ReductionProcessor.cpp#L347

For example, if you look at the llvm code we generate by-val reductions (which 
should be identical after my changes), it loaded the reduction variables 
unconditionally, so this must be some kind of pointer.

https://github.com/llvm/llvm-project/pull/84958
___
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: [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (#84127) (PR #85118)

2024-03-15 Thread Ian Anderson via llvm-branch-commits

ian-twilightcoder wrote:

@tstellar can you merge this one for me please?

https://github.com/llvm/llvm-project/pull/85118
___
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] [lld] [llvm][lld][RISCV] Support x3_reg_usage (PR #84598)

2024-03-15 Thread Paul Kirth via llvm-branch-commits

https://github.com/ilovepi updated 
https://github.com/llvm/llvm-project/pull/84598

>From 7c9298eea6d8239f9afedc3d6aabb1ec0f71e273 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 11 Mar 2024 15:35:59 -0700
Subject: [PATCH] Update callsite parameter

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index b2e0ba17e4efe5..5eb2ce3d64513a 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1228,8 +1228,8 @@ mergeAttributesSection(const SmallVector §ions) {
   if (r.second) {
 firstX3RegUse = sec;
   } else {
-mergeX3RegUse(merged.intAttr, firstX3RegUse, sec,
-  r.first->getSecond(), *i);
+mergeX3RegUse(r.first, firstX3RegUse, sec, r.first->getSecond(),
+  *i);
   }
 }
 continue;

___
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] [lld] [llvm][lld][RISCV] Support x3_reg_usage (PR #84598)

2024-03-15 Thread Paul Kirth via llvm-branch-commits

https://github.com/ilovepi updated 
https://github.com/llvm/llvm-project/pull/84598

>From 7c9298eea6d8239f9afedc3d6aabb1ec0f71e273 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Mon, 11 Mar 2024 15:35:59 -0700
Subject: [PATCH] Update callsite parameter

Created using spr 1.3.4
---
 lld/ELF/Arch/RISCV.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index b2e0ba17e4efe5..5eb2ce3d64513a 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -1228,8 +1228,8 @@ mergeAttributesSection(const SmallVector §ions) {
   if (r.second) {
 firstX3RegUse = sec;
   } else {
-mergeX3RegUse(merged.intAttr, firstX3RegUse, sec,
-  r.first->getSecond(), *i);
+mergeX3RegUse(r.first, firstX3RegUse, sec, r.first->getSecond(),
+  *i);
   }
 }
 continue;

___
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] [lld] [llvm][lld][RISCV] Support x3_reg_usage (PR #84598)

2024-03-15 Thread Paul Kirth via llvm-branch-commits


@@ -1135,11 +1135,34 @@ static void mergeAtomic(DenseMap::iterator it,
   };
 }
 
+static void mergeX3RegUse(DenseMap::iterator it,
+  const InputSectionBase *oldSection,
+  const InputSectionBase *newSection,
+  unsigned int oldTag, unsigned int newTag) {
+  // X3/GP register usage ar incompatible and cannot be merged, with the
+  // exception of the UNKNOWN or 0 value
+  using RISCVAttrs::RISCVX3RegUse::X3RegUsage;
+  if (newTag == X3RegUsage::UNKNOWN)
+return;
+  if (oldTag == X3RegUsage::UNKNOWN) {
+it->getSecond() = newTag;
+return;
+  }
+  if (oldTag != newTag) {
+errorOrWarn(toString(oldSection) + " has x3_reg_usage=" + Twine(oldTag) +

ilovepi wrote:

Thanks. I've changed it to an error, but it's now inconsistent w/ STACK_ALIGN a 
few lines up. Should we change that too?

https://github.com/llvm/llvm-project/pull/84598
___
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] [lld] [llvm][lld][RISCV] Support x3_reg_usage (PR #84598)

2024-03-15 Thread Paul Kirth via llvm-branch-commits

ilovepi wrote:

I've tried to use SubtargetFeatures to model the behavior here, but I don't 
really love the approach. It feels to me like I've chosen the wrong construct, 
but I'm not sure what that would be. There are obviously still some changes 
that would be required in the Clang driver to land this(at least for the SCS 
and GP-relax cases), but I'd rather wait until the mechanism is agreed upon 
before doing that.

https://github.com/llvm/llvm-project/pull/84598
___
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] [lld] [llvm] Backport fixes for ARM64EC import libraries (PR #84590)

2024-03-15 Thread Daniel Paoliello via llvm-branch-commits

https://github.com/dpaoliello updated 
https://github.com/llvm/llvm-project/pull/84590

>From 1a9bb5ccfd8f93be51d22fb00f38e86a01e82587 Mon Sep 17 00:00:00 2001
From: Jacek Caban 
Date: Tue, 6 Feb 2024 13:47:58 +0100
Subject: [PATCH 1/5] [llvm-readobj][Object][COFF] Print COFF import library
 symbol export name. (#78769)

getExportName implementation is based on lld-link. In its current form,
it's mostly about convenience, but it will be more useful for EXPORTAS
support, for which export name is not possible to deduce from other
printed properties.
---
 lld/test/COFF/def-export-cpp.s|  1 +
 lld/test/COFF/def-export-stdcall.s| 13 ++
 lld/test/COFF/dllexport.s |  4 +++
 llvm/include/llvm/Object/COFFImportFile.h |  1 +
 llvm/lib/Object/COFFImportFile.cpp| 26 +++
 .../tools/llvm-dlltool/coff-decorated.def |  7 +
 llvm/test/tools/llvm-dlltool/coff-exports.def |  3 +++
 llvm/test/tools/llvm-dlltool/coff-noname.def  |  1 +
 .../llvm-dlltool/no-leading-underscore.def|  2 ++
 llvm/test/tools/llvm-lib/arm64ec-implib.test  |  2 ++
 .../tools/llvm-readobj/COFF/file-headers.test |  1 +
 llvm/tools/llvm-readobj/COFFImportDumper.cpp  |  3 +++
 12 files changed, 64 insertions(+)

diff --git a/lld/test/COFF/def-export-cpp.s b/lld/test/COFF/def-export-cpp.s
index e00b35b1c5b39b..370b8ddba4104b 100644
--- a/lld/test/COFF/def-export-cpp.s
+++ b/lld/test/COFF/def-export-cpp.s
@@ -10,6 +10,7 @@
 
 # IMPLIB: File: foo.dll
 # IMPLIB: Name type: undecorate
+# IMPLIB-NEXT: Export name: GetPathOnDisk
 # IMPLIB-NEXT: Symbol: __imp_?GetPathOnDisk@@YA_NPEA_W@Z
 # IMPLIB-NEXT: Symbol: ?GetPathOnDisk@@YA_NPEA_W@Z
 
diff --git a/lld/test/COFF/def-export-stdcall.s 
b/lld/test/COFF/def-export-stdcall.s
index f015e205c74a33..7e4e04c77cbe7a 100644
--- a/lld/test/COFF/def-export-stdcall.s
+++ b/lld/test/COFF/def-export-stdcall.s
@@ -6,15 +6,19 @@
 # RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix 
UNDECORATED-EXPORTS %s
 
 # UNDECORATED-IMPLIB: Name type: noprefix
+# UNDECORATED-IMPLIB-NEXT: Export name: _underscored
 # UNDECORATED-IMPLIB-NEXT: __imp___underscored
 # UNDECORATED-IMPLIB-NEXT: __underscored
 # UNDECORATED-IMPLIB: Name type: undecorate
+# UNDECORATED-IMPLIB-NEXT: Export name: fastcall
 # UNDECORATED-IMPLIB-NEXT: __imp_@fastcall@8
 # UNDECORATED-IMPLIB-NEXT: fastcall@8
 # UNDECORATED-IMPLIB: Name type: undecorate
+# UNDECORATED-IMPLIB-NEXT: Export name: stdcall
 # UNDECORATED-IMPLIB-NEXT: __imp__stdcall@8
 # UNDECORATED-IMPLIB-NEXT: _stdcall@8
 # UNDECORATED-IMPLIB: Name type: undecorate
+# UNDECORATED-IMPLIB-NEXT: Export name: vectorcall
 # UNDECORATED-IMPLIB-NEXT: __imp_vectorcall@@8
 # UNDECORATED-IMPLIB-NEXT: vectorcall@@8
 
@@ -30,12 +34,15 @@
 # RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix 
DECORATED-EXPORTS %s
 
 # DECORATED-IMPLIB: Name type: name
+# DECORATED-IMPLIB-NEXT: Export name: @fastcall@8
 # DECORATED-IMPLIB-NEXT: __imp_@fastcall@8
 # DECORATED-IMPLIB-NEXT: @fastcall@8
 # DECORATED-IMPLIB: Name type: name
+# DECORATED-IMPLIB-NEXT: Export name: _stdcall@8
 # DECORATED-IMPLIB-NEXT: __imp__stdcall@8
 # DECORATED-IMPLIB-NEXT: _stdcall@8
 # DECORATED-IMPLIB: Name type: name
+# DECORATED-IMPLIB-NEXT: Export name: vectorcall@@8
 # DECORATED-IMPLIB-NEXT: __imp_vectorcall@@8
 # DECORATED-IMPLIB-NEXT: vectorcall@@8
 
@@ -51,14 +58,17 @@
 # RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix 
DECORATED-MINGW-EXPORTS %s
 
 # DECORATED-MINGW-IMPLIB: Name type: name
+# DECORATED-MINGW-IMPLIB-NEXT: Export name: @fastcall@8
 # DECORATED-MINGW-IMPLIB-NEXT: __imp_@fastcall@8
 # DECORATED-MINGW-IMPLIB-NEXT: fastcall@8
 # DECORATED-MINGW-IMPLIB: Name type: noprefix
+# DECORATED-MINGW-IMPLIB-NEXT: Export name: stdcall@8
 # DECORATED-MINGW-IMPLIB-NEXT: __imp__stdcall@8
 # DECORATED-MINGW-IMPLIB-NEXT: _stdcall@8
 # GNU tools don't support vectorcall, but this test is just to track that
 # lld's behaviour remains consistent over time.
 # DECORATED-MINGW-IMPLIB: Name type: name
+# DECORATED-MINGW-IMPLIB-NEXT: Export name: vectorcall@@8
 # DECORATED-MINGW-IMPLIB-NEXT: __imp_vectorcall@@8
 # DECORATED-MINGW-IMPLIB-NEXT: vectorcall@@8
 
@@ -75,14 +85,17 @@
 # RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix 
MINGW-KILL-AT-EXPORTS %s
 
 # MINGW-KILL-AT-IMPLIB: Name type: noprefix
+# MINGW-KILL-AT-IMPLIB: Export name: fastcall
 # MINGW-KILL-AT-IMPLIB: __imp__fastcall
 # MINGW-KILL-AT-IMPLIB-NEXT: _fastcall
 # MINGW-KILL-AT-IMPLIB: Name type: noprefix
+# MINGW-KILL-AT-IMPLIB-NEXT: Export name: stdcall
 # MINGW-KILL-AT-IMPLIB-NEXT: __imp__stdcall
 # MINGW-KILL-AT-IMPLIB-NEXT: _stdcall
 # GNU tools don't support vectorcall, but this test is just to track that
 # lld's behaviour remains consistent over time.
 # MINGW-KILL-AT-IMPLIB: Name type: noprefix
+# MINGW-KILL-AT-IMPLIB-NEXT: Export name: vectorcall
 # MINGW-KILL-AT-IMPLIB-NEXT: __imp__vectorcall
 # MINGW-KILL-AT-IMPLIB-NEXT

[llvm-branch-commits] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82851


___
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] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82851


___
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] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82852


___
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] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82852


___
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][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82853


___
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][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82853


___
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][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon edited 
https://github.com/llvm/llvm-project/pull/82853
___
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][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon edited 
https://github.com/llvm/llvm-project/pull/82853
___
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][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon edited 
https://github.com/llvm/llvm-project/pull/82853
___
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] [OpenMP][MLIR] Extend record member map support for omp dialect to LLVM-IR (PR #82852)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon edited 
https://github.com/llvm/llvm-project/pull/82852
___
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] [OpenMP][MLIR] Add new arguments to map_info to help support record type maps (PR #82851)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon edited 
https://github.com/llvm/llvm-project/pull/82851
___
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] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-03-15 Thread via llvm-branch-commits

https://github.com/agozillon updated 
https://github.com/llvm/llvm-project/pull/82853

>From 21b05eee943e4f1ad20fcd8f30bd14a0a3317db6 Mon Sep 17 00:00:00 2001
From: Andrew Gozillon 
Date: Fri, 15 Mar 2024 14:13:30 -0500
Subject: [PATCH] update with minor tidying up

Created using spr 1.3.4
---
 flang/lib/Lower/OpenMP/Utils.cpp  | 2 +-
 flang/lib/Lower/OpenMP/Utils.h| 2 --
 flang/lib/Optimizer/Transforms/CMakeLists.txt | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp
index 60aea9f5b70aba..18728e2c4c1b06 100644
--- a/flang/lib/Lower/OpenMP/Utils.cpp
+++ b/flang/lib/Lower/OpenMP/Utils.cpp
@@ -13,7 +13,6 @@
 #include "Utils.h"
 #include "Clauses.h"
 
-#include 
 #include 
 #include 
 #include 
@@ -22,6 +21,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 llvm::cl::opt treatIndexAsSection(
diff --git a/flang/lib/Lower/OpenMP/Utils.h b/flang/lib/Lower/OpenMP/Utils.h
index f45e4490c2abe7..942dd4c12d87b6 100644
--- a/flang/lib/Lower/OpenMP/Utils.h
+++ b/flang/lib/Lower/OpenMP/Utils.h
@@ -14,7 +14,6 @@
 #include "mlir/IR/Location.h"
 #include "mlir/IR/Value.h"
 #include "llvm/Support/CommandLine.h"
-#include 
 
 extern llvm::cl::opt treatIndexAsSection;
 extern llvm::cl::opt enableDelayedPrivatization;
@@ -36,7 +35,6 @@ class Symbol;
 namespace parser {
 struct OmpObject;
 struct OmpObjectList;
-struct Designator;
 } // namespace parser
 
 namespace lower {
diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt 
b/flang/lib/Optimizer/Transforms/CMakeLists.txt
index ce5ce3ed1bc48d..63fbe2a0658d83 100644
--- a/flang/lib/Optimizer/Transforms/CMakeLists.txt
+++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt
@@ -17,8 +17,8 @@ add_flang_library(FIRTransforms
   AddDebugFoundation.cpp
   PolymorphicOpConversion.cpp
   LoopVersioning.cpp
-  OMPMapInfoFinalization.cpp
   OMPFunctionFiltering.cpp
+  OMPMapInfoFinalization.cpp
   OMPMarkDeclareTarget.cpp
   VScaleAttr.cpp
   FunctionAttr.cpp

___
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] [Flang][OpenMP][MLIR] Initial derived type member map support (PR #82853)

2024-03-15 Thread via llvm-branch-commits

agozillon wrote:

The current PR stack has been updated with the aims to extend support to 
explicit derived type member mapping at arbitrary depths, and not just top 
level member mapping. The change set is slightly different, primarily in the 
sense that we now need to handle index generation in Flang and then first/last 
member selection in the lowering differently due to the new attribute type in 
use for member placement tracking (DenseIntElementsAttr, for N-D indices). 

These are the encompassing PR stack that were updated:

https://github.com/llvm/llvm-project/pull/82853
https://github.com/llvm/llvm-project/pull/82852
https://github.com/llvm/llvm-project/pull/82851
https://github.com/llvm/llvm-project/pull/82850

The only PR from the stack that is still a little in flux so I would recommend 
not reviewing for a little while (I'll add a comment when it's ready), is the 
MLIR -> LLVM-IR lowering (https://github.com/llvm/llvm-project/pull/82852), as 
it has a partially duplicate change set that's segmented into another PR 
(https://github.com/llvm/llvm-project/pull/84349) for hopefully easier/quicker 
review. Once the other has landed I hope to perform a rebase to align the stack 
completely. That being said, if you do review it, I'll do my best to apply the 
requests to the relevant PR.

https://github.com/llvm/llvm-project/pull/82853
___
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][runtime] Added custom visitor for IoStatementState variants. (PR #85179)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85179


___
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][runtime] Added custom visitor for IoStatementState variants. (PR #85179)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85179


___
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][runtime] Enable PRINT of integer32 for device. (PR #85182)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85182


___
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][runtime] Enable PRINT of integer32 for device. (PR #85182)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85182


___
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-tools-extra] release/18.x: [clangd] [HeuristicResolver] Protect against infinite recursion on DependentNameTypes (#83542) (PR #84117)

2024-03-15 Thread Nathan Ridge via llvm-branch-commits

HighCommander4 wrote:

> that sounds a bit unclear. :)

I'm happy to take suggestions for better wording!

https://github.com/llvm/llvm-project/pull/84117
___
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][runtime] Added Fortran::common::reference_wrapper for use on device. (PR #85178)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85178


___
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][runtime] Added Fortran::common::reference_wrapper for use on device. (PR #85178)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85178


___
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][runtime] Enable PRINT of integer32 for device. (PR #85182)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85182


___
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][runtime] Enable PRINT of integer32 for device. (PR #85182)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85182


___
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][runtime] Added custom visitor for IoStatementState variants. (PR #85179)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85179


___
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][runtime] Added custom visitor for IoStatementState variants. (PR #85179)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85179


___
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] [NFC][flang] Reorder const and RT_API_ATTRS. (PR #85180)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85180


___
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] [NFC][flang] Reorder const and RT_API_ATTRS. (PR #85180)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85180


___
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][runtime] Added self-printing for InternalUnit. (PR #85181)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85181


___
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][runtime] Added self-printing for InternalUnit. (PR #85181)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85181


___
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][runtime] Added Fortran::common::reference_wrapper for use on device. (PR #85178)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85178


___
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][runtime] Added Fortran::common::reference_wrapper for use on device. (PR #85178)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85178


___
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][runtime] Added custom visitor for IoStatementState variants. (PR #85179)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85179


___
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][runtime] Added custom visitor for IoStatementState variants. (PR #85179)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85179


___
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] [NFC][flang] Reorder const and RT_API_ATTRS. (PR #85180)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85180


___
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] [NFC][flang] Reorder const and RT_API_ATTRS. (PR #85180)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85180


___
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][runtime] Added self-printing for InternalUnit. (PR #85181)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85181


___
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][runtime] Added self-printing for InternalUnit. (PR #85181)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85181


___
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][runtime] Enable PRINT of integer32 for device. (PR #85182)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85182


___
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][runtime] Enable PRINT of integer32 for device. (PR #85182)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85182


___
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] [flang][OpenMP] Main splitting functionality dev-complete (PR #82003)

2024-03-15 Thread Krzysztof Parzyszek via llvm-branch-commits

https://github.com/kparzysz closed 
https://github.com/llvm/llvm-project/pull/82003
___
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] [flang][OpenMP] Main splitting functionality dev-complete (PR #83264)

2024-03-15 Thread Krzysztof Parzyszek via llvm-branch-commits

https://github.com/kparzysz closed 
https://github.com/llvm/llvm-project/pull/83264
___
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] [flang][OpenMP] Main splitting functionality dev-complete (PR #82495)

2024-03-15 Thread Krzysztof Parzyszek via llvm-branch-commits

https://github.com/kparzysz closed 
https://github.com/llvm/llvm-project/pull/82495
___
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] [NFC][flang] Reorder const and RT_API_ATTRS. (PR #85180)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85180


___
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][runtime] Added custom visitor for IoStatementState variants. (PR #85179)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85179


___
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][runtime] Added custom visitor for IoStatementState variants. (PR #85179)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85179


___
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] [NFC][flang] Reorder const and RT_API_ATTRS. (PR #85180)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85180


___
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][runtime] Added self-printing for InternalUnit. (PR #85181)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85181


___
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][runtime] Added self-printing for InternalUnit. (PR #85181)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85181


___
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][runtime] Enable PRINT of integer32 for device. (PR #85182)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85182


___
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][runtime] Enable PRINT of integer32 for device. (PR #85182)

2024-03-15 Thread Slava Zakharin via llvm-branch-commits

https://github.com/vzakhari updated 
https://github.com/llvm/llvm-project/pull/85182


___
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: [TSan] Fix atomicrmw xchg with pointer and floats (#85228) (PR #85371)

2024-03-15 Thread Vitaly Buka via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/85371
___
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] [mlir] [mlir][LLVM] erase call mappings in forgetMapping() (PR #84955)

2024-03-15 Thread Mehdi Amini via llvm-branch-commits


@@ -0,0 +1,47 @@
+// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
+
+// Test that we don't crash when there is a call operation in the combiner
+
+omp.reduction.declare @add_f32 : f32
+init {
+^bb0(%arg: f32):
+  %0 = llvm.mlir.constant(0.0 : f32) : f32
+  omp.yield (%0 : f32)
+}
+combiner {
+^bb1(%arg0: f32, %arg1: f32):
+// test this call here:
+  llvm.call @test_call() : () -> ()
+  %1 = llvm.fadd %arg0, %arg1 : f32
+  omp.yield (%1 : f32)
+}
+atomic {
+^bb2(%arg2: !llvm.ptr, %arg3: !llvm.ptr):
+  %2 = llvm.load %arg3 : !llvm.ptr -> f32
+  llvm.atomicrmw fadd %arg2, %2 monotonic : !llvm.ptr, f32
+  omp.yield
+}
+
+llvm.func @simple_reduction(%lb : i64, %ub : i64, %step : i64) {
+  %c1 = llvm.mlir.constant(1 : i32) : i32
+  %0 = llvm.alloca %c1 x i32 : (i32) -> !llvm.ptr
+  omp.parallel {
+omp.wsloop reduction(@add_f32 %0 -> %prv : !llvm.ptr)
+for (%iv) : i64 = (%lb) to (%ub) step (%step) {
+  %1 = llvm.mlir.constant(2.0 : f32) : f32
+  %2 = llvm.load %prv : !llvm.ptr -> f32
+  %3 = llvm.fadd %1, %2 : f32
+  llvm.store %3, %prv : f32, !llvm.ptr
+  omp.yield
+}
+omp.terminator
+  }
+  llvm.return
+}
+
+llvm.func @test_call() -> ()

joker-eph wrote:

This seems quite complex to me: is this the minimum test? 

Why do we need any OpenMp constructs here?

https://github.com/llvm/llvm-project/pull/84955
___
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: [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (#84127) (PR #85118)

2024-03-15 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar updated 
https://github.com/llvm/llvm-project/pull/85118

>From a649e0a6e80f5ae26657b640de469e8a53244ad2 Mon Sep 17 00:00:00 2001
From: Ian Anderson 
Date: Wed, 13 Mar 2024 11:15:41 -0700
Subject: [PATCH] [clang][modules] giving the __stddef_ headers their own
 modules can cause redeclaration errors with
 -fbuiltin-headers-in-system-modules (#84127)

On Apple platforms, some of the stddef.h types are also declared in
system headers. In particular NULL has a conflicting declaration in
. When that's in a different module from
<__stddef_null.h>, redeclaration errors can occur.

Make the \_\_stddef_ headers be non-modular in
-fbuiltin-headers-in-system-modules and restore them back to not
respecting their header guards. Still define the header guards though.
__stddef_max_align_t.h was in _Builtin_stddef_max_align_t prior to the
addition of _Builtin_stddef, and it needs to stay in a module because
struct's can't be type merged. __stddef_wint_t.h didn't used to have a
module, but leave it in it current module since it doesn't really belong
to stddef.h.

(cherry picked from commit f50d3582b4844b86ad86372028e44b52c560ec7d)
---
 clang/lib/Basic/Module.cpp|  7 ++--
 clang/lib/Headers/__stddef_null.h |  2 +-
 clang/lib/Headers/__stddef_nullptr_t.h|  7 +++-
 clang/lib/Headers/__stddef_offsetof.h |  7 +++-
 clang/lib/Headers/__stddef_ptrdiff_t.h|  7 +++-
 clang/lib/Headers/__stddef_rsize_t.h  |  7 +++-
 clang/lib/Headers/__stddef_size_t.h   |  7 +++-
 clang/lib/Headers/__stddef_unreachable.h  |  7 +++-
 clang/lib/Headers/__stddef_wchar_t.h  |  7 +++-
 clang/lib/Headers/module.modulemap| 20 ++--
 clang/lib/Lex/ModuleMap.cpp   |  9 --
 .../no-undeclared-includes-builtins.cpp   |  2 +-
 clang/test/Modules/stddef.c   | 32 +++
 13 files changed, 80 insertions(+), 41 deletions(-)

diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index 925217431d4d02..0dac8748a98aff 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -301,10 +301,9 @@ bool Module::directlyUses(const Module *Requested) {
 if (Requested->isSubModuleOf(Use))
   return true;
 
-  // Anyone is allowed to use our builtin stdarg.h and stddef.h and their
-  // accompanying modules.
-  if (Requested->getTopLevelModuleName() == "_Builtin_stdarg" ||
-  Requested->getTopLevelModuleName() == "_Builtin_stddef")
+  // Anyone is allowed to use our builtin stddef.h and its accompanying 
modules.
+  if (Requested->fullModuleNameIs({"_Builtin_stddef", "max_align_t"}) ||
+  Requested->fullModuleNameIs({"_Builtin_stddef_wint_t"}))
 return true;
 
   if (NoUndeclaredIncludes)
diff --git a/clang/lib/Headers/__stddef_null.h 
b/clang/lib/Headers/__stddef_null.h
index 7336fdab389723..c10bd2d7d9887c 100644
--- a/clang/lib/Headers/__stddef_null.h
+++ b/clang/lib/Headers/__stddef_null.h
@@ -7,7 +7,7 @@
  *===---===
  */
 
-#if !defined(NULL) || !__has_feature(modules)
+#if !defined(NULL) || !__building_module(_Builtin_stddef)
 
 /* linux/stddef.h will define NULL to 0. glibc (and other) headers then define
  * __need_NULL and rely on stddef.h to redefine NULL to the correct value 
again.
diff --git a/clang/lib/Headers/__stddef_nullptr_t.h 
b/clang/lib/Headers/__stddef_nullptr_t.h
index 183d394d56c1b7..7f3fbe6fe0d3a8 100644
--- a/clang/lib/Headers/__stddef_nullptr_t.h
+++ b/clang/lib/Headers/__stddef_nullptr_t.h
@@ -7,7 +7,12 @@
  *===---===
  */
 
-#ifndef _NULLPTR_T
+/*
+ * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
+ * and needs to behave as if it was textual.
+ */
+#if !defined(_NULLPTR_T) ||
\
+(__has_feature(modules) && !__building_module(_Builtin_stddef))
 #define _NULLPTR_T
 
 #ifdef __cplusplus
diff --git a/clang/lib/Headers/__stddef_offsetof.h 
b/clang/lib/Headers/__stddef_offsetof.h
index 3b347b3b92f62c..84172c6cd27352 100644
--- a/clang/lib/Headers/__stddef_offsetof.h
+++ b/clang/lib/Headers/__stddef_offsetof.h
@@ -7,6 +7,11 @@
  *===---===
  */
 
-#ifndef offsetof
+/*
+ * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
+ * and needs to behave as if it was textual.
+ */
+#if !defined(offsetof) ||  
\
+(__has_feature(modules) && !__building_module(_Builtin_stddef))
 #define offsetof(t, d) __builtin_offsetof(t, d)
 #endif
diff --git a/clang/lib/Headers/__stddef_ptrdiff_t.h 
b/clang/lib/Headers/__stddef_ptrdiff_t.h
index 3ea6d7d2852e1c..fd3c893c66c979 100644
--- a/clang/lib/Headers/__stddef_ptrdiff_t.h
+++ b/clang/lib/Headers/__stddef_ptrdiff_t.h
@@ -7,7 +7,12

[llvm-branch-commits] [clang] a649e0a - [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (#84127)

2024-03-15 Thread Tom Stellard via llvm-branch-commits

Author: Ian Anderson
Date: 2024-03-15T17:06:34-07:00
New Revision: a649e0a6e80f5ae26657b640de469e8a53244ad2

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

LOG: [clang][modules] giving the __stddef_ headers their own modules can cause 
redeclaration errors with -fbuiltin-headers-in-system-modules (#84127)

On Apple platforms, some of the stddef.h types are also declared in
system headers. In particular NULL has a conflicting declaration in
. When that's in a different module from
<__stddef_null.h>, redeclaration errors can occur.

Make the \_\_stddef_ headers be non-modular in
-fbuiltin-headers-in-system-modules and restore them back to not
respecting their header guards. Still define the header guards though.
__stddef_max_align_t.h was in _Builtin_stddef_max_align_t prior to the
addition of _Builtin_stddef, and it needs to stay in a module because
struct's can't be type merged. __stddef_wint_t.h didn't used to have a
module, but leave it in it current module since it doesn't really belong
to stddef.h.

(cherry picked from commit f50d3582b4844b86ad86372028e44b52c560ec7d)

Added: 


Modified: 
clang/lib/Basic/Module.cpp
clang/lib/Headers/__stddef_null.h
clang/lib/Headers/__stddef_nullptr_t.h
clang/lib/Headers/__stddef_offsetof.h
clang/lib/Headers/__stddef_ptrdiff_t.h
clang/lib/Headers/__stddef_rsize_t.h
clang/lib/Headers/__stddef_size_t.h
clang/lib/Headers/__stddef_unreachable.h
clang/lib/Headers/__stddef_wchar_t.h
clang/lib/Headers/module.modulemap
clang/lib/Lex/ModuleMap.cpp
clang/test/Modules/no-undeclared-includes-builtins.cpp
clang/test/Modules/stddef.c

Removed: 




diff  --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index 925217431d4d02..0dac8748a98aff 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -301,10 +301,9 @@ bool Module::directlyUses(const Module *Requested) {
 if (Requested->isSubModuleOf(Use))
   return true;
 
-  // Anyone is allowed to use our builtin stdarg.h and stddef.h and their
-  // accompanying modules.
-  if (Requested->getTopLevelModuleName() == "_Builtin_stdarg" ||
-  Requested->getTopLevelModuleName() == "_Builtin_stddef")
+  // Anyone is allowed to use our builtin stddef.h and its accompanying 
modules.
+  if (Requested->fullModuleNameIs({"_Builtin_stddef", "max_align_t"}) ||
+  Requested->fullModuleNameIs({"_Builtin_stddef_wint_t"}))
 return true;
 
   if (NoUndeclaredIncludes)

diff  --git a/clang/lib/Headers/__stddef_null.h 
b/clang/lib/Headers/__stddef_null.h
index 7336fdab389723..c10bd2d7d9887c 100644
--- a/clang/lib/Headers/__stddef_null.h
+++ b/clang/lib/Headers/__stddef_null.h
@@ -7,7 +7,7 @@
  *===---===
  */
 
-#if !defined(NULL) || !__has_feature(modules)
+#if !defined(NULL) || !__building_module(_Builtin_stddef)
 
 /* linux/stddef.h will define NULL to 0. glibc (and other) headers then define
  * __need_NULL and rely on stddef.h to redefine NULL to the correct value 
again.

diff  --git a/clang/lib/Headers/__stddef_nullptr_t.h 
b/clang/lib/Headers/__stddef_nullptr_t.h
index 183d394d56c1b7..7f3fbe6fe0d3a8 100644
--- a/clang/lib/Headers/__stddef_nullptr_t.h
+++ b/clang/lib/Headers/__stddef_nullptr_t.h
@@ -7,7 +7,12 @@
  *===---===
  */
 
-#ifndef _NULLPTR_T
+/*
+ * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
+ * and needs to behave as if it was textual.
+ */
+#if !defined(_NULLPTR_T) ||
\
+(__has_feature(modules) && !__building_module(_Builtin_stddef))
 #define _NULLPTR_T
 
 #ifdef __cplusplus

diff  --git a/clang/lib/Headers/__stddef_offsetof.h 
b/clang/lib/Headers/__stddef_offsetof.h
index 3b347b3b92f62c..84172c6cd27352 100644
--- a/clang/lib/Headers/__stddef_offsetof.h
+++ b/clang/lib/Headers/__stddef_offsetof.h
@@ -7,6 +7,11 @@
  *===---===
  */
 
-#ifndef offsetof
+/*
+ * When -fbuiltin-headers-in-system-modules is set this is a non-modular header
+ * and needs to behave as if it was textual.
+ */
+#if !defined(offsetof) ||  
\
+(__has_feature(modules) && !__building_module(_Builtin_stddef))
 #define offsetof(t, d) __builtin_offsetof(t, d)
 #endif

diff  --git a/clang/lib/Headers/__stddef_ptr
diff _t.h b/clang/lib/Headers/__stddef_ptr
diff _t.h
index 3ea6d7d2852e1c..fd3c893c66c979 100644
--- a/clang/lib/Headers/__stddef_ptr
diff _t.h
+++ b/clang/lib/Headers/__stddef_ptr
diff _t.h
@@ -7,7 +7,12 @@
  *===---===

[llvm-branch-commits] [clang] release/18.x: [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (#84127) (PR #85118)

2024-03-15 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/85118
___
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] [libc] f2be0a8 - Revert "[libc] Match stdlib.h baremetal entrypoints with types (#85030)"

2024-03-15 Thread via llvm-branch-commits

Author: Paul Kirth
Date: 2024-03-15T17:38:48-07:00
New Revision: f2be0a8191be71cdb9295604bb29f41444938393

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

LOG: Revert "[libc] Match stdlib.h baremetal entrypoints with types (#85030)"

This reverts commit 500e05f5a29e8a8008f849788b385cfb0c72e3ef.

Added: 


Modified: 
libc/config/baremetal/api.td

Removed: 




diff  --git a/libc/config/baremetal/api.td b/libc/config/baremetal/api.td
index d24c92e9e590de..28364726077942 100644
--- a/libc/config/baremetal/api.td
+++ b/libc/config/baremetal/api.td
@@ -68,7 +68,7 @@ def StdlibAPI : PublicAPI<"stdlib.h"> {
 "size_t",
 "__bsearchcompare_t",
 "__qsortcompare_t",
-"__qsortrcompare_t",
+"__atexithandler_t",
   ];
 }
 



___
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] Backport #85277 (PR #85422)

2024-03-15 Thread Ben Shi via llvm-branch-commits

https://github.com/benshi001 updated 
https://github.com/llvm/llvm-project/pull/85422

>From bb49a9f39c5643ed7503c78b56bfc28388e21709 Mon Sep 17 00:00:00 2001
From: Patryk Wychowaniec 
Date: Fri, 15 Mar 2024 12:07:54 +0100
Subject: [PATCH] [AVR] Remove earlyclobber from LDDRdPtrQ (#85277)

LDDRdPtrQ was marked as `earlyclobber`, which doesn't play well with
GreedyRA (which can generate this instruction through `loadRegFromStackSlot()`).

This seems to be the same case as:

https://github.com/llvm/llvm-project/blob/a99b912c9b74f6ef91786b4dfbc25160c27d3b41/llvm/lib/Target/AVR/AVRInstrInfo.td#L1421

Closes https://github.com/llvm/llvm-project/issues/81911.
---
 llvm/lib/Target/AVR/AVRInstrInfo.td |   2 +-
 llvm/test/CodeGen/AVR/bug-81911.ll  | 163 
 2 files changed, 164 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/CodeGen/AVR/bug-81911.ll

diff --git a/llvm/lib/Target/AVR/AVRInstrInfo.td 
b/llvm/lib/Target/AVR/AVRInstrInfo.td
index efaaec32ee6bb1..0a77c7c1d418a1 100644
--- a/llvm/lib/Target/AVR/AVRInstrInfo.td
+++ b/llvm/lib/Target/AVR/AVRInstrInfo.td
@@ -1398,7 +1398,7 @@ let mayLoad = 1, hasSideEffects = 0,
 
 // Load indirect with displacement operations.
 let canFoldAsLoad = 1, isReMaterializable = 1 in {
-  let Constraints = "@earlyclobber $reg" in def LDDRdPtrQ
+  def LDDRdPtrQ
   : FSTDLDD<0,
 (outs GPR8
  : $reg),
diff --git a/llvm/test/CodeGen/AVR/bug-81911.ll 
b/llvm/test/CodeGen/AVR/bug-81911.ll
new file mode 100644
index 00..2a22666a1ff927
--- /dev/null
+++ b/llvm/test/CodeGen/AVR/bug-81911.ll
@@ -0,0 +1,163 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 
UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=avr -mcpu=atmega328 -O1 -verify-machineinstrs | 
FileCheck %s
+
+define internal i8 @main() {
+; CHECK-LABEL: main:
+; CHECK:   ; %bb.0: ; %bb0
+; CHECK-NEXT:push r2
+; CHECK-NEXT:push r3
+; CHECK-NEXT:push r4
+; CHECK-NEXT:push r5
+; CHECK-NEXT:push r6
+; CHECK-NEXT:push r7
+; CHECK-NEXT:push r8
+; CHECK-NEXT:push r9
+; CHECK-NEXT:push r10
+; CHECK-NEXT:push r11
+; CHECK-NEXT:push r12
+; CHECK-NEXT:push r13
+; CHECK-NEXT:push r14
+; CHECK-NEXT:push r15
+; CHECK-NEXT:push r16
+; CHECK-NEXT:push r17
+; CHECK-NEXT:push r28
+; CHECK-NEXT:push r29
+; CHECK-NEXT:in r28, 61
+; CHECK-NEXT:in r29, 62
+; CHECK-NEXT:sbiw r28, 13
+; CHECK-NEXT:in r0, 63
+; CHECK-NEXT:cli
+; CHECK-NEXT:out 62, r29
+; CHECK-NEXT:out 63, r0
+; CHECK-NEXT:out 61, r28
+; CHECK-NEXT:ldi r16, 0
+; CHECK-NEXT:ldi r17, 0
+; CHECK-NEXT:ldi r18, -1
+; CHECK-NEXT:;APP
+; CHECK-NEXT:ldi r24, 123
+; CHECK-NEXT:;NO_APP
+; CHECK-NEXT:std Y+1, r24 ; 1-byte Folded Spill
+; CHECK-NEXT:movw r24, r28
+; CHECK-NEXT:adiw r24, 6
+; CHECK-NEXT:std Y+3, r25 ; 2-byte Folded Spill
+; CHECK-NEXT:std Y+2, r24 ; 2-byte Folded Spill
+; CHECK-NEXT:movw r8, r16
+; CHECK-NEXT:movw r6, r16
+; CHECK-NEXT:movw r4, r16
+; CHECK-NEXT:movw r2, r16
+; CHECK-NEXT:rjmp .LBB0_2
+; CHECK-NEXT:  .LBB0_1: ; %bb1
+; CHECK-NEXT:; in Loop: Header=BB0_2 Depth=1
+; CHECK-NEXT:andi r30, 1
+; CHECK-NEXT:ldd r31, Y+4 ; 1-byte Folded Reload
+; CHECK-NEXT:dec r31
+; CHECK-NEXT:cpi r30, 0
+; CHECK-NEXT:movw r8, r18
+; CHECK-NEXT:movw r6, r20
+; CHECK-NEXT:movw r4, r22
+; CHECK-NEXT:movw r2, r24
+; CHECK-NEXT:mov r18, r31
+; CHECK-NEXT:brne .LBB0_2
+; CHECK-NEXT:rjmp .LBB0_4
+; CHECK-NEXT:  .LBB0_2: ; %bb1
+; CHECK-NEXT:; =>This Inner Loop Header: Depth=1
+; CHECK-NEXT:std Y+4, r18 ; 1-byte Folded Spill
+; CHECK-NEXT:movw r18, r8
+; CHECK-NEXT:movw r20, r6
+; CHECK-NEXT:movw r22, r4
+; CHECK-NEXT:movw r24, r2
+; CHECK-NEXT:ldi r26, 10
+; CHECK-NEXT:ldi r27, 0
+; CHECK-NEXT:movw r10, r26
+; CHECK-NEXT:movw r12, r16
+; CHECK-NEXT:movw r14, r16
+; CHECK-NEXT:call __udivdi3
+; CHECK-NEXT:std Y+13, r25
+; CHECK-NEXT:std Y+12, r24
+; CHECK-NEXT:std Y+11, r23
+; CHECK-NEXT:std Y+10, r22
+; CHECK-NEXT:std Y+9, r21
+; CHECK-NEXT:std Y+8, r20
+; CHECK-NEXT:std Y+7, r19
+; CHECK-NEXT:std Y+6, r18
+; CHECK-NEXT:ldd r30, Y+2 ; 2-byte Folded Reload
+; CHECK-NEXT:ldd r31, Y+3 ; 2-byte Folded Reload
+; CHECK-NEXT:;APP
+; CHECK-NEXT:;NO_APP
+; CHECK-NEXT:ldi r30, 1
+; CHECK-NEXT:cp r8, r1
+; CHECK-NEXT:cpc r9, r1
+; CHECK-NEXT:cpc r6, r16
+; CHECK-NEXT:cpc r7, r17
+; CHECK-NEXT:cpc r4, r16
+; CHECK-NEXT:cpc r5, r17
+; CHECK-NEXT:cpc r2, r16
+; CHECK-NEXT:cpc r3, r17
+; CHECK-NEXT:breq .LBB0_3
+; CHECK-NEXT:rjmp .LBB0_1
+; CHECK-NEXT:  .LBB0_3: ; %bb1
+; CHECK-NEXT:; in Loop: Header=BB0_2 Depth=1
+; CHECK-NEXT:mov r30, r1
+; CHECK-NEXT:rjmp .LBB0_1
+; CHECK-NEXT:  .LBB0_4: ; %bb3
+; CHECK-NEXT:ldd r24, Y+1 ; 1-