[llvm-branch-commits] [llvm] release/20.x: [X86] Do not combine LRINT and TRUNC (#125848) (PR #125995)

2025-02-06 Thread Craig Topper via llvm-branch-commits

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

LGTM

https://github.com/llvm/llvm-project/pull/125995
___
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/20.x: [X86] Do not combine LRINT and TRUNC (#125848) (PR #125995)

2025-02-06 Thread Nikita Popov via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/125995
___
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] [AMDGPU][MLIR] Replace gfx940 and gfx941 with gfx942 in MLIR (PR #125836)

2025-02-06 Thread Krzysztof Drewniak via llvm-branch-commits

krzysz00 wrote:

I'll try and remember to go to that

https://github.com/llvm/llvm-project/pull/125836
___
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/20.x: [X86] Do not combine LRINT and TRUNC (#125848) (PR #125995)

2025-02-06 Thread Simon Pilgrim via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/125995
___
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] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits


@@ -146,13 +146,24 @@ def PrivateClauseOp : OpenMP_Op<"private", 
[IsolatedFromAbove, RecipeInterface]>
   return region.empty() ? nullptr : region.getArgument(0);
 }
 
+/// Returns true if the init region might read from the mold argument
+bool initReadsFromMold() {
+  BlockArgument moldArg = getInitMoldArg();
+  return moldArg ? !moldArg.use_empty() : false;

skatrak wrote:

Nit: I think it's a bit simpler this way, but feel free to ignore.
```suggestion
  return moldArg && !moldArg.use_empty();
```

https://github.com/llvm/llvm-project/pull/125307
___
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] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits


@@ -1794,37 +1909,118 @@ convertOmpTaskOp(omp::TaskOp taskOp, 
llvm::IRBuilderBase &builder,
   moduleTranslation, allocaIP);
 
   // Allocate and initialize private variables
-  // TODO: package private variables up in a structure
   builder.SetInsertPoint(initBlock->getTerminator());
-  for (auto [privDecl, mlirPrivVar, blockArg] :
-   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs)) {
-llvm::Type *llvmAllocType =
-moduleTranslation.convertType(privDecl.getType());
 
-// Allocations:
-builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
-llvm::Value *llvmPrivateVar = builder.CreateAlloca(
-llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+  // Create task variable structure
+  taskStructMgr.generateTaskContextStruct();
+  // GEPs so that we can initialize the variables. Don't use these GEPs inside
+  // of the body otherwise it will be the GEP not the struct which is fowarded
+  // to the outlined function. GEPs forwarded in this way are passed in a
+  // stack-allocated (by OpenMPIRBuilder) structure which is not safe for tasks
+  // which may not be executed until after the current stack frame goes out of
+  // scope.
+  taskStructMgr.createGEPsToPrivateVars();
+
+  for (auto [privDecl, mlirPrivVar, blockArg, llvmPrivateVarAlloc] :
+   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs,
+   taskStructMgr.getLLVMPrivateVarGEPs())) {
+if (!privDecl.readsFromMold())
+  // to be handled inside the task
+  continue;
+assert(llvmPrivateVarAlloc &&
+   "reads from mold so shouldn't have been skipped");
 
-auto err =
+llvm::Expected privateVarOrErr =
 initPrivateVar(builder, moduleTranslation, privDecl, mlirPrivVar,
-   blockArg, llvmPrivateVar, llvmPrivateVars, initBlock);
-if (err)
+   blockArg, llvmPrivateVarAlloc, initBlock);
+if (auto err = privateVarOrErr.takeError())
   return handleError(std::move(err), *taskOp.getOperation());
+
+llvm::IRBuilderBase::InsertPointGuard guard(builder);
+builder.SetInsertPoint(builder.GetInsertBlock()->getTerminator());
+
+// TODO: this is a bit of a hack for Fortran character boxes.
+// Character boxes are passed by value into the init region and then the
+// initialized character box is yielded by value. Here we need to store the
+// yielded value into the private allocation, and load the private
+// allocation to match the type expected by region block arguments.
+if ((privateVarOrErr.get() != llvmPrivateVarAlloc) &&
+!mlir::isa(blockArg.getType())) {
+  builder.CreateStore(privateVarOrErr.get(), llvmPrivateVarAlloc);
+  // Load it so we have the value pointed to by the GEP
+  llvmPrivateVarAlloc = 
builder.CreateLoad(privateVarOrErr.get()->getType(),
+   llvmPrivateVarAlloc);
+}
+assert(llvmPrivateVarAlloc->getType() ==
+   moduleTranslation.convertType(blockArg.getType()));
+
+// Mapping blockArg -> llvmPrivateVarAlloc is done inside the body callback
+// so that OpenMPIRBuilder doesn't try to pass each GEP address through a
+// stack allocated structure.
   }
 
   // firstprivate copy region
   if (failed(initFirstPrivateVars(builder, moduleTranslation, mlirPrivateVars,
-  llvmPrivateVars, privateDecls, copyBlock)))
+  taskStructMgr.getLLVMPrivateVarGEPs(),
+  privateDecls, copyBlock)))
 return llvm::failure();
 
   // Set up for call to createTask()
   builder.SetInsertPoint(taskStartBlock);
 
   auto bodyCB = [&](InsertPointTy allocaIP,
 InsertPointTy codegenIP) -> llvm::Error {
+// Save the alloca insertion point on ModuleTranslation stack for use in
+// nested regions.
+LLVM::ModuleTranslation::SaveStack frame(
+moduleTranslation, allocaIP);
+
 // translate the body of the task:
 builder.restoreIP(codegenIP);
+
+llvm::BasicBlock *privInitBlock = nullptr;
+for (auto [blockArg, privDecl, mlirPrivVar] :
+ llvm::zip_equal(privateBlockArgs, privateDecls, mlirPrivateVars)) {
+  if (privDecl.readsFromMold())
+// This is handled before the task executes
+continue;
+
+  auto codegenInsertionPt = builder.saveIP();
+  llvm::Type *llvmAllocType =
+  moduleTranslation.convertType(privDecl.getType());
+  builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
+  llvm::Value *llvmPrivateVar = builder.CreateAlloca(
+  llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+
+  llvm::Expected privateVarOrError =
+  initPrivateVar(builder, moduleTranslation, privDecl, mlirPrivVar,
+ blockArg, llvmPrivateVar, privInitBlock);
+  if (auto err = privateVarOrError.takeError())
+   

[llvm-branch-commits] [flang] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits


@@ -1794,37 +1909,118 @@ convertOmpTaskOp(omp::TaskOp taskOp, 
llvm::IRBuilderBase &builder,
   moduleTranslation, allocaIP);
 
   // Allocate and initialize private variables
-  // TODO: package private variables up in a structure
   builder.SetInsertPoint(initBlock->getTerminator());
-  for (auto [privDecl, mlirPrivVar, blockArg] :
-   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs)) {
-llvm::Type *llvmAllocType =
-moduleTranslation.convertType(privDecl.getType());
 
-// Allocations:
-builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
-llvm::Value *llvmPrivateVar = builder.CreateAlloca(
-llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+  // Create task variable structure
+  taskStructMgr.generateTaskContextStruct();
+  // GEPs so that we can initialize the variables. Don't use these GEPs inside
+  // of the body otherwise it will be the GEP not the struct which is fowarded
+  // to the outlined function. GEPs forwarded in this way are passed in a
+  // stack-allocated (by OpenMPIRBuilder) structure which is not safe for tasks
+  // which may not be executed until after the current stack frame goes out of
+  // scope.
+  taskStructMgr.createGEPsToPrivateVars();
+
+  for (auto [privDecl, mlirPrivVar, blockArg, llvmPrivateVarAlloc] :
+   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs,
+   taskStructMgr.getLLVMPrivateVarGEPs())) {
+if (!privDecl.readsFromMold())
+  // to be handled inside the task
+  continue;
+assert(llvmPrivateVarAlloc &&
+   "reads from mold so shouldn't have been skipped");
 
-auto err =
+llvm::Expected privateVarOrErr =
 initPrivateVar(builder, moduleTranslation, privDecl, mlirPrivVar,
-   blockArg, llvmPrivateVar, llvmPrivateVars, initBlock);
-if (err)
+   blockArg, llvmPrivateVarAlloc, initBlock);
+if (auto err = privateVarOrErr.takeError())
   return handleError(std::move(err), *taskOp.getOperation());
+
+llvm::IRBuilderBase::InsertPointGuard guard(builder);
+builder.SetInsertPoint(builder.GetInsertBlock()->getTerminator());
+
+// TODO: this is a bit of a hack for Fortran character boxes.
+// Character boxes are passed by value into the init region and then the
+// initialized character box is yielded by value. Here we need to store the
+// yielded value into the private allocation, and load the private
+// allocation to match the type expected by region block arguments.
+if ((privateVarOrErr.get() != llvmPrivateVarAlloc) &&
+!mlir::isa(blockArg.getType())) {
+  builder.CreateStore(privateVarOrErr.get(), llvmPrivateVarAlloc);
+  // Load it so we have the value pointed to by the GEP
+  llvmPrivateVarAlloc = 
builder.CreateLoad(privateVarOrErr.get()->getType(),
+   llvmPrivateVarAlloc);
+}
+assert(llvmPrivateVarAlloc->getType() ==
+   moduleTranslation.convertType(blockArg.getType()));
+
+// Mapping blockArg -> llvmPrivateVarAlloc is done inside the body callback
+// so that OpenMPIRBuilder doesn't try to pass each GEP address through a
+// stack allocated structure.
   }
 
   // firstprivate copy region
   if (failed(initFirstPrivateVars(builder, moduleTranslation, mlirPrivateVars,
-  llvmPrivateVars, privateDecls, copyBlock)))
+  taskStructMgr.getLLVMPrivateVarGEPs(),
+  privateDecls, copyBlock)))
 return llvm::failure();
 
   // Set up for call to createTask()
   builder.SetInsertPoint(taskStartBlock);
 
   auto bodyCB = [&](InsertPointTy allocaIP,
 InsertPointTy codegenIP) -> llvm::Error {
+// Save the alloca insertion point on ModuleTranslation stack for use in
+// nested regions.
+LLVM::ModuleTranslation::SaveStack frame(
+moduleTranslation, allocaIP);
+
 // translate the body of the task:
 builder.restoreIP(codegenIP);
+
+llvm::BasicBlock *privInitBlock = nullptr;
+for (auto [blockArg, privDecl, mlirPrivVar] :
+ llvm::zip_equal(privateBlockArgs, privateDecls, mlirPrivateVars)) {
+  if (privDecl.readsFromMold())
+// This is handled before the task executes
+continue;
+
+  auto codegenInsertionPt = builder.saveIP();
+  llvm::Type *llvmAllocType =
+  moduleTranslation.convertType(privDecl.getType());
+  builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
+  llvm::Value *llvmPrivateVar = builder.CreateAlloca(
+  llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+
+  llvm::Expected privateVarOrError =
+  initPrivateVar(builder, moduleTranslation, privDecl, mlirPrivVar,
+ blockArg, llvmPrivateVar, privInitBlock);
+  if (auto err = privateVarOrError.takeError())
+   

[llvm-branch-commits] [flang] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits


@@ -1794,37 +1909,118 @@ convertOmpTaskOp(omp::TaskOp taskOp, 
llvm::IRBuilderBase &builder,
   moduleTranslation, allocaIP);
 
   // Allocate and initialize private variables
-  // TODO: package private variables up in a structure
   builder.SetInsertPoint(initBlock->getTerminator());
-  for (auto [privDecl, mlirPrivVar, blockArg] :
-   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs)) {
-llvm::Type *llvmAllocType =
-moduleTranslation.convertType(privDecl.getType());
 
-// Allocations:
-builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
-llvm::Value *llvmPrivateVar = builder.CreateAlloca(
-llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+  // Create task variable structure
+  taskStructMgr.generateTaskContextStruct();
+  // GEPs so that we can initialize the variables. Don't use these GEPs inside
+  // of the body otherwise it will be the GEP not the struct which is fowarded
+  // to the outlined function. GEPs forwarded in this way are passed in a
+  // stack-allocated (by OpenMPIRBuilder) structure which is not safe for tasks
+  // which may not be executed until after the current stack frame goes out of
+  // scope.
+  taskStructMgr.createGEPsToPrivateVars();
+
+  for (auto [privDecl, mlirPrivVar, blockArg, llvmPrivateVarAlloc] :
+   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs,
+   taskStructMgr.getLLVMPrivateVarGEPs())) {
+if (!privDecl.readsFromMold())
+  // to be handled inside the task
+  continue;
+assert(llvmPrivateVarAlloc &&
+   "reads from mold so shouldn't have been skipped");
 
-auto err =
+llvm::Expected privateVarOrErr =
 initPrivateVar(builder, moduleTranslation, privDecl, mlirPrivVar,
-   blockArg, llvmPrivateVar, llvmPrivateVars, initBlock);
-if (err)
+   blockArg, llvmPrivateVarAlloc, initBlock);
+if (auto err = privateVarOrErr.takeError())
   return handleError(std::move(err), *taskOp.getOperation());
+
+llvm::IRBuilderBase::InsertPointGuard guard(builder);
+builder.SetInsertPoint(builder.GetInsertBlock()->getTerminator());
+
+// TODO: this is a bit of a hack for Fortran character boxes.
+// Character boxes are passed by value into the init region and then the
+// initialized character box is yielded by value. Here we need to store the
+// yielded value into the private allocation, and load the private
+// allocation to match the type expected by region block arguments.
+if ((privateVarOrErr.get() != llvmPrivateVarAlloc) &&
+!mlir::isa(blockArg.getType())) {
+  builder.CreateStore(privateVarOrErr.get(), llvmPrivateVarAlloc);
+  // Load it so we have the value pointed to by the GEP
+  llvmPrivateVarAlloc = 
builder.CreateLoad(privateVarOrErr.get()->getType(),
+   llvmPrivateVarAlloc);
+}
+assert(llvmPrivateVarAlloc->getType() ==
+   moduleTranslation.convertType(blockArg.getType()));
+
+// Mapping blockArg -> llvmPrivateVarAlloc is done inside the body callback
+// so that OpenMPIRBuilder doesn't try to pass each GEP address through a
+// stack allocated structure.
   }
 
   // firstprivate copy region
   if (failed(initFirstPrivateVars(builder, moduleTranslation, mlirPrivateVars,
-  llvmPrivateVars, privateDecls, copyBlock)))
+  taskStructMgr.getLLVMPrivateVarGEPs(),
+  privateDecls, copyBlock)))
 return llvm::failure();
 
   // Set up for call to createTask()
   builder.SetInsertPoint(taskStartBlock);
 
   auto bodyCB = [&](InsertPointTy allocaIP,
 InsertPointTy codegenIP) -> llvm::Error {
+// Save the alloca insertion point on ModuleTranslation stack for use in
+// nested regions.
+LLVM::ModuleTranslation::SaveStack frame(
+moduleTranslation, allocaIP);
+
 // translate the body of the task:
 builder.restoreIP(codegenIP);
+
+llvm::BasicBlock *privInitBlock = nullptr;
+for (auto [blockArg, privDecl, mlirPrivVar] :
+ llvm::zip_equal(privateBlockArgs, privateDecls, mlirPrivateVars)) {
+  if (privDecl.readsFromMold())
+// This is handled before the task executes

skatrak wrote:

Nit: Move comment above 'if'.

https://github.com/llvm/llvm-project/pull/125307
___
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] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits


@@ -1794,37 +1909,118 @@ convertOmpTaskOp(omp::TaskOp taskOp, 
llvm::IRBuilderBase &builder,
   moduleTranslation, allocaIP);
 
   // Allocate and initialize private variables
-  // TODO: package private variables up in a structure
   builder.SetInsertPoint(initBlock->getTerminator());
-  for (auto [privDecl, mlirPrivVar, blockArg] :
-   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs)) {
-llvm::Type *llvmAllocType =
-moduleTranslation.convertType(privDecl.getType());
 
-// Allocations:
-builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
-llvm::Value *llvmPrivateVar = builder.CreateAlloca(
-llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+  // Create task variable structure
+  taskStructMgr.generateTaskContextStruct();
+  // GEPs so that we can initialize the variables. Don't use these GEPs inside
+  // of the body otherwise it will be the GEP not the struct which is fowarded
+  // to the outlined function. GEPs forwarded in this way are passed in a
+  // stack-allocated (by OpenMPIRBuilder) structure which is not safe for tasks
+  // which may not be executed until after the current stack frame goes out of
+  // scope.
+  taskStructMgr.createGEPsToPrivateVars();
+
+  for (auto [privDecl, mlirPrivVar, blockArg, llvmPrivateVarAlloc] :
+   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs,
+   taskStructMgr.getLLVMPrivateVarGEPs())) {
+if (!privDecl.readsFromMold())
+  // to be handled inside the task
+  continue;
+assert(llvmPrivateVarAlloc &&
+   "reads from mold so shouldn't have been skipped");
 
-auto err =
+llvm::Expected privateVarOrErr =
 initPrivateVar(builder, moduleTranslation, privDecl, mlirPrivVar,
-   blockArg, llvmPrivateVar, llvmPrivateVars, initBlock);
-if (err)
+   blockArg, llvmPrivateVarAlloc, initBlock);
+if (auto err = privateVarOrErr.takeError())
   return handleError(std::move(err), *taskOp.getOperation());
+
+llvm::IRBuilderBase::InsertPointGuard guard(builder);
+builder.SetInsertPoint(builder.GetInsertBlock()->getTerminator());
+
+// TODO: this is a bit of a hack for Fortran character boxes.
+// Character boxes are passed by value into the init region and then the
+// initialized character box is yielded by value. Here we need to store the
+// yielded value into the private allocation, and load the private
+// allocation to match the type expected by region block arguments.
+if ((privateVarOrErr.get() != llvmPrivateVarAlloc) &&
+!mlir::isa(blockArg.getType())) {
+  builder.CreateStore(privateVarOrErr.get(), llvmPrivateVarAlloc);
+  // Load it so we have the value pointed to by the GEP
+  llvmPrivateVarAlloc = 
builder.CreateLoad(privateVarOrErr.get()->getType(),
+   llvmPrivateVarAlloc);
+}
+assert(llvmPrivateVarAlloc->getType() ==
+   moduleTranslation.convertType(blockArg.getType()));
+
+// Mapping blockArg -> llvmPrivateVarAlloc is done inside the body callback
+// so that OpenMPIRBuilder doesn't try to pass each GEP address through a
+// stack allocated structure.
   }
 
   // firstprivate copy region
   if (failed(initFirstPrivateVars(builder, moduleTranslation, mlirPrivateVars,
-  llvmPrivateVars, privateDecls, copyBlock)))
+  taskStructMgr.getLLVMPrivateVarGEPs(),
+  privateDecls, copyBlock)))
 return llvm::failure();
 
   // Set up for call to createTask()
   builder.SetInsertPoint(taskStartBlock);
 
   auto bodyCB = [&](InsertPointTy allocaIP,
 InsertPointTy codegenIP) -> llvm::Error {
+// Save the alloca insertion point on ModuleTranslation stack for use in
+// nested regions.
+LLVM::ModuleTranslation::SaveStack frame(
+moduleTranslation, allocaIP);
+
 // translate the body of the task:
 builder.restoreIP(codegenIP);
+
+llvm::BasicBlock *privInitBlock = nullptr;
+for (auto [blockArg, privDecl, mlirPrivVar] :
+ llvm::zip_equal(privateBlockArgs, privateDecls, mlirPrivateVars)) {
+  if (privDecl.readsFromMold())
+// This is handled before the task executes
+continue;
+
+  auto codegenInsertionPt = builder.saveIP();
+  llvm::Type *llvmAllocType =
+  moduleTranslation.convertType(privDecl.getType());
+  builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
+  llvm::Value *llvmPrivateVar = builder.CreateAlloca(
+  llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+
+  llvm::Expected privateVarOrError =
+  initPrivateVar(builder, moduleTranslation, privDecl, mlirPrivVar,
+ blockArg, llvmPrivateVar, privInitBlock);
+  if (auto err = privateVarOrError.takeError())
+   

[llvm-branch-commits] [flang] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak commented:

Thank you Tom, I have some minor comments but otherwise this LGTM.

https://github.com/llvm/llvm-project/pull/125307
___
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] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits


@@ -1415,11 +1413,13 @@ static llvm::Expected 
allocateAndInitPrivateVars(
 llvm::Value *llvmPrivateVar = builder.CreateAlloca(
 llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
 
-llvm::Error err = initPrivateVar(
+llvm::Expected privateVarOrError = initPrivateVar(
 builder, moduleTranslation, privDecl, mlirPrivVar, blockArg,
-llvmPrivateVar, llvmPrivateVars, privInitBlock, mappedPrivateVars);
-if (err)
+llvmPrivateVar, privInitBlock, mappedPrivateVars);
+if (auto err = privateVarOrError.takeError())

skatrak wrote:

I'm not sure if this can cause issues. The documentation for `takeError` states 
that, after calling this function, `privateVarOrError` would be in an 
"indeterminate state that can only be safely destroyed". Maybe I'm 
misunderstanding, but to be safe, I'd suggest this alternative:
```c++
if (!privateVarOrError)
  return privateVarOrError.takeError();
```

https://github.com/llvm/llvm-project/pull/125307
___
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] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits


@@ -1331,19 +1334,16 @@ findAssociatedValue(Value privateVar, 
llvm::IRBuilderBase &builder,
 
 /// Initialize a single (first)private variable. You probably want to use
 /// allocateAndInitPrivateVars instead of this.
-static llvm::Error
-initPrivateVar(llvm::IRBuilderBase &builder,
-   LLVM::ModuleTranslation &moduleTranslation,
-   omp::PrivateClauseOp &privDecl, Value mlirPrivVar,
-   BlockArgument &blockArg, llvm::Value *llvmPrivateVar,
-   llvm::SmallVectorImpl &llvmPrivateVars,
-   llvm::BasicBlock *privInitBlock,
-   llvm::DenseMap *mappedPrivateVars = nullptr) {
+/// This returns the private variable which has been initialized. This
+/// variable should be mapped before constructing the body of the Op.
+static llvm::Expected initPrivateVar(
+llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation,
+omp::PrivateClauseOp &privDecl, Value mlirPrivVar, BlockArgument &blockArg,
+llvm::Value *llvmPrivateVar, llvm::BasicBlock *privInitBlock,
+llvm::DenseMap *mappedPrivateVars = nullptr) {
   Region &initRegion = privDecl.getInitRegion();
   if (initRegion.empty()) {

skatrak wrote:

Nit: Braces on a single-statement 'if'.

https://github.com/llvm/llvm-project/pull/125307
___
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] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits

https://github.com/skatrak edited 
https://github.com/llvm/llvm-project/pull/125307
___
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] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits


@@ -1794,37 +1909,118 @@ convertOmpTaskOp(omp::TaskOp taskOp, 
llvm::IRBuilderBase &builder,
   moduleTranslation, allocaIP);
 
   // Allocate and initialize private variables
-  // TODO: package private variables up in a structure
   builder.SetInsertPoint(initBlock->getTerminator());
-  for (auto [privDecl, mlirPrivVar, blockArg] :
-   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs)) {
-llvm::Type *llvmAllocType =
-moduleTranslation.convertType(privDecl.getType());
 
-// Allocations:
-builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
-llvm::Value *llvmPrivateVar = builder.CreateAlloca(
-llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+  // Create task variable structure
+  taskStructMgr.generateTaskContextStruct();
+  // GEPs so that we can initialize the variables. Don't use these GEPs inside
+  // of the body otherwise it will be the GEP not the struct which is fowarded
+  // to the outlined function. GEPs forwarded in this way are passed in a
+  // stack-allocated (by OpenMPIRBuilder) structure which is not safe for tasks
+  // which may not be executed until after the current stack frame goes out of
+  // scope.
+  taskStructMgr.createGEPsToPrivateVars();
+
+  for (auto [privDecl, mlirPrivVar, blockArg, llvmPrivateVarAlloc] :
+   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs,
+   taskStructMgr.getLLVMPrivateVarGEPs())) {
+if (!privDecl.readsFromMold())
+  // to be handled inside the task

skatrak wrote:

Nit: Move comment above 'if'.
```suggestion
  // To be handled inside the task.
```

https://github.com/llvm/llvm-project/pull/125307
___
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] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits


@@ -1794,37 +1909,118 @@ convertOmpTaskOp(omp::TaskOp taskOp, 
llvm::IRBuilderBase &builder,
   moduleTranslation, allocaIP);
 
   // Allocate and initialize private variables
-  // TODO: package private variables up in a structure
   builder.SetInsertPoint(initBlock->getTerminator());
-  for (auto [privDecl, mlirPrivVar, blockArg] :
-   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs)) {
-llvm::Type *llvmAllocType =
-moduleTranslation.convertType(privDecl.getType());
 
-// Allocations:
-builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
-llvm::Value *llvmPrivateVar = builder.CreateAlloca(
-llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+  // Create task variable structure
+  taskStructMgr.generateTaskContextStruct();
+  // GEPs so that we can initialize the variables. Don't use these GEPs inside
+  // of the body otherwise it will be the GEP not the struct which is fowarded
+  // to the outlined function. GEPs forwarded in this way are passed in a
+  // stack-allocated (by OpenMPIRBuilder) structure which is not safe for tasks
+  // which may not be executed until after the current stack frame goes out of
+  // scope.
+  taskStructMgr.createGEPsToPrivateVars();
+
+  for (auto [privDecl, mlirPrivVar, blockArg, llvmPrivateVarAlloc] :
+   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs,
+   taskStructMgr.getLLVMPrivateVarGEPs())) {
+if (!privDecl.readsFromMold())
+  // to be handled inside the task
+  continue;
+assert(llvmPrivateVarAlloc &&
+   "reads from mold so shouldn't have been skipped");
 
-auto err =
+llvm::Expected privateVarOrErr =
 initPrivateVar(builder, moduleTranslation, privDecl, mlirPrivVar,
-   blockArg, llvmPrivateVar, llvmPrivateVars, initBlock);
-if (err)
+   blockArg, llvmPrivateVarAlloc, initBlock);
+if (auto err = privateVarOrErr.takeError())

skatrak wrote:

Same comment as above, I'm not sure if this handling can cause issues. I'd 
suggest:
```c++
if (!privateVarOrErr)
  return handleError(privateVarOrErr.takeError(), *taskOp.getOperation());
```

https://github.com/llvm/llvm-project/pull/125307
___
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] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Sergio Afonso via llvm-branch-commits


@@ -1794,37 +1909,118 @@ convertOmpTaskOp(omp::TaskOp taskOp, 
llvm::IRBuilderBase &builder,
   moduleTranslation, allocaIP);
 
   // Allocate and initialize private variables
-  // TODO: package private variables up in a structure
   builder.SetInsertPoint(initBlock->getTerminator());
-  for (auto [privDecl, mlirPrivVar, blockArg] :
-   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs)) {
-llvm::Type *llvmAllocType =
-moduleTranslation.convertType(privDecl.getType());
 
-// Allocations:
-builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
-llvm::Value *llvmPrivateVar = builder.CreateAlloca(
-llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
+  // Create task variable structure
+  taskStructMgr.generateTaskContextStruct();
+  // GEPs so that we can initialize the variables. Don't use these GEPs inside
+  // of the body otherwise it will be the GEP not the struct which is fowarded
+  // to the outlined function. GEPs forwarded in this way are passed in a
+  // stack-allocated (by OpenMPIRBuilder) structure which is not safe for tasks
+  // which may not be executed until after the current stack frame goes out of
+  // scope.
+  taskStructMgr.createGEPsToPrivateVars();
+
+  for (auto [privDecl, mlirPrivVar, blockArg, llvmPrivateVarAlloc] :
+   llvm::zip_equal(privateDecls, mlirPrivateVars, privateBlockArgs,
+   taskStructMgr.getLLVMPrivateVarGEPs())) {
+if (!privDecl.readsFromMold())
+  // to be handled inside the task
+  continue;
+assert(llvmPrivateVarAlloc &&
+   "reads from mold so shouldn't have been skipped");
 
-auto err =
+llvm::Expected privateVarOrErr =
 initPrivateVar(builder, moduleTranslation, privDecl, mlirPrivVar,
-   blockArg, llvmPrivateVar, llvmPrivateVars, initBlock);
-if (err)
+   blockArg, llvmPrivateVarAlloc, initBlock);
+if (auto err = privateVarOrErr.takeError())
   return handleError(std::move(err), *taskOp.getOperation());
+
+llvm::IRBuilderBase::InsertPointGuard guard(builder);
+builder.SetInsertPoint(builder.GetInsertBlock()->getTerminator());
+
+// TODO: this is a bit of a hack for Fortran character boxes.
+// Character boxes are passed by value into the init region and then the
+// initialized character box is yielded by value. Here we need to store the
+// yielded value into the private allocation, and load the private
+// allocation to match the type expected by region block arguments.
+if ((privateVarOrErr.get() != llvmPrivateVarAlloc) &&
+!mlir::isa(blockArg.getType())) {
+  builder.CreateStore(privateVarOrErr.get(), llvmPrivateVarAlloc);
+  // Load it so we have the value pointed to by the GEP
+  llvmPrivateVarAlloc = 
builder.CreateLoad(privateVarOrErr.get()->getType(),
+   llvmPrivateVarAlloc);
+}
+assert(llvmPrivateVarAlloc->getType() ==
+   moduleTranslation.convertType(blockArg.getType()));
+
+// Mapping blockArg -> llvmPrivateVarAlloc is done inside the body callback
+// so that OpenMPIRBuilder doesn't try to pass each GEP address through a
+// stack allocated structure.
   }
 
   // firstprivate copy region
   if (failed(initFirstPrivateVars(builder, moduleTranslation, mlirPrivateVars,
-  llvmPrivateVars, privateDecls, copyBlock)))
+  taskStructMgr.getLLVMPrivateVarGEPs(),
+  privateDecls, copyBlock)))
 return llvm::failure();
 
   // Set up for call to createTask()
   builder.SetInsertPoint(taskStartBlock);
 
   auto bodyCB = [&](InsertPointTy allocaIP,
 InsertPointTy codegenIP) -> llvm::Error {
+// Save the alloca insertion point on ModuleTranslation stack for use in
+// nested regions.
+LLVM::ModuleTranslation::SaveStack frame(
+moduleTranslation, allocaIP);
+
 // translate the body of the task:
 builder.restoreIP(codegenIP);
+
+llvm::BasicBlock *privInitBlock = nullptr;
+for (auto [blockArg, privDecl, mlirPrivVar] :
+ llvm::zip_equal(privateBlockArgs, privateDecls, mlirPrivateVars)) {
+  if (privDecl.readsFromMold())
+// This is handled before the task executes
+continue;
+
+  auto codegenInsertionPt = builder.saveIP();

skatrak wrote:

Nit: This seems to be replaceable with an insertion guard.

https://github.com/llvm/llvm-project/pull/125307
___
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/20.x: [clang] Parse warning-suppression-mapping after setting up diagengine (#125714) (PR #126030)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:

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

https://github.com/llvm/llvm-project/pull/126030
___
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] [flang] release/20.x: [flang][Driver] When linking with the Fortran runtime also link with libexecinfo (#125998) (PR #126038)

2025-02-06 Thread via llvm-branch-commits

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

Backport d1de75acea0da55316cd7827563e064105868f0f

Requested by: @brad0

>From c6d065519accfb2d6e77bc3255102132239ab31c Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 6 Feb 2025 04:36:47 -0500
Subject: [PATCH] [flang][Driver] When linking with the Fortran runtime also
 link with libexecinfo (#125998)

Also link with libexecinfo on FreeBSD, NetBSD, OpenBSD and DragonFly
for the backtrace functions.

(cherry picked from commit d1de75acea0da55316cd7827563e064105868f0f)
---
 clang/lib/Driver/ToolChains/CommonArgs.cpp |  5 +
 flang/test/Driver/linker-flags.f90 | 16 
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 2c4b082bcce4a62..4ed4dbc1a8d1bc9 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1340,6 +1340,11 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, 
const ArgList &Args,
 CmdArgs.push_back("-lFortranRuntime");
 CmdArgs.push_back("-lFortranDecimal");
 addArchSpecificRPath(TC, Args, CmdArgs);
+
+// needs libexecinfo for backtrace functions
+if (TC.getTriple().isOSFreeBSD() || TC.getTriple().isOSNetBSD() ||
+TC.getTriple().isOSOpenBSD() || TC.getTriple().isOSDragonFly())
+  CmdArgs.push_back("-lexecinfo");
   }
 
   // libomp needs libatomic for atomic operations if using libgcc
diff --git a/flang/test/Driver/linker-flags.f90 
b/flang/test/Driver/linker-flags.f90
index ac9500d7c45cecd..b998cbaa6227c35 100644
--- a/flang/test/Driver/linker-flags.f90
+++ b/flang/test/Driver/linker-flags.f90
@@ -5,10 +5,10 @@
 ! RUN: %flang -### --target=ppc64le-linux-gnu %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
 ! RUN: %flang -### --target=aarch64-apple-darwin %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,DARWIN,DARWIN-F128%f128-lib
 ! RUN: %flang -### --target=sparc-sun-solaris2.11 %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,SOLARIS-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-freebsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-netbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-openbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-dragonfly %S/Inputs/hello.f90 2>&1 
| FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-freebsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-netbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-openbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-dragonfly %S/Inputs/hello.f90 2>&1 
| FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
 ! RUN: %flang -### --target=x86_64-unknown-haiku %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,HAIKU,HAIKU-F128%f128-lib
 ! RUN: %flang -### --target=x86_64-windows-gnu %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,MINGW,MINGW-F128%f128-lib
 ! RUN: %flang -### -rtlib=compiler-rt --target=aarch64-linux-gnu 
%S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,COMPILER-RT
@@ -36,6 +36,14 @@
 ! UNIX-SAME: "-lFortranRuntime" "-lFortranDecimal" "-lm"
 ! COMPILER-RT: "{{.*}}{{\\|/}}libclang_rt.builtins.a"
 
+! BSD-LABEL:  "{{.*}}ld{{(\.exe)?}}"
+! BSD-SAME: "[[object_file]]"
+! BSD-F128NONE-NOT: FortranFloat128Math
+! BSD-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" 
"--no-as-needed"
+! BSD-SAME: -lFortranRuntime
+! BSD-SAME: -lFortranDecimal
+! BSD-SAME: -lexecinfo
+
 ! DARWIN-LABEL:  "{{.*}}ld{{(\.exe)?}}"
 ! DARWIN-SAME: "[[object_file]]"
 ! DARWIN-F128NONE-NOT: FortranFloat128Math

___
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] [flang] release/20.x: [flang][Driver] When linking with the Fortran runtime also link with libexecinfo (#125998) (PR #126038)

2025-02-06 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/126038
___
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/20.x: [clang] Stop parsing warning suppression mappings in driver (#125722) (PR #126027)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:

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

https://github.com/llvm/llvm-project/pull/126027
___
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/20.x: [clang] Stop parsing warning suppression mappings in driver (#125722) (PR #126027)

2025-02-06 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/126027
___
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/20.x: [clang] Stop parsing warning suppression mappings in driver (#125722) (PR #126027)

2025-02-06 Thread via llvm-branch-commits

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

Backport df22bbe2beb57687c76402bc0cfdf7901a31cf29

Requested by: @kadircet

>From 7bf662937a37e46baddb9b603048abfe63670790 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?kadir=20=C3=A7etinkaya?= 
Date: Thu, 6 Feb 2025 10:02:42 +0100
Subject: [PATCH] [clang] Stop parsing warning suppression mappings in driver
 (#125722)

This gets rid of some extra IO from driver startup, and possiblity of
emitting warnings twice.

(cherry picked from commit df22bbe2beb57687c76402bc0cfdf7901a31cf29)
---
 .../test/Driver/warning-suppression-mappings-not-parsed.cpp  | 5 +
 clang/tools/driver/driver.cpp| 4 
 2 files changed, 9 insertions(+)
 create mode 100644 
clang/test/Driver/warning-suppression-mappings-not-parsed.cpp

diff --git a/clang/test/Driver/warning-suppression-mappings-not-parsed.cpp 
b/clang/test/Driver/warning-suppression-mappings-not-parsed.cpp
new file mode 100644
index 000..8f52fb1c6cc7d6c
--- /dev/null
+++ b/clang/test/Driver/warning-suppression-mappings-not-parsed.cpp
@@ -0,0 +1,5 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: echo '[unknown-warning]' > %t/foo.txt
+// RUN: %clang -fdriver-only --warning-suppression-mappings=%t/foo.txt %s | 
FileCheck -allow-empty %s
+// CHECK-NOT: unknown warning option 'unknown-warning'
diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index 74923247b7ee169..00c00cea16f470f 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -318,6 +318,10 @@ int clang_main(int Argc, char **Argv, const 
llvm::ToolContext &ToolContext) {
 
   IntrusiveRefCntPtr DiagOpts =
   CreateAndPopulateDiagOpts(Args);
+  // Driver's diagnostics don't use suppression mappings, so don't bother
+  // parsing them. CC1 still receives full args, so this doesn't impact other
+  // actions.
+  DiagOpts->DiagnosticSuppressionMappingsFile.clear();
 
   TextDiagnosticPrinter *DiagClient
 = new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts);

___
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/20.x: [clang] Stop parsing warning suppression mappings in driver (#125722) (PR #126027)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: None (llvmbot)


Changes

Backport df22bbe2beb57687c76402bc0cfdf7901a31cf29

Requested by: @kadircet

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


2 Files Affected:

- (added) clang/test/Driver/warning-suppression-mappings-not-parsed.cpp (+5) 
- (modified) clang/tools/driver/driver.cpp (+4) 


``diff
diff --git a/clang/test/Driver/warning-suppression-mappings-not-parsed.cpp 
b/clang/test/Driver/warning-suppression-mappings-not-parsed.cpp
new file mode 100644
index 000..8f52fb1c6cc7d6c
--- /dev/null
+++ b/clang/test/Driver/warning-suppression-mappings-not-parsed.cpp
@@ -0,0 +1,5 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: echo '[unknown-warning]' > %t/foo.txt
+// RUN: %clang -fdriver-only --warning-suppression-mappings=%t/foo.txt %s | 
FileCheck -allow-empty %s
+// CHECK-NOT: unknown warning option 'unknown-warning'
diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index 74923247b7ee169..00c00cea16f470f 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -318,6 +318,10 @@ int clang_main(int Argc, char **Argv, const 
llvm::ToolContext &ToolContext) {
 
   IntrusiveRefCntPtr DiagOpts =
   CreateAndPopulateDiagOpts(Args);
+  // Driver's diagnostics don't use suppression mappings, so don't bother
+  // parsing them. CC1 still receives full args, so this doesn't impact other
+  // actions.
+  DiagOpts->DiagnosticSuppressionMappingsFile.clear();
 
   TextDiagnosticPrinter *DiagClient
 = new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts);

``




https://github.com/llvm/llvm-project/pull/126027
___
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] AMDGPU/GlobalISel: Temporal divergence lowering (non i1) (PR #124298)

2025-02-06 Thread via llvm-branch-commits


@@ -188,6 +190,35 @@ void 
DivergenceLoweringHelper::constrainAsLaneMask(Incoming &In) {
   In.Reg = Copy.getReg(0);
 }
 
+void replaceUsesOfRegInInstWith(Register Reg, MachineInstr *Inst,
+Register NewReg) {
+  for (MachineOperand &Op : Inst->operands()) {
+if (Op.isReg() && Op.getReg() == Reg)
+  Op.setReg(NewReg);
+  }
+}
+
+bool DivergenceLoweringHelper::lowerTemporalDivergence() {
+  AMDGPU::IntrinsicLaneMaskAnalyzer ILMA(*MF);
+
+  for (auto [Inst, UseInst, _] : MUI->getTemporalDivergenceList()) {

ruiling wrote:

I am not sure if it is ok to assume only the first `def` can be temporal 
divergent. Maybe holds a map from the `Register` to a array of temporal 
divergence users?

https://github.com/llvm/llvm-project/pull/124298
___
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] AMDGPU/GlobalISel: Temporal divergence lowering (non i1) (PR #124298)

2025-02-06 Thread via llvm-branch-commits


@@ -188,6 +190,35 @@ void 
DivergenceLoweringHelper::constrainAsLaneMask(Incoming &In) {
   In.Reg = Copy.getReg(0);
 }
 
+void replaceUsesOfRegInInstWith(Register Reg, MachineInstr *Inst,
+Register NewReg) {
+  for (MachineOperand &Op : Inst->operands()) {
+if (Op.isReg() && Op.getReg() == Reg)
+  Op.setReg(NewReg);
+  }
+}
+
+bool DivergenceLoweringHelper::lowerTemporalDivergence() {
+  AMDGPU::IntrinsicLaneMaskAnalyzer ILMA(*MF);
+
+  for (auto [Inst, UseInst, _] : MUI->getTemporalDivergenceList()) {
+Register Reg = Inst->getOperand(0).getReg();
+if (MRI->getType(Reg) == LLT::scalar(1) || MUI->isDivergent(Reg) ||
+ILMA.isS32S64LaneMask(Reg))
+  continue;
+
+MachineBasicBlock *MBB = Inst->getParent();
+B.setInsertPt(*MBB, 
MBB->SkipPHIsAndLabels(std::next(Inst->getIterator(;
+
+Register VgprReg = MRI->createGenericVirtualRegister(MRI->getType(Reg));

ruiling wrote:

I am not sure how it works in global-isel, can we set the RegisterClass of 
VgprReg to vector register here to make it more obvious this is copy from sgpr 
to vgpr?

https://github.com/llvm/llvm-project/pull/124298
___
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/20.x: Fix `llvm/test/DebugInfo/Generic/discriminated-union.ll` on big-endian targets (#125849) (PR #126029)

2025-02-06 Thread via llvm-branch-commits

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

Backport 3c2807624d2006fa8aacf9c6441c9a3034a52b44 
34929853bc39d28943373b8a96371a7e81e98917

Requested by: @beetrees

>From d14cfb20f9835b5b17848e2a5003c3e3641bed9c Mon Sep 17 00:00:00 2001
From: Tom Tromey 
Date: Tue, 4 Feb 2025 14:36:22 -0700
Subject: [PATCH 1/2] Allow 128-bit discriminants in DWARF variants (#125578)

If a variant part has a 128-bit discriminator, then
DwarfUnit::constructTypeDIE will assert.  This patch fixes the problem
by allowing any size of integer to be used here.  This is largely
accomplished by moving part of DwarfUnit::addConstantValue to a new
method.

Fixes #119655

(cherry picked from commit 3c2807624d2006fa8aacf9c6441c9a3034a52b44)
---
 llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 64 +++
 llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h   |  8 +++
 .../DebugInfo/Generic/discriminated-union.ll  |  4 +-
 3 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp 
b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index d3450b8b0556fde..5a17aa3bc9dc52e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -232,6 +232,42 @@ void DwarfUnit::addUInt(DIEValueList &Block, dwarf::Form 
Form,
   addUInt(Block, (dwarf::Attribute)0, Form, Integer);
 }
 
+void DwarfUnit::addIntAsBlock(DIE &Die, dwarf::Attribute Attribute, const 
APInt &Val) {
+  DIEBlock *Block = new (DIEValueAllocator) DIEBlock;
+
+  // Get the raw data form of the large APInt.
+  const uint64_t *Ptr64 = Val.getRawData();
+
+  int NumBytes = Val.getBitWidth() / 8; // 8 bits per byte.
+  bool LittleEndian = Asm->getDataLayout().isLittleEndian();
+
+  // Output the constant to DWARF one byte at a time.
+  for (int i = 0; i < NumBytes; i++) {
+uint8_t c;
+if (LittleEndian)
+  c = Ptr64[i / 8] >> (8 * (i & 7));
+else
+  c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7));
+addUInt(*Block, dwarf::DW_FORM_data1, c);
+  }
+
+  addBlock(Die, Attribute, Block);
+}
+
+void DwarfUnit::addInt(DIE &Die, dwarf::Attribute Attribute,
+  const APInt &Val, bool Unsigned) {
+  unsigned CIBitWidth = Val.getBitWidth();
+  if (CIBitWidth <= 64) {
+if (Unsigned)
+  addUInt(Die, Attribute, std::nullopt, Val.getZExtValue());
+else
+  addSInt(Die, Attribute, std::nullopt, Val.getSExtValue());
+return;
+  }
+
+  addIntAsBlock(Die, Attribute, Val);
+}
+
 void DwarfUnit::addSInt(DIEValueList &Die, dwarf::Attribute Attribute,
 std::optional Form, int64_t Integer) {
   if (!Form)
@@ -484,25 +520,7 @@ void DwarfUnit::addConstantValue(DIE &Die, const APInt 
&Val, bool Unsigned) {
 return;
   }
 
-  DIEBlock *Block = new (DIEValueAllocator) DIEBlock;
-
-  // Get the raw data form of the large APInt.
-  const uint64_t *Ptr64 = Val.getRawData();
-
-  int NumBytes = Val.getBitWidth() / 8; // 8 bits per byte.
-  bool LittleEndian = Asm->getDataLayout().isLittleEndian();
-
-  // Output the constant to DWARF one byte at a time.
-  for (int i = 0; i < NumBytes; i++) {
-uint8_t c;
-if (LittleEndian)
-  c = Ptr64[i / 8] >> (8 * (i & 7));
-else
-  c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7));
-addUInt(*Block, dwarf::DW_FORM_data1, c);
-  }
-
-  addBlock(Die, dwarf::DW_AT_const_value, Block);
+  addIntAsBlock(Die, dwarf::DW_AT_const_value, Val);
 }
 
 void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) {
@@ -980,12 +998,8 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const 
DICompositeType *CTy) {
   DIE &Variant = createAndAddDIE(dwarf::DW_TAG_variant, Buffer);
   if (const ConstantInt *CI =
   dyn_cast_or_null(DDTy->getDiscriminantValue())) {
-if (DD->isUnsignedDIType(Discriminator->getBaseType()))
-  addUInt(Variant, dwarf::DW_AT_discr_value, std::nullopt,
-  CI->getZExtValue());
-else
-  addSInt(Variant, dwarf::DW_AT_discr_value, std::nullopt,
-  CI->getSExtValue());
+   addInt(Variant, dwarf::DW_AT_discr_value, CI->getValue(),
+  DD->isUnsignedDIType(Discriminator->getBaseType()));
   }
   constructMemberDIE(Variant, DDTy);
 } else {
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h 
b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index 7a5295d826a483b..842a8d6ad53b107 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -167,6 +167,10 @@ class DwarfUnit : public DIEUnit {
 
   void addSInt(DIELoc &Die, std::optional Form, int64_t Integer);
 
+  /// Add an integer attribute data and value; value may be any width.
+  void addInt(DIE &Die, dwarf::Attribute Attribute, const APInt &Integer,
+ bool Unsigned);
+
   /// Add a string attribute data and value.
   ///
   /// We always emit a r

[llvm-branch-commits] [clang] release/20.x: [clang] Parse warning-suppression-mapping after setting up diagengine (#125714) (PR #126030)

2025-02-06 Thread via llvm-branch-commits

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

Backport ecb016a87d89aed36b8f5d8102e15d8eb0e57108

Requested by: @kadircet

>From 2cac0e37805926cec9305b23c907c8e84d3770df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?kadir=20=C3=A7etinkaya?= 
Date: Thu, 6 Feb 2025 10:18:38 +0100
Subject: [PATCH] [clang] Parse warning-suppression-mapping after setting up
 diagengine (#125714)

We can emit diagnostics while parsing warning-suppression-mapping, make
sure command line flags take affect when emitting those.

(cherry picked from commit ecb016a87d89aed36b8f5d8102e15d8eb0e57108)
---
 clang/lib/Basic/Warnings.cpp | 23 +--
 clang/unittests/Basic/DiagnosticTest.cpp |  9 +
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/clang/lib/Basic/Warnings.cpp b/clang/lib/Basic/Warnings.cpp
index da0304463007b65..5f48e0ec8155434 100644
--- a/clang/lib/Basic/Warnings.cpp
+++ b/clang/lib/Basic/Warnings.cpp
@@ -73,16 +73,6 @@ void clang::ProcessWarningOptions(DiagnosticsEngine &Diags,
   else
 Diags.setExtensionHandlingBehavior(diag::Severity::Ignored);
 
-  if (!Opts.DiagnosticSuppressionMappingsFile.empty()) {
-if (auto FileContents =
-VFS.getBufferForFile(Opts.DiagnosticSuppressionMappingsFile)) {
-  Diags.setDiagSuppressionMapping(**FileContents);
-} else if (ReportDiags) {
-  Diags.Report(diag::err_drv_no_such_file)
-  << Opts.DiagnosticSuppressionMappingsFile;
-}
-  }
-
   SmallVector _Diags;
   const IntrusiveRefCntPtr< DiagnosticIDs > DiagIDs =
 Diags.getDiagnosticIDs();
@@ -237,4 +227,17 @@ void clang::ProcessWarningOptions(DiagnosticsEngine &Diags,
   }
 }
   }
+
+  // Process suppression mappings file after processing other warning flags
+  // (like -Wno-unknown-warning-option) as we can emit extra warnings during
+  // processing.
+  if (!Opts.DiagnosticSuppressionMappingsFile.empty()) {
+if (auto FileContents =
+VFS.getBufferForFile(Opts.DiagnosticSuppressionMappingsFile)) {
+  Diags.setDiagSuppressionMapping(**FileContents);
+} else if (ReportDiags) {
+  Diags.Report(diag::err_drv_no_such_file)
+  << Opts.DiagnosticSuppressionMappingsFile;
+}
+  }
 }
diff --git a/clang/unittests/Basic/DiagnosticTest.cpp 
b/clang/unittests/Basic/DiagnosticTest.cpp
index e03d9a464df7f98..e33840705e44ab4 100644
--- a/clang/unittests/Basic/DiagnosticTest.cpp
+++ b/clang/unittests/Basic/DiagnosticTest.cpp
@@ -346,4 +346,13 @@ TEST_F(SuppressionMappingTest, IsIgnored) {
   EXPECT_FALSE(Diags.isIgnored(diag::warn_unused_function,
SM.getLocForStartOfFile(ClangID)));
 }
+
+TEST_F(SuppressionMappingTest, ParsingRespectsOtherWarningOpts) {
+  Diags.getDiagnosticOptions().DiagnosticSuppressionMappingsFile = "foo.txt";
+  FS->addFile("foo.txt", /*ModificationTime=*/{},
+  llvm::MemoryBuffer::getMemBuffer("[non-existing-warning]"));
+  Diags.getDiagnosticOptions().Warnings.push_back("no-unknown-warning-option");
+  clang::ProcessWarningOptions(Diags, Diags.getDiagnosticOptions(), *FS);
+  EXPECT_THAT(diags(), IsEmpty());
+}
 } // namespace

___
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/20.x: Fix `llvm/test/DebugInfo/Generic/discriminated-union.ll` on big-endian targets (#125849) (PR #126029)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:

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

https://github.com/llvm/llvm-project/pull/126029
___
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/20.x: [clang] Parse warning-suppression-mapping after setting up diagengine (#125714) (PR #126030)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: None (llvmbot)


Changes

Backport ecb016a87d89aed36b8f5d8102e15d8eb0e57108

Requested by: @kadircet

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


2 Files Affected:

- (modified) clang/lib/Basic/Warnings.cpp (+13-10) 
- (modified) clang/unittests/Basic/DiagnosticTest.cpp (+9) 


``diff
diff --git a/clang/lib/Basic/Warnings.cpp b/clang/lib/Basic/Warnings.cpp
index da0304463007b65..5f48e0ec8155434 100644
--- a/clang/lib/Basic/Warnings.cpp
+++ b/clang/lib/Basic/Warnings.cpp
@@ -73,16 +73,6 @@ void clang::ProcessWarningOptions(DiagnosticsEngine &Diags,
   else
 Diags.setExtensionHandlingBehavior(diag::Severity::Ignored);
 
-  if (!Opts.DiagnosticSuppressionMappingsFile.empty()) {
-if (auto FileContents =
-VFS.getBufferForFile(Opts.DiagnosticSuppressionMappingsFile)) {
-  Diags.setDiagSuppressionMapping(**FileContents);
-} else if (ReportDiags) {
-  Diags.Report(diag::err_drv_no_such_file)
-  << Opts.DiagnosticSuppressionMappingsFile;
-}
-  }
-
   SmallVector _Diags;
   const IntrusiveRefCntPtr< DiagnosticIDs > DiagIDs =
 Diags.getDiagnosticIDs();
@@ -237,4 +227,17 @@ void clang::ProcessWarningOptions(DiagnosticsEngine &Diags,
   }
 }
   }
+
+  // Process suppression mappings file after processing other warning flags
+  // (like -Wno-unknown-warning-option) as we can emit extra warnings during
+  // processing.
+  if (!Opts.DiagnosticSuppressionMappingsFile.empty()) {
+if (auto FileContents =
+VFS.getBufferForFile(Opts.DiagnosticSuppressionMappingsFile)) {
+  Diags.setDiagSuppressionMapping(**FileContents);
+} else if (ReportDiags) {
+  Diags.Report(diag::err_drv_no_such_file)
+  << Opts.DiagnosticSuppressionMappingsFile;
+}
+  }
 }
diff --git a/clang/unittests/Basic/DiagnosticTest.cpp 
b/clang/unittests/Basic/DiagnosticTest.cpp
index e03d9a464df7f98..e33840705e44ab4 100644
--- a/clang/unittests/Basic/DiagnosticTest.cpp
+++ b/clang/unittests/Basic/DiagnosticTest.cpp
@@ -346,4 +346,13 @@ TEST_F(SuppressionMappingTest, IsIgnored) {
   EXPECT_FALSE(Diags.isIgnored(diag::warn_unused_function,
SM.getLocForStartOfFile(ClangID)));
 }
+
+TEST_F(SuppressionMappingTest, ParsingRespectsOtherWarningOpts) {
+  Diags.getDiagnosticOptions().DiagnosticSuppressionMappingsFile = "foo.txt";
+  FS->addFile("foo.txt", /*ModificationTime=*/{},
+  llvm::MemoryBuffer::getMemBuffer("[non-existing-warning]"));
+  Diags.getDiagnosticOptions().Warnings.push_back("no-unknown-warning-option");
+  clang::ProcessWarningOptions(Diags, Diags.getDiagnosticOptions(), *FS);
+  EXPECT_THAT(diags(), IsEmpty());
+}
 } // namespace

``




https://github.com/llvm/llvm-project/pull/126030
___
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/20.x: Fix `llvm/test/DebugInfo/Generic/discriminated-union.ll` on big-endian targets (#125849) (PR #126029)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-debuginfo

Author: None (llvmbot)


Changes

Backport 3c2807624d2006fa8aacf9c6441c9a3034a52b44 
34929853bc39d28943373b8a96371a7e81e98917

Requested by: @beetrees

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


3 Files Affected:

- (modified) llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (+39-25) 
- (modified) llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h (+8) 
- (modified) llvm/test/DebugInfo/Generic/discriminated-union.ll (+5-4) 


``diff
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp 
b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index d3450b8b0556fde..5a17aa3bc9dc52e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -232,6 +232,42 @@ void DwarfUnit::addUInt(DIEValueList &Block, dwarf::Form 
Form,
   addUInt(Block, (dwarf::Attribute)0, Form, Integer);
 }
 
+void DwarfUnit::addIntAsBlock(DIE &Die, dwarf::Attribute Attribute, const 
APInt &Val) {
+  DIEBlock *Block = new (DIEValueAllocator) DIEBlock;
+
+  // Get the raw data form of the large APInt.
+  const uint64_t *Ptr64 = Val.getRawData();
+
+  int NumBytes = Val.getBitWidth() / 8; // 8 bits per byte.
+  bool LittleEndian = Asm->getDataLayout().isLittleEndian();
+
+  // Output the constant to DWARF one byte at a time.
+  for (int i = 0; i < NumBytes; i++) {
+uint8_t c;
+if (LittleEndian)
+  c = Ptr64[i / 8] >> (8 * (i & 7));
+else
+  c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7));
+addUInt(*Block, dwarf::DW_FORM_data1, c);
+  }
+
+  addBlock(Die, Attribute, Block);
+}
+
+void DwarfUnit::addInt(DIE &Die, dwarf::Attribute Attribute,
+  const APInt &Val, bool Unsigned) {
+  unsigned CIBitWidth = Val.getBitWidth();
+  if (CIBitWidth <= 64) {
+if (Unsigned)
+  addUInt(Die, Attribute, std::nullopt, Val.getZExtValue());
+else
+  addSInt(Die, Attribute, std::nullopt, Val.getSExtValue());
+return;
+  }
+
+  addIntAsBlock(Die, Attribute, Val);
+}
+
 void DwarfUnit::addSInt(DIEValueList &Die, dwarf::Attribute Attribute,
 std::optional Form, int64_t Integer) {
   if (!Form)
@@ -484,25 +520,7 @@ void DwarfUnit::addConstantValue(DIE &Die, const APInt 
&Val, bool Unsigned) {
 return;
   }
 
-  DIEBlock *Block = new (DIEValueAllocator) DIEBlock;
-
-  // Get the raw data form of the large APInt.
-  const uint64_t *Ptr64 = Val.getRawData();
-
-  int NumBytes = Val.getBitWidth() / 8; // 8 bits per byte.
-  bool LittleEndian = Asm->getDataLayout().isLittleEndian();
-
-  // Output the constant to DWARF one byte at a time.
-  for (int i = 0; i < NumBytes; i++) {
-uint8_t c;
-if (LittleEndian)
-  c = Ptr64[i / 8] >> (8 * (i & 7));
-else
-  c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7));
-addUInt(*Block, dwarf::DW_FORM_data1, c);
-  }
-
-  addBlock(Die, dwarf::DW_AT_const_value, Block);
+  addIntAsBlock(Die, dwarf::DW_AT_const_value, Val);
 }
 
 void DwarfUnit::addLinkageName(DIE &Die, StringRef LinkageName) {
@@ -980,12 +998,8 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const 
DICompositeType *CTy) {
   DIE &Variant = createAndAddDIE(dwarf::DW_TAG_variant, Buffer);
   if (const ConstantInt *CI =
   dyn_cast_or_null(DDTy->getDiscriminantValue())) {
-if (DD->isUnsignedDIType(Discriminator->getBaseType()))
-  addUInt(Variant, dwarf::DW_AT_discr_value, std::nullopt,
-  CI->getZExtValue());
-else
-  addSInt(Variant, dwarf::DW_AT_discr_value, std::nullopt,
-  CI->getSExtValue());
+   addInt(Variant, dwarf::DW_AT_discr_value, CI->getValue(),
+  DD->isUnsignedDIType(Discriminator->getBaseType()));
   }
   constructMemberDIE(Variant, DDTy);
 } else {
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h 
b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index 7a5295d826a483b..842a8d6ad53b107 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -167,6 +167,10 @@ class DwarfUnit : public DIEUnit {
 
   void addSInt(DIELoc &Die, std::optional Form, int64_t Integer);
 
+  /// Add an integer attribute data and value; value may be any width.
+  void addInt(DIE &Die, dwarf::Attribute Attribute, const APInt &Integer,
+ bool Unsigned);
+
   /// Add a string attribute data and value.
   ///
   /// We always emit a reference to the string pool instead of immediate
@@ -336,6 +340,10 @@ class DwarfUnit : public DIEUnit {
   void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT);
 
 private:
+  /// A helper to add a wide integer constant to a DIE using a block
+  /// form.
+  void addIntAsBlock(DIE &Die, dwarf::Attribute Attribute, const APInt &Val);
+
   void constructTypeDIE(DIE &Buffer, const DIBasicType *BTy);
   void constructTypeDIE(DIE &Buffer, const DIStringType *BTy);
   void constructTypeD

[llvm-branch-commits] [clang] release/20.x: [clang] Parse warning-suppression-mapping after setting up diagengine (#125714) (PR #126030)

2025-02-06 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/126030
___
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/20.x: Fix `llvm/test/DebugInfo/Generic/discriminated-union.ll` on big-endian targets (#125849) (PR #126029)

2025-02-06 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/126029
___
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] [libcxx] release/20.x: [libc++] Replace __is_trivially_relocatable by is_trivially_copyable (#124970) (PR #125996)

2025-02-06 Thread Nikolas Klauser via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/125996
___
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][Lower][OpenMP] try to avoid using init mold argument (PR #125900)

2025-02-06 Thread Kareem Ergawy via llvm-branch-commits

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

Nice! Thanks!

https://github.com/llvm/llvm-project/pull/125900
___
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][Lower][OpenMP] Don't read moldarg for static sized array (PR #125901)

2025-02-06 Thread Tom Eccles via llvm-branch-commits

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

>From 8a7e449cfa357e18ba094cc61d14bf481668ddcd Mon Sep 17 00:00:00 2001
From: Tom Eccles 
Date: Wed, 5 Feb 2025 17:29:42 +
Subject: [PATCH] [flang][Lower][OpenMP] Don't read moldarg for static sized
 array

This should further reduce the number of spurious barriers
---
 .../lib/Lower/OpenMP/DataSharingProcessor.cpp |  5 +-
 .../Lower/OpenMP/PrivateReductionUtils.cpp| 61 +--
 .../lib/Lower/OpenMP/PrivateReductionUtils.h  |  6 +-
 .../OpenMP/delayed-privatization-array.f90|  7 +--
 4 files changed, 51 insertions(+), 28 deletions(-)

diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp 
b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
index 55f543ca38178d1..800d332b74e3182 100644
--- a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
@@ -508,6 +508,8 @@ void DataSharingProcessor::doPrivatize(const 
semantics::Symbol *sym,
 
   lower::SymbolBox hsb = converter.lookupOneLevelUpSymbol(*sym);
   assert(hsb && "Host symbol box not found");
+  hlfir::Entity entity{hsb.getAddr()};
+  bool cannotHaveNonDefaultLowerBounds = 
!entity.mayHaveNonDefaultLowerBounds();
 
   mlir::Location symLoc = hsb.getAddr().getLoc();
   std::string privatizerName = sym->name().ToString() + ".privatizer";
@@ -528,7 +530,6 @@ void DataSharingProcessor::doPrivatize(const 
semantics::Symbol *sym,
   // an alloca for a fir.array type there. Get around this by boxing all
   // arrays.
   if (mlir::isa(allocType)) {
-hlfir::Entity entity{hsb.getAddr()};
 entity = genVariableBox(symLoc, firOpBuilder, entity);
 privVal = entity.getBase();
 allocType = privVal.getType();
@@ -590,7 +591,7 @@ void DataSharingProcessor::doPrivatize(const 
semantics::Symbol *sym,
   result.getDeallocRegion(),
   isFirstPrivate ? DeclOperationKind::FirstPrivate
  : DeclOperationKind::Private,
-  sym);
+  sym, cannotHaveNonDefaultLowerBounds);
   // TODO: currently there are false positives from dead uses of the mold
   // arg
   if (!result.getInitMoldArg().getUses().empty())
diff --git a/flang/lib/Lower/OpenMP/PrivateReductionUtils.cpp 
b/flang/lib/Lower/OpenMP/PrivateReductionUtils.cpp
index 951293b133677d3..e970968eb72887b 100644
--- a/flang/lib/Lower/OpenMP/PrivateReductionUtils.cpp
+++ b/flang/lib/Lower/OpenMP/PrivateReductionUtils.cpp
@@ -122,25 +122,40 @@ static void 
createCleanupRegion(Fortran::lower::AbstractConverter &converter,
   typeError();
 }
 
-fir::ShapeShiftOp Fortran::lower::omp::getShapeShift(fir::FirOpBuilder 
&builder,
- mlir::Location loc,
- mlir::Value box) {
+fir::ShapeShiftOp
+Fortran::lower::omp::getShapeShift(fir::FirOpBuilder &builder,
+   mlir::Location loc, mlir::Value box,
+   bool cannotHaveNonDefaultLowerBounds) {
   fir::SequenceType sequenceType = mlir::cast(
   hlfir::getFortranElementOrSequenceType(box.getType()));
   const unsigned rank = sequenceType.getDimension();
+
   llvm::SmallVector lbAndExtents;
   lbAndExtents.reserve(rank * 2);
-
   mlir::Type idxTy = builder.getIndexType();
-  for (unsigned i = 0; i < rank; ++i) {
-// TODO: ideally we want to hoist box reads out of the critical section.
-// We could do this by having box dimensions in block arguments like
-// OpenACC does
-mlir::Value dim = builder.createIntegerConstant(loc, idxTy, i);
-auto dimInfo =
-builder.create(loc, idxTy, idxTy, idxTy, box, dim);
-lbAndExtents.push_back(dimInfo.getLowerBound());
-lbAndExtents.push_back(dimInfo.getExtent());
+
+  if (cannotHaveNonDefaultLowerBounds && !sequenceType.hasDynamicExtents()) {
+// We don't need fir::BoxDimsOp if all of the extents are statically known
+// and we can assume default lower bounds. This helps avoids reads from the
+// mold arg.
+mlir::Value one = builder.createIntegerConstant(loc, idxTy, 1);
+for (int64_t extent : sequenceType.getShape()) {
+  assert(extent != sequenceType.getUnknownExtent());
+  mlir::Value extentVal = builder.createIntegerConstant(loc, idxTy, 
extent);
+  lbAndExtents.push_back(one);
+  lbAndExtents.push_back(extentVal);
+}
+  } else {
+for (unsigned i = 0; i < rank; ++i) {
+  // TODO: ideally we want to hoist box reads out of the critical section.
+  // We could do this by having box dimensions in block arguments like
+  // OpenACC does
+  mlir::Value dim = builder.createIntegerConstant(loc, idxTy, i);
+  auto dimInfo =
+  builder.create(loc, idxTy, idxTy, idxTy, box, dim);
+  lbAndExtents.push_back(dimInfo.getLowerBound());
+  lbAndExtents.push_back(dimInfo.getExtent());
+}
   }
 
   auto shapeShiftTy = fir::ShapeShiftType::get(builder.getCont

[llvm-branch-commits] [flang] [mlir] [mlir][OpenMP] Pack task private variables into a heap-allocated context struct (PR #125307)

2025-02-06 Thread Tom Eccles via llvm-branch-commits

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

>From 06831df6909ff246ccd541e4f4c39fd47fd993a4 Mon Sep 17 00:00:00 2001
From: Tom Eccles 
Date: Fri, 24 Jan 2025 17:32:41 +
Subject: [PATCH 01/12] [mlir][OpenMP] Pack task private variables into a
 heap-allocated context struct

See RFC:
https://discourse.llvm.org/t/rfc-openmp-supporting-delayed-task-execution-with-firstprivate-variables/83084

The aim here is to ensure that tasks which are not executed for a while
after they are created do not try to reference any data which are now
out of scope. This is done by packing the data referred to by the task
into a heap allocated structure (freed at the end of the task).

I decided to create the task context structure in
OpenMPToLLVMIRTranslation instead of adapting how it is done
CodeExtractor (via OpenMPIRBuilder] because CodeExtractor is (at least
in theory) generic code which could have other unrelated uses.
---
 .../OpenMP/OpenMPToLLVMIRTranslation.cpp  | 203 +++---
 mlir/test/Target/LLVMIR/openmp-llvm.mlir  |   5 +-
 .../LLVMIR/openmp-task-privatization.mlir |  82 +++
 3 files changed, 254 insertions(+), 36 deletions(-)
 create mode 100644 mlir/test/Target/LLVMIR/openmp-task-privatization.mlir

diff --git 
a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp 
b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index 372e0c8e8871336..5c4deab492c8390 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -13,6 +13,7 @@
 #include "mlir/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.h"
 #include "mlir/Analysis/TopologicalSortUtils.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
+#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
 #include "mlir/Dialect/OpenMP/OpenMPDialect.h"
 #include "mlir/Dialect/OpenMP/OpenMPInterfaces.h"
 #include "mlir/IR/IRMapping.h"
@@ -24,10 +25,12 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/TypeSwitch.h"
 #include "llvm/Frontend/OpenMP/OMPConstants.h"
 #include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
 #include "llvm/IR/DebugInfoMetadata.h"
+#include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/ReplaceConstant.h"
 #include "llvm/Support/FileSystem.h"
@@ -1331,19 +1334,16 @@ findAssociatedValue(Value privateVar, 
llvm::IRBuilderBase &builder,
 
 /// Initialize a single (first)private variable. You probably want to use
 /// allocateAndInitPrivateVars instead of this.
-static llvm::Error
-initPrivateVar(llvm::IRBuilderBase &builder,
-   LLVM::ModuleTranslation &moduleTranslation,
-   omp::PrivateClauseOp &privDecl, Value mlirPrivVar,
-   BlockArgument &blockArg, llvm::Value *llvmPrivateVar,
-   llvm::SmallVectorImpl &llvmPrivateVars,
-   llvm::BasicBlock *privInitBlock,
-   llvm::DenseMap *mappedPrivateVars = nullptr) {
+/// This returns the private variable which has been initialized. This
+/// variable should be mapped before constructing the body of the Op.
+static llvm::Expected initPrivateVar(
+llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation,
+omp::PrivateClauseOp &privDecl, Value mlirPrivVar, BlockArgument &blockArg,
+llvm::Value *llvmPrivateVar, llvm::BasicBlock *privInitBlock,
+llvm::DenseMap *mappedPrivateVars = nullptr) {
   Region &initRegion = privDecl.getInitRegion();
   if (initRegion.empty()) {
-moduleTranslation.mapValue(blockArg, llvmPrivateVar);
-llvmPrivateVars.push_back(llvmPrivateVar);
-return llvm::Error::success();
+return llvmPrivateVar;
   }
 
   // map initialization region block arguments
@@ -1363,17 +1363,15 @@ initPrivateVar(llvm::IRBuilderBase &builder,
 
   assert(phis.size() == 1 && "expected one allocation to be yielded");
 
-  // prefer the value yielded from the init region to the allocated private
-  // variable in case the region is operating on arguments by-value (e.g.
-  // Fortran character boxes).
-  moduleTranslation.mapValue(blockArg, phis[0]);
-  llvmPrivateVars.push_back(phis[0]);
-
   // clear init region block argument mapping in case it needs to be
   // re-created with a different source for another use of the same
   // reduction decl
   moduleTranslation.forgetMapping(initRegion);
-  return llvm::Error::success();
+
+  // Prefer the value yielded from the init region to the allocated private
+  // variable in case the region is operating on arguments by-value (e.g.
+  // Fortran character boxes).
+  return phis[0];
 }
 
 /// Allocate and initialize delayed private variables. Returns the basic block
@@ -1415,11 +1413,13 @@ static llvm::Expected 
allocateAndInitPrivateVars(
 llvm::Value *llvmPrivateVar = builder.CreateAlloca(
 llvmAllocType, /*ArraySize=*/nullptr, "omp.private.alloc");
 
-  

[llvm-branch-commits] [clang-tools-extra] [clang-doc] Make `--repository` change the HTML output (PR #122566)

2025-02-06 Thread Paul Kirth via llvm-branch-commits


@@ -494,18 +494,31 @@ genReferencesBlock(const std::vector 
&References,
 static std::unique_ptr
 writeFileDefinition(const Location &L,
 std::optional RepositoryUrl = std::nullopt) {
-  if (!L.IsFileInRootDir || !RepositoryUrl)
+  if (!L.IsFileInRootDir && !RepositoryUrl)
 return std::make_unique(
 HTMLTag::TAG_P, "Defined at line " + std::to_string(L.LineNumber) +
 " of file " + L.Filename);
   SmallString<128> FileURL(*RepositoryUrl);
-  llvm::sys::path::append(FileURL, llvm::sys::path::Style::posix, L.Filename);
+  llvm::sys::path::append(
+  FileURL, llvm::sys::path::Style::posix,
+  // If we're on windows, the file name will be in the wrong format, and

ilovepi wrote:

Done.

https://github.com/llvm/llvm-project/pull/122566
___
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] [clang-doc] Make `--repository` change the HTML output (PR #122566)

2025-02-06 Thread Paul Kirth via llvm-branch-commits

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

>From b2f162f08125caabe380d678ce5cb8df57cb7477 Mon Sep 17 00:00:00 2001
From: Paul Kirth 
Date: Sat, 11 Jan 2025 01:21:54 +
Subject: [PATCH] [clang-doc] Make `--repository` change the HTML output

The current check in writeFileDefinition() is incorrect, and prevents us
from ever emitting the URL from the clang-doc tool. The unit tests do
test this, but call the API directly circumventing the check.

This is the first step towards addressing #59814.
---
 clang-tools-extra/clang-doc/HTMLGenerator.cpp |  17 +-
 .../Inputs/basic-project/src/Circle.cpp   |   3 +-
 .../test/clang-doc/basic-project.test | 295 +++---
 .../unittests/clang-doc/HTMLGeneratorTest.cpp |   7 +-
 4 files changed, 197 insertions(+), 125 deletions(-)

diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp 
b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index a6ebc007278db40..18a0de826630c33 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -494,18 +494,31 @@ genReferencesBlock(const std::vector 
&References,
 static std::unique_ptr
 writeFileDefinition(const Location &L,
 std::optional RepositoryUrl = std::nullopt) {
-  if (!L.IsFileInRootDir || !RepositoryUrl)
+  if (!L.IsFileInRootDir && !RepositoryUrl)
 return std::make_unique(
 HTMLTag::TAG_P, "Defined at line " + std::to_string(L.LineNumber) +
 " of file " + L.Filename);
   SmallString<128> FileURL(*RepositoryUrl);
-  llvm::sys::path::append(FileURL, llvm::sys::path::Style::posix, L.Filename);
+  llvm::sys::path::append(
+  FileURL, llvm::sys::path::Style::posix,
+  // If we're on Windows, the file name will be in the wrong format, and
+  // append won't convert the full path being appended to the correct
+  // format, so we need to do that here.
+  llvm::sys::path::convert_to_slash(
+  L.Filename,
+  // The style here is the current style of the path, not the one we're
+  // targeting. If the string is already in the posix style, it will do
+  // nothing.
+  llvm::sys::path::Style::windows));
   auto Node = std::make_unique(HTMLTag::TAG_P);
   Node->Children.emplace_back(std::make_unique("Defined at line "));
   auto LocNumberNode =
   std::make_unique(HTMLTag::TAG_A, std::to_string(L.LineNumber));
   // The links to a specific line in the source code use the github /
   // googlesource notation so it won't work for all hosting pages.
+  // FIXME: we probably should have a configuration setting for line number
+  // rendering in the HTML. For example, GitHub uses #L22, while googlesource
+  // uses #22 for line numbers.
   LocNumberNode->Attributes.emplace_back(
   "href", (FileURL + "#" + std::to_string(L.LineNumber)).str());
   Node->Children.emplace_back(std::move(LocNumberNode));
diff --git 
a/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Circle.cpp 
b/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Circle.cpp
index 823384a4d97e868..3ddb2fd9ff563ee 100644
--- a/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Circle.cpp
+++ b/clang-tools-extra/test/clang-doc/Inputs/basic-project/src/Circle.cpp
@@ -8,4 +8,5 @@ double Circle::area() const {
 
 double Circle::perimeter() const {
 return 3.141 * radius_;
-}
\ No newline at end of file
+}
+
diff --git a/clang-tools-extra/test/clang-doc/basic-project.test 
b/clang-tools-extra/test/clang-doc/basic-project.test
index b6b43bb82bb15db..1f5ba8bdc0703d7 100644
--- a/clang-tools-extra/test/clang-doc/basic-project.test
+++ b/clang-tools-extra/test/clang-doc/basic-project.test
@@ -54,130 +54,183 @@
 // JSON-INDEX-NEXT: };
 // JSON-INDEX-NEXT: }
 
-// HTML-SHAPE: class Shape
-// HTML-SHAPE: Defined at line 8 of file {{.*}}Shape.h
-// HTML-SHAPE: brief
-// HTML-SHAPE:  Abstract base class for shapes.
-// HTML-SHAPE:  Provides a common interface for different types of 
shapes.
-// HTML-SHAPE: Functions
-// HTML-SHAPE: area
-// HTML-SHAPE: public double area()
-// HTML-SHAPE: brief
-// HTML-SHAPE:  Calculates the area of the shape.
-// HTML-SHAPE: perimeter
-// HTML-SHAPE: public double perimeter()
-// HTML-SHAPE: brief
-// HTML-SHAPE:  Calculates the perimeter of the shape.
-// HTML-SHAPE: return
-// HTML-SHAPE:  double The perimeter of the shape.
-// HTML-SHAPE: ~Shape
-// HTML-SHAPE: public void ~Shape()
-// HTML-SHAPE: Defined at line 13 of file {{.*}}Shape.h
-// HTML-SHAPE: brief
-// HTML-SHAPE:  Virtual destructor.
+//  HTML-SHAPE: class Shape
+// HTML-SHAPE-NEXT: 
+// HTML-SHAPE-NEXT: Defined at line
+// HTML-SHAPE-NEXT: https://repository.com/./include/Shape.h#8";>8
+// HTML-SHAPE-NEXT: of file
+// HTML-SHAPE-NEXT: https://repository.com/./include/Shape.h";>Shape.h
+// HTML-SHAPE-NEXT: 
+//  HTML-SHAPE: brief
+//  HTML-SHAPE:  Abstract base class for shapes.
+//  HTML-SHAPE:  Provides

[llvm-branch-commits] [clang-tools-extra] [clang-doc] Make `--repository` change the HTML output (PR #122566)

2025-02-06 Thread Paul Kirth via llvm-branch-commits

ilovepi wrote:

### Merge activity

* **Feb 6, 1:58 PM EST**: A user started a stack merge that includes this pull 
request via 
[Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/122566).


https://github.com/llvm/llvm-project/pull/122566
___
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/20.x: [OpenMP] Fix misspelled symbol name (#126120) (PR #126121)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-transforms

Author: None (llvmbot)


Changes

Backport b35749559ddd9b2d4e044ef71d13d888b8a3d8cb

Requested by: @jhuber6

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


1 Files Affected:

- (modified) llvm/lib/Transforms/IPO/Internalize.cpp (+1-1) 


``diff
diff --git a/llvm/lib/Transforms/IPO/Internalize.cpp 
b/llvm/lib/Transforms/IPO/Internalize.cpp
index f0270600aa26631..404102eef89fc2d 100644
--- a/llvm/lib/Transforms/IPO/Internalize.cpp
+++ b/llvm/lib/Transforms/IPO/Internalize.cpp
@@ -235,7 +235,7 @@ bool InternalizePass::internalizeModule(Module &M) {
 
   // Preserve the RPC interface for GPU host callbacks when internalizing.
   if (Triple(M.getTargetTriple()).isNVPTX())
-AlwaysPreserved.insert("__llvm_rpc_server");
+AlwaysPreserved.insert("__llvm_rpc_client");
 
   // Mark all functions not in the api as internal.
   IsWasm = Triple(M.getTargetTriple()).isOSBinFormatWasm();

``




https://github.com/llvm/llvm-project/pull/126121
___
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] [clang] Implement evaluation context for checking template parameters (PR #126088)

2025-02-06 Thread Younan Zhang via llvm-branch-commits

zyn0217 wrote:

(Did you mean `Implement *instantiation* context for checking template 
parameters`?)

https://github.com/llvm/llvm-project/pull/126088
___
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] [AMDGPU][Attributor] Rework update of `AAAMDWavesPerEU` (PR #123995)

2025-02-06 Thread Shilei Tian via llvm-branch-commits

https://github.com/shiltian edited 
https://github.com/llvm/llvm-project/pull/123995
___
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] [clang] Implement instantiation context note for checking template parameters (PR #126088)

2025-02-06 Thread Matheus Izvekov via llvm-branch-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/126088
___
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] [clang] Implement instantiation context note for checking template parameters (PR #126088)

2025-02-06 Thread Vlad Serebrennikov via llvm-branch-commits


@@ -1503,6 +1505,7 @@ namespace cwg389 { // cwg389: no
 typedef enum {} const D; // #cwg389-D
   };
   template struct T {};
+  // cxx98-note@-1 5{{template parameter is declared here}}

Endilll wrote:

Those, too, should go to their respective errors

https://github.com/llvm/llvm-project/pull/126088
___
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] [clang] Implement instantiation context note for checking template parameters (PR #126088)

2025-02-06 Thread Vlad Serebrennikov via llvm-branch-commits

https://github.com/Endilll commented:

Good job following the way expected directives are written in C++ DR tests, but 
I have to ask you to fix the remaining discrepancies to keep them consistent.

I also spotted the same note emitted twice for the same line. That seems 
unfortunate.

https://github.com/llvm/llvm-project/pull/126088
___
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] [clang] Implement instantiation context note for checking template parameters (PR #126088)

2025-02-06 Thread Vlad Serebrennikov via llvm-branch-commits


@@ -637,6 +641,8 @@ namespace cwg431 { // cwg431: 2.8
 
 namespace cwg432 { // cwg432: 3.0
   template struct A {};
+  // expected-note@-1{{template parameter is declared here}}
+  // since-cxx11-note@-2 {{template parameter is declared here}}

Endilll wrote:

Hmm, why do you have this note emitted twice in C++11 and on?

https://github.com/llvm/llvm-project/pull/126088
___
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] [clang] Implement instantiation context note for checking template parameters (PR #126088)

2025-02-06 Thread Vlad Serebrennikov via llvm-branch-commits

https://github.com/Endilll edited 
https://github.com/llvm/llvm-project/pull/126088
___
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] [clang] Implement instantiation context note for checking template parameters (PR #126088)

2025-02-06 Thread Vlad Serebrennikov via llvm-branch-commits


@@ -83,6 +83,7 @@ namespace cwg603 { // cwg603: 3.1
   typedef S<'\001'> S1;
   typedef S<(1ul << __CHAR_BIT__) + 1> S1;
   // since-cxx11-error@-1 {{non-type template argument evaluates to 257, which 
cannot be narrowed to type 'unsigned char'}}
+  //   since-cxx11-note@-4 {{template parameter is declared here}}

Endilll wrote:

Use a label instead of `-4`, readers shouldn't have to count lines to 
understand which line the note is emitted for.

https://github.com/llvm/llvm-project/pull/126088
___
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] [clang] Implement instantiation context note for checking template parameters (PR #126088)

2025-02-06 Thread Vlad Serebrennikov via llvm-branch-commits


@@ -637,6 +641,8 @@ namespace cwg431 { // cwg431: 2.8
 
 namespace cwg432 { // cwg432: 3.0
   template struct A {};
+  // expected-note@-1{{template parameter is declared here}}
+  // since-cxx11-note@-2 {{template parameter is declared here}}

Endilll wrote:

```suggestion
  //   since-cxx11-note@-2 {{template parameter is declared here}}
```

https://github.com/llvm/llvm-project/pull/126088
___
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] [clang] Implement instantiation context note for checking template parameters (PR #126088)

2025-02-06 Thread Vlad Serebrennikov via llvm-branch-commits


@@ -318,6 +318,7 @@ namespace cwg319 { // cwg319: no
   pa parr; // ok, type has linkage despite using 'n1'
 
   template struct X {};
+  // cxx98-note@-1 2{{template parameter is declared here}}

Endilll wrote:

Those two notes should go to their respective errors

https://github.com/llvm/llvm-project/pull/126088
___
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] [clang] Implement instantiation context note for checking template parameters (PR #126088)

2025-02-06 Thread Vlad Serebrennikov via llvm-branch-commits


@@ -1018,9 +1019,9 @@ namespace cwg62 { // cwg62: 2.9
   struct A {
 struct { int n; } b;
   };
-  template struct X {};
-  template T get() { return get(); }
-  template int take(T) { return 0; }
+  template struct X {}; // cxx98-note 6{{template parameter is 
declared here}}

Endilll wrote:

Those notes have to be places together with their respective errors, one by 
one, without matching for multiple notes with one expected directive.

https://github.com/llvm/llvm-project/pull/126088
___
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] release/20.x: [LLD][ELF][AArch64] Discard .ARM.attributes sections (#125838) (PR #126065)

2025-02-06 Thread via llvm-branch-commits

https://github.com/sivan-shani approved this pull request.


https://github.com/llvm/llvm-project/pull/126065
___
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/20.x: [OpenMP] Fix misspelled symbol name (#126120) (PR #126121)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:

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

https://github.com/llvm/llvm-project/pull/126121
___
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/20.x: [OpenMP] Fix misspelled symbol name (#126120) (PR #126121)

2025-02-06 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/126121
___
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/20.x: [OpenMP] Fix misspelled symbol name (#126120) (PR #126121)

2025-02-06 Thread via llvm-branch-commits

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

Backport b35749559ddd9b2d4e044ef71d13d888b8a3d8cb

Requested by: @jhuber6

>From 79c56250f674720d62e736bce76a9d6d9b23ed63 Mon Sep 17 00:00:00 2001
From: Joseph Huber 
Date: Thu, 6 Feb 2025 14:13:43 -0600
Subject: [PATCH] [OpenMP] Fix misspelled symbol name (#126120)

Summary:
This is supposed to be `__llvm_rpc_client` but I screwed it up and
didn't notice at the time. Will need to be backported.

(cherry picked from commit b35749559ddd9b2d4e044ef71d13d888b8a3d8cb)
---
 llvm/lib/Transforms/IPO/Internalize.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/IPO/Internalize.cpp 
b/llvm/lib/Transforms/IPO/Internalize.cpp
index f0270600aa26631..404102eef89fc2d 100644
--- a/llvm/lib/Transforms/IPO/Internalize.cpp
+++ b/llvm/lib/Transforms/IPO/Internalize.cpp
@@ -235,7 +235,7 @@ bool InternalizePass::internalizeModule(Module &M) {
 
   // Preserve the RPC interface for GPU host callbacks when internalizing.
   if (Triple(M.getTargetTriple()).isNVPTX())
-AlwaysPreserved.insert("__llvm_rpc_server");
+AlwaysPreserved.insert("__llvm_rpc_client");
 
   // Mark all functions not in the api as internal.
   IsWasm = Triple(M.getTargetTriple()).isOSBinFormatWasm();

___
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] [flang] release/20.x: [flang][Driver] When linking with the Fortran runtime also link with libexecinfo (#125998) (PR #126038)

2025-02-06 Thread via llvm-branch-commits

https://github.com/llvmbot updated 
https://github.com/llvm/llvm-project/pull/126038

>From 35d4de59a4bf8f36496f815dff8b7ab8283bf467 Mon Sep 17 00:00:00 2001
From: Brad Smith 
Date: Thu, 6 Feb 2025 04:36:47 -0500
Subject: [PATCH] [flang][Driver] When linking with the Fortran runtime also
 link with libexecinfo (#125998)

Also link with libexecinfo on FreeBSD, NetBSD, OpenBSD and DragonFly
for the backtrace functions.

(cherry picked from commit d1de75acea0da55316cd7827563e064105868f0f)
---
 clang/lib/Driver/ToolChains/CommonArgs.cpp |  5 +
 flang/test/Driver/linker-flags.f90 | 16 
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 2c4b082bcce4a62..4ed4dbc1a8d1bc9 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1340,6 +1340,11 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, 
const ArgList &Args,
 CmdArgs.push_back("-lFortranRuntime");
 CmdArgs.push_back("-lFortranDecimal");
 addArchSpecificRPath(TC, Args, CmdArgs);
+
+// needs libexecinfo for backtrace functions
+if (TC.getTriple().isOSFreeBSD() || TC.getTriple().isOSNetBSD() ||
+TC.getTriple().isOSOpenBSD() || TC.getTriple().isOSDragonFly())
+  CmdArgs.push_back("-lexecinfo");
   }
 
   // libomp needs libatomic for atomic operations if using libgcc
diff --git a/flang/test/Driver/linker-flags.f90 
b/flang/test/Driver/linker-flags.f90
index ac9500d7c45cecd..b998cbaa6227c35 100644
--- a/flang/test/Driver/linker-flags.f90
+++ b/flang/test/Driver/linker-flags.f90
@@ -5,10 +5,10 @@
 ! RUN: %flang -### --target=ppc64le-linux-gnu %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
 ! RUN: %flang -### --target=aarch64-apple-darwin %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,DARWIN,DARWIN-F128%f128-lib
 ! RUN: %flang -### --target=sparc-sun-solaris2.11 %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,SOLARIS-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-freebsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-netbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-openbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-dragonfly %S/Inputs/hello.f90 2>&1 
| FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-freebsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-netbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-openbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-dragonfly %S/Inputs/hello.f90 2>&1 
| FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
 ! RUN: %flang -### --target=x86_64-unknown-haiku %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,HAIKU,HAIKU-F128%f128-lib
 ! RUN: %flang -### --target=x86_64-windows-gnu %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,MINGW,MINGW-F128%f128-lib
 ! RUN: %flang -### -rtlib=compiler-rt --target=aarch64-linux-gnu 
%S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,COMPILER-RT
@@ -36,6 +36,14 @@
 ! UNIX-SAME: "-lFortranRuntime" "-lFortranDecimal" "-lm"
 ! COMPILER-RT: "{{.*}}{{\\|/}}libclang_rt.builtins.a"
 
+! BSD-LABEL:  "{{.*}}ld{{(\.exe)?}}"
+! BSD-SAME: "[[object_file]]"
+! BSD-F128NONE-NOT: FortranFloat128Math
+! BSD-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" 
"--no-as-needed"
+! BSD-SAME: -lFortranRuntime
+! BSD-SAME: -lFortranDecimal
+! BSD-SAME: -lexecinfo
+
 ! DARWIN-LABEL:  "{{.*}}ld{{(\.exe)?}}"
 ! DARWIN-SAME: "[[object_file]]"
 ! DARWIN-F128NONE-NOT: FortranFloat128Math

___
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] [flang] release/20.x: [flang][Driver] When linking with the Fortran runtime also link with libexecinfo (#125998) (PR #126038)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-driver

Author: None (llvmbot)


Changes

Backport d1de75acea0da55316cd7827563e064105868f0f

Requested by: @brad0

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


2 Files Affected:

- (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+5) 
- (modified) flang/test/Driver/linker-flags.f90 (+12-4) 


``diff
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 2c4b082bcce4a62..4ed4dbc1a8d1bc9 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1340,6 +1340,11 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, 
const ArgList &Args,
 CmdArgs.push_back("-lFortranRuntime");
 CmdArgs.push_back("-lFortranDecimal");
 addArchSpecificRPath(TC, Args, CmdArgs);
+
+// needs libexecinfo for backtrace functions
+if (TC.getTriple().isOSFreeBSD() || TC.getTriple().isOSNetBSD() ||
+TC.getTriple().isOSOpenBSD() || TC.getTriple().isOSDragonFly())
+  CmdArgs.push_back("-lexecinfo");
   }
 
   // libomp needs libatomic for atomic operations if using libgcc
diff --git a/flang/test/Driver/linker-flags.f90 
b/flang/test/Driver/linker-flags.f90
index ac9500d7c45cecd..b998cbaa6227c35 100644
--- a/flang/test/Driver/linker-flags.f90
+++ b/flang/test/Driver/linker-flags.f90
@@ -5,10 +5,10 @@
 ! RUN: %flang -### --target=ppc64le-linux-gnu %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
 ! RUN: %flang -### --target=aarch64-apple-darwin %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,DARWIN,DARWIN-F128%f128-lib
 ! RUN: %flang -### --target=sparc-sun-solaris2.11 %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,SOLARIS-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-freebsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-netbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-openbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
-! RUN: %flang -### --target=x86_64-unknown-dragonfly %S/Inputs/hello.f90 2>&1 
| FileCheck %s --check-prefixes=CHECK,UNIX,UNIX-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-freebsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-netbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-openbsd %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
+! RUN: %flang -### --target=x86_64-unknown-dragonfly %S/Inputs/hello.f90 2>&1 
| FileCheck %s --check-prefixes=CHECK,BSD,BSD-F128%f128-lib
 ! RUN: %flang -### --target=x86_64-unknown-haiku %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,HAIKU,HAIKU-F128%f128-lib
 ! RUN: %flang -### --target=x86_64-windows-gnu %S/Inputs/hello.f90 2>&1 | 
FileCheck %s --check-prefixes=CHECK,MINGW,MINGW-F128%f128-lib
 ! RUN: %flang -### -rtlib=compiler-rt --target=aarch64-linux-gnu 
%S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,UNIX,COMPILER-RT
@@ -36,6 +36,14 @@
 ! UNIX-SAME: "-lFortranRuntime" "-lFortranDecimal" "-lm"
 ! COMPILER-RT: "{{.*}}{{\\|/}}libclang_rt.builtins.a"
 
+! BSD-LABEL:  "{{.*}}ld{{(\.exe)?}}"
+! BSD-SAME: "[[object_file]]"
+! BSD-F128NONE-NOT: FortranFloat128Math
+! BSD-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" 
"--no-as-needed"
+! BSD-SAME: -lFortranRuntime
+! BSD-SAME: -lFortranDecimal
+! BSD-SAME: -lexecinfo
+
 ! DARWIN-LABEL:  "{{.*}}ld{{(\.exe)?}}"
 ! DARWIN-SAME: "[[object_file]]"
 ! DARWIN-F128NONE-NOT: FortranFloat128Math

``




https://github.com/llvm/llvm-project/pull/126038
___
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] [clang] Implement evaluation context for checking template parameters (PR #126088)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Matheus Izvekov (mizvekov)


Changes

Instead of manually adding a note pointing to the relevant template parameter 
to every relevant error, which is very easy to miss, this patch adds a new 
instantiation context note, so that this can work using RAII magic.

This fixes a bunch of places where these notes were missing, and is more 
future-proof.

Some diagnostics are reworked to make better use of this note:
- Errors about missing template arguments now refer to the parameter which is 
missing an argument.
- Template Template parameter mismatches now refer to template parameters as 
parameters instead of arguments.

It's likely this will add the note to some diagnostics where the parameter is 
not super relevant, but this can be reworked with time and the decrease in 
maintenance burden makes up for it.

This bypasses the templight dumper for the new context entry, as the tests are 
very hard to update.

This depends on #125453, which is needed to avoid losing the context 
note for errors occuring during template argument deduction.

---

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


95 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (+10) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+7-3) 
- (modified) clang/include/clang/Sema/Sema.h (+18-2) 
- (modified) clang/lib/Frontend/FrontendActions.cpp (+16-8) 
- (modified) clang/lib/Sema/SemaInit.cpp (+3-4) 
- (modified) clang/lib/Sema/SemaLambda.cpp (+3-4) 
- (modified) clang/lib/Sema/SemaLookup.cpp (+10-4) 
- (modified) clang/lib/Sema/SemaTemplate.cpp (+48-93) 
- (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+3-2) 
- (modified) clang/lib/Sema/SemaTemplateInstantiate.cpp (+24-6) 
- (modified) clang/test/AST/ByteCode/cxx1z.cpp (+1-1) 
- (modified) clang/test/AST/ByteCode/cxx20.cpp (+1-1) 
- (modified) clang/test/AST/ByteCode/cxx98.cpp (+1-1) 
- (modified) clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp (+1) 
- (modified) clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp (+1-1) 
- (modified) clang/test/CXX/drs/cwg0xx.cpp (+6-4) 
- (modified) clang/test/CXX/drs/cwg10xx.cpp (+1) 
- (modified) clang/test/CXX/drs/cwg13xx.cpp (+1) 
- (modified) clang/test/CXX/drs/cwg18xx.cpp (+10-9) 
- (modified) clang/test/CXX/drs/cwg1xx.cpp (+11-5) 
- (modified) clang/test/CXX/drs/cwg20xx.cpp (+7-3) 
- (modified) clang/test/CXX/drs/cwg21xx.cpp (+2-1) 
- (modified) clang/test/CXX/drs/cwg3xx.cpp (+3) 
- (modified) clang/test/CXX/drs/cwg4xx.cpp (+9-2) 
- (modified) clang/test/CXX/drs/cwg6xx.cpp (+3-2) 
- (modified) clang/test/CXX/expr/expr.const/p3-0x.cpp (+4-3) 
- (modified) clang/test/CXX/expr/expr.prim/expr.prim.req/type-requirement.cpp 
(+1-1) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1-11.cpp (+1-1) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp (+4-3) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp (+7-7) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp (+6-6) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp (+4-4) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp (+12-6) 
- (modified) clang/test/CXX/temp/temp.decls/temp.class.spec/p8-1y.cpp (+2-2) 
- (modified) clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp 
(+21-21) 
- (modified) 
clang/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp 
(+5-5) 
- (modified) clang/test/CXX/temp/temp.deduct/p9.cpp (+3-2) 
- (modified) clang/test/CXX/temp/temp.param/p1.cpp (+5-4) 
- (modified) clang/test/CXX/temp/temp.param/p12.cpp (+1-1) 
- (modified) clang/test/CXX/temp/temp.param/p15-cxx0x.cpp (+5-5) 
- (modified) clang/test/CXX/temp/temp.param/p8-cxx20.cpp (+1-1) 
- (modified) clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp 
(+1-1) 
- (modified) clang/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp 
(+5-5) 
- (modified) clang/test/CXX/temp/temp.spec/part.spec.cpp (+2-2) 
- (modified) clang/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp (+4-4) 
- (modified) clang/test/Misc/integer-literal-printing.cpp (+7) 
- (modified) clang/test/Modules/missing-body-in-import.cpp (+1) 
- (modified) clang/test/Modules/template-default-args.cpp (+3-1) 
- (modified) clang/test/Parser/MicrosoftExtensions.cpp (+1-1) 
- (modified) clang/test/Parser/cxx-template-argument.cpp (+6-6) 
- (modified) clang/test/Parser/cxx-template-template-recovery.cpp (+12-12) 
- (modified) clang/test/Parser/cxx1z-class-template-argument-deduction.cpp 
(+5-5) 
- (modified) clang/test/SemaCXX/access-base-class.cpp (+12-12) 
- (modified) clang/test/SemaCXX/alias-template.cpp (+4-1) 
- (modified) clang/test/SemaCXX/anonymous-struct.cpp (+2-1) 
- (modified) clang/test/SemaCXX/constant-expression-cxx11.cpp (+2-2) 
- (modified) clang/test/SemaCXX/constant-expression.cpp (+1-1) 
- (modified) clang/test/SemaCXX/cxx1z-noexcept-functi

[llvm-branch-commits] [clang] [clang] Implement evaluation context for checking template parameters (PR #126088)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:



@llvm/pr-subscribers-hlsl

@llvm/pr-subscribers-clang-modules

Author: Matheus Izvekov (mizvekov)


Changes

Instead of manually adding a note pointing to the relevant template parameter 
to every relevant error, which is very easy to miss, this patch adds a new 
instantiation context note, so that this can work using RAII magic.

This fixes a bunch of places where these notes were missing, and is more 
future-proof.

Some diagnostics are reworked to make better use of this note:
- Errors about missing template arguments now refer to the parameter which is 
missing an argument.
- Template Template parameter mismatches now refer to template parameters as 
parameters instead of arguments.

It's likely this will add the note to some diagnostics where the parameter is 
not super relevant, but this can be reworked with time and the decrease in 
maintenance burden makes up for it.

This bypasses the templight dumper for the new context entry, as the tests are 
very hard to update.

This depends on #125453, which is needed to avoid losing the context 
note for errors occuring during template argument deduction.

---

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


95 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (+10) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+7-3) 
- (modified) clang/include/clang/Sema/Sema.h (+18-2) 
- (modified) clang/lib/Frontend/FrontendActions.cpp (+16-8) 
- (modified) clang/lib/Sema/SemaInit.cpp (+3-4) 
- (modified) clang/lib/Sema/SemaLambda.cpp (+3-4) 
- (modified) clang/lib/Sema/SemaLookup.cpp (+10-4) 
- (modified) clang/lib/Sema/SemaTemplate.cpp (+48-93) 
- (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+3-2) 
- (modified) clang/lib/Sema/SemaTemplateInstantiate.cpp (+24-6) 
- (modified) clang/test/AST/ByteCode/cxx1z.cpp (+1-1) 
- (modified) clang/test/AST/ByteCode/cxx20.cpp (+1-1) 
- (modified) clang/test/AST/ByteCode/cxx98.cpp (+1-1) 
- (modified) clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp (+1) 
- (modified) clang/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp (+1-1) 
- (modified) clang/test/CXX/drs/cwg0xx.cpp (+6-4) 
- (modified) clang/test/CXX/drs/cwg10xx.cpp (+1) 
- (modified) clang/test/CXX/drs/cwg13xx.cpp (+1) 
- (modified) clang/test/CXX/drs/cwg18xx.cpp (+10-9) 
- (modified) clang/test/CXX/drs/cwg1xx.cpp (+11-5) 
- (modified) clang/test/CXX/drs/cwg20xx.cpp (+7-3) 
- (modified) clang/test/CXX/drs/cwg21xx.cpp (+2-1) 
- (modified) clang/test/CXX/drs/cwg3xx.cpp (+3) 
- (modified) clang/test/CXX/drs/cwg4xx.cpp (+9-2) 
- (modified) clang/test/CXX/drs/cwg6xx.cpp (+3-2) 
- (modified) clang/test/CXX/expr/expr.const/p3-0x.cpp (+4-3) 
- (modified) clang/test/CXX/expr/expr.prim/expr.prim.req/type-requirement.cpp 
(+1-1) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1-11.cpp (+1-1) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp (+4-3) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp (+7-7) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp (+6-6) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp (+4-4) 
- (modified) clang/test/CXX/temp/temp.arg/temp.arg.type/p2.cpp (+12-6) 
- (modified) clang/test/CXX/temp/temp.decls/temp.class.spec/p8-1y.cpp (+2-2) 
- (modified) clang/test/CXX/temp/temp.decls/temp.variadic/fixed-expansion.cpp 
(+21-21) 
- (modified) 
clang/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp 
(+5-5) 
- (modified) clang/test/CXX/temp/temp.deduct/p9.cpp (+3-2) 
- (modified) clang/test/CXX/temp/temp.param/p1.cpp (+5-4) 
- (modified) clang/test/CXX/temp/temp.param/p12.cpp (+1-1) 
- (modified) clang/test/CXX/temp/temp.param/p15-cxx0x.cpp (+5-5) 
- (modified) clang/test/CXX/temp/temp.param/p8-cxx20.cpp (+1-1) 
- (modified) clang/test/CXX/temp/temp.res/temp.dep/temp.dep.constexpr/p2.cpp 
(+1-1) 
- (modified) clang/test/CXX/temp/temp.spec/cxx1y-variable-template-no-body.cpp 
(+5-5) 
- (modified) clang/test/CXX/temp/temp.spec/part.spec.cpp (+2-2) 
- (modified) clang/test/CXX/temp/temp.spec/temp.expl.spec/p20.cpp (+4-4) 
- (modified) clang/test/Misc/integer-literal-printing.cpp (+7) 
- (modified) clang/test/Modules/missing-body-in-import.cpp (+1) 
- (modified) clang/test/Modules/template-default-args.cpp (+3-1) 
- (modified) clang/test/Parser/MicrosoftExtensions.cpp (+1-1) 
- (modified) clang/test/Parser/cxx-template-argument.cpp (+6-6) 
- (modified) clang/test/Parser/cxx-template-template-recovery.cpp (+12-12) 
- (modified) clang/test/Parser/cxx1z-class-template-argument-deduction.cpp 
(+5-5) 
- (modified) clang/test/SemaCXX/access-base-class.cpp (+12-12) 
- (modified) clang/test/SemaCXX/alias-template.cpp (+4-1) 
- (modified) clang/test/SemaCXX/anonymous-struct.cpp (+2-1) 
- (modified) clang/test/SemaCXX/constant-expression-cxx11.cpp (+2-2) 
- (modified) clang/test/SemaCXX/constant-expression.cpp (+1-1) 
- (modified) clang/

[llvm-branch-commits] [llvm] release/20.x: Fix `llvm/test/DebugInfo/Generic/discriminated-union.ll` on big-endian targets (#125849) (PR #126029)

2025-02-06 Thread David Blaikie via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/126029
___
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] [clang] Implement evaluation context for checking template parameters (PR #126088)

2025-02-06 Thread Matheus Izvekov via llvm-branch-commits

mizvekov wrote:

> (Did you mean `Implement *instantiation* context for checking template 
> parameters`?)

Oops, yes of course :)

https://github.com/llvm/llvm-project/pull/126088
___
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] [clang] Implement instantiation context for checking template parameters (PR #126088)

2025-02-06 Thread Matheus Izvekov via llvm-branch-commits

https://github.com/mizvekov edited 
https://github.com/llvm/llvm-project/pull/126088
___
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] [libcxx] 71ee354 - [libc++][TZDB] Fixes %z escaping. (#125399)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

Author: Mark de Wever
Date: 2025-02-06T22:53:04-08:00
New Revision: 71ee354bab4ad4e3132d079f11e7b9771012442c

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

LOG: [libc++][TZDB] Fixes %z escaping. (#125399)

The previous tested TZDB did not contain %z for the rule letters. The
usage of %z in TZDB 2024b revealed a bug in the implementation. The
patch fixes it and has been locally tested with TZDB 2024b.

Fixes #108957

(cherry picked from commit a27f3b2bb137001735949549354aff89dbf227f4)

Added: 


Modified: 
libcxx/src/experimental/time_zone.cpp

libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp

Removed: 




diff  --git a/libcxx/src/experimental/time_zone.cpp 
b/libcxx/src/experimental/time_zone.cpp
index f7d82a5d4cfc30c..289164ab1203642 100644
--- a/libcxx/src/experimental/time_zone.cpp
+++ b/libcxx/src/experimental/time_zone.cpp
@@ -668,7 +668,7 @@ __first_rule(seconds __stdoff, const vector<__tz::__rule>& 
__rules) {
__continuation_end,
__continuation.__stdoff + __save,
chrono::duration_cast(__save),
-   __continuation.__format},
+   chrono::__format(__continuation, __continuation.__format, 
__save)},
   true};
 }
 

diff  --git 
a/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp
 
b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp
index 7f08c64d5e0e715..afd1273421f3985 100644
--- 
a/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp
+++ 
b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp
@@ -157,7 +157,6 @@ static void test_abbrev(std::string_view input, 
std::string_view expected) {
   TEST_LIBCPP_REQUIRE(result == expected, TEST_WRITE_CONCATENATED("\nExpected 
", expected, "\nActual ", result, '\n'));
 }
 
-// This format is valid, however is not used in the tzdata.zi.
 static void percentage_z_format() {
   test_abbrev(
   R"(
@@ -188,6 +187,12 @@ Z Format 0:45 F %z)",
 R F 1999 max - Jan 5 0 -1 foo
 Z Format 0:45 F %z)",
   "-0015");
+
+  test_abbrev(
+  R"(
+Z Format -1:2:20 - LMT 1912 Ja 1 1u
+-1 - %z)",
+  "-01");
 }
 
 int main(int, const char**) {



___
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] undo (PR #126192)

2025-02-06 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka converted_to_draft 
https://github.com/llvm/llvm-project/pull/126192
___
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] undo (PR #126192)

2025-02-06 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/126192
___
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] fix: removes invalid token from LLVM_VERSION_SUFFIX in LIBC namespace (PR #126193)

2025-02-06 Thread via llvm-branch-commits

github-actions[bot] wrote:



Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write 
permissions for the repository. In which case you can instead tag reviewers by 
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a 
review by "ping"ing the PR by adding a comment “Ping”. The common courtesy 
"ping" rate is once a week. Please remember that you are asking for valuable 
time from other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

https://github.com/llvm/llvm-project/pull/126193
___
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] fix: removes invalid token from LLVM_VERSION_SUFFIX in LIBC namespace (PR #126193)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-libc

Author: s.vgys (samvangysegem)


Changes

Resolves #125831 


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


1 Files Affected:

- (modified) libc/CMakeLists.txt (+2-1) 


``diff
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index c061e2a05ebd8f..1c4c0cd5aa22ba 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -51,7 +51,8 @@ set(LIBC_KERNEL_HEADERS "/usr/include" CACHE STRING "Path to 
Linux kernel header
 # Defining a global namespace to enclose all libc functions.
 set(default_namespace "__llvm_libc")
 if(LLVM_VERSION_MAJOR)
-  set(default_namespace 
"__llvm_libc_${LLVM_VERSION_MAJOR}_${LLVM_VERSION_MINOR}_${LLVM_VERSION_PATCH}_${LLVM_VERSION_SUFFIX}")
+  string(REPLACE "-" "" NS_LLVM_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
+  set(default_namespace 
"__llvm_libc_${LLVM_VERSION_MAJOR}_${LLVM_VERSION_MINOR}_${LLVM_VERSION_PATCH}_${NS_LLVM_VERSION_SUFFIX}")
 endif()
 set(LIBC_NAMESPACE ${default_namespace}
   CACHE STRING "The namespace to use to enclose internal implementations. Must 
start with '__llvm_libc'."

``




https://github.com/llvm/llvm-project/pull/126193
___
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] fix: removes invalid token from LLVM_VERSION_SUFFIX in LIBC namespace (PR #126193)

2025-02-06 Thread via llvm-branch-commits

https://github.com/samvangysegem created 
https://github.com/llvm/llvm-project/pull/126193

Resolves #125831 


>From 9d3cd961eec16a881e2e69873f93aeb813031212 Mon Sep 17 00:00:00 2001
From: "s.vgys" 
Date: Fri, 7 Feb 2025 08:05:33 +0100
Subject: [PATCH] fix: removes invalid token from LLVM_VERSION_SUFFIX in LIBC
 namespace

---
 libc/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index c061e2a05ebd8f5..1c4c0cd5aa22ba7 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -51,7 +51,8 @@ set(LIBC_KERNEL_HEADERS "/usr/include" CACHE STRING "Path to 
Linux kernel header
 # Defining a global namespace to enclose all libc functions.
 set(default_namespace "__llvm_libc")
 if(LLVM_VERSION_MAJOR)
-  set(default_namespace 
"__llvm_libc_${LLVM_VERSION_MAJOR}_${LLVM_VERSION_MINOR}_${LLVM_VERSION_PATCH}_${LLVM_VERSION_SUFFIX}")
+  string(REPLACE "-" "" NS_LLVM_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
+  set(default_namespace 
"__llvm_libc_${LLVM_VERSION_MAJOR}_${LLVM_VERSION_MINOR}_${LLVM_VERSION_PATCH}_${NS_LLVM_VERSION_SUFFIX}")
 endif()
 set(LIBC_NAMESPACE ${default_namespace}
   CACHE STRING "The namespace to use to enclose internal implementations. Must 
start with '__llvm_libc'."

___
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] fix: removes invalid token from LLVM_VERSION_SUFFIX in LIBC namespace (PR #126193)

2025-02-06 Thread via llvm-branch-commits

https://github.com/samvangysegem updated 
https://github.com/llvm/llvm-project/pull/126193

>From 9d3cd961eec16a881e2e69873f93aeb813031212 Mon Sep 17 00:00:00 2001
From: "s.vgys" 
Date: Fri, 7 Feb 2025 08:05:33 +0100
Subject: [PATCH] fix: removes invalid token from LLVM_VERSION_SUFFIX in LIBC
 namespace

---
 libc/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index c061e2a05ebd8f..1c4c0cd5aa22ba 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -51,7 +51,8 @@ set(LIBC_KERNEL_HEADERS "/usr/include" CACHE STRING "Path to 
Linux kernel header
 # Defining a global namespace to enclose all libc functions.
 set(default_namespace "__llvm_libc")
 if(LLVM_VERSION_MAJOR)
-  set(default_namespace 
"__llvm_libc_${LLVM_VERSION_MAJOR}_${LLVM_VERSION_MINOR}_${LLVM_VERSION_PATCH}_${LLVM_VERSION_SUFFIX}")
+  string(REPLACE "-" "" NS_LLVM_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
+  set(default_namespace 
"__llvm_libc_${LLVM_VERSION_MAJOR}_${LLVM_VERSION_MINOR}_${LLVM_VERSION_PATCH}_${NS_LLVM_VERSION_SUFFIX}")
 endif()
 set(LIBC_NAMESPACE ${default_namespace}
   CACHE STRING "The namespace to use to enclose internal implementations. Must 
start with '__llvm_libc'."

___
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] undo (PR #126192)

2025-02-06 Thread via llvm-branch-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff 45fc89f407b6784a6ef2009e388c5a79b4588455 
611b0c1713964a7df8a3f168c4dda69e6f6b63d5 --extensions cpp -- 
llvm/lib/Passes/PassBuilderPipelines.cpp
``





View the diff from clang-format here.


``diff
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp 
b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 0794729cd4..ed147504c6 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1817,10 +1817,10 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel 
Level,
   // in the current module.
   MPM.addPass(CrossDSOCFIPass());
 
-//  MPM.addPass(CoroEarlyPass());
+  //  MPM.addPass(CoroEarlyPass());
 
   auto Exit = llvm::make_scope_exit([&]() {
-//MPM.addPass(CoroCleanupPass());
+//MPM.addPass(CoroCleanupPass());
 
 invokeFullLinkTimeOptimizationLastEPCallbacks(MPM, Level);
 
@@ -1987,8 +1987,8 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel 
Level,
   // transform it to pass arguments by value instead of by reference.
   CGSCCPassManager CGPM;
   CGPM.addPass(ArgumentPromotionPass());
-//  CGPM.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
-//  CGPM.addPass(CoroAnnotationElidePass());
+  //  CGPM.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
+  //  CGPM.addPass(CoroAnnotationElidePass());
   MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
 
   FunctionPassManager FPM;

``




https://github.com/llvm/llvm-project/pull/126192
___
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] [AMDGPU] Push amdgpu-preload-kern-arg-prolog after livedebugvalues (PR #126148)

2025-02-06 Thread Scott Linder via llvm-branch-commits

https://github.com/slinder1 updated 
https://github.com/llvm/llvm-project/pull/126148

>From 87d26ba446362f1f50dea05339f5a46c08312f7a Mon Sep 17 00:00:00 2001
From: Scott Linder 
Date: Thu, 6 Feb 2025 00:01:07 +
Subject: [PATCH] [AMDGPU] Push amdgpu-preload-kern-arg-prolog after
 livedebugvalues

This is effectively a workaround for a bug in livedebugvalues, but seems
to potentially be a general improvement, as BB sections seems like it
could ruin the special 256-byte prelude scheme that
amdgpu-preload-kern-arg-prolog requires anyway. Moving it even later
doesn't seem to have any material impact, and just adds livedebugvalues
to the list of things which no longer have to deal with pseudo
multiple-entry functions.

AMDGPU debug-info isn't supported upstream yet, so the bug being avoided
isn't testable here. I am posting the patch upstream to avoid an
unnecessary diff with AMD's fork.
---
 llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp |  6 ++
 llvm/test/CodeGen/AMDGPU/llc-pipeline.ll   | 10 +-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp 
b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index fffd30b26dc1d50..67b155e4e740011 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -1147,6 +1147,7 @@ class GCNPassConfig final : public AMDGPUPassConfig {
   void addPostRegAlloc() override;
   void addPreSched2() override;
   void addPreEmitPass() override;
+  void addPostBBSections() override;
 };
 
 } // end anonymous namespace
@@ -1686,6 +1687,11 @@ void GCNPassConfig::addPreEmitPass() {
 addPass(&AMDGPUInsertDelayAluID);
 
   addPass(&BranchRelaxationPassID);
+}
+
+void GCNPassConfig::addPostBBSections() {
+  // We run this later to avoid passes like livedebugvalues and BBSections
+  // having to deal with the apparent multi-entry functions we may generate.
   addPass(createAMDGPUPreloadKernArgPrologLegacyPass());
 }
 
diff --git a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll 
b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
index 893b9fa6fb40d07..d7f54f3b8e9e26d 100644
--- a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
+++ b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
@@ -145,11 +145,11 @@
 ; GCN-O0-NEXT:Post RA hazard recognizer
 ; GCN-O0-NEXT:AMDGPU Insert waits for SGPR read hazards
 ; GCN-O0-NEXT:Branch relaxation pass
-; GCN-O0-NEXT:AMDGPU Preload Kernel Arguments Prolog
 ; GCN-O0-NEXT:Register Usage Information Collector Pass
 ; GCN-O0-NEXT:Remove Loads Into Fake Uses
 ; GCN-O0-NEXT:Live DEBUG_VALUE analysis
 ; GCN-O0-NEXT:Machine Sanitizer Binary Metadata
+; GCN-O0-NEXT:AMDGPU Preload Kernel Arguments Prolog
 ; GCN-O0-NEXT:Lazy Machine Block Frequency Analysis
 ; GCN-O0-NEXT:Machine Optimization Remark Emitter
 ; GCN-O0-NEXT:Stack Frame Layout Analysis
@@ -430,11 +430,11 @@
 ; GCN-O1-NEXT:AMDGPU Insert waits for SGPR read hazards
 ; GCN-O1-NEXT:AMDGPU Insert Delay ALU
 ; GCN-O1-NEXT:Branch relaxation pass
-; GCN-O1-NEXT:AMDGPU Preload Kernel Arguments Prolog
 ; GCN-O1-NEXT:Register Usage Information Collector Pass
 ; GCN-O1-NEXT:Remove Loads Into Fake Uses
 ; GCN-O1-NEXT:Live DEBUG_VALUE analysis
 ; GCN-O1-NEXT:Machine Sanitizer Binary Metadata
+; GCN-O1-NEXT:AMDGPU Preload Kernel Arguments Prolog
 ; GCN-O1-NEXT:Lazy Machine Block Frequency Analysis
 ; GCN-O1-NEXT:Machine Optimization Remark Emitter
 ; GCN-O1-NEXT:Stack Frame Layout Analysis
@@ -743,11 +743,11 @@
 ; GCN-O1-OPTS-NEXT:AMDGPU Insert waits for SGPR read hazards
 ; GCN-O1-OPTS-NEXT:AMDGPU Insert Delay ALU
 ; GCN-O1-OPTS-NEXT:Branch relaxation pass
-; GCN-O1-OPTS-NEXT:AMDGPU Preload Kernel Arguments Prolog
 ; GCN-O1-OPTS-NEXT:Register Usage Information Collector Pass
 ; GCN-O1-OPTS-NEXT:Remove Loads Into Fake Uses
 ; GCN-O1-OPTS-NEXT:Live DEBUG_VALUE analysis
 ; GCN-O1-OPTS-NEXT:Machine Sanitizer Binary Metadata
+; GCN-O1-OPTS-NEXT:AMDGPU Preload Kernel Arguments Prolog
 ; GCN-O1-OPTS-NEXT:Lazy Machine Block Frequency Analysis
 ; GCN-O1-OPTS-NEXT:Machine Optimization Remark Emitter
 ; GCN-O1-OPTS-NEXT:Stack Frame Layout Analysis
@@ -1062,11 +1062,11 @@
 ; GCN-O2-NEXT:AMDGPU Insert waits for SGPR read hazards
 ; GCN-O2-NEXT:AMDGPU Insert Delay ALU
 ; GCN-O2-NEXT:Branch relaxation pass
-; GCN-O2-NEXT:AMDGPU Preload Kernel Arguments Prolog
 ; GCN-O2-NEXT:Register Usage Information Collector Pass
 ; GCN-O2-NEXT:Remove Loads Into Fake Uses
 ; GCN-O2-NEXT:Live DEBUG_VALUE analysis
 ; GCN-O2-NEXT:Machine Sanitizer Binary Metadata
+; GCN-O2-NEXT:AMDGPU Preload Kernel Arguments Prolog
 ; GCN-O2-NEXT:Lazy Machine Block Frequency Analysis
 ; GCN-O2-NEXT:  

[llvm-branch-commits] [polly] [Polly] Remove ScopPass infrastructure (PR #125783)

2025-02-06 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur updated 
https://github.com/llvm/llvm-project/pull/125783

>From 67ff7b622fef21d39c524d0de9d4659d2444ccfd Mon Sep 17 00:00:00 2001
From: Michael Kruse 
Date: Wed, 5 Feb 2025 00:51:47 +0100
Subject: [PATCH] Remove ScopPass infrastructure

---
 polly/docs/ReleaseNotes.rst   |   1 +
 polly/include/polly/CodeGen/CodeGeneration.h  |  13 +-
 polly/include/polly/CodeGen/IslAst.h  |  21 +-
 polly/include/polly/CodePreparation.h |   7 +-
 polly/include/polly/DeLICM.h  |  21 +-
 polly/include/polly/DeadCodeElimination.h |   8 -
 polly/include/polly/DependenceInfo.h  |  26 +-
 polly/include/polly/ForwardOpTree.h   |  25 +-
 polly/include/polly/JSONExporter.h|  17 +-
 polly/include/polly/MaximalStaticExpansion.h  |  20 --
 polly/include/polly/Pass/PhaseManager.h   |   6 +-
 polly/include/polly/PruneUnprofitable.h   |  16 +-
 polly/include/polly/ScheduleOptimizer.h   |  24 +-
 polly/include/polly/ScopGraphPrinter.h|   1 -
 polly/include/polly/ScopInfo.h|   1 -
 polly/include/polly/ScopPass.h| 264 --
 polly/include/polly/Simplify.h|  29 +-
 polly/lib/Analysis/DependenceInfo.cpp |  27 --
 polly/lib/Analysis/PruneUnprofitable.cpp  |  16 --
 polly/lib/Analysis/ScopDetection.cpp  |   1 -
 polly/lib/Analysis/ScopInfo.cpp   |   1 -
 polly/lib/Analysis/ScopPass.cpp   | 134 -
 polly/lib/CMakeLists.txt  |   1 -
 polly/lib/CodeGen/CodeGeneration.cpp  |  13 -
 polly/lib/CodeGen/IslAst.cpp  |  19 --
 polly/lib/Exchange/JSONExporter.cpp   |  27 --
 polly/lib/Pass/PhaseManager.cpp   |   2 +
 polly/lib/Support/PollyPasses.def |  44 ---
 polly/lib/Support/RegisterPasses.cpp  | 133 +
 polly/lib/Transform/CodePreparation.cpp   |  14 -
 polly/lib/Transform/DeLICM.cpp|  43 ---
 polly/lib/Transform/DeadCodeElimination.cpp   |  23 --
 polly/lib/Transform/FlattenSchedule.cpp   |   1 -
 polly/lib/Transform/ForwardOpTree.cpp |  42 ---
 polly/lib/Transform/MatmulOptimizer.cpp   |   1 -
 .../lib/Transform/MaximalStaticExpansion.cpp  |  42 ---
 polly/lib/Transform/ScheduleOptimizer.cpp |  39 +--
 polly/lib/Transform/ScopInliner.cpp   |   1 -
 polly/lib/Transform/Simplify.cpp  |  35 ---
 ...invariant_load_base_pointer_conditional.ll |   2 +-
 polly/unittests/CMakeLists.txt|   1 -
 .../unittests/ScopPassManager/CMakeLists.txt  |   7 -
 .../ScopPassManager/PassManagerTest.cpp   |  66 -
 43 files changed, 42 insertions(+), 1193 deletions(-)
 delete mode 100644 polly/include/polly/ScopPass.h
 delete mode 100644 polly/lib/Analysis/ScopPass.cpp
 delete mode 100644 polly/unittests/ScopPassManager/CMakeLists.txt
 delete mode 100644 polly/unittests/ScopPassManager/PassManagerTest.cpp

diff --git a/polly/docs/ReleaseNotes.rst b/polly/docs/ReleaseNotes.rst
index 215a802843304fb..6461af35e9625d9 100644
--- a/polly/docs/ReleaseNotes.rst
+++ b/polly/docs/ReleaseNotes.rst
@@ -17,3 +17,4 @@ In Polly |version| the following important changes have been 
incorporated.
 
  * Polly's support for the legacy pass manager has been removed.
 
+ * The infrastructure around ScopPasses has been removed.
diff --git a/polly/include/polly/CodeGen/CodeGeneration.h 
b/polly/include/polly/CodeGen/CodeGeneration.h
index 2340fbe016b4937..bf0b8e69f46bb75 100644
--- a/polly/include/polly/CodeGen/CodeGeneration.h
+++ b/polly/include/polly/CodeGen/CodeGeneration.h
@@ -10,12 +10,16 @@
 #define POLLY_CODEGENERATION_H
 
 #include "polly/CodeGen/IRBuilder.h"
-#include "polly/ScopPass.h"
-#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+class RegionInfo;
+}
 
 namespace polly {
 class IslAstInfo;
 
+using llvm::BasicBlock;
+
 enum VectorizerChoice {
   VECTORIZER_NONE,
   VECTORIZER_STRIPMINE,
@@ -28,11 +32,6 @@ extern VectorizerChoice PollyVectorizerChoice;
 /// UnreachableInst.
 void markBlockUnreachable(BasicBlock &Block, PollyIRBuilder &Builder);
 
-struct CodeGenerationPass final : PassInfoMixin {
-  PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
-ScopStandardAnalysisResults &AR, SPMUpdater &U);
-};
-
 extern bool PerfMonitoring;
 
 bool runCodeGeneration(Scop &S, llvm::RegionInfo &RI, IslAstInfo &AI);
diff --git a/polly/include/polly/CodeGen/IslAst.h 
b/polly/include/polly/CodeGen/IslAst.h
index 3e1ff2c8a24da51..243ca46f9ba3215 100644
--- a/polly/include/polly/CodeGen/IslAst.h
+++ b/polly/include/polly/CodeGen/IslAst.h
@@ -22,12 +22,11 @@
 #define POLLY_ISLAST_H
 
 #include "polly/DependenceInfo.h"
-#include "polly/ScopPass.h"
 #include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/IR/PassManager.h"
 #include "isl/ctx.h"
 
 namespace polly {
+using llvm::raw_ostream;
 using llvm::SmallPtrSet;
 
 class Dependences;
@@ -164,24 +163,6 @@ cla

[llvm-branch-commits] undo (PR #126192)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-lto

Author: Vitaly Buka (vitalybuka)


Changes



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


4 Files Affected:

- (modified) llvm/lib/Passes/PassBuilderPipelines.cpp (+4-4) 
- (modified) llvm/test/Other/new-pm-O0-defaults.ll (-2) 
- (modified) llvm/test/Other/new-pm-lto-defaults.ll (-4) 
- (modified) llvm/test/ThinLTO/X86/coro.ll (+3-3) 


``diff
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp 
b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 93a05c0f5a288d4..0794729cd4c2b7f 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1817,10 +1817,10 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel 
Level,
   // in the current module.
   MPM.addPass(CrossDSOCFIPass());
 
-  MPM.addPass(CoroEarlyPass());
+//  MPM.addPass(CoroEarlyPass());
 
   auto Exit = llvm::make_scope_exit([&]() {
-MPM.addPass(CoroCleanupPass());
+//MPM.addPass(CoroCleanupPass());
 
 invokeFullLinkTimeOptimizationLastEPCallbacks(MPM, Level);
 
@@ -1987,8 +1987,8 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel 
Level,
   // transform it to pass arguments by value instead of by reference.
   CGSCCPassManager CGPM;
   CGPM.addPass(ArgumentPromotionPass());
-  CGPM.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
-  CGPM.addPass(CoroAnnotationElidePass());
+//  CGPM.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
+//  CGPM.addPass(CoroAnnotationElidePass());
   MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
 
   FunctionPassManager FPM;
diff --git a/llvm/test/Other/new-pm-O0-defaults.ll 
b/llvm/test/Other/new-pm-O0-defaults.ll
index db450269414e3ef..e8131ac7fab45ac 100644
--- a/llvm/test/Other/new-pm-O0-defaults.ll
+++ b/llvm/test/Other/new-pm-O0-defaults.ll
@@ -47,14 +47,12 @@
 ; CHECK-THINLTO-NEXT: Running pass: EliminateAvailableExternallyPass
 ; CHECK-THINLTO-NEXT: Running pass: GlobalDCEPass
 ; CHECK-LTO: Running pass: CrossDSOCFIPass on [module]
-; CHECK-LTO-NEXT: CoroEarlyPass
 ; CHECK-LTO-NEXT: Running pass: WholeProgramDevirtPass
 ; CHECK-LTO-NEXT: Running analysis: InnerAnalysisManagerProxy
 ; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
 ; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
 ; CHECK-CORO-NEXT: Running pass: AnnotationRemarksPass
 ; CHECK-CORO-NEXT: Running analysis: TargetLibraryAnalysis
-; CHECK-LTO-NEXT: CoroCleanupPass
 ; CHECK-LTO-NEXT: Running pass: AnnotationRemarksPass
 ; CHECK-LTO-NEXT: Running analysis: TargetLibraryAnalysis
 ; CHECK-NEXT: Running pass: PrintModulePass
diff --git a/llvm/test/Other/new-pm-lto-defaults.ll 
b/llvm/test/Other/new-pm-lto-defaults.ll
index d6e88bd7b5c50a5..86480c5115748d5 100644
--- a/llvm/test/Other/new-pm-lto-defaults.ll
+++ b/llvm/test/Other/new-pm-lto-defaults.ll
@@ -35,7 +35,6 @@
 
 ; CHECK-EP: Running pass: NoOpModulePass
 ; CHECK-O: Running pass: CrossDSOCFIPass
-; CHECK-O-NEXT: CoroEarlyPass
 ; CHECK-O-NEXT: Running pass: OpenMPOptPass
 ; CHECK-O-NEXT: Running pass: GlobalDCEPass
 ; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
@@ -87,8 +86,6 @@
 ; CHECK-O23SZ-NEXT: Running pass: OpenMPOptPass
 ; CHECK-O23SZ-NEXT: Running pass: GlobalDCEPass
 ; CHECK-O23SZ-NEXT: Running pass: ArgumentPromotionPass
-; CHECK-O23SZ-NEXT: CoroSplitPass on (foo)
-; CHECK-O23SZ-NEXT: CoroAnnotationElidePass on (foo)
 ; CHECK-O23SZ-NEXT: Running pass: InstCombinePass
 ; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
 ; CHECK-O23SZ-NEXT: Running pass: ConstraintEliminationPass
@@ -159,7 +156,6 @@
 ; CHECK-O23SZ-NEXT: Running pass: GlobalDCEPass
 ; CHECK-O23SZ-NEXT: Running pass: RelLookupTableConverterPass
 ; CHECK-O23SZ-NEXT: Running pass: CGProfilePass
-; CHECK-O-NEXT: CoroCleanupPass
 ; CHECK-EP-NEXT: Running pass: NoOpModulePass
 ; CHECK-O-NEXT: Running pass: AnnotationRemarksPass on foo
 ; CHECK-O-NEXT: Running pass: PrintModulePass
diff --git a/llvm/test/ThinLTO/X86/coro.ll b/llvm/test/ThinLTO/X86/coro.ll
index cde398dd76d85a4..372641c9579b311 100644
--- a/llvm/test/ThinLTO/X86/coro.ll
+++ b/llvm/test/ThinLTO/X86/coro.ll
@@ -1,6 +1,6 @@
-; RUN: llvm-as %s -o %t1.bc
-; RUN: llvm-lto2 run %t1.bc -o %t2.o -r=%t1.bc,test,plx 
-r=%t1.bc,extern_func,plx -save-temps
-; RUN: llvm-dis %t2.o.0.5.precodegen.bc -o - | FileCheck %s 
--implicit-check-not="call void @llvm.coro"
+; RU1N: llvm-as %s -o %t1.bc
+; RU1N: llvm-lto2 run %t1.bc -o %t2.o -r=%t1.bc,test,plx 
-r=%t1.bc,extern_func,plx -save-temps
+; RU1N: llvm-dis %t2.o.0.5.precodegen.bc -o - | FileCheck %s 
--implicit-check-not="call void @llvm.coro"
 
 target datalayout = 
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-fuchsia"

``




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

2025-02-06 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka reopened 
https://github.com/llvm/llvm-project/pull/126192
___
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] undo (PR #126192)

2025-02-06 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka created 
https://github.com/llvm/llvm-project/pull/126192

None


___
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] 04209c2 - Add info about the gdb x packet into the release notes (#125680)

2025-02-06 Thread via llvm-branch-commits

Author: Pavel Labath
Date: 2025-02-06T22:52:23-08:00
New Revision: 04209c2a2b3eddbfcf6a172e521d40c23780ce41

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

LOG: Add info about the gdb x packet into the release notes (#125680)

See also #125653.

Added: 


Modified: 
llvm/docs/ReleaseNotes.md

Removed: 




diff  --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index db9a681ebe2bc57..44a0b17d6a07b97 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -604,6 +604,8 @@ Changes to LLDB
 
 * Incorrect floating-point register DWARF numbers for LoongArch were 
[fixed](https://github.com/llvm/llvm-project/pull/120391).
 
+* Support was added for handling the GDB Remote Protocol `x` packet in the 
format introduced by GDB 16.2. LLDB currently uses a 
diff erent format for `x` and LLDB is now able to handle both formats. At some 
point in the future support for LLDB's format of `x` will be removed.
+
 Changes to BOLT
 -
 



___
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] Add info about the gdb x packet into the release notes (PR #125680)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/125680
___
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] [libcxx] release/20.x: [libc++][TZDB] Fixes %z escaping. (#125399) (PR #125730)

2025-02-06 Thread via llvm-branch-commits

https://github.com/llvmbot updated 
https://github.com/llvm/llvm-project/pull/125730

>From 71ee354bab4ad4e3132d079f11e7b9771012442c Mon Sep 17 00:00:00 2001
From: Mark de Wever 
Date: Tue, 4 Feb 2025 17:36:31 +0100
Subject: [PATCH] [libc++][TZDB] Fixes %z escaping. (#125399)

The previous tested TZDB did not contain %z for the rule letters. The
usage of %z in TZDB 2024b revealed a bug in the implementation. The
patch fixes it and has been locally tested with TZDB 2024b.

Fixes #108957

(cherry picked from commit a27f3b2bb137001735949549354aff89dbf227f4)
---
 libcxx/src/experimental/time_zone.cpp  | 2 +-
 .../time.zone.members/get_info.sys_time.pass.cpp   | 7 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libcxx/src/experimental/time_zone.cpp 
b/libcxx/src/experimental/time_zone.cpp
index f7d82a5d4cfc30c..289164ab1203642 100644
--- a/libcxx/src/experimental/time_zone.cpp
+++ b/libcxx/src/experimental/time_zone.cpp
@@ -668,7 +668,7 @@ __first_rule(seconds __stdoff, const vector<__tz::__rule>& 
__rules) {
__continuation_end,
__continuation.__stdoff + __save,
chrono::duration_cast(__save),
-   __continuation.__format},
+   chrono::__format(__continuation, __continuation.__format, 
__save)},
   true};
 }
 
diff --git 
a/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp
 
b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp
index 7f08c64d5e0e715..afd1273421f3985 100644
--- 
a/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp
+++ 
b/libcxx/test/libcxx/time/time.zone/time.zone.timezone/time.zone.members/get_info.sys_time.pass.cpp
@@ -157,7 +157,6 @@ static void test_abbrev(std::string_view input, 
std::string_view expected) {
   TEST_LIBCPP_REQUIRE(result == expected, TEST_WRITE_CONCATENATED("\nExpected 
", expected, "\nActual ", result, '\n'));
 }
 
-// This format is valid, however is not used in the tzdata.zi.
 static void percentage_z_format() {
   test_abbrev(
   R"(
@@ -188,6 +187,12 @@ Z Format 0:45 F %z)",
 R F 1999 max - Jan 5 0 -1 foo
 Z Format 0:45 F %z)",
   "-0015");
+
+  test_abbrev(
+  R"(
+Z Format -1:2:20 - LMT 1912 Ja 1 1u
+-1 - %z)",
+  "-01");
 }
 
 int main(int, const char**) {

___
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] [libcxx] release/20.x: [libc++][TZDB] Fixes %z escaping. (#125399) (PR #125730)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/125730
___
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] [libcxx] release/20.x: [libc++][TZDB] Fixes %z escaping. (#125399) (PR #125730)

2025-02-06 Thread via llvm-branch-commits

github-actions[bot] wrote:

@mordante (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/125730
___
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] 6fd9dd9 - Revert "[HLSL] Implement HLSL Flat casting (excluding splat cases) (#118842)"

2025-02-06 Thread via llvm-branch-commits

Author: Sarah Spall
Date: 2025-02-06T15:17:49-08:00
New Revision: 6fd9dd96b0cd68d9bb04e791f90ec8ef5211563a

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

LOG: Revert "[HLSL] Implement HLSL Flat casting (excluding splat cases) 
(#118842)"

This reverts commit 01072e546fd6243b889c6cfc109e9ad761e1b17c.

Added: 


Modified: 
clang/include/clang/AST/OperationKinds.def
clang/include/clang/Sema/SemaHLSL.h
clang/lib/AST/Expr.cpp
clang/lib/AST/ExprConstant.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGExprAgg.cpp
clang/lib/CodeGen/CGExprComplex.cpp
clang/lib/CodeGen/CGExprConstant.cpp
clang/lib/CodeGen/CGExprScalar.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/Edit/RewriteObjCFoundationAPI.cpp
clang/lib/Sema/SemaCast.cpp
clang/lib/Sema/SemaHLSL.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
clang/test/SemaHLSL/BuiltIns/vector-constructors-erros.hlsl

Removed: 
clang/test/CodeGenHLSL/BasicFeatures/ArrayElementwiseCast.hlsl
clang/test/CodeGenHLSL/BasicFeatures/StructElementwiseCast.hlsl
clang/test/CodeGenHLSL/BasicFeatures/VectorElementwiseCast.hlsl
clang/test/SemaHLSL/Language/ElementwiseCast-errors.hlsl
clang/test/SemaHLSL/Language/ElementwiseCasts.hlsl



diff  --git a/clang/include/clang/AST/OperationKinds.def 
b/clang/include/clang/AST/OperationKinds.def
index b3dc7c3d8dc77e1..8788b8ff0ef0a45 100644
--- a/clang/include/clang/AST/OperationKinds.def
+++ b/clang/include/clang/AST/OperationKinds.def
@@ -367,9 +367,6 @@ CAST_OPERATION(HLSLVectorTruncation)
 // Non-decaying array RValue cast (HLSL only).
 CAST_OPERATION(HLSLArrayRValue)
 
-// Aggregate by Value cast (HLSL only).
-CAST_OPERATION(HLSLElementwiseCast)
-
 //===- Binary Operations  
-===//
 // Operators listed in order of precedence.
 // Note that additions to this should also update the StmtVisitor class,

diff  --git a/clang/include/clang/Sema/SemaHLSL.h 
b/clang/include/clang/Sema/SemaHLSL.h
index 6e8ca2e4710dec8..20376e980ab351a 100644
--- a/clang/include/clang/Sema/SemaHLSL.h
+++ b/clang/include/clang/Sema/SemaHLSL.h
@@ -141,9 +141,6 @@ class SemaHLSL : public SemaBase {
   // Diagnose whether the input ID is uint/unit2/uint3 type.
   bool diagnoseInputIDType(QualType T, const ParsedAttr &AL);
 
-  bool CanPerformScalarCast(QualType SrcTy, QualType DestTy);
-  bool ContainsBitField(QualType BaseTy);
-  bool CanPerformElementwiseCast(Expr *Src, QualType DestType);
   ExprResult ActOnOutParamExpr(ParmVarDecl *Param, Expr *Arg);
 
   QualType getInoutParameterType(QualType Ty);

diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index c22aa66ba2cfb3d..4fc62919fde94bf 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1956,7 +1956,6 @@ bool CastExpr::CastConsistency() const {
   case CK_FixedPointToBoolean:
   case CK_HLSLArrayRValue:
   case CK_HLSLVectorTruncation:
-  case CK_HLSLElementwiseCast:
   CheckNoBasePath:
 assert(path_empty() && "Cast kind should not have a base path!");
 break;

diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 192b679b4c99596..37019b5235f5610 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -15047,7 +15047,6 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) 
{
   case CK_NoOp:
   case CK_LValueToRValueBitCast:
   case CK_HLSLArrayRValue:
-  case CK_HLSLElementwiseCast:
 return ExprEvaluatorBaseTy::VisitCastExpr(E);
 
   case CK_MemberPointerToBoolean:
@@ -15906,7 +15905,6 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr 
*E) {
   case CK_IntegralToFixedPoint:
   case CK_MatrixCast:
   case CK_HLSLVectorTruncation:
-  case CK_HLSLElementwiseCast:
 llvm_unreachable("invalid cast kind for complex value");
 
   case CK_LValueToRValue:

diff  --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 1e233c42c8782df..bf8df2789f58dba 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -5338,7 +5338,6 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) 
{
   case CK_MatrixCast:
   case CK_HLSLVectorTruncation:
   case CK_HLSLArrayRValue:
-  case CK_HLSLElementwiseCast:
 return EmitUnsupportedLValue(E, "unexpected cast lvalue");
 
   case CK_Dependent:
@@ -6377,75 +6376,3 @@ RValue CodeGenFunction::EmitPseudoObjectRValue(const 
PseudoObjectExpr *E,
 LValue CodeGenFunction::EmitPseudoObjectLValue(const PseudoObjectExpr *E) {
   return emitPseudoObjectExpr(*this, E, true, AggValueSlot::ignored()).LV;
 }
-
-void CodeGenFunction::FlattenAccessAndType(
-Address Addr, QualType AddrType,
-SmallVectorImpl> &AccessList,
-SmallVectorImpl &FlatTypes) {
-  // WorkList is list of type

[llvm-branch-commits] [lldb] 4d16551 - [lldb] Add support for gdb-style 'x' packet (#124733)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

Author: Pavel Labath
Date: 2025-02-06T17:11:02-08:00
New Revision: 4d16551293fe4a0bf56cebd3f52d2a6e36f166a8

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

LOG: [lldb] Add support for gdb-style 'x' packet (#124733)

See also
https://discourse.llvm.org/t/rfc-fixing-incompatibilties-of-the-x-packet-w-r-t-gdb/84288
and https://sourceware.org/pipermail/gdb/2025-January/051705.html

(cherry picked from commit 13d0318a9848ec322ceea4f37fb6b421d70407b0)

Added: 
lldb/test/API/functionalities/gdb_remote_client/TestReadMemory.py

Modified: 
lldb/packages/Python/lldbsuite/test/gdbclientutils.py
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py 
b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
index 1784487323ad6be..4b782b3b470fe22 100644
--- a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
+++ b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
@@ -126,6 +126,9 @@ def respond(self, packet):
 if packet[0] == "m":
 addr, length = [int(x, 16) for x in packet[1:].split(",")]
 return self.readMemory(addr, length)
+if packet[0] == "x":
+addr, length = [int(x, 16) for x in packet[1:].split(",")]
+return self.x(addr, length)
 if packet[0] == "M":
 location, encoded_data = packet[1:].split(":")
 addr, length = [int(x, 16) for x in location.split(",")]
@@ -267,6 +270,9 @@ def writeRegister(self, register, value_hex):
 def readMemory(self, addr, length):
 return "00" * length
 
+def x(self, addr, length):
+return ""
+
 def writeMemory(self, addr, data_hex):
 return "OK"
 

diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index b3f1c6f052955b0..581dd8f8e0b6b64 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -275,7 +275,6 @@ void 
GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) {
 m_supports_vCont_s = eLazyBoolCalculate;
 m_supports_vCont_S = eLazyBoolCalculate;
 m_supports_p = eLazyBoolCalculate;
-m_supports_x = eLazyBoolCalculate;
 m_supports_QSaveRegisterState = eLazyBoolCalculate;
 m_qHostInfo_is_valid = eLazyBoolCalculate;
 m_curr_pid_is_valid = eLazyBoolCalculate;
@@ -295,6 +294,7 @@ void 
GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) {
 m_supports_qXfer_siginfo_read = eLazyBoolCalculate;
 m_supports_augmented_libraries_svr4_read = eLazyBoolCalculate;
 m_uses_native_signals = eLazyBoolCalculate;
+m_x_packet_state.reset();
 m_supports_qProcessInfoPID = true;
 m_supports_qfProcessInfo = true;
 m_supports_qUserName = true;
@@ -348,6 +348,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
   m_supports_memory_tagging = eLazyBoolNo;
   m_supports_qSaveCore = eLazyBoolNo;
   m_uses_native_signals = eLazyBoolNo;
+  m_x_packet_state.reset();
 
   m_max_packet_size = UINT64_MAX; // It's supposed to always be there, but if
   // not, we assume no limit
@@ -401,6 +402,8 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
 m_supports_qSaveCore = eLazyBoolYes;
   else if (x == "native-signals+")
 m_uses_native_signals = eLazyBoolYes;
+  else if (x == "binary-upload+")
+m_x_packet_state = xPacketState::Prefixed;
   // Look for a list of compressions in the features list e.g.
   // 
qXfer:features:read+;PacketSize=2;qEcho+;SupportedCompressions=zlib-
   // deflate,lzma
@@ -715,19 +718,20 @@ Status GDBRemoteCommunicationClient::WriteMemoryTags(
   return status;
 }
 
-bool GDBRemoteCommunicationClient::GetxPacketSupported() {
-  if (m_supports_x == eLazyBoolCalculate) {
+GDBRemoteCommunicationClient::xPacketState
+GDBRemoteCommunicationClient::GetxPacketState() {
+  if (!m_x_packet_state)
+GetRemoteQSupported();
+  if (!m_x_packet_state) {
 StringExtractorGDBRemote response;
-m_supports_x = eLazyBoolNo;
-char packet[256];
-snprintf(packet, sizeof(packet), "x0,0");
-if (SendPacketAndWaitForResponse(packet, response) ==
+m_x_packet_state = xPacketState::Unimplemented;
+if (SendPacketAndWaitForResponse("x0,0", response) ==
 PacketResult::Success) {
   if (response.IsOKResponse())
-m_supports_x = eLazyBoolYes;
+m_x_packet_state = xPack

[llvm-branch-commits] [lldb] release/20.x: [lldb] Add support for gdb-style 'x' packet (#124733) (PR #125653)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/125653
___
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] [lldb] release/20.x: [lldb] Add support for gdb-style 'x' packet (#124733) (PR #125653)

2025-02-06 Thread Jonas Devlieghere via llvm-branch-commits

https://github.com/JDevlieghere edited 
https://github.com/llvm/llvm-project/pull/125653
___
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] [clang] Implement instantiation context note for checking template parameters (PR #126088)

2025-02-06 Thread Vlad Serebrennikov via llvm-branch-commits


@@ -637,6 +641,8 @@ namespace cwg431 { // cwg431: 2.8
 
 namespace cwg432 { // cwg432: 3.0
   template struct A {};
+  // expected-note@-1{{template parameter is declared here}}
+  // since-cxx11-note@-2 {{template parameter is declared here}}

Endilll wrote:

Oh, put them closer to their respective errors then.

https://github.com/llvm/llvm-project/pull/126088
___
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/20.x: [llvm] Add CMake flag to compile out the telemetry framework (#124850) (PR #125555)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/12
___
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] [lldb] release/20.x: [lldb] Add support for gdb-style 'x' packet (#124733) (PR #125653)

2025-02-06 Thread via llvm-branch-commits

github-actions[bot] wrote:

@labath (or anyone else). If you would like to add a note about this fix in the 
release notes (completely optional). Please reply to this comment with a one or 
two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/125653
___
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] [lldb] release/20.x: [lldb] Add support for gdb-style 'x' packet (#124733) (PR #125653)

2025-02-06 Thread via llvm-branch-commits

https://github.com/llvmbot updated 
https://github.com/llvm/llvm-project/pull/125653

>From 4d16551293fe4a0bf56cebd3f52d2a6e36f166a8 Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Fri, 31 Jan 2025 09:07:11 +0100
Subject: [PATCH] [lldb] Add support for gdb-style 'x' packet (#124733)

See also
https://discourse.llvm.org/t/rfc-fixing-incompatibilties-of-the-x-packet-w-r-t-gdb/84288
and https://sourceware.org/pipermail/gdb/2025-January/051705.html

(cherry picked from commit 13d0318a9848ec322ceea4f37fb6b421d70407b0)
---
 .../Python/lldbsuite/test/gdbclientutils.py   |  6 ++
 .../GDBRemoteCommunicationClient.cpp  | 22 +---
 .../gdb-remote/GDBRemoteCommunicationClient.h | 11 +++-
 .../Process/gdb-remote/ProcessGDBRemote.cpp   | 36 +++-
 .../gdb_remote_client/TestReadMemory.py   | 55 +++
 5 files changed, 106 insertions(+), 24 deletions(-)
 create mode 100644 
lldb/test/API/functionalities/gdb_remote_client/TestReadMemory.py

diff --git a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py 
b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
index 1784487323ad6be..4b782b3b470fe22 100644
--- a/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
+++ b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
@@ -126,6 +126,9 @@ def respond(self, packet):
 if packet[0] == "m":
 addr, length = [int(x, 16) for x in packet[1:].split(",")]
 return self.readMemory(addr, length)
+if packet[0] == "x":
+addr, length = [int(x, 16) for x in packet[1:].split(",")]
+return self.x(addr, length)
 if packet[0] == "M":
 location, encoded_data = packet[1:].split(":")
 addr, length = [int(x, 16) for x in location.split(",")]
@@ -267,6 +270,9 @@ def writeRegister(self, register, value_hex):
 def readMemory(self, addr, length):
 return "00" * length
 
+def x(self, addr, length):
+return ""
+
 def writeMemory(self, addr, data_hex):
 return "OK"
 
diff --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index b3f1c6f052955b0..581dd8f8e0b6b64 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -275,7 +275,6 @@ void 
GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) {
 m_supports_vCont_s = eLazyBoolCalculate;
 m_supports_vCont_S = eLazyBoolCalculate;
 m_supports_p = eLazyBoolCalculate;
-m_supports_x = eLazyBoolCalculate;
 m_supports_QSaveRegisterState = eLazyBoolCalculate;
 m_qHostInfo_is_valid = eLazyBoolCalculate;
 m_curr_pid_is_valid = eLazyBoolCalculate;
@@ -295,6 +294,7 @@ void 
GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) {
 m_supports_qXfer_siginfo_read = eLazyBoolCalculate;
 m_supports_augmented_libraries_svr4_read = eLazyBoolCalculate;
 m_uses_native_signals = eLazyBoolCalculate;
+m_x_packet_state.reset();
 m_supports_qProcessInfoPID = true;
 m_supports_qfProcessInfo = true;
 m_supports_qUserName = true;
@@ -348,6 +348,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
   m_supports_memory_tagging = eLazyBoolNo;
   m_supports_qSaveCore = eLazyBoolNo;
   m_uses_native_signals = eLazyBoolNo;
+  m_x_packet_state.reset();
 
   m_max_packet_size = UINT64_MAX; // It's supposed to always be there, but if
   // not, we assume no limit
@@ -401,6 +402,8 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
 m_supports_qSaveCore = eLazyBoolYes;
   else if (x == "native-signals+")
 m_uses_native_signals = eLazyBoolYes;
+  else if (x == "binary-upload+")
+m_x_packet_state = xPacketState::Prefixed;
   // Look for a list of compressions in the features list e.g.
   // 
qXfer:features:read+;PacketSize=2;qEcho+;SupportedCompressions=zlib-
   // deflate,lzma
@@ -715,19 +718,20 @@ Status GDBRemoteCommunicationClient::WriteMemoryTags(
   return status;
 }
 
-bool GDBRemoteCommunicationClient::GetxPacketSupported() {
-  if (m_supports_x == eLazyBoolCalculate) {
+GDBRemoteCommunicationClient::xPacketState
+GDBRemoteCommunicationClient::GetxPacketState() {
+  if (!m_x_packet_state)
+GetRemoteQSupported();
+  if (!m_x_packet_state) {
 StringExtractorGDBRemote response;
-m_supports_x = eLazyBoolNo;
-char packet[256];
-snprintf(packet, sizeof(packet), "x0,0");
-if (SendPacketAndWaitForResponse(packet, response) ==
+m_x_packet_state = xPacketState::Unimplemented;
+if (SendPacketAndWaitForResponse("x0,0", response) ==
 PacketResult::Success) {
   if (response.IsOKResponse())
-m_supports_x = eLazyBoolYes;
+m_x_packet_state = xPacketState::Bare;
 }
   }
-  return m_supports_x;
+  return *m_x_packet_state;

[llvm-branch-commits] [llvm] [DXIL] Add support for root signature flag element in DXContainer (PR #123147)

2025-02-06 Thread via llvm-branch-commits

https://github.com/joaosaffran updated 
https://github.com/llvm/llvm-project/pull/123147

>From aabdfe7d6c6b6e27e9c2150c10199baa6638b6df Mon Sep 17 00:00:00 2001
From: joaosaffran 
Date: Wed, 15 Jan 2025 17:30:00 +
Subject: [PATCH 01/21] adding metadata extraction

---
 .../llvm/Analysis/DXILMetadataAnalysis.h  |  3 +
 llvm/lib/Analysis/DXILMetadataAnalysis.cpp| 89 +++
 .../lib/Target/DirectX/DXContainerGlobals.cpp | 24 +
 3 files changed, 116 insertions(+)

diff --git a/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h 
b/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h
index cb535ac14f1c613..f420244ba111a45 100644
--- a/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h
+++ b/llvm/include/llvm/Analysis/DXILMetadataAnalysis.h
@@ -11,9 +11,11 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/MC/DXContainerRootSignature.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/VersionTuple.h"
 #include "llvm/TargetParser/Triple.h"
+#include 
 
 namespace llvm {
 
@@ -37,6 +39,7 @@ struct ModuleMetadataInfo {
   Triple::EnvironmentType ShaderProfile{Triple::UnknownEnvironment};
   VersionTuple ValidatorVersion{};
   SmallVector EntryPropertyVec{};
+  std::optional RootSignatureDesc;
   void print(raw_ostream &OS) const;
 };
 
diff --git a/llvm/lib/Analysis/DXILMetadataAnalysis.cpp 
b/llvm/lib/Analysis/DXILMetadataAnalysis.cpp
index a7f666a3f8b48f2..388e3853008eaec 100644
--- a/llvm/lib/Analysis/DXILMetadataAnalysis.cpp
+++ b/llvm/lib/Analysis/DXILMetadataAnalysis.cpp
@@ -15,12 +15,91 @@
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/Module.h"
 #include "llvm/InitializePasses.h"
+#include "llvm/MC/DXContainerRootSignature.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/ErrorHandling.h"
+#include 
 
 #define DEBUG_TYPE "dxil-metadata-analysis"
 
 using namespace llvm;
 using namespace dxil;
+using namespace llvm::mcdxbc;
+
+static bool parseRootFlags(MDNode *RootFlagNode, RootSignatureDesc *Desc) {
+
+  assert(RootFlagNode->getNumOperands() == 2 &&
+ "Invalid format for RootFlag Element");
+  auto *Flag = mdconst::extract(RootFlagNode->getOperand(1));
+  auto Value = (RootSignatureFlags)Flag->getZExtValue();
+
+  if ((Value & ~RootSignatureFlags::ValidFlags) != RootSignatureFlags::None)
+return true;
+
+  Desc->Flags = Value;
+  return false;
+}
+
+static bool parseRootSignatureElement(MDNode *Element,
+  RootSignatureDesc *Desc) {
+  MDString *ElementText = cast(Element->getOperand(0));
+
+  assert(ElementText != nullptr && "First preoperty of element is not ");
+
+  RootSignatureElementKind ElementKind =
+  StringSwitch(ElementText->getString())
+  .Case("RootFlags", RootSignatureElementKind::RootFlags)
+  .Case("RootConstants", RootSignatureElementKind::RootConstants)
+  .Case("RootCBV", RootSignatureElementKind::RootDescriptor)
+  .Case("RootSRV", RootSignatureElementKind::RootDescriptor)
+  .Case("RootUAV", RootSignatureElementKind::RootDescriptor)
+  .Case("Sampler", RootSignatureElementKind::RootDescriptor)
+  .Case("DescriptorTable", RootSignatureElementKind::DescriptorTable)
+  .Case("StaticSampler", RootSignatureElementKind::StaticSampler)
+  .Default(RootSignatureElementKind::None);
+
+  switch (ElementKind) {
+
+  case RootSignatureElementKind::RootFlags: {
+return parseRootFlags(Element, Desc);
+break;
+  }
+
+  case RootSignatureElementKind::RootConstants:
+  case RootSignatureElementKind::RootDescriptor:
+  case RootSignatureElementKind::DescriptorTable:
+  case RootSignatureElementKind::StaticSampler:
+  case RootSignatureElementKind::None:
+llvm_unreachable("Not Implemented yet");
+break;
+  }
+
+  return true;
+}
+
+bool parseRootSignature(RootSignatureDesc *Desc, int32_t Version,
+NamedMDNode *Root) {
+  Desc->Version = Version;
+  bool HasError = false;
+
+  for (unsigned int Sid = 0; Sid < Root->getNumOperands(); Sid++) {
+// This should be an if, for error handling
+MDNode *Node = cast(Root->getOperand(Sid));
+
+// Not sure what use this for...
+Metadata *Func = Node->getOperand(0).get();
+
+// This should be an if, for error handling
+MDNode *Elements = cast(Node->getOperand(1).get());
+
+for (unsigned int Eid = 0; Eid < Elements->getNumOperands(); Eid++) {
+  MDNode *Element = cast(Elements->getOperand(Eid));
+
+  HasError = HasError || parseRootSignatureElement(Element, Desc);
+}
+  }
+  return HasError;
+}
 
 static ModuleMetadataInfo collectMetadataInfo(Module &M) {
   ModuleMetadataInfo MMDAI;
@@ -28,6 +107,7 @@ static ModuleMetadataInfo collectMetadataInfo(Module &M) {
   MMDAI.DXILVersion = TT.getDXILVersion();
   MMDAI.ShaderModelVersion = TT.getOSVersion();
   MMDAI.ShaderProfile = TT.getEnvironment();
+
   NamedMDNode *ValidatorVerNode = M.getNamedMetadata("dx.valver");
   if (ValidatorVerNode) {

[llvm-branch-commits] [llvm] [AMDGPU] Push amdgpu-preload-kern-arg-prolog after livedebugvalues (PR #126148)

2025-02-06 Thread Scott Linder via llvm-branch-commits

https://github.com/slinder1 ready_for_review 
https://github.com/llvm/llvm-project/pull/126148
___
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] [AMDGPU] Remove dead function metadata after amdgpu-lower-kernel-arguments (PR #126147)

2025-02-06 Thread Scott Linder via llvm-branch-commits

https://github.com/slinder1 ready_for_review 
https://github.com/llvm/llvm-project/pull/126147
___
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] [AMDGPU] Remove dead function metadata after amdgpu-lower-kernel-arguments (PR #126147)

2025-02-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-backend-amdgpu

Author: Scott Linder (slinder1)


Changes

The verifier ensures function !dbg metadata is unique across the module,
so ensure the old nameless function we leave behind doesn't violate
this invariant.

Removing the function via e.g. eraseFromParent seems like a better
option, but doesn't seem to be legal from a FunctionPass.

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


2 Files Affected:

- (modified) llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (+1) 
- (modified) llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll 
(+3-3) 


``diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp 
b/llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
index e9d009baa20af2..09412d1b0f1cc9 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
@@ -132,6 +132,7 @@ class PreloadKernelArgInfo {
 NF->setAttributes(AL);
 F.replaceAllUsesWith(NF);
 F.setCallingConv(CallingConv::C);
+F.clearMetadata();
 
 return NF;
   }
diff --git a/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll 
b/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll
index fe110cbcafc465..4b47a218f1be45 100644
--- a/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll
+++ b/llvm/test/CodeGen/AMDGPU/preload-implicit-kernargs-debug-info.ll
@@ -1,7 +1,7 @@
-; RUN: not --crash opt -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 
-passes='amdgpu-attributor,function(amdgpu-lower-kernel-arguments)' 
-amdgpu-kernarg-preload-count=16 -S < %s 2>&1 | FileCheck %s
+; RUN: opt -mtriple=amdgcn-amd-amdhsa -mcpu=gfx940 
-passes='amdgpu-attributor,function(amdgpu-lower-kernel-arguments)' 
-amdgpu-kernarg-preload-count=16 -S < %s 2>&1 | FileCheck %s
 
-; CHECK: function declaration may only have a unique !dbg attachment
-; CHECK-NEXT: ptr @0
+; CHECK: define amdgpu_kernel void @preload_block_count_x{{.*}} !dbg ![[#]]
+; CHECK-NOT: declare void @0{{.*}} !dbg ![[#]]
 
 define amdgpu_kernel void @preload_block_count_x(ptr addrspace(1) %out) !dbg 
!4 {
   %imp_arg_ptr = call ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr()

``




https://github.com/llvm/llvm-project/pull/126147
___
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] 99f3ed7 - [X86][AVX10] Disable m[no-]avx10.1 and switch m[no-]avx10.2 to alias of 512 bit options (#124511) (#125057)

2025-02-06 Thread via llvm-branch-commits

Author: Phoebe Wang
Date: 2025-02-06T16:56:13-08:00
New Revision: 99f3ed737567acfccd9ec196aaf8595447ac1d32

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

LOG: [X86][AVX10] Disable m[no-]avx10.1 and switch m[no-]avx10.2 to alias of 
512 bit options (#124511) (#125057)

Per the feedback we got, we’d like to switch m[no-]avx10.2 to alias of
512 bit options and disable m[no-]avx10.1 due to they were alias of 256
bit options.

We also change -mno-avx10.[1,2]-512 to alias of 256 bit options to
disable both 256 and 512 instructions.

Cherry-pick from
https://github.com/llvm/llvm-project/commit/9ebfee9d686b41f789b47a6acc7dcdba808fb3f9

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Arch/X86.cpp
clang/test/Driver/x86-target-features.c
clang/test/Preprocessor/x86_target_features.c

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index b23963c8e611a1a..3281ac0c4dbe28c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1165,6 +1165,10 @@ X86 Support
 - Support ISA of ``MOVRS``.
 
 - Supported ``-march/tune=diamondrapids``
+- Disable ``-m[no-]avx10.1`` and switch ``-m[no-]avx10.2`` to alias of 512 bit
+  options.
+- Change ``-mno-avx10.1-512`` to alias of ``-mno-avx10.1-256`` to disable both
+  256 and 512 bit instructions.
 
 Arm and AArch64 Support
 ^^^

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 1af633e59d0bbae..a2b47b943ef90dd 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -6441,15 +6441,13 @@ def mno_avx : Flag<["-"], "mno-avx">, 
Group;
 def mavx10_1_256 : Flag<["-"], "mavx10.1-256">, 
Group;
 def mno_avx10_1_256 : Flag<["-"], "mno-avx10.1-256">, 
Group;
 def mavx10_1_512 : Flag<["-"], "mavx10.1-512">, 
Group;
-def mno_avx10_1_512 : Flag<["-"], "mno-avx10.1-512">, 
Group;
-def mavx10_1 : Flag<["-"], "mavx10.1">, Alias;
-def mno_avx10_1 : Flag<["-"], "mno-avx10.1">, Alias;
+def mno_avx10_1_512 : Flag<["-"], "mno-avx10.1-512">, Alias;
+def mavx10_1 : Flag<["-"], "mavx10.1">, Flags<[Unsupported]>;
+def mno_avx10_1 : Flag<["-"], "mno-avx10.1">, Flags<[Unsupported]>;
 def mavx10_2_256 : Flag<["-"], "mavx10.2-256">, 
Group;
-def mno_avx10_2_256 : Flag<["-"], "mno-avx10.2-256">, 
Group;
 def mavx10_2_512 : Flag<["-"], "mavx10.2-512">, 
Group;
-def mno_avx10_2_512 : Flag<["-"], "mno-avx10.2-512">, 
Group;
-def mavx10_2 : Flag<["-"], "mavx10.2">, Alias;
-def mno_avx10_2 : Flag<["-"], "mno-avx10.2">, Alias;
+def mavx10_2 : Flag<["-"], "mavx10.2">, Alias;
+def mno_avx10_2 : Flag<["-"], "mno-avx10.2">, 
Group;
 def mavx2 : Flag<["-"], "mavx2">, Group;
 def mno_avx2 : Flag<["-"], "mno-avx2">, Group;
 def mavx512f : Flag<["-"], "mavx512f">, Group;

diff  --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp 
b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index b2109e11038fe80..47c2c3e23f9fd95 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -237,15 +237,18 @@ void x86::getX86TargetFeatures(const Driver &D, const 
llvm::Triple &Triple,
 
 bool IsNegative = Name.consume_front("no-");
 
-#ifndef NDEBUG
-assert(Name.starts_with("avx10.") && "Invalid AVX10 feature name.");
 StringRef Version, Width;
 std::tie(Version, Width) = Name.substr(6).split('-');
+assert(Name.starts_with("avx10.") && "Invalid AVX10 feature name.");
 assert((Version == "1" || Version == "2") && "Invalid AVX10 feature 
name.");
-assert((Width == "256" || Width == "512") && "Invalid AVX10 feature 
name.");
-#endif
 
-Features.push_back(Args.MakeArgString((IsNegative ? "-" : "+") + Name));
+if (Width == "") {
+  assert(IsNegative && "Only negative options can omit width.");
+  Features.push_back(Args.MakeArgString("-" + Name + "-256"));
+} else {
+  assert((Width == "256" || Width == "512") && "Invalid vector length.");
+  Features.push_back(Args.MakeArgString((IsNegative ? "-" : "+") + Name));
+}
   }
 
   // Now add any that the user explicitly requested on the command line,

diff  --git a/clang/test/Driver/x86-target-features.c 
b/clang/test/Driver/x86-target-features.c
index 339f593dc760a82..18361251dcebc56 100644
--- a/clang/test/Driver/x86-target-features.c
+++ b/clang/test/Driver/x86-target-features.c
@@ -395,7 +395,8 @@
 // EVEX512: "-target-feature" "+evex512"
 // NO-EVEX512: "-target-feature" "-evex512"
 
-// RUN: %clang --target=i386 -mavx10.1 %s -### -o %t.o 2>&1 | FileCheck 
-check-prefix=AVX10_1_256 %s
+// RUN: not %clang --target=i386 -march=i386 -mavx10.1 %s -### -o %t.o 2>&1 | 
FileCheck -check-prefix=UNSUPPORT-AVX10 %s
+// RUN: not %clan

[llvm-branch-commits] [clang] [X86][AVX10] Disable m[no-]avx10.1 and switch m[no-]avx10.2 to alias of 512 bit options (#124511) (PR #125057)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

https://github.com/tstellar closed 
https://github.com/llvm/llvm-project/pull/125057
___
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] 0892ddd - [llvm] Add CMake flag to compile out the telemetry framework (#124850)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2025-02-06T17:05:33-08:00
New Revision: 0892dddc23c64bf2aab2c5ee1fc9f4dcd68771e0

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

LOG: [llvm] Add CMake flag to compile out the telemetry framework (#124850)

Add a CMake flag (LLVM_BUILD_TELEMETRY) to disable building the
telemetry framework. The flag being enabled does *not* mean that
telemetry is being collected, it merely means we're building the generic
telemetry framework. Hence the flag is enabled by default.

Motivated by this Discourse thread:
https://discourse.llvm.org/t/how-to-disable-building-llvm-clang-telemetry/84305

(cherry picked from commit bac62ee5b473e70981a6bd9759ec316315fca07d)

Added: 


Modified: 
llvm/CMakeLists.txt
llvm/lib/CMakeLists.txt
llvm/unittests/CMakeLists.txt

Removed: 




diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index c9ff3696e22d698..d1b4c2700ce8ef7 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -829,6 +829,7 @@ option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm 
API documentation." OF
 option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
 option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
 option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
+option (LLVM_BUILD_TELEMETRY "Build the telemtry library. This does not enable 
telemetry." ON)
 
 set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/doxygen-html"
 CACHE STRING "Doxygen-generated HTML documentation install directory")

diff  --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt
index f6465612d30c0b4..d0a2bc929438179 100644
--- a/llvm/lib/CMakeLists.txt
+++ b/llvm/lib/CMakeLists.txt
@@ -41,7 +41,9 @@ add_subdirectory(ProfileData)
 add_subdirectory(Passes)
 add_subdirectory(TargetParser)
 add_subdirectory(TextAPI)
-add_subdirectory(Telemetry)
+if (LLVM_BUILD_TELEMETRY)
+  add_subdirectory(Telemetry)
+endif()
 add_subdirectory(ToolDrivers)
 add_subdirectory(XRay)
 if (LLVM_INCLUDE_TESTS)

diff  --git a/llvm/unittests/CMakeLists.txt b/llvm/unittests/CMakeLists.txt
index 81abce51b8939f0..12e229b1c349840 100644
--- a/llvm/unittests/CMakeLists.txt
+++ b/llvm/unittests/CMakeLists.txt
@@ -63,7 +63,9 @@ add_subdirectory(Support)
 add_subdirectory(TableGen)
 add_subdirectory(Target)
 add_subdirectory(TargetParser)
-add_subdirectory(Telemetry)
+if (LLVM_BUILD_TELEMETRY)
+  add_subdirectory(Telemetry)
+endif()
 add_subdirectory(Testing)
 add_subdirectory(TextAPI)
 add_subdirectory(Transforms)



___
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] 7fa1a3a - [CMake] Fix typo in docstring: telemtry -> telemetry (NFC)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2025-02-06T17:05:33-08:00
New Revision: 7fa1a3a398d510f0876af8908f213dd90bd9a07d

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

LOG: [CMake] Fix typo in docstring: telemtry -> telemetry (NFC)

Thanks Nikita for spotting it.

(cherry picked from commit 13ded6829bf7ca793795c50d47dd2b95482e5cfa)

Added: 


Modified: 
llvm/CMakeLists.txt

Removed: 




diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index d1b4c2700ce8ef..f5293e8663243b 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -829,7 +829,7 @@ option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm 
API documentation." OF
 option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
 option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
 option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
-option (LLVM_BUILD_TELEMETRY "Build the telemtry library. This does not enable 
telemetry." ON)
+option (LLVM_BUILD_TELEMETRY "Build the telemetry library. This does not 
enable telemetry." ON)
 
 set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/doxygen-html"
 CACHE STRING "Doxygen-generated HTML documentation install directory")



___
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/20.x: [llvm] Add CMake flag to compile out the telemetry framework (#124850) (PR #125555)

2025-02-06 Thread via llvm-branch-commits

https://github.com/llvmbot updated 
https://github.com/llvm/llvm-project/pull/12

>From 0892dddc23c64bf2aab2c5ee1fc9f4dcd68771e0 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Mon, 3 Feb 2025 10:35:14 -0800
Subject: [PATCH 1/2] [llvm] Add CMake flag to compile out the telemetry
 framework (#124850)

Add a CMake flag (LLVM_BUILD_TELEMETRY) to disable building the
telemetry framework. The flag being enabled does *not* mean that
telemetry is being collected, it merely means we're building the generic
telemetry framework. Hence the flag is enabled by default.

Motivated by this Discourse thread:
https://discourse.llvm.org/t/how-to-disable-building-llvm-clang-telemetry/84305

(cherry picked from commit bac62ee5b473e70981a6bd9759ec316315fca07d)
---
 llvm/CMakeLists.txt   | 1 +
 llvm/lib/CMakeLists.txt   | 4 +++-
 llvm/unittests/CMakeLists.txt | 4 +++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index c9ff3696e22d698..d1b4c2700ce8ef7 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -829,6 +829,7 @@ option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm 
API documentation." OF
 option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
 option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
 option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
+option (LLVM_BUILD_TELEMETRY "Build the telemtry library. This does not enable 
telemetry." ON)
 
 set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/doxygen-html"
 CACHE STRING "Doxygen-generated HTML documentation install directory")
diff --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt
index f6465612d30c0b4..d0a2bc929438179 100644
--- a/llvm/lib/CMakeLists.txt
+++ b/llvm/lib/CMakeLists.txt
@@ -41,7 +41,9 @@ add_subdirectory(ProfileData)
 add_subdirectory(Passes)
 add_subdirectory(TargetParser)
 add_subdirectory(TextAPI)
-add_subdirectory(Telemetry)
+if (LLVM_BUILD_TELEMETRY)
+  add_subdirectory(Telemetry)
+endif()
 add_subdirectory(ToolDrivers)
 add_subdirectory(XRay)
 if (LLVM_INCLUDE_TESTS)
diff --git a/llvm/unittests/CMakeLists.txt b/llvm/unittests/CMakeLists.txt
index 81abce51b8939f0..12e229b1c349840 100644
--- a/llvm/unittests/CMakeLists.txt
+++ b/llvm/unittests/CMakeLists.txt
@@ -63,7 +63,9 @@ add_subdirectory(Support)
 add_subdirectory(TableGen)
 add_subdirectory(Target)
 add_subdirectory(TargetParser)
-add_subdirectory(Telemetry)
+if (LLVM_BUILD_TELEMETRY)
+  add_subdirectory(Telemetry)
+endif()
 add_subdirectory(Testing)
 add_subdirectory(TextAPI)
 add_subdirectory(Transforms)

>From 7fa1a3a398d510f0876af8908f213dd90bd9a07d Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Mon, 3 Feb 2025 15:05:19 -0800
Subject: [PATCH 2/2] [CMake] Fix typo in docstring: telemtry -> telemetry
 (NFC)

Thanks Nikita for spotting it.

(cherry picked from commit 13ded6829bf7ca793795c50d47dd2b95482e5cfa)
---
 llvm/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index d1b4c2700ce8ef7..f5293e8663243bc 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -829,7 +829,7 @@ option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm 
API documentation." OF
 option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
 option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
 option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
-option (LLVM_BUILD_TELEMETRY "Build the telemtry library. This does not enable 
telemetry." ON)
+option (LLVM_BUILD_TELEMETRY "Build the telemetry library. This does not 
enable telemetry." ON)
 
 set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/doxygen-html"
 CACHE STRING "Doxygen-generated HTML documentation install directory")

___
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] [X86][AVX10] Disable m[no-]avx10.1 and switch m[no-]avx10.2 to alias of 512 bit options (#124511) (PR #125057)

2025-02-06 Thread via llvm-branch-commits

github-actions[bot] wrote:

@phoebewang (or anyone else). If you would like to add a note about this fix in 
the release notes (completely optional). Please reply to this comment with a 
one or two sentence description of the fix.  When you are done, please add the 
release:note label to this PR. 

https://github.com/llvm/llvm-project/pull/125057
___
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] 857d8d7 - [InstCombine] Fix FMF propagation in `foldSelectWithFCmpToFabs` (#121580)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

Author: Yingwei Zheng
Date: 2025-02-06T16:59:38-08:00
New Revision: 857d8d767ab2f3c5f08f9710e98aa5fd1b1dff66

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

LOG: [InstCombine] Fix FMF propagation in `foldSelectWithFCmpToFabs` (#121580)

Consider the following pattern:
```
%cmp = fcmp  double %x, 0.00e+00
%negX = fneg  double %x
%sel = select i1 %cmp, double %x, double %negX
```
We cannot propagate ninf from fneg to select since `%negX` may not be
chosen. Similarly, we cannot propagate nnan unless `%negX` is guaranteed
to be selected when `%x` is NaN.
This patch also propagates nnan/ninf from fcmp to avoid regression in
`PhaseOrdering/generate-fabs.ll`.

Alive2: https://alive2.llvm.org/ce/z/t6U-tA
Closes https://github.com/llvm/llvm-project/issues/121430 and
https://github.com/llvm/llvm-project/issues/113989.

(cherry picked from commit 3ec6a6b85aed838b7d56bd6843cad52e822b9111)

Added: 


Modified: 
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/fabs.ll
llvm/test/Transforms/InstCombine/fneg-fabs.ll

Removed: 




diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index e2af4d4c5636488..29c5cef84ccdb72 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -2852,10 +2852,10 @@ static Instruction *foldSelectWithFCmpToFabs(SelectInst 
&SI,
 if (!match(TrueVal, m_FNeg(m_Specific(X
   return nullptr;
 
-// Forward-propagate nnan and ninf from the fneg to the select.
+// Forward-propagate nnan and ninf from the fcmp to the select.
 // If all inputs are not those values, then the select is not either.
 // Note: nsz is defined 
diff erently, so it may not be correct to propagate.
-FastMathFlags FMF = cast(TrueVal)->getFastMathFlags();
+FastMathFlags FMF = cast(CondVal)->getFastMathFlags();
 if (FMF.noNaNs() && !SI.hasNoNaNs()) {
   SI.setHasNoNaNs(true);
   ChangedFMF = true;
@@ -2864,6 +2864,13 @@ static Instruction *foldSelectWithFCmpToFabs(SelectInst 
&SI,
   SI.setHasNoInfs(true);
   ChangedFMF = true;
 }
+// Forward-propagate nnan from the fneg to the select.
+// The nnan flag can be propagated iff fneg is selected when X is NaN.
+if (!SI.hasNoNaNs() && cast(TrueVal)->hasNoNaNs() &&
+(Swap ? FCmpInst::isOrdered(Pred) : FCmpInst::isUnordered(Pred))) {
+  SI.setHasNoNaNs(true);
+  ChangedFMF = true;
+}
 
 // With nsz, when 'Swap' is false:
 // fold (X < +/-0.0) ? -X : X or (X <= +/-0.0) ? -X : X to fabs(X)

diff  --git a/llvm/test/Transforms/InstCombine/fabs.ll 
b/llvm/test/Transforms/InstCombine/fabs.ll
index cccf0f4457b6ab5..7b9a672f188cab6 100644
--- a/llvm/test/Transforms/InstCombine/fabs.ll
+++ b/llvm/test/Transforms/InstCombine/fabs.ll
@@ -484,7 +484,7 @@ define double @select_fcmp_nnan_nsz_olt_zero(double %x) {
 ; CHECK-LABEL: @select_fcmp_nnan_nsz_olt_zero(
 ; CHECK-NEXT:[[LTZERO:%.*]] = fcmp olt double [[X:%.*]], 0.00e+00
 ; CHECK-NEXT:[[NEGX:%.*]] = fneg nnan nsz double [[X]]
-; CHECK-NEXT:[[FABS:%.*]] = select nnan i1 [[LTZERO]], double [[NEGX]], 
double [[X]]
+; CHECK-NEXT:[[FABS:%.*]] = select i1 [[LTZERO]], double [[NEGX]], double 
[[X]]
 ; CHECK-NEXT:ret double [[FABS]]
 ;
   %ltzero = fcmp olt double %x, 0.0
@@ -523,7 +523,7 @@ define double 
@select_fcmp_nnan_nsz_olt_zero_unary_fneg(double %x) {
 ; CHECK-LABEL: @select_fcmp_nnan_nsz_olt_zero_unary_fneg(
 ; CHECK-NEXT:[[LTZERO:%.*]] = fcmp olt double [[X:%.*]], 0.00e+00
 ; CHECK-NEXT:[[NEGX:%.*]] = fneg nnan nsz double [[X]]
-; CHECK-NEXT:[[FABS:%.*]] = select nnan i1 [[LTZERO]], double [[NEGX]], 
double [[X]]
+; CHECK-NEXT:[[FABS:%.*]] = select i1 [[LTZERO]], double [[NEGX]], double 
[[X]]
 ; CHECK-NEXT:ret double [[FABS]]
 ;
   %ltzero = fcmp olt double %x, 0.0
@@ -553,7 +553,7 @@ define float @select_fcmp_nnan_nsz_olt_negzero(float %x) {
 ; CHECK-LABEL: @select_fcmp_nnan_nsz_olt_negzero(
 ; CHECK-NEXT:[[LTZERO:%.*]] = fcmp olt float [[X:%.*]], 0.00e+00
 ; CHECK-NEXT:[[NEGX:%.*]] = fneg nnan ninf nsz float [[X]]
-; CHECK-NEXT:[[FABS:%.*]] = select nnan ninf i1 [[LTZERO]], float 
[[NEGX]], float [[X]]
+; CHECK-NEXT:[[FABS:%.*]] = select i1 [[LTZERO]], float [[NEGX]], float 
[[X]]
 ; CHECK-NEXT:ret float [[FABS]]
 ;
   %ltzero = fcmp olt float %x, -0.0
@@ -579,7 +579,7 @@ define float @select_fcmp_nnan_nsz_ult_negzero(float %x) {
 ; CHECK-LABEL: @select_fcmp_nnan_nsz_ult_negzero(
 ; CHECK-NEXT:[[LTZERO:%.*]] = fcmp ult float [[X:%.*]], 0.00e+00
 ; CHECK-NEXT:[[NEGX:%.*]] = fneg nnan ninf nsz float [[X]]
-; CHECK-NEXT:[[FABS:%.*]] = se

[llvm-branch-commits] [llvm] release/20.x: [InstCombine] Fix FMF propagation in `foldSelectWithFCmpToFabs` (#121580) (PR #125338)

2025-02-06 Thread Tom Stellard via llvm-branch-commits

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


  1   2   >