diff options
author | Asher Mancinelli <ashermancinelli@gmail.com> | 2024-10-30 09:50:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-30 09:50:27 -0700 |
commit | 0c9a02355abc3b037be53c072fc46a13bb5aa2c1 (patch) | |
tree | 96783b0361469724d9672034be3aedd3b324ca10 /lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h | |
parent | 49277253f016268e4a10109f1db2e53c60d35881 (diff) | |
download | llvm-0c9a02355abc3b037be53c072fc46a13bb5aa2c1.zip llvm-0c9a02355abc3b037be53c072fc46a13bb5aa2c1.tar.gz llvm-0c9a02355abc3b037be53c072fc46a13bb5aa2c1.tar.bz2 |
[flang][fir] always use memcpy for fir.box (#113949)
@jeanPerier explained the importance of converting box loads and stores
into `memcpy`s instead of aggregate loads and stores, and I'll do my
best to explain it here.
* [(godbolt link) Example comparing opt transformations on memcpys vs
aggregate load/stores](https://godbolt.org/z/be7xM83cG)
* LLVM can more effectively reason about memcpys compared to aggregate
load/stores.
* This came up when others were discussing array descriptors for
assumed-rank arrays passed to `bind(c)` subroutines, with the
implication that the array descriptors are known to have lower bounds of
1 and that they are not pointer/allocatable types.
* [(godbolt link) Clang also uses memcpys so we should probably follow
them, assuming the clang developers are generatign what they know Opt
will handle more effectively.](https://godbolt.org/z/YT4x7387W)
* This currently may not help much without the `nocapture` attribute
being propagated to function calls, but [it looks like someone may do
this soon (discourse
link)](https://discourse.llvm.org/t/applying-the-nocapture-attribute-to-reference-passed-arguments-in-fortran-subroutines/81401/23)
or I can do this in a follow-up patch.
Note on test `flang/test/Fir/embox-char.fir`: it looks like the original
test was auto-generated. I wasn't too sure which parts were especially
important to test, so I regenerated the test. If we want the updated
version to look more like the old version, I'll make those changes.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h')
0 files changed, 0 insertions, 0 deletions