[flang-commits] [PATCH] D133779: [flang] Make a descriptor copy for fir.load fir.ref<fir.box>
Jean Perier via Phabricator via flang-commits
flang-commits at lists.llvm.org
Tue Sep 13 08:16:25 PDT 2022
jeanPerier created this revision.
jeanPerier added reviewers: vzakhari, PeteSteinfeld, clementval.
jeanPerier added a project: Flang.
Herald added subscribers: mehdi_amini, jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.
`fir.box` and `fir.ref<fir.box>` are both lowered to LLVM as a
descriptor in memory. This is because fir.box of polymorphic and assumed
rank entities cannot be known at compile time, so fir.box cannot be
lowered to a struct value.
fir.load or fir.ref<fir.box> was previously lowered to a no-op,
propagating the operand descriptor storage as a result.
This is wrong because the operand descriptor storage may later be
modified, and these changes should not be visible in the loaded fir.box
that is an immutable SSA value.
Modify fir.load codegen for fir.box to make a copy into a new storage to
ensure the fir.box is immutable.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D133779
Files:
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/test/Fir/convert-to-llvm.fir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133779.459754.patch
Type: text/x-patch
Size: 7312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220913/aa0381ff/attachment-0001.bin>
More information about the flang-commits
mailing list