[all-commits] [llvm/llvm-project] 05142f: [flang] Reject module-scope fir.alloca (#214157)

Keshav Vinayak Jha via All-commits all-commits at lists.llvm.org
Sat Aug 8 23:39:15 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 05142fc7308d336d316c2d705ee205393f7576ea
      https://github.com/llvm/llvm-project/commit/05142fc7308d336d316c2d705ee205393f7576ea
  Author: Keshav Vinayak Jha <31160700+keshavvinayak01 at users.noreply.github.com>
  Date:   2026-08-09 (Sun, 09 Aug 2026)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/FIROps.td
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    M flang/test/Fir/invalid.fir

  Log Message:
  -----------
  [flang] Reject module-scope fir.alloca (#214157)

`fir.alloca` represents a stack allocation, but its verifier currently
accepts operations placed directly in a `builtin.module`. During
FIR-to-LLVM conversion, `AllocaOpConversion::matchAndRewrite` calls
`getBlockForAllocaInsert`, which performs a `dyn_cast` to
`OutlineableOpenMPOpInterface` on the alloca's parent op.

For a module-level alloca the expected parent function/block does not
exist and the cast/assert fails.

This patch rejectsdirect module-scope `fir.alloca` operations during FIR
verification.

Assisted-by: codex

---------

Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha at gmail.com>



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