[all-commits] [llvm/llvm-project] 446d4f: [flang][OpenMP][Lower] fix statement context clean...

Tom Eccles via All-commits all-commits at lists.llvm.org
Tue Apr 8 02:28:01 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 446d4f51eb1a172776e69ffb51b5972a0225c0a1
      https://github.com/llvm/llvm-project/commit/446d4f51eb1a172776e69ffb51b5972a0225c0a1
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2025-04-08 (Tue, 08 Apr 2025)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    A flang/test/Lower/OpenMP/clause-cleanup.f90

  Log Message:
  -----------
  [flang][OpenMP][Lower] fix statement context cleanup insertion point (#133891)

The statement context is used for lowering clauses for openmp operations
using generalised helpers from flang lowering. The statement context
stores closures which generate code for cleaning up temporary values
generated by the lowering helper. These closures are run when the
statement construct is destroyed. Keeping the statement context local to
the clause or operation being lowered without any special handling was
not correct because any cleanup code would be generated at the insertion
point when that statement context went out of scope (which would in
general be inside of the newly created container operation). It would be
better to generate the cleanup code after the newly created operation
(clause processing is synchronous even for deferred tasks).

Currently supported clauses are mostly populated with simple scalar
values that require no cleanup. Even the simple array sections added by
#132994 needed no cleanup because indexing the right values of the array
did not create any temporaries. Supporting array sections with vector
indexing will generate hlfir.destroy operations for cleanup. This patch
fixes where those will be created. Those hlfir.destroy operations don't
generate any FIR (or LLVM) code, but the issue still exists
theoretically.

I wasn't able to find any clauses which have any cleanup to use to test
this PR. It is probably NFC for the current lowering. This will be
tested in [the PR adding vector subscripting of array
sections](https://github.com/llvm/llvm-project/pull/133892).



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