[flang-commits] [flang] [flang][NFC] use llvm.intr.stacksave/restore instead of opaque calls (PR #108562)
via flang-commits
flang-commits at lists.llvm.org
Mon Sep 16 00:58:05 PDT 2024
================
@@ -328,6 +329,18 @@ mlir::Value fir::FirOpBuilder::createHeapTemporary(
name, dynamicLength, dynamicShape, attrs);
}
+mlir::Value fir::FirOpBuilder::genStackSave(mlir::Location loc) {
+ mlir::DataLayout dataLayout(getModule());
----------------
jeanPerier wrote:
I have mixed feeling about having the mlir::DataLayout be built here, mostly because MLIR docs suggest the data layout computation may be "expensive" here:
https://github.com/llvm/llvm-project/blob/af1d2b9fb1c6065d3a4611f086b8c83a0c05795c/mlir/docs/DataLayout.md?plain=1#L84
`genStackSave` is not as hot as some helpers to get types, so it is likely acceptable here, but I am worried people may just copy paste this solution to get a DataLayout here and there. I think I would make that unique_ptr member of the fir::FirOpBuilder built on demand in some getDataLayout() accessor if not already built.
https://github.com/llvm/llvm-project/pull/108562
More information about the flang-commits
mailing list