Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flang] Add support for -fstack-arrays option #59231

Closed
kiranchandramohan opened this issue Nov 28, 2022 · 6 comments
Closed

[Flang] Add support for -fstack-arrays option #59231

kiranchandramohan opened this issue Nov 28, 2022 · 6 comments

Comments

@kiranchandramohan
Copy link
Contributor

The stack-arrays option is enabled by gfortran at Ofast. While some of the allocations happen on the stack by default in llvm/flang, in some cases like array-assignments, the memory is allocated in the heap.

Stack arrays has the following definition in the gfortran option help.

-fstack-arrays
Adding this option will make the Fortran compiler put all arrays of unknown size and array temporaries onto stack memory. If your program uses very large local arrays it is possible that you will have to extend your runtime limits for stack memory on some operating systems. This flag is enabled by default at optimization level -Ofast unless -fmax-stack-var-size is specified.

Note: This came out of the discussion regarding Ofast in https://discourse.llvm.org/t/rfc-the-meaning-of-ofast/66554

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 28, 2022

@llvm/issue-subscribers-flang-ir

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 28, 2022

@llvm/issue-subscribers-flang-driver

@tblah
Copy link
Contributor

tblah commented Dec 8, 2022

I've posted an RFC covering the scope of the required changes https://reviews.llvm.org/D139617

@tblah
Copy link
Contributor

tblah commented Jan 4, 2023

Patches implementing -fstack-arrays (covering most cases) are up for review https://reviews.llvm.org/D140972

@xgupta
Copy link
Contributor

xgupta commented Apr 12, 2023

Since the StackArray pass (https://reviews.llvm.org/D140415) is also committed, will it be fine to close this issue @kiranchandramohan?

@tblah
Copy link
Contributor

tblah commented Apr 12, 2023

Yes this can be closed. Thanks for pointing this out @xgupta

@tblah tblah closed this as completed Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants