diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -68,6 +68,7 @@ SCRUB_LEADING_WHITESPACE_RE = re.compile(r'^(\s+)') SCRUB_WHITESPACE_RE = re.compile(r'(?!^(| \w))[ \t]+', flags=re.M) SCRUB_TRAILING_WHITESPACE_RE = re.compile(r'[ \t]+$', flags=re.M) +SCRUB_TRAILING_WHITESPACE_AND_ATTRIBUTES_RE = re.compile(r'([ \t]|(#[0-9]+))+$', flags=re.M) SCRUB_KILL_COMMENT_RE = re.compile(r'^ *#+ +kill:.*\n') SCRUB_LOOP_COMMENT_RE = re.compile( r'# =>This Inner Loop Header:.*|# in Loop:.*', flags=re.M) diff --git a/llvm/utils/update_test_checks.py b/llvm/utils/update_test_checks.py --- a/llvm/utils/update_test_checks.py +++ b/llvm/utils/update_test_checks.py @@ -68,9 +68,15 @@ help='Do not scrub IR names') parser.add_argument('--function-signature', action='store_true', help='Keep function signature information around for the check line') + parser.add_argument('--scrub-attributes', action='store_true', + help='Remove attribute annotations (#0) from the end of check line') parser.add_argument('tests', nargs='+') args = parser.parse_args() + # If requested we scrub trailing attribute annotations, e.g., '#0', together with whitespaces + if args.scrub_attributes: + common.SCRUB_TRAILING_WHITESPACE_RE = common.SCRUB_TRAILING_WHITESPACE_AND_ATTRIBUTES_RE + script_name = os.path.basename(__file__) autogenerated_note = (ADVERT + 'utils/' + script_name)