[all-commits] [llvm/llvm-project] e5e200: [flang][PFT-to-MLIR] reset Evaluation blocks betwe...

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Mon Jul 20 04:32:37 PDT 2026


  Branch: refs/heads/users/ergawy/enclode_in_scf.execute_region_2
  Home:   https://github.com/llvm/llvm-project
  Commit: e5e20031fbe83a53d86229b7fff97c24fcb6e5c0
      https://github.com/llvm/llvm-project/commit/e5e20031fbe83a53d86229b7fff97c24fcb6e5c0
  Author: ergawy <kareem.ergawy at gmail.com>
  Date:   2026-07-20 (Mon, 20 Jul 2026)

  Changed paths:
    M flang/lib/Lower/Bridge.cpp
    M flang/test/Lower/if_construct_execute_region_wrap.f90

  Log Message:
  -----------
  [flang][PFT-to-MLIR] reset Evaluation blocks between entry-point passes

A subprogram with an alternate ENTRY is lowered by walking the shared
PFT once per entry.  Evaluation::block is populated during each walk
(top-level createEmptyBlocks and inside wrapUnstructuredConstruct's own
createEmptyBlocks), but the second pass previously inherited stale
pointers into the first entry's function/wrap regions.  For a wrappable
IfConstruct nested inside a structured container, the entry block that
genFIR(IfConstruct) starts before creating its scf.execute_region then
sent the builder into the previous entry's region, and the wrap plus
its inner load ended up in the wrong func:

    subroutine foo(a)
      integer a
    entry bar(a)
      if (a .eq. 1) then
        if (a .ne. 3) stop
      end if
    end subroutine

produced both scf.execute_region ops in _QPfoo, with an inner
fir.load referencing bar's %arg0 — 'fir.load' op using value defined
outside the region.

Fix: null every Evaluation::block in the shared PFT at the start of each
entry-point pass, so createEmptyBlocks fills a clean tree and later
reads (in particular the landing-pad reposition in genFIR(IfConstruct))
never see a pointer from a prior pass.



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