[all-commits] [llvm/llvm-project] 2384e8: [flang] Restore stack after allocas created by Tar...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Wed Apr 26 10:33:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2384e84bbbfd8d713fd2e1ffcc7d3d89dc1a0f16
      https://github.com/llvm/llvm-project/commit/2384e84bbbfd8d713fd2e1ffcc7d3d89dc1a0f16
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2023-04-26 (Wed, 26 Apr 2023)

  Changed paths:
    M flang/include/flang/Optimizer/CodeGen/CGPasses.td
    M flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
    M flang/test/Fir/target-rewrite-complex16.fir
    M flang/test/Fir/target.fir

  Log Message:
  -----------
  [flang] Restore stack after allocas created by TargetRewrite.

This resolves issues with running out of stack on examples like
https://fortran-lang.discourse.group/t/modern-fortran-sample-code/2019/18
reported by @clementval.

When target rewrite creates alloca(s) around a call, we need to insert
stacksave/stackrestore to free the allocated stack. Better performant
code may be achieved by placing the alloca(s) outside of loops,
but the placement has to behave correctly with regards to OpenMP/OpenACC/etc.
dialect operations that have special representation for "private"
objects. This is a concervative fix for correctness issue.

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




More information about the All-commits mailing list