hnrklssn updated this revision to Diff 525174.
hnrklssn added a comment.
Herald added a subscriber: ormris.

Overhauled how update_cc_tests.py checks globals

It now:

- no longer matches the literal names, like update_test_checks.py does unless 
--preserve-names (which doesn't seem to see much use, at least not upstream, so 
did not add option to update_cc_tests.py) is set
- (along with update_test_checks.py) now adds checks for any definitions of 
globals referenced in the IR (by default, can still check all globals using 
"--check-globals all")
- (along with update_test_checks.py) can also be configured to emit checks for 
any definitions of globals referenced by other globals referenced in the IR, 
using "--check-globals transitive"
- (along with update_test_checks.py) filters out unstable metadata output, so 
that literal directory names and git hashes are not matched against


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148216/new/

https://reviews.llvm.org/D148216

Files:
  clang/test/utils/update_cc_test_checks/Inputs/annotations.c
  clang/test/utils/update_cc_test_checks/Inputs/annotations.c.expected
  clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected
  
clang/test/utils/update_cc_test_checks/Inputs/explicit-template-instantiation.cpp.expected
  clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
  
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected
  
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected
  
clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected
  clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c.expected
  clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
  
clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected
  clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.v2.expected
  
clang/test/utils/update_cc_test_checks/Inputs/replace-value-regex-across-runs.c.expected
  
clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
  clang/test/utils/update_cc_test_checks/annotations.test
  clang/test/utils/update_cc_test_checks/check-globals.test
  clang/test/utils/update_cc_test_checks/generated-funcs.test
  clang/test/utils/update_cc_test_checks/global-hex-value-regex.test
  clang/test/utils/update_cc_test_checks/global-value-regex.test
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.globals.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.globals.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.generated.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.generated.globals.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.globals.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/pre-process.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.noglobals.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected
  llvm/test/tools/UpdateTestChecks/update_test_checks/generated_funcs.test
  
llvm/test/tools/UpdateTestChecks/update_test_checks/generated_funcs_prefix_reuse.test
  llvm/test/tools/UpdateTestChecks/update_test_checks/various_ir_values.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_cc_test_checks.py
  llvm/utils/update_test_checks.py

Index: llvm/utils/update_test_checks.py
===================================================================
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -59,7 +59,7 @@
                       help='Remove attribute annotations (#0) from the end of check line')
   parser.add_argument('--check-attributes', action='store_true',
                       help='Check "Function Attributes" for functions')
-  parser.add_argument('--check-globals', action='store_true',
+  parser.add_argument('--check-globals', default='seen', choices=['none', 'seen', 'transitive', 'all'],
                       help='Check global entries (global variables, metadata, attribute sets, ...) for functions')
   parser.add_argument('tests', nargs='+')
   initial_args = common.parse_commandline_args(parser)
@@ -158,12 +158,12 @@
       common.dump_input_lines(output_lines, ti, prefix_set, ';')
 
       args = ti.args
-      if args.check_globals:
+      if args.check_globals != 'none':
         generated_prefixes.extend(
             common.add_global_checks(builder.global_var_dict(), ';',
                                      prefix_list, output_lines,
                                      global_vars_seen_dict, args.preserve_names,
-                                     True))
+                                     True, args.check_globals))
 
       # Now generate all the checks.
       generated_prefixes.extend(
@@ -211,12 +211,11 @@
 
         m = common.IR_FUNCTION_RE.match(input_line)
         if m and not has_checked_pre_function_globals:
-          if args.check_globals:
-            generated_prefixes.extend(
-                common.add_global_checks(builder.global_var_dict(), ';',
-                                         prefix_list, output_lines,
-                                         global_vars_seen_dict,
-                                         args.preserve_names, True))
+          generated_prefixes.extend(
+              common.add_global_checks(builder.global_var_dict(), ';',
+                                       prefix_list, output_lines,
+                                       global_vars_seen_dict,
+                                       args.preserve_names, True, args.check_globals))
           has_checked_pre_function_globals = True
 
         if common.should_add_line_to_output(input_line, prefix_set, not is_in_function):
@@ -240,11 +239,11 @@
           continue
         is_in_function = is_in_function_start = True
 
-    if args.check_globals:
+    if args.check_globals != 'none':
       generated_prefixes.extend(
           common.add_global_checks(builder.global_var_dict(), ';', prefix_list,
                                    output_lines, global_vars_seen_dict,
-                                   args.preserve_names, False))
+                                   args.preserve_names, False, args.check_globals))
     if ti.args.gen_unused_prefix_body:
       output_lines.extend(ti.get_checks_for_unused_prefixes(
           prefix_list, generated_prefixes))
Index: llvm/utils/update_cc_test_checks.py
===================================================================
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -169,7 +169,7 @@
                       help='Keep function signature information around for the check line')
   parser.add_argument('--check-attributes', action='store_true',
                       help='Check "Function Attributes" for functions')
-  parser.add_argument('--check-globals', action='store_true',
+  parser.add_argument('--check-globals', default='seen', choices=['none', 'seen', 'transitive', 'all'],
                       help='Check global entries (global variables, metadata, attribute sets, ...) for functions')
   parser.add_argument('tests', nargs='+')
   args = common.parse_commandline_args(parser)
@@ -359,11 +359,11 @@
                                 func_dict, func, global_vars_seen_dict,
                                 is_filtered=builder.is_filtered())
 
-      if ti.args.check_globals:
+      if ti.args.check_globals != 'none':
         generated_prefixes.extend(
             common.add_global_checks(builder.global_var_dict(), '//', run_list,
-                                     output_lines, global_vars_seen_dict, True,
-                                     True))
+                                     output_lines, global_vars_seen_dict, False,
+                                     True, ti.args.check_globals))
       generated_prefixes.extend(
           common.add_checks_at_end(
               output_lines, filecheck_run_list, builder.func_order(), '//',
@@ -400,11 +400,11 @@
                 # line as part of common.add_ir_checks()
                 output_lines.pop()
                 last_line = output_lines[-1].strip()
-              if ti.args.check_globals and not has_checked_pre_function_globals:
+              if ti.args.check_globals != 'none' and not has_checked_pre_function_globals:
                 generated_prefixes.extend(
                     common.add_global_checks(builder.global_var_dict(), '//',
                                              run_list, output_lines,
-                                             global_vars_seen_dict, True, True))
+                                             global_vars_seen_dict, False, True, ti.args.check_globals))
                 has_checked_pre_function_globals = True
               if added:
                 output_lines.append('//')
@@ -427,11 +427,11 @@
         if include_line:
           output_lines.append(line.rstrip('\n'))
 
-    if ti.args.check_globals:
+    if ti.args.check_globals != 'none':
       generated_prefixes.extend(
           common.add_global_checks(builder.global_var_dict(), '//', run_list,
-                                   output_lines, global_vars_seen_dict, True,
-                                   False))
+                                   output_lines, global_vars_seen_dict, False,
+                                   False, ti.args.check_globals))
     if ti.args.gen_unused_prefix_body:
       output_lines.extend(
           ti.get_checks_for_unused_prefixes(run_list, generated_prefixes))
Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -697,9 +697,10 @@
     return self.global_ir_rhs_regexp is not None
 
   # Return the IR prefix and check prefix we use for this kind or IR value,
-  # e.g., (%, TMP) for locals.
+  # e.g., (%, TMP) for locals. If the IR prefix is a regex, return the prefix
+  # used in the IR output
   def get_ir_prefix_from_ir_value_match(self, match):
-    return self.ir_prefix, self.check_prefix
+    return re.search(self.ir_prefix, match[0])[0], self.check_prefix
 
   # Return the IR regexp we use for this kind or IR value, e.g., [\w.-]+? for locals
   def get_ir_regex_from_ir_value_re_match(self, match):
@@ -775,8 +776,11 @@
     NamelessValue(r'META'       , '!' , r'metadata '           , r'![0-9]+'             , None                 ) ,
     NamelessValue(r'META'       , '!' , r''                    , r'![0-9]+'             , r'(?:distinct |)!.*' ) ,
     NamelessValue(r'ACC_GRP'    , '!' , r'!llvm.access.group ' , r'![0-9]+'             , None                 ) ,
