This is an archive of the discontinued LLVM Phabricator instance.

[flang] do not generate padding/truncation code when character length are equals
ClosedPublic

Authored by jeanPerier on Dec 5 2022, 7:40 AM.

Details

Summary

When generating character assignment operations, the generic code
generates some code to handle truncation and padding when the length
differ at runtime. A bypass already exists when the length are compile
time constant and match, but it was not used for the trivial case where
the RHS and LHS length is the same SSA value. In such case, even though,
the length is not know at compile time, it is known to be the same.

This will simplify the code creating character temporaries from a
variable in HLFIR that will use this assignment code.

Note that this probably has little impact on performance (llvm may be clever enough
to later catch that for us). But it makes the generated IR a lot more readable at
little cost.

Diff Detail

Event Timeline

jeanPerier created this revision.Dec 5 2022, 7:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 7:40 AM
jeanPerier requested review of this revision.Dec 5 2022, 7:40 AM
PeteSteinfeld accepted this revision.Dec 5 2022, 8:26 AM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Dec 5 2022, 8:26 AM