[all-commits] [llvm/llvm-project] 775de6: [flang] convert stack arrays allocation to match o...
Tom Eccles via All-commits
all-commits at lists.llvm.org
Mon Jun 5 02:58:34 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 775de6754af8d5122f10204097f41be02c5c9f3b
https://github.com/llvm/llvm-project/commit/775de6754af8d5122f10204097f41be02c5c9f3b
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2023-06-05 (Mon, 05 Jun 2023)
Changed paths:
M flang/lib/Optimizer/Transforms/StackArrays.cpp
M flang/test/Transforms/stack-arrays.fir
Log Message:
-----------
[flang] convert stack arrays allocation to match old type
The old fir.allocmem operation returned a !fir.heap<.> type. The new
fir.alloca operation returns a !fir.ref<.> type. This patch inserts a
fir.convert so that the old type is preserved. This prevents verifier
failures when types returned from fir.if statements don't match the
expected type.
Differential Revision: https://reviews.llvm.org/D151921
Commit: 53cc33b00b5bf5cec5de214c1566289c927a83ca
https://github.com/llvm/llvm-project/commit/53cc33b00b5bf5cec5de214c1566289c927a83ca
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2023-06-05 (Mon, 05 Jun 2023)
Changed paths:
M flang/include/flang/Optimizer/Builder/FIRBuilder.h
M flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
M flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
M flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
M flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
M flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
M flang/lib/Optimizer/Transforms/AbstractResult.cpp
M flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
M flang/lib/Optimizer/Transforms/LoopVersioning.cpp
M flang/lib/Optimizer/Transforms/StackArrays.cpp
Log Message:
-----------
[flang] Store KindMapping by value in FirOpBuilder
Previously only a constant reference was stored in the FirOpBuilder.
However, a lot of code was merged using
FirOpBuilder builder{rewriter, getKindMapping(mod)};
This is incorrect because the KindMapping returned will go out of scope
as soon as FirOpBuilder's constructor had run. This led to an infinite
loop running some tests using HLFIR (because the stack space containing
the kind mapping was re-used and corrupted).
One solution would have just been to fix the incorrect call sites,
however, as a large number of these had already made it past review, I
decided to instead change FirOpBuilder to store its own copy of the
KindMapping. This is not costly because nearly every time we construct a
KindMapping is exclusively to construct a FirOpBuilder. To make this
common pattern simpler, I added a new constructor to FirOpBuilder which
calls getKindMapping().
Differential Revision: https://reviews.llvm.org/D151881
Compare: https://github.com/llvm/llvm-project/compare/70bd66070944...53cc33b00b5b
More information about the All-commits
mailing list