+    NamelessValue(r'META'       , '!' , r'![a-z.]+ '           , r'![0-9]+'             , None                 ) ,
 ]
 
+global_nameless_values = [nameless_value for nameless_value in ir_nameless_values if nameless_value.global_ir_rhs_regexp is not None]
+
 asm_nameless_values = [
     NamelessValue(r'MCINST'     , 'Inst#' , '<MCInst #'        , r'\d+'                 , r'.+', is_number=True, replace_number_with_counter=True),
     NamelessValue(r'MCREG'      , 'Reg:'  , '<MCOperand Reg:'  , r'\d+'                 , r'.+', is_number=True, replace_number_with_counter=True),
@@ -803,9 +807,15 @@
   if nameless_value.global_ir_rhs_regexp is not None:
     match = '^' + match
   IR_VALUE_REGEXP_STRING = createOrRegexp(IR_VALUE_REGEXP_STRING, match)
-IR_VALUE_REGEXP_SUFFIX = r'([,\s\(\)]|\Z)'
+IR_VALUE_REGEXP_SUFFIX = r'([,\s\(\)\}]|\Z)'
 IR_VALUE_RE = re.compile(IR_VALUE_REGEXP_PREFIX + r'(' + IR_VALUE_REGEXP_STRING + r')' + IR_VALUE_REGEXP_SUFFIX)
 
+GLOBAL_VALUE_REGEXP_STRING = r''
+for nameless_value in global_nameless_values:
+  match = createPrefixMatch(nameless_value.ir_prefix, nameless_value.ir_regexp)
+  GLOBAL_VALUE_REGEXP_STRING = createOrRegexp(GLOBAL_VALUE_REGEXP_STRING, match)
+GLOBAL_VALUE_RE = re.compile(IR_VALUE_REGEXP_PREFIX + r'(' + GLOBAL_VALUE_REGEXP_STRING + r')' + IR_VALUE_REGEXP_SUFFIX)
+
 # Build the regexp that matches an "ASM value" (currently only for --asm-show-inst comments).
 ASM_VALUE_REGEXP_STRING = ''
 for nameless_value in asm_nameless_values:
@@ -814,6 +824,7 @@
 ASM_VALUE_REGEXP_SUFFIX = r'([>\s]|\Z)'
 ASM_VALUE_RE = re.compile(r'((?:#|//)\s*)' + '(' + ASM_VALUE_REGEXP_STRING + ')' + ASM_VALUE_REGEXP_SUFFIX)
 
+
 # The entire match is group 0, the prefix has one group (=1), the entire
 # IR_VALUE_REGEXP_STRING is one group (=2), and then the nameless values start.
 first_nameless_group_in_ir_value_match = 3
@@ -905,6 +916,12 @@
                                        global_vars_seen, ir_nameless_values,
                                        IR_VALUE_RE, False)
 
+def generalize_global_check_line(line, is_analyze, global_vars_seen):
+  [new_line] = generalize_check_lines_common([line], is_analyze, set(),
+                                       global_vars_seen, global_nameless_values,
+                                       GLOBAL_VALUE_RE, False)
+  return new_line
+
 def generalize_asm_check_lines(lines, vars_seen, global_vars_seen):
   return generalize_check_lines_common(lines, False, vars_seen,
                                        global_vars_seen, asm_nameless_values,
@@ -1072,7 +1089,7 @@
                     is_filtered)
 
 def build_global_values_dictionary(glob_val_dict, raw_tool_output, prefixes):
-  for nameless_value in itertools.chain(ir_nameless_values, asm_nameless_values):
+  for nameless_value in itertools.chain(global_nameless_values, asm_nameless_values):
     if nameless_value.global_ir_rhs_regexp is None:
       continue
 
@@ -1098,11 +1115,57 @@
           continue
       glob_val_dict[prefix][nameless_value.check_prefix] = lines
 
-def add_global_checks(glob_val_dict, comment_marker, prefix_list, output_lines, global_vars_seen_dict, is_analyze, is_before_functions):
-  printed_prefixes = set()
-  for nameless_value in ir_nameless_values:
-    if nameless_value.global_ir_rhs_regexp is None:
+def filter_globals_according_to_preference(global_val_lines, global_vars_seen, nameless_value, global_check_setting):
+  if global_check_setting == 'none':
+    return []
+  if global_check_setting == 'all':
+    return global_val_lines
+
+  def extract(line, nv):
+    p = '^' + nv.ir_prefix + '(' + nv.ir_regexp + ') = (' + nv.global_ir_rhs_regexp + ')'
+    match = re.match(p, line)
+    return (match.group(1), re.findall(nv.ir_regexp, match.group(2)))
+
+  if global_check_setting == 'seen':
+    return [line for line in global_val_lines if (extract(line, nameless_value)[0], nameless_value.check_key) in global_vars_seen]
+  assert global_check_setting == 'transitive'
+
+  transitively_visible = set()
+  contains_refs_to = {}
+
+  def add(var):
+    nonlocal transitively_visible
+    nonlocal contains_refs_to
+    if var in transitively_visible:
+      return
+    transitively_visible.add(var)
+    if not var in contains_refs_to:
+      return
+    for x in contains_refs_to[var]:
+      add(x)
+
+  for line in global_val_lines:
+    (var, refs) = extract(line, nameless_value)
+    contains_refs_to[var] = refs
+  for var, check_key in global_vars_seen:
+    if check_key != nameless_value.check_key:
       continue
+    add(var)
+  return [line for line in global_val_lines if extract(line, nameless_value)[0] in transitively_visible]
+
+# The capture group is kept as is, followed by a {{.*}} glob
+METADATA_FILTERS = [r'(\w+ version )[\d.]+ \(git@[\w.:/-]+\.git \w+\)',
+                    r'(!DIFile\(filename: ".+", directory: )".+"']
+METADATA_FILTERS_RE = [re.compile(s) for s in METADATA_FILTERS]
+
+def filter_unstable_metadata(line):
+  for f in METADATA_FILTERS_RE:
+    line = f.sub(r'\1{{.*}}', line)
+  return line
+
+def add_global_checks(glob_val_dict, comment_marker, prefix_list, output_lines, global_vars_seen_dict, is_analyze, is_before_functions, global_check_setting):
+  printed_prefixes = set()
+  for nameless_value in global_nameless_values:
     if nameless_value.is_before_functions != is_before_functions:
       continue
     for p in prefix_list:
@@ -1126,17 +1189,20 @@
 
         check_lines = []
         global_vars_seen_before = [key for key in global_vars_seen.keys()]
-        for line in glob_val_dict[checkprefix][nameless_value.check_prefix]:
+        lines = glob_val_dict[checkprefix][nameless_value.check_prefix]
+        lines = filter_globals_according_to_preference(lines, global_vars_seen_before, nameless_value, global_check_setting)
+        for line in lines:
           if _global_value_regex:
             matched = False
             for regex in _global_value_regex:
-              if re.match('^@' + regex + ' = ', line):
+              if re.match('^@' + regex + ' = ', line) or re.match('^!' + regex + ' = ', line):
                 matched = True
                 break
             if not matched:
               continue
-          tmp = generalize_check_lines([line], is_analyze, set(), global_vars_seen)
-          check_line = '%s %s: %s' % (comment_marker, checkprefix, tmp[0])
+          new_line = generalize_global_check_line(line, is_analyze, global_vars_seen)
+          new_line = filter_unstable_metadata(new_line)
+          check_line = '%s %s: %s' % (comment_marker, checkprefix, new_line)
           check_lines.append(check_line)
         if not check_lines:
           continue
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/various_ir_values.test
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/various_ir_values.test
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/various_ir_values.test
@@ -14,5 +14,9 @@
 # RUN: %update_test_checks %t.ll
 # RUN: diff -u %t.ll %S/Inputs/various_ir_values.ll.funcsig.expected
 ## Also try the --check-globals flag
-# RUN: %update_test_checks %t.ll --check-globals
+# RUN: %update_test_checks %t.ll --check-globals all
 # RUN: diff -u %t.ll %S/Inputs/various_ir_values.ll.funcsig.globals.expected
