This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] avoid useless LHS temporaries inside WHERE
ClosedPublic

Authored by jeanPerier on Jul 4 2023, 1:56 AM.

Details

Summary

The need to save LHS addresses on a stack before doing an assignment
is very limited: it is only really needed for forall and vectore
subscripted LHS where the LHS cannot be computed as a descriptor.

The previous current WHERE codegen was creating address stacks for
LHS element addresses when the LHS evaluation conflicts with the
assignment (may depend on the LHS value). This is not needed
since the computed array designator for the LHS is already "saved"
before the assignment from an SSA point of view.

This patch prevents LHS temporary stack from being created outside
of forall and vector subscripted assignments.

Diff Detail

Event Timeline

jeanPerier created this revision.Jul 4 2023, 1:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 4 2023, 1:56 AM
jeanPerier requested review of this revision.Jul 4 2023, 1:56 AM
tblah accepted this revision.Jul 4 2023, 3:44 AM

LGTM, thanks!

This revision is now accepted and ready to land.Jul 4 2023, 3:44 AM