This is an archive of the discontinued LLVM Phabricator instance.

utils/compare.py: Add --absolute-diff
ClosedPublic

Authored by arichardson on Apr 20 2022, 9:36 AM.

Details

Summary

This is useful for metrics such as number of times a given pass performed
a transformation, etc.

Diff Detail

Repository
rT test-suite

Event Timeline

arichardson created this revision.Apr 20 2022, 9:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2022, 9:36 AM
arichardson requested review of this revision.Apr 20 2022, 9:36 AM
MatzeB accepted this revision.Apr 20 2022, 10:20 AM

LGTM

utils/compare.py
294–295

Should this have a default=False? (I guess currently you get None which works but feels a bit accidental)

This revision is now accepted and ready to land.Apr 20 2022, 10:20 AM
arichardson marked an inline comment as done.Apr 20 2022, 10:33 AM
arichardson added inline comments.
utils/compare.py
294–295

Good question, I just checked and it turns out the store_true action sets the default to False:

>>> import argparse
>>> parser = argparse.ArgumentParser(prog='compare.py')
>>> parser.add_argument('--absolute-diff', action='store_true', help='Use an absolute instead of a relative difference')
_StoreTrueAction(option_strings=['--absolute-diff'], dest='absolute_diff', nargs=0, const=True, default=False, type=None, choices=None, help='Use an absolute instead of a relative difference', metavar=None)
>>> parser.parse_args()
Namespace(absolute_diff=False)
This revision was automatically updated to reflect the committed changes.
arichardson marked an inline comment as done.