[flang-commits] [flang] [flang][OpenMP][CUDA] Set allocator_idx on privatized allocatable device array descriptors (PR #186945)
Zhen Wang via flang-commits
flang-commits at lists.llvm.org
Tue Mar 17 09:34:23 PDT 2026
================
@@ -435,9 +436,13 @@ fir::IfOp PopulateInitAndCleanupRegionsHelper::handleNullAllocatable() {
// right rank. This returns an empty value if the types don't match.
mlir::Value shape = generateZeroShapeForRank(builder, loc, moldArg);
- mlir::Value nullBox =
- fir::EmboxOp::create(builder, loc, valType, addr, shape,
- /*slice=*/mlir::Value{}, lenParams);
+ auto nullBox = fir::EmboxOp::create(builder, loc, valType, addr, shape,
+ /*slice=*/mlir::Value{}, lenParams);
+ if (sym) {
+ unsigned idx = Fortran::lower::getAllocatorIdx(sym->GetUltimate());
+ if (idx != kDefaultAllocator)
+ nullBox.setAllocatorIdx(idx);
----------------
wangzpgi wrote:
Setting it unconditionally breaks 5 existing tests, I will update those tests to take into acount the allocator_idx = 0 for non-CUDA allocatables.
https://github.com/llvm/llvm-project/pull/186945
More information about the flang-commits
mailing list