+# RUN: cp -f %S/Inputs/various_ir_values.ll %t.ll && %update_test_checks %t.ll --check-globals none
+# RUN: diff -u %t.ll %S/Inputs/various_ir_values.ll.funcsig.noglobals.expected
+# RUN: cp -f %S/Inputs/various_ir_values.ll %t.ll && %update_test_checks %t.ll --check-globals transitive
+# RUN: diff -u %t.ll %S/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/generated_funcs_prefix_reuse.test
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/generated_funcs_prefix_reuse.test
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/generated_funcs_prefix_reuse.test
@@ -6,7 +6,7 @@
 # RUN: %update_test_checks --include-generated-funcs %t.ll
 # RUN: diff -u %t.ll %S/Inputs/generated_funcs_prefix_reuse.ll.generated.expected
 ## Also try the --check-globals flag
-# RUN: %update_test_checks %t.ll --check-globals
+# RUN: %update_test_checks %t.ll --check-globals all
 # RUN: diff -u %t.ll %S/Inputs/generated_funcs_prefix_reuse.ll.generated.globals.expected
 
 ## Check that generated functions are not included.
@@ -17,5 +17,5 @@
 # RUN: %update_test_checks %t.ll
 # RUN: diff -u %t.ll %S/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.expected
 ## Also try the --check-globals flag
-# RUN: %update_test_checks %t.ll --check-globals
+# RUN: %update_test_checks %t.ll --check-globals all
 # RUN: diff -u %t.ll %S/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.globals.expected
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/generated_funcs.test
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/generated_funcs.test
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/generated_funcs.test
@@ -6,7 +6,7 @@
 # RUN: %update_test_checks --include-generated-funcs %t.ll
 # RUN: diff -u %t.ll %S/Inputs/generated_funcs.ll.generated.expected
 ## Also try the --check-globals flag
-# RUN: %update_test_checks %t.ll --check-globals
+# RUN: %update_test_checks %t.ll --check-globals all
 # RUN: diff -u %t.ll %S/Inputs/generated_funcs.ll.generated.globals.expected
 
 ## Check that generated functions are not included.
@@ -17,5 +17,5 @@
 # RUN: %update_test_checks %t.ll
 # RUN: diff -u %t.ll %S/Inputs/generated_funcs.ll.nogenerated.expected
 ## Also try the --check-globals flag
-# RUN: %update_test_checks %t.ll --check-globals
+# RUN: %update_test_checks %t.ll --check-globals all
 # RUN: diff -u %t.ll %S/Inputs/generated_funcs.ll.nogenerated.globals.expected
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals transitive
 ; Just run it through opt, no passes needed.
 ; RUN: opt < %s -S | FileCheck %s
 
@@ -242,3 +242,66 @@
 !60 = !DILocation(line: 11, column: 1, scope: !39)
 !61 = !{!"branch_weights", i32 1, i32 1048575}
 !62 = distinct !DIAssignID()
+;.
+; CHECK: attributes #[[ATTR3]] = { nounwind }
+;.
+; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: [[META1:![0-9]+]], producer: "clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
+; CHECK: [[META1]] = !DIFile(filename: "various_ir_values.c", directory: {{.*}})
+; CHECK: [[META2]] = !{}
+; CHECK: [[META7:![0-9]+]] = distinct !DISubprogram(name: "foo", scope: [[META1]], file: [[META1]], line: 1, type: [[META8:![0-9]+]], scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META12:![0-9]+]])
+; CHECK: [[META8]] = !DISubroutineType(types: [[META9:![0-9]+]])
+; CHECK: [[META9]] = !{null, [[META10:![0-9]+]]}
+; CHECK: [[META10]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META11:![0-9]+]], size: 64)
+; CHECK: [[META11]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+; CHECK: [[META12]] = !{[[META13]], [[META14]]}
+; CHECK: [[META13]] = !DILocalVariable(name: "A", arg: 1, scope: [[META7]], file: [[META1]], line: 1, type: [[META10]])
+; CHECK: [[META14]] = !DILocalVariable(name: "i", scope: [[META15:![0-9]+]], file: [[META1]], line: 3, type: [[META11]])
+; CHECK: [[META15]] = distinct !DILexicalBlock(scope: [[META7]], file: [[META1]], line: 3, column: 3)
+; CHECK: [[DIASSIGNID16]] = distinct !DIAssignID()
+; CHECK: [[DBG17]] = !DILocation(line: 1, column: 15, scope: [[META7]])
+; CHECK: [[TBAA18]] = !{[[META19:![0-9]+]], [[META19]], i64 0}
+; CHECK: [[META19]] = !{!"any pointer", [[META20:![0-9]+]], i64 0}
+; CHECK: [[META20]] = !{!"omnipotent char", [[META21:![0-9]+]], i64 0}
+; CHECK: [[META21]] = !{!"Simple C/C++ TBAA"}
+; CHECK: [[DBG22]] = !DILocation(line: 3, column: 8, scope: [[META15]])
+; CHECK: [[DBG23]] = !DILocation(line: 3, column: 12, scope: [[META15]])
+; CHECK: [[TBAA24]] = !{[[META25:![0-9]+]], [[META25]], i64 0}
+; CHECK: [[META25]] = !{!"int", [[META20]], i64 0}
+; CHECK: [[DBG26]] = !DILocation(line: 3, column: 19, scope: [[META27:![0-9]+]])
+; CHECK: [[META27]] = distinct !DILexicalBlock(scope: [[META15]], file: [[META1]], line: 3, column: 3)
+; CHECK: [[DBG28]] = !DILocation(line: 3, column: 24, scope: [[META27]])
+; CHECK: [[DBG29]] = !DILocation(line: 3, column: 23, scope: [[META27]])
+; CHECK: [[DBG30]] = !DILocation(line: 3, column: 21, scope: [[META27]])
+; CHECK: [[DBG31]] = !DILocation(line: 3, column: 3, scope: [[META15]])
+; CHECK: [[PROF32]] = !{!"branch_weights", i32 1, i32 1048575}
+; CHECK: [[DBG33]] = !DILocation(line: 3, column: 3, scope: [[META27]])
+; CHECK: [[DBG34]] = !DILocation(line: 4, column: 5, scope: [[META27]])
+; CHECK: [[DBG35]] = !DILocation(line: 4, column: 7, scope: [[META27]])
+; CHECK: [[DBG36]] = !DILocation(line: 4, column: 10, scope: [[META27]])
+; CHECK: [[DBG37]] = !DILocation(line: 3, column: 27, scope: [[META27]])
+; CHECK: [[LOOP38]] = distinct !{[[LOOP38]], [[DBG31]], [[META39:![0-9]+]]}
+; CHECK: [[META39]] = !DILocation(line: 4, column: 12, scope: [[META15]])
+; CHECK: [[DBG40]] = !DILocation(line: 5, column: 1, scope: [[META7]])
+; CHECK: [[META41:![0-9]+]] = distinct !DISubprogram(name: "bar", scope: [[META1]], file: [[META1]], line: 7, type: [[META8]], scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META42:![0-9]+]])
+; CHECK: [[META42]] = !{[[META43]], [[META44]]}
+; CHECK: [[META43]] = !DILocalVariable(name: "A", arg: 1, scope: [[META41]], file: [[META1]], line: 7, type: [[META10]])
+; CHECK: [[META44]] = !DILocalVariable(name: "i", scope: [[META45:![0-9]+]], file: [[META1]], line: 9, type: [[META11]])
+; CHECK: [[META45]] = distinct !DILexicalBlock(scope: [[META41]], file: [[META1]], line: 9, column: 3)
+; CHECK: [[DBG46]] = !DILocation(line: 7, column: 15, scope: [[META41]])
+; CHECK: [[DBG47]] = !DILocation(line: 9, column: 8, scope: [[META45]])
+; CHECK: [[DBG48]] = !DILocation(line: 9, column: 12, scope: [[META45]])
+; CHECK: [[DBG49]] = !DILocation(line: 9, column: 19, scope: [[META50:![0-9]+]])
+; CHECK: [[META50]] = distinct !DILexicalBlock(scope: [[META45]], file: [[META1]], line: 9, column: 3)
+; CHECK: [[DBG51]] = !DILocation(line: 9, column: 24, scope: [[META50]])
+; CHECK: [[DBG52]] = !DILocation(line: 9, column: 23, scope: [[META50]])
+; CHECK: [[DBG53]] = !DILocation(line: 9, column: 21, scope: [[META50]])
+; CHECK: [[DBG54]] = !DILocation(line: 9, column: 3, scope: [[META45]])
+; CHECK: [[DBG55]] = !DILocation(line: 9, column: 3, scope: [[META50]])
+; CHECK: [[DBG56]] = !DILocation(line: 10, column: 5, scope: [[META50]])
+; CHECK: [[DBG57]] = !DILocation(line: 10, column: 7, scope: [[META50]])
+; CHECK: [[DBG58]] = !DILocation(line: 10, column: 10, scope: [[META50]])
+; CHECK: [[DBG59]] = !DILocation(line: 9, column: 27, scope: [[META50]])
+; CHECK: [[LOOP60]] = distinct !{[[LOOP60]], [[DBG54]], [[META61:![0-9]+]]}
+; CHECK: [[META61]] = !DILocation(line: 10, column: 12, scope: [[META45]])
+; CHECK: [[DBG62]] = !DILocation(line: 11, column: 1, scope: [[META41]])
+;.
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.noglobals.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.noglobals.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.noglobals.expected
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals none
 ; Just run it through opt, no passes needed.
 ; RUN: opt < %s -S | FileCheck %s
 
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals all
 ; Just run it through opt, no passes needed.
 ; RUN: opt < %s -S | FileCheck %s
 
