This is an archive of the discontinued LLVM Phabricator instance.

[flang] Remove redundant reallocation
ClosedPublic

Authored by rovka on May 6 2021, 2:46 AM.

Details

Summary

The MaxMinHelper used to implement MIN and MAX for character types would
reallocate the accumulator whenever the number of characters in it was
different from that in the other input. This is unnecessary if the
accumulator is already larger than the other input. This patch fixes the
issue and adds a unit test to make sure we don't reallocate if we don't
need to.

Diff Detail

Event Timeline

rovka created this revision.May 6 2021, 2:46 AM
rovka requested review of this revision.May 6 2021, 2:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2021, 2:46 AM
klausler accepted this revision.May 6 2021, 9:22 AM

Thanks for noticing and fixing this, and for the new test!

This revision is now accepted and ready to land.May 6 2021, 9:22 AM
This revision was automatically updated to reflect the committed changes.