[all-commits] [llvm/llvm-project] eb436d: [flang] automatically load FIR dialect with hlfir

Tom Eccles via All-commits all-commits at lists.llvm.org
Tue Feb 14 05:46:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eb436da6b8269407e03b6954319de77a082f4adf
      https://github.com/llvm/llvm-project/commit/eb436da6b8269407e03b6954319de77a082f4adf
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2023-02-14 (Tue, 14 Feb 2023)

  Changed paths:
    M flang/include/flang/Optimizer/HLFIR/HLFIROpBase.td
    M flang/include/flang/Optimizer/HLFIR/HLFIROps.h

  Log Message:
  -----------
  [flang] automatically load FIR dialect with hlfir

MLIR loads dialects lazily so if a hlfir type (or operation) is found
before any fir type (or operation), the fir dialect will not have been
loaded when the hlfir thing is verified. Verification of some hlfir
operations does depend on fir types (e.g. hlfir.sum needs
fir::SequenceType).

Tablegen change recommended by jeanPerier

Differential Revision: https://reviews.llvm.org/D143930


  Commit: 7a49d50f22ad577d91cda7904c8a162c2cecd4a8
      https://github.com/llvm/llvm-project/commit/7a49d50f22ad577d91cda7904c8a162c2cecd4a8
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2023-02-14 (Tue, 14 Feb 2023)

  Changed paths:
    M flang/lib/Optimizer/Transforms/StackArrays.cpp
    M flang/test/Transforms/stack-arrays.fir

  Log Message:
  -----------
  [flang] support fir.unreachable in stack arrays pass

Some functions (e.g. the main function) end with a call to the STOP
statement instead of a func.return. This is lowered as a call to the
stop runtime function followed by a fir.unreachable. fir.unreachable is
a terminator and so this can cause functions to have no func.return.

The stack arrays pass looks to see which heap allocations have always
been freed by the time a function returns. Without any returns, the pass
does not detect any freed allocations. This patch changes this behaviour
so that fir.unreachable is checked as well as func.return.

This allows 15 heap allocations for array temporaries in spec2017
exchange2's main function to be moved to the stack.

Differential Revision: https://reviews.llvm.org/D143918


Compare: https://github.com/llvm/llvm-project/compare/ddfabefe1be1...7a49d50f22ad


More information about the All-commits mailing list