@@ -250,67 +250,67 @@
 ; CHECK: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
 ; CHECK: attributes #[[ATTR3]] = { nounwind }
 ;.
-; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (g...@github.com:llvm/llvm-project.git 1d5da8cd30fce1c0a2c2fa6ba656dbfaa36192c8)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
-; CHECK: [[META1:![0-9]+]] = !DIFile(filename: "various_ir_values.c", directory: "/data/build/llvm-project")
-; CHECK: [[META2:![0-9]+]] = !{}
+; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: [[META1:![0-9]+]], producer: "clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
+; CHECK: [[META1]] = !DIFile(filename: "various_ir_values.c", directory: {{.*}})
+; CHECK: [[META2]] = !{}
 ; CHECK: [[META3:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 4}
 ; CHECK: [[META4:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
 ; CHECK: [[META5:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
-; CHECK: [[META6:![0-9]+]] = !{!"clang version 11.0.0 (g...@github.com:llvm/llvm-project.git 1d5da8cd30fce1c0a2c2fa6ba656dbfaa36192c8)"}
-; CHECK: [[DBG7]] = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)
-; CHECK: [[META8:![0-9]+]] = !DISubroutineType(types: !9)
-; CHECK: [[META9:![0-9]+]] = !{null, !10}
-; CHECK: [[META10:![0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
-; CHECK: [[META11:![0-9]+]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-; CHECK: [[META12:![0-9]+]] = !{!13, !14}
-; CHECK: [[META13]] = !DILocalVariable(name: "A", arg: 1, scope: !7, file: !1, line: 1, type: !10)
-; CHECK: [[META14]] = !DILocalVariable(name: "i", scope: !15, file: !1, line: 3, type: !11)
-; CHECK: [[META15:![0-9]+]] = distinct !DILexicalBlock(scope: !7, file: !1, line: 3, column: 3)
+; CHECK: [[META6:![0-9]+]] = !{!"clang version {{.*}}"}
+; CHECK: [[DBG7]] = distinct !DISubprogram(name: "foo", scope: [[META1]], file: [[META1]], line: 1, type: [[META8:![0-9]+]], scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META12:![0-9]+]])
+; CHECK: [[META8]] = !DISubroutineType(types: [[META9:![0-9]+]])
+; CHECK: [[META9]] = !{null, [[META10:![0-9]+]]}
+; CHECK: [[META10]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META11:![0-9]+]], size: 64)
+; CHECK: [[META11]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+; CHECK: [[META12]] = !{[[META13]], [[META14]]}
+; CHECK: [[META13]] = !DILocalVariable(name: "A", arg: 1, scope: [[DBG7]], file: [[META1]], line: 1, type: [[META10]])
+; CHECK: [[META14]] = !DILocalVariable(name: "i", scope: [[META15:![0-9]+]], file: [[META1]], line: 3, type: [[META11]])
+; CHECK: [[META15]] = distinct !DILexicalBlock(scope: [[DBG7]], file: [[META1]], line: 3, column: 3)
 ; CHECK: [[DIASSIGNID16]] = distinct !DIAssignID()
-; CHECK: [[DBG17]] = !DILocation(line: 1, column: 15, scope: !7)
-; CHECK: [[TBAA18]] = !{!19, !19, i64 0}
-; CHECK: [[META19:![0-9]+]] = !{!"any pointer", !20, i64 0}
-; CHECK: [[META20:![0-9]+]] = !{!"omnipotent char", !21, i64 0}
-; CHECK: [[META21:![0-9]+]] = !{!"Simple C/C++ TBAA"}
-; CHECK: [[DBG22]] = !DILocation(line: 3, column: 8, scope: !15)
-; CHECK: [[DBG23]] = !DILocation(line: 3, column: 12, scope: !15)
-; CHECK: [[TBAA24]] = !{!25, !25, i64 0}
-; CHECK: [[META25:![0-9]+]] = !{!"int", !20, i64 0}
-; CHECK: [[DBG26]] = !DILocation(line: 3, column: 19, scope: !27)
-; CHECK: [[META27:![0-9]+]] = distinct !DILexicalBlock(scope: !15, file: !1, line: 3, column: 3)
-; CHECK: [[DBG28]] = !DILocation(line: 3, column: 24, scope: !27)
-; CHECK: [[DBG29]] = !DILocation(line: 3, column: 23, scope: !27)
-; CHECK: [[DBG30]] = !DILocation(line: 3, column: 21, scope: !27)
-; CHECK: [[DBG31]] = !DILocation(line: 3, column: 3, scope: !15)
+; CHECK: [[DBG17]] = !DILocation(line: 1, column: 15, scope: [[DBG7]])
+; CHECK: [[TBAA18]] = !{[[META19:![0-9]+]], [[META19]], i64 0}
+; CHECK: [[META19]] = !{!"any pointer", [[META20:![0-9]+]], i64 0}
+; CHECK: [[META20]] = !{!"omnipotent char", [[META21:![0-9]+]], i64 0}
+; CHECK: [[META21]] = !{!"Simple C/C++ TBAA"}
+; CHECK: [[DBG22]] = !DILocation(line: 3, column: 8, scope: [[META15]])
+; CHECK: [[DBG23]] = !DILocation(line: 3, column: 12, scope: [[META15]])
+; CHECK: [[TBAA24]] = !{[[META25:![0-9]+]], [[META25]], i64 0}
+; CHECK: [[META25]] = !{!"int", [[META20]], i64 0}
+; CHECK: [[DBG26]] = !DILocation(line: 3, column: 19, scope: [[META27:![0-9]+]])
+; CHECK: [[META27]] = distinct !DILexicalBlock(scope: [[META15]], file: [[META1]], line: 3, column: 3)
+; CHECK: [[DBG28]] = !DILocation(line: 3, column: 24, scope: [[META27]])
+; CHECK: [[DBG29]] = !DILocation(line: 3, column: 23, scope: [[META27]])
+; CHECK: [[DBG30]] = !DILocation(line: 3, column: 21, scope: [[META27]])
+; CHECK: [[DBG31]] = !DILocation(line: 3, column: 3, scope: [[META15]])
 ; CHECK: [[PROF32]] = !{!"branch_weights", i32 1, i32 1048575}
-; CHECK: [[DBG33]] = !DILocation(line: 3, column: 3, scope: !27)
-; CHECK: [[DBG34]] = !DILocation(line: 4, column: 5, scope: !27)
-; CHECK: [[DBG35]] = !DILocation(line: 4, column: 7, scope: !27)
-; CHECK: [[DBG36]] = !DILocation(line: 4, column: 10, scope: !27)
-; CHECK: [[DBG37]] = !DILocation(line: 3, column: 27, scope: !27)
-; CHECK: [[LOOP38]] = distinct !{!38, !31, !39}
-; CHECK: [[META39:![0-9]+]] = !DILocation(line: 4, column: 12, scope: !15)
-; CHECK: [[DBG40]] = !DILocation(line: 5, column: 1, scope: !7)
-; CHECK: [[DBG41]] = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 7, type: !8, scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !42)
-; CHECK: [[META42:![0-9]+]] = !{!43, !44}
-; CHECK: [[META43]] = !DILocalVariable(name: "A", arg: 1, scope: !41, file: !1, line: 7, type: !10)
-; CHECK: [[META44]] = !DILocalVariable(name: "i", scope: !45, file: !1, line: 9, type: !11)
-; CHECK: [[META45:![0-9]+]] = distinct !DILexicalBlock(scope: !41, file: !1, line: 9, column: 3)
-; CHECK: [[DBG46]] = !DILocation(line: 7, column: 15, scope: !41)
-; CHECK: [[DBG47]] = !DILocation(line: 9, column: 8, scope: !45)
-; CHECK: [[DBG48]] = !DILocation(line: 9, column: 12, scope: !45)
-; CHECK: [[DBG49]] = !DILocation(line: 9, column: 19, scope: !50)
-; CHECK: [[META50:![0-9]+]] = distinct !DILexicalBlock(scope: !45, file: !1, line: 9, column: 3)
-; CHECK: [[DBG51]] = !DILocation(line: 9, column: 24, scope: !50)
-; CHECK: [[DBG52]] = !DILocation(line: 9, column: 23, scope: !50)
-; CHECK: [[DBG53]] = !DILocation(line: 9, column: 21, scope: !50)
-; CHECK: [[DBG54]] = !DILocation(line: 9, column: 3, scope: !45)
-; CHECK: [[DBG55]] = !DILocation(line: 9, column: 3, scope: !50)
-; CHECK: [[DBG56]] = !DILocation(line: 10, column: 5, scope: !50)
-; CHECK: [[DBG57]] = !DILocation(line: 10, column: 7, scope: !50)
-; CHECK: [[DBG58]] = !DILocation(line: 10, column: 10, scope: !50)
-; CHECK: [[DBG59]] = !DILocation(line: 9, column: 27, scope: !50)
-; CHECK: [[LOOP60]] = distinct !{!60, !54, !61}
-; CHECK: [[META61:![0-9]+]] = !DILocation(line: 10, column: 12, scope: !45)
-; CHECK: [[DBG62]] = !DILocation(line: 11, column: 1, scope: !41)
+; CHECK: [[DBG33]] = !DILocation(line: 3, column: 3, scope: [[META27]])
+; CHECK: [[DBG34]] = !DILocation(line: 4, column: 5, scope: [[META27]])
+; CHECK: [[DBG35]] = !DILocation(line: 4, column: 7, scope: [[META27]])
+; CHECK: [[DBG36]] = !DILocation(line: 4, column: 10, scope: [[META27]])
+; CHECK: [[DBG37]] = !DILocation(line: 3, column: 27, scope: [[META27]])
+; CHECK: [[LOOP38]] = distinct !{[[LOOP38]], [[DBG31]], [[META39:![0-9]+]]}
+; CHECK: [[META39]] = !DILocation(line: 4, column: 12, scope: [[META15]])
+; CHECK: [[DBG40]] = !DILocation(line: 5, column: 1, scope: [[DBG7]])
+; CHECK: [[DBG41]] = distinct !DISubprogram(name: "bar", scope: [[META1]], file: [[META1]], line: 7, type: [[META8]], scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META42:![0-9]+]])
+; CHECK: [[META42]] = !{[[META43]], [[META44]]}
+; CHECK: [[META43]] = !DILocalVariable(name: "A", arg: 1, scope: [[DBG41]], file: [[META1]], line: 7, type: [[META10]])
+; CHECK: [[META44]] = !DILocalVariable(name: "i", scope: [[META45:![0-9]+]], file: [[META1]], line: 9, type: [[META11]])
+; CHECK: [[META45]] = distinct !DILexicalBlock(scope: [[DBG41]], file: [[META1]], line: 9, column: 3)
+; CHECK: [[DBG46]] = !DILocation(line: 7, column: 15, scope: [[DBG41]])
+; CHECK: [[DBG47]] = !DILocation(line: 9, column: 8, scope: [[META45]])
+; CHECK: [[DBG48]] = !DILocation(line: 9, column: 12, scope: [[META45]])
+; CHECK: [[DBG49]] = !DILocation(line: 9, column: 19, scope: [[META50:![0-9]+]])
+; CHECK: [[META50]] = distinct !DILexicalBlock(scope: [[META45]], file: [[META1]], line: 9, column: 3)
+; CHECK: [[DBG51]] = !DILocation(line: 9, column: 24, scope: [[META50]])
+; CHECK: [[DBG52]] = !DILocation(line: 9, column: 23, scope: [[META50]])
+; CHECK: [[DBG53]] = !DILocation(line: 9, column: 21, scope: [[META50]])
+; CHECK: [[DBG54]] = !DILocation(line: 9, column: 3, scope: [[META45]])
+; CHECK: [[DBG55]] = !DILocation(line: 9, column: 3, scope: [[META50]])
+; CHECK: [[DBG56]] = !DILocation(line: 10, column: 5, scope: [[META50]])
+; CHECK: [[DBG57]] = !DILocation(line: 10, column: 7, scope: [[META50]])
+; CHECK: [[DBG58]] = !DILocation(line: 10, column: 10, scope: [[META50]])
+; CHECK: [[DBG59]] = !DILocation(line: 9, column: 27, scope: [[META50]])
+; CHECK: [[LOOP60]] = distinct !{[[LOOP60]], [[DBG54]], [[META61:![0-9]+]]}
+; CHECK: [[META61]] = !DILocation(line: 10, column: 12, scope: [[META45]])
+; CHECK: [[DBG62]] = !DILocation(line: 11, column: 1, scope: [[DBG41]])
 ;.
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.expected
@@ -244,3 +244,48 @@
 !60 = !DILocation(line: 11, column: 1, scope: !39)
 !61 = !{!"branch_weights", i32 1, i32 1048575}
 !62 = distinct !DIAssignID()
+;.
+; CHECK: attributes #[[ATTR0]] = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "denormal-fp-math"="ieee,ieee" "denormal-fp-math-f32"="ieee,ieee" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+; CHECK: attributes #[[ATTR3]] = { nounwind }
+;.
+; CHECK: [[DBG7]] = distinct !DISubprogram(name: "foo", scope: [[META1:![0-9]+]], file: [[META1]], line: 1, type: [[META8:![0-9]+]], scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0:![0-9]+]], retainedNodes: [[META12:![0-9]+]])
+; CHECK: [[META13]] = !DILocalVariable(name: "A", arg: 1, scope: [[DBG7]], file: [[META1]], line: 1, type: [[META10:![0-9]+]])
+; CHECK: [[META14]] = !DILocalVariable(name: "i", scope: [[META15:![0-9]+]], file: [[META1]], line: 3, type: [[META11:![0-9]+]])
+; CHECK: [[DIASSIGNID16]] = distinct !DIAssignID()
+; CHECK: [[DBG17]] = !DILocation(line: 1, column: 15, scope: [[DBG7]])
+; CHECK: [[TBAA18]] = !{[[META19:![0-9]+]], [[META19]], i64 0}
+; CHECK: [[DBG22]] = !DILocation(line: 3, column: 8, scope: [[META15]])
+; CHECK: [[DBG23]] = !DILocation(line: 3, column: 12, scope: [[META15]])
+; CHECK: [[TBAA24]] = !{[[META25:![0-9]+]], [[META25]], i64 0}
+; CHECK: [[DBG26]] = !DILocation(line: 3, column: 19, scope: [[META27:![0-9]+]])
+; CHECK: [[DBG28]] = !DILocation(line: 3, column: 24, scope: [[META27]])
+; CHECK: [[DBG29]] = !DILocation(line: 3, column: 23, scope: [[META27]])
+; CHECK: [[DBG30]] = !DILocation(line: 3, column: 21, scope: [[META27]])
+; CHECK: [[DBG31]] = !DILocation(line: 3, column: 3, scope: [[META15]])
+; CHECK: [[PROF32]] = !{!"branch_weights", i32 1, i32 1048575}
+; CHECK: [[DBG33]] = !DILocation(line: 3, column: 3, scope: [[META27]])
+; CHECK: [[DBG34]] = !DILocation(line: 4, column: 5, scope: [[META27]])
+; CHECK: [[DBG35]] = !DILocation(line: 4, column: 7, scope: [[META27]])
+; CHECK: [[DBG36]] = !DILocation(line: 4, column: 10, scope: [[META27]])
+; CHECK: [[DBG37]] = !DILocation(line: 3, column: 27, scope: [[META27]])
+; CHECK: [[LOOP38]] = distinct !{[[LOOP38]], [[DBG31]], [[META39:![0-9]+]]}
+; CHECK: [[DBG40]] = !DILocation(line: 5, column: 1, scope: [[DBG7]])
+; CHECK: [[DBG41]] = distinct !DISubprogram(name: "bar", scope: [[META1]], file: [[META1]], line: 7, type: [[META8]], scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META42:![0-9]+]])
+; CHECK: [[META43]] = !DILocalVariable(name: "A", arg: 1, scope: [[DBG41]], file: [[META1]], line: 7, type: [[META10]])
+; CHECK: [[META44]] = !DILocalVariable(name: "i", scope: [[META45:![0-9]+]], file: [[META1]], line: 9, type: [[META11]])
+; CHECK: [[DBG46]] = !DILocation(line: 7, column: 15, scope: [[DBG41]])
+; CHECK: [[DBG47]] = !DILocation(line: 9, column: 8, scope: [[META45]])
+; CHECK: [[DBG48]] = !DILocation(line: 9, column: 12, scope: [[META45]])
+; CHECK: [[DBG49]] = !DILocation(line: 9, column: 19, scope: [[META50:![0-9]+]])
+; CHECK: [[DBG51]] = !DILocation(line: 9, column: 24, scope: [[META50]])
+; CHECK: [[DBG52]] = !DILocation(line: 9, column: 23, scope: [[META50]])
+; CHECK: [[DBG53]] = !DILocation(line: 9, column: 21, scope: [[META50]])
+; CHECK: [[DBG54]] = !DILocation(line: 9, column: 3, scope: [[META45]])
+; CHECK: [[DBG55]] = !DILocation(line: 9, column: 3, scope: [[META50]])
+; CHECK: [[DBG56]] = !DILocation(line: 10, column: 5, scope: [[META50]])
+; CHECK: [[DBG57]] = !DILocation(line: 10, column: 7, scope: [[META50]])
+; CHECK: [[DBG58]] = !DILocation(line: 10, column: 10, scope: [[META50]])
+; CHECK: [[DBG59]] = !DILocation(line: 9, column: 27, scope: [[META50]])
+; CHECK: [[LOOP60]] = distinct !{[[LOOP60]], [[DBG54]], [[META61:![0-9]+]]}
+; CHECK: [[DBG62]] = !DILocation(line: 11, column: 1, scope: [[DBG41]])
+;.
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.expected
@@ -242,3 +242,45 @@
 !60 = !DILocation(line: 11, column: 1, scope: !39)
 !61 = !{!"branch_weights", i32 1, i32 1048575}
 !62 = distinct !DIAssignID()
