[all-commits] [llvm/llvm-project] 2befcb: [flang] Restrict O0 hlfir.assign scalar-to-array i...

Sairudra More via All-commits all-commits at lists.llvm.org
Mon Jun 8 09:06:58 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2befcb4d3224a78e0676c6cac29c37125088643d
      https://github.com/llvm/llvm-project/commit/2befcb4d3224a78e0676c6cac29c37125088643d
  Author: Sairudra More <sairudra60 at gmail.com>
  Date:   2026-06-08 (Mon, 08 Jun 2026)

  Changed paths:
    M flang/include/flang/Tools/CrossToolHelpers.h
    M flang/lib/Frontend/FrontendActions.cpp
    M flang/lib/Optimizer/Passes/Pipelines.cpp
    M flang/test/Driver/mlir-debug-pass-pipeline.f90
    M flang/test/Driver/mlir-pass-pipeline.f90
    M flang/test/Integration/OpenMP/parallel-private-reduction-worstcase.f90
    M flang/test/Integration/OpenMP/private-global.f90
    M flang/test/Integration/prefetch.f90
    A flang/test/Lower/OpenMP/scalar-to-array-assign-target-device-O0.f90
    M flang/test/Lower/OpenMP/workdistribute-saxpy-and-scalar-assign.f90
    M flang/test/Lower/OpenMP/workdistribute-scalar-assign.f90
    A flang/test/Lower/scalar-to-array-assign-host-O0.f90
    M flang/tools/bbc/bbc.cpp

  Log Message:
  -----------
  [flang] Restrict O0 hlfir.assign scalar-to-array inlining to OpenMP target device (#201774)

Follow-up to #197092.

That PR fixed the OpenMP target-device case by running scalar-to-array
`hlfir.assign` inlining at `-O0`, so device code would not lower through
`_FortranAAssign`.

However, running that path for normal host `-g -O0` also changed
debugging behavior: a breakpoint on a scalar broadcast like `arr = 11`
could be hit once per array element because the assignment became an
inline loop.

This patch restricts the `-O0` scalar-RHS-only inlining path to OpenMP
target-device compilation. Host `-O0` keeps the existing
`_FortranAAssign` path and debugger behavior, while device `-O0` still
avoids the runtime call.

Two focused tests cover both sides:
- host `-O0` scalar broadcast keeps `_FortranAAssign`
- OpenMP target-device `-O0` scalar broadcast avoids `_FortranAAssign`

Fixing debug locations for generated inline loops more generally is left
as separate follow-up work.
The broader debug-location issue for generated inline assignment loops
is tracked separately in #202065.



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