[all-commits] [llvm/llvm-project] d0703d: [Flang][OpenMP] Add pass to replace allocas with d...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Mon Apr 27 05:14:28 PDT 2026


  Branch: refs/heads/users/skatrak/flang-generic-10-shared-alloca-pass
  Home:   https://github.com/llvm/llvm-project
  Commit: d0703dc88e4fec9d66a16b2e715e0d48197d5ef2
      https://github.com/llvm/llvm-project/commit/d0703dc88e4fec9d66a16b2e715e0d48197d5ef2
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2026-04-27 (Mon, 27 Apr 2026)

  Changed paths:
    M flang/include/flang/Optimizer/Support/InitFIR.h
    M flang/lib/Optimizer/Passes/Pipelines.cpp
    M flang/test/Fir/basic-program.fir
    M mlir/docs/Passes.md
    M mlir/include/mlir/Dialect/OpenMP/Transforms/Passes.h
    M mlir/include/mlir/Dialect/OpenMP/Transforms/Passes.td
    M mlir/lib/Dialect/OpenMP/CMakeLists.txt
    A mlir/lib/Dialect/OpenMP/IR/CMakeLists.txt
    M mlir/lib/Dialect/OpenMP/Transforms/CMakeLists.txt
    A mlir/lib/Dialect/OpenMP/Transforms/StackToShared.cpp
    A mlir/test/Dialect/OpenMP/stack-to-shared.mlir

  Log Message:
  -----------
  [Flang][OpenMP] Add pass to replace allocas with device shared memory

This patch introduces a new OpenMP MLIR pass, only for target device modules,
that identifies `llvm.alloca` operations that should use device shared
memory and replaces them with pairs of `omp.alloc_shared_mem` and
`omp.free_shared_mem` operations.

This works in conjunction to the MLIR to LLVM IR translation pass' handling of
privatization, mapping and reductions in the OpenMP dialect to properly select
the right memory space for allocations based on where they are made and where
they are used.

This pass, in particular, handles explicit stack allocations in MLIR, whereas
the aforementioned translation pass takes care of implicit ones represented by
entry block arguments.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list