+;.
+; CHECK: attributes #[[ATTR3]] = { nounwind }
+;.
+; CHECK: [[META13]] = !DILocalVariable(name: "A", arg: 1, scope: [[META7:![0-9]+]], file: [[META1:![0-9]+]], line: 1, type: [[META10:![0-9]+]])
+; CHECK: [[META14]] = !DILocalVariable(name: "i", scope: [[META15:![0-9]+]], file: [[META1]], line: 3, type: [[META11:![0-9]+]])
+; CHECK: [[DIASSIGNID16]] = distinct !DIAssignID()
+; CHECK: [[DBG17]] = !DILocation(line: 1, column: 15, scope: [[META7]])
+; CHECK: [[TBAA18]] = !{[[META19:![0-9]+]], [[META19]], i64 0}
+; CHECK: [[DBG22]] = !DILocation(line: 3, column: 8, scope: [[META15]])
+; CHECK: [[DBG23]] = !DILocation(line: 3, column: 12, scope: [[META15]])
+; CHECK: [[TBAA24]] = !{[[META25:![0-9]+]], [[META25]], i64 0}
+; CHECK: [[DBG26]] = !DILocation(line: 3, column: 19, scope: [[META27:![0-9]+]])
+; CHECK: [[DBG28]] = !DILocation(line: 3, column: 24, scope: [[META27]])
+; CHECK: [[DBG29]] = !DILocation(line: 3, column: 23, scope: [[META27]])
+; CHECK: [[DBG30]] = !DILocation(line: 3, column: 21, scope: [[META27]])
+; CHECK: [[DBG31]] = !DILocation(line: 3, column: 3, scope: [[META15]])
+; CHECK: [[PROF32]] = !{!"branch_weights", i32 1, i32 1048575}
+; CHECK: [[DBG33]] = !DILocation(line: 3, column: 3, scope: [[META27]])
+; CHECK: [[DBG34]] = !DILocation(line: 4, column: 5, scope: [[META27]])
+; CHECK: [[DBG35]] = !DILocation(line: 4, column: 7, scope: [[META27]])
+; CHECK: [[DBG36]] = !DILocation(line: 4, column: 10, scope: [[META27]])
+; CHECK: [[DBG37]] = !DILocation(line: 3, column: 27, scope: [[META27]])
+; CHECK: [[LOOP38]] = distinct !{[[LOOP38]], [[DBG31]], [[META39:![0-9]+]]}
+; CHECK: [[DBG40]] = !DILocation(line: 5, column: 1, scope: [[META7]])
+; CHECK: [[META43]] = !DILocalVariable(name: "A", arg: 1, scope: [[META41:![0-9]+]], file: [[META1]], line: 7, type: [[META10]])
+; CHECK: [[META44]] = !DILocalVariable(name: "i", scope: [[META45:![0-9]+]], file: [[META1]], line: 9, type: [[META11]])
+; CHECK: [[DBG46]] = !DILocation(line: 7, column: 15, scope: [[META41]])
+; CHECK: [[DBG47]] = !DILocation(line: 9, column: 8, scope: [[META45]])
+; CHECK: [[DBG48]] = !DILocation(line: 9, column: 12, scope: [[META45]])
+; CHECK: [[DBG49]] = !DILocation(line: 9, column: 19, scope: [[META50:![0-9]+]])
+; CHECK: [[DBG51]] = !DILocation(line: 9, column: 24, scope: [[META50]])
+; CHECK: [[DBG52]] = !DILocation(line: 9, column: 23, scope: [[META50]])
+; CHECK: [[DBG53]] = !DILocation(line: 9, column: 21, scope: [[META50]])
+; CHECK: [[DBG54]] = !DILocation(line: 9, column: 3, scope: [[META45]])
+; CHECK: [[DBG55]] = !DILocation(line: 9, column: 3, scope: [[META50]])
+; CHECK: [[DBG56]] = !DILocation(line: 10, column: 5, scope: [[META50]])
+; CHECK: [[DBG57]] = !DILocation(line: 10, column: 7, scope: [[META50]])
+; CHECK: [[DBG58]] = !DILocation(line: 10, column: 10, scope: [[META50]])
+; CHECK: [[DBG59]] = !DILocation(line: 9, column: 27, scope: [[META50]])
+; CHECK: [[LOOP60]] = distinct !{[[LOOP60]], [[DBG54]], [[META61:![0-9]+]]}
+; CHECK: [[DBG62]] = !DILocation(line: 11, column: 1, scope: [[META41]])
+;.
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/scrub_attrs.ll.plain.expected
@@ -11,3 +11,6 @@
   call void @foo() readnone
   ret void
 }
+;.
+; CHECK: attributes #[[ATTR0]] = { memory(none) }
+;.
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/pre-process.ll.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/pre-process.ll.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/pre-process.ll.expected
@@ -36,3 +36,12 @@
 entry:
   ret ptr addrspace(200) %arg
 }
+;.
+; CHECK-AS200: attributes #[[ATTR0]] = { nounwind }
+;.
+; CHECK-AS0: attributes #[[ATTR0]] = { nounwind }
+;.
+; CHECK-AS1: attributes #[[ATTR0]] = { nounwind }
+;.
+; CHECK-AS200-NOOP-PRE-PROCESS: attributes #[[ATTR0]] = { nounwind }
+;.
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.globals.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.globals.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.globals.expected
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all
 ; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s --check-prefix=REUSE
 ; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s --check-prefix=REUSE
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.nogenerated.expected
@@ -56,3 +56,6 @@
 
 declare void @llvm.trap() noreturn cold
 declare void @_Z10sideeffectv()
+;.
+; REUSE: attributes #[[ATTR2]] = { noinline }
+;.
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.generated.globals.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.generated.globals.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.generated.globals.expected
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --include-generated-funcs
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs
 ; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s --check-prefix=REUSE
 ; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s --check-prefix=REUSE
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.generated.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.generated.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs_prefix_reuse.ll.generated.expected
@@ -75,3 +75,6 @@
 ; REUSE-NEXT:    call void @llvm.trap()
 ; REUSE-NEXT:    unreachable
 ;
+;.
+; REUSE: attributes #[[ATTR2]] = { noinline }
+;.
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.globals.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.globals.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.globals.expected
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all
 ; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.14.0"
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.nogenerated.expected
@@ -55,3 +55,6 @@
 
 declare void @llvm.trap() noreturn cold
 declare void @_Z10sideeffectv()
+;.
+; CHECK: attributes #[[ATTR2]] = { noinline }
+;.
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.globals.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.globals.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.globals.expected
@@ -1,4 +1,4 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --include-generated-funcs
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs
 ; RUN: opt -passes=hotcoldsplit -hotcoldsplit-threshold=0 -S < %s | FileCheck %s
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.14.0"
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/generated_funcs.ll.generated.expected
@@ -74,3 +74,6 @@
 ; CHECK-NEXT:    call void @llvm.trap()
 ; CHECK-NEXT:    unreachable
 ;
+;.
+; CHECK: attributes #[[ATTR2]] = { noinline }
+;.
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
@@ -16,6 +16,9 @@
   %arrayidx = getelementptr inbounds %struct.ST, ptr %s, i64 1, i32 2, i32 1, i64 5, i64 13
   ret ptr %arrayidx
 }
+;.
+; CHECK: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind optsize ssp willreturn memory(none) uwtable }
+;.
 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
 ; IS__CGSCC____: {{.*}}
 ; IS__TUNIT____: {{.*}}
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
@@ -17,6 +17,9 @@
   %arrayidx = getelementptr inbounds %struct.ST, ptr %s, i64 1, i32 2, i32 1, i64 5, i64 13
   ret ptr %arrayidx
 }
+;.
+; CHECK: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind optsize ssp willreturn memory(none) uwtable }
+;.
 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
 ; IS__CGSCC____: {{.*}}
 ; IS__TUNIT____: {{.*}}
Index: clang/test/utils/update_cc_test_checks/global-value-regex.test
===================================================================
--- clang/test/utils/update_cc_test_checks/global-value-regex.test
+++ clang/test/utils/update_cc_test_checks/global-value-regex.test
@@ -2,7 +2,7 @@
 
 # Check --global-value-regex.
 RUN: cp %S/Inputs/global-value-regex.c %t/test.c
-RUN: %update_cc_test_checks %t/test.c --check-globals \
+RUN: %update_cc_test_checks %t/test.c --check-globals all\
 RUN:   --global-value-regex "foo\.."
 RUN: diff -u %S/Inputs/global-value-regex.c.expected %t/test.c
 
Index: clang/test/utils/update_cc_test_checks/global-hex-value-regex.test
===================================================================
--- clang/test/utils/update_cc_test_checks/global-hex-value-regex.test
+++ clang/test/utils/update_cc_test_checks/global-hex-value-regex.test
@@ -2,7 +2,7 @@
 
 # Check --global-hex-value-regex.
 RUN: cp %S/Inputs/global-hex-value-regex.c %t/test.c
-RUN: %update_cc_test_checks %t/test.c --check-globals \
+RUN: %update_cc_test_checks %t/test.c --check-globals all\
 RUN:     --global-value-regex "foo\..*" "bar\..*" \
 RUN:     --global-hex-value-regex ".*\.hex"
 RUN: diff -u %S/Inputs/global-hex-value-regex.c.expected %t/test.c
Index: clang/test/utils/update_cc_test_checks/generated-funcs.test
===================================================================
--- clang/test/utils/update_cc_test_checks/generated-funcs.test
+++ clang/test/utils/update_cc_test_checks/generated-funcs.test
@@ -1,8 +1,8 @@
 ## Test that CHECK lines are generated for clang-generated functions
 
-# RUN: cp %S/Inputs/generated-funcs.c %t-generated.c && %update_cc_test_checks --include-generated-funcs %t-generated.c
+# RUN: cp %S/Inputs/generated-funcs.c %t-generated.c && %update_cc_test_checks --include-generated-funcs --check-globals transitive %t-generated.c
 # RUN: diff -u %S/Inputs/generated-funcs.c.generated.expected %t-generated.c
-# RUN: cp %S/Inputs/generated-funcs.c %t-no-generated.c && %update_cc_test_checks %t-no-generated.c
+# RUN: cp %S/Inputs/generated-funcs.c %t-no-generated.c && %update_cc_test_checks --check-globals transitive %t-no-generated.c
 # RUN: diff -u %S/Inputs/generated-funcs.c.no-generated.expected %t-no-generated.c
 
 ## Check that re-running update_cc_test_checks doesn't change the output
Index: clang/test/utils/update_cc_test_checks/check-globals.test
===================================================================
--- clang/test/utils/update_cc_test_checks/check-globals.test
+++ clang/test/utils/update_cc_test_checks/check-globals.test
@@ -1,26 +1,26 @@
 RUN: rm -rf %t && mkdir %t
 
-# Check --check-globals in normal mode and in --include-generated-funcs mode.
+# Check --check-globals all in normal mode and in --include-generated-funcs mode.
 
 RUN: cp %S/Inputs/check-globals.c %t/norm.c
-RUN: %update_cc_test_checks %t/norm.c --check-globals
+RUN: %update_cc_test_checks %t/norm.c --check-globals all
 RUN: FileCheck %s --input-file=%t/norm.c --match-full-lines -strict-whitespace \
 RUN:   -check-prefixes=BOTH,NRM
 
 RUN: cp %S/Inputs/check-globals.c %t/igf.c
-RUN: %update_cc_test_checks %t/igf.c --check-globals --include-generated-funcs
+RUN: %update_cc_test_checks %t/igf.c --check-globals all --include-generated-funcs
 RUN: FileCheck %s --input-file=%t/igf.c --match-full-lines -strict-whitespace \
 RUN:   -check-prefixes=BOTH,IGF
 
 # Check that repeating doesn't change it, such as duplicating '//.' occurrences.
 
 RUN: cp %t/norm.c %t/norm-again.c
-RUN: %update_cc_test_checks %t/norm-again.c --check-globals
+RUN: %update_cc_test_checks %t/norm-again.c --check-globals all
 RUN: diff -u %t/norm.c %t/norm-again.c
 RUN: rm %t/norm-again.c
 
 RUN: cp %t/igf.c %t/igf-again.c
-RUN: %update_cc_test_checks %t/igf-again.c --check-globals \
+RUN: %update_cc_test_checks %t/igf-again.c --check-globals all \
 RUN:     --include-generated-funcs
 RUN: diff -u %t/igf.c %t/igf-again.c
 RUN: rm %t/igf-again.c
@@ -38,8 +38,8 @@
 END.
 
   BOTH-NOT:{{.}}
-       NRM:// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals
-       IGF:// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --include-generated-funcs
+       NRM:// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all
+       IGF:// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs
  BOTH-NEXT:// {{.*}}
  BOTH-NEXT:// RUN: true
  BOTH-NEXT:// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
@@ -51,10 +51,10 @@
   IGF-NEXT:  static int i, j;
   IGF-NEXT:}
  BOTH-NEXT://.
- BOTH-NEXT:// CHECK: @foo.i = internal global i32 0, align 4
- BOTH-NEXT:// CHECK: @foo.j = internal global i32 0, align 4
- BOTH-NEXT:// CHECK: @bar.i = internal global i32 0, align 4
- BOTH-NEXT:// CHECK: @bar.j = internal global i32 0, align 4
+ BOTH-NEXT:// CHECK: @{{\[\[FOO_I:\[a-zA-Z0-9_\$"\\\\\.-\]\+\]\]}} = internal global i32 0, align 4
+ BOTH-NEXT:// CHECK: @{{\[\[FOO_J:\[a-zA-Z0-9_\$"\\\\\.-\]\+\]\]}} = internal global i32 0, align 4
+ BOTH-NEXT:// CHECK: @{{\[\[BAR_I:\[a-zA-Z0-9_\$"\\\\\.-\]\+\]\]}} = internal global i32 0, align 4
+ BOTH-NEXT:// CHECK: @{{\[\[BAR_J:\[a-zA-Z0-9_\$"\\\\\.-\]\+\]\]}} = internal global i32 0, align 4
  BOTH-NEXT://.
  BOTH-NEXT:// CHECK-LABEL: @foo(
  BOTH-NEXT:// CHECK-NEXT:  entry:
@@ -74,8 +74,8 @@
  BOTH-NEXT://.
  BOTH-NEXT:// CHECK: attributes {{.*}}
  BOTH-NEXT://.
- BOTH-NEXT:// CHECK: !0 = {{.*}}
- BOTH-NEXT:// CHECK: !1 = {{.*}}
+ BOTH-NEXT:// CHECK: {{\[\[META0:!\[0-9\]\+\]\]}} = {{.*}}
+ BOTH-NEXT:// CHECK: {{\[\[META1:!\[0-9\]\+\]\]}} = {{.*}}
  BOTH-NEXT://.
   BOTH-NOT:{{.}}
 
Index: clang/test/utils/update_cc_test_checks/annotations.test
===================================================================
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/annotations.test
@@ -0,0 +1,4 @@
+## Test that !annotation metadata is matched correctly
+
+# RUN: cp %S/Inputs/annotations.c %t.c && %update_cc_test_checks %t.c
+# RUN: diff -u %S/Inputs/annotations.c.expected %t.c
Index: clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/resolve-tmp-conflict.cpp.expected
@@ -23,3 +23,6 @@
   tmp1 = a;
   return;
 }
+//.
+// CHECK: attributes #[[ATTR0]] = { mustprogress noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/replace-value-regex-across-runs.c.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/replace-value-regex-across-runs.c.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/replace-value-regex-across-runs.c.expected
@@ -13,3 +13,6 @@
   #pragma omp target
   ;
 }
+//.
+// CHECK: attributes #[[ATTR2]] = { nounwind }
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.v2.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.v2.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.v2.expected
@@ -41,3 +41,6 @@
 __attribute__((overloadable)) long test(long a, int b, int c) {
   return a + b + c;
 }
+//.
+// CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.v2.expected
@@ -41,3 +41,6 @@
 __attribute__((overloadable)) long test(long a, int b, int c) {
   return a + b + c;
 }
+//.
+// CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/mangled_names.c.funcsig.expected
@@ -41,3 +41,6 @@
 __attribute__((overloadable)) long test(long a, int b, int c) {
   return a + b + c;
 }
+//.
+// CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c.expected
@@ -1,9 +1,9 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --global-value-regex "foo\.."
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --global-value-regex "foo\.."
 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
 
 //.
-// CHECK: @foo.i = internal global i32 0, align 4
-// CHECK: @foo.j = internal global i32 0, align 4
+// CHECK: @[[FOO_I:[a-zA-Z0-9_$"\\.-]+]] = internal global i32 0, align 4
+// CHECK: @[[FOO_J:[a-zA-Z0-9_$"\\.-]+]] = internal global i32 0, align 4
 //.
 // CHECK-LABEL: @foo(
 // CHECK-NEXT:  entry:
Index: clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected
@@ -1,11 +1,11 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --global-value-regex "foo\..*" "bar\..*" --global-hex-value-regex ".*\.hex"
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --global-value-regex "foo\..*" "bar\..*" --global-hex-value-regex ".*\.hex"
 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
 
 //.
-// CHECK: @foo.hex = internal global i32 [[#0x10]], align 4
-// CHECK: @foo.dec = internal global i32 10, align 4
-// CHECK: @bar.hex = internal global i32 [[#0x20]], align 4
-// CHECK: @bar.dec = internal global i32 20, align 4
+// CHECK: @[[FOO_HEX:[a-zA-Z0-9_$"\\.-]+]] = internal global i32 [[#0x10]], align 4
+// CHECK: @[[FOO_DEC:[a-zA-Z0-9_$"\\.-]+]] = internal global i32 10, align 4
+// CHECK: @[[BAR_HEX:[a-zA-Z0-9_$"\\.-]+]] = internal global i32 [[#0x20]], align 4
+// CHECK: @[[BAR_DEC:[a-zA-Z0-9_$"\\.-]+]] = internal global i32 20, align 4
 //.
 // CHECK-LABEL: @foo(
 // CHECK-NEXT:  entry:
Index: clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected
@@ -1,4 +1,4 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals transitive
 // Check that the CHECK lines are generated for clang-generated functions
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o - | FileCheck --check-prefix=OMP %s
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck --check-prefix=NOOMP %s
@@ -98,3 +98,8 @@
     A[i] = 1.0;
   }
 }
+//.
+// NOOMP: [[LOOP2]] = distinct !{[[LOOP2]], [[META3:![0-9]+]]}
+// NOOMP: [[META3]] = !{!"llvm.loop.mustprogress"}
+// NOOMP: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]]}
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected
@@ -1,4 +1,4 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals transitive --include-generated-funcs
 // Check that the CHECK lines are generated for clang-generated functions
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o - | FileCheck --check-prefix=OMP %s
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck --check-prefix=NOOMP %s
@@ -227,3 +227,8 @@
 // NOOMP:       for.end:
 // NOOMP-NEXT:    ret void
 //
+//.
+// NOOMP: [[LOOP2]] = distinct !{[[LOOP2]], [[META3:![0-9]+]]}
+// NOOMP: [[META3]] = !{!"llvm.loop.mustprogress"}
+// NOOMP: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]]}
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected
@@ -34,3 +34,6 @@
 // CHECK-NEXT:    call void @use(i32 noundef [[TMP0]])
 // CHECK-NEXT:    ret void
 //
+//.
+// CHECK: attributes #[[ATTR3]] = { nounwind }
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/explicit-template-instantiation.cpp.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/explicit-template-instantiation.cpp.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/explicit-template-instantiation.cpp.expected
@@ -188,3 +188,6 @@
 // CHECK-NEXT:    ret void
 //
 template struct Baz<long>;
+//.
+// CHECK: attributes #[[ATTR2]] = { nounwind }
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected
@@ -78,3 +78,6 @@
   f.function_defined_inline(2);
   f.function_defined_out_of_line(3);
 }
+//.
+// CHECK: attributes #[[ATTR3]] = { nounwind }
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/annotations.c.expected
===================================================================
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/annotations.c.expected
@@ -0,0 +1,20 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=zero %s -emit-llvm -o - | FileCheck %s
+
+// CHECK-LABEL: @foo(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[X:%.*]] = alloca i32, align 4
+// CHECK-NEXT:    store i32 0, ptr [[X]], align 4, !annotation [[META2:![0-9]+]]
+// CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr [[X]], align 4
+// CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP0]], 1
+// CHECK-NEXT:    store i32 [[ADD]], ptr [[X]], align 4
+// CHECK-NEXT:    [[TMP1:%.*]] = load i32, ptr [[X]], align 4
+// CHECK-NEXT:    ret i32 [[TMP1]]
+//
+int foo() {
+    int x = x + 1;
+    return x;
+}
+//.
+// CHECK: [[META2]] = !{!"auto-init"}
+//.
Index: clang/test/utils/update_cc_test_checks/Inputs/annotations.c
===================================================================
--- /dev/null
+++ clang/test/utils/update_cc_test_checks/Inputs/annotations.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=zero %s -emit-llvm -o - | FileCheck %s
+
+int foo() {
+    int x = x + 1;
+    return x;
+}
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to