diff --git a/llvm/test/Transforms/InstCombine/widen-load-of-small-alloca.ll b/llvm/test/Transforms/InstCombine/widen-load-of-small-alloca.ll --- a/llvm/test/Transforms/InstCombine/widen-load-of-small-alloca.ll +++ b/llvm/test/Transforms/InstCombine/widen-load-of-small-alloca.ll @@ -1,8 +1,8 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -passes=instcombine -data-layout="e-n8:16:32:64" -S %s | FileCheck %s --check-prefixes=CHECK-ALL -; RUN: opt -passes=instcombine -data-layout="e-n8:16:32" -S %s | FileCheck %s --check-prefixes=CHECK-ALL -; RUN: opt -passes=instcombine -data-layout="E-n8:16:32:64" -S %s | FileCheck %s --check-prefixes=CHECK-ALL -; RUN: opt -passes=instcombine -data-layout="E-n8:16:32" -S %s | FileCheck %s --check-prefixes=CHECK-ALL +; RUN: opt -passes=instcombine -data-layout="e-n8:16:32:64" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-64,CHECK-LE-64 +; RUN: opt -passes=instcombine -data-layout="e-n8:16:32" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-32,CHECK-LE-32 +; RUN: opt -passes=instcombine -data-layout="E-n8:16:32:64" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-64,CHECK-BE-64 +; RUN: opt -passes=instcombine -data-layout="E-n8:16:32" -S %s | FileCheck %s --check-prefixes=CHECK-ALL,CHECK-SCALAR,CHECK-SCALAR-32,CHECK-BE-32 define void @load-1byte-chunk-of-1byte-alloca(ptr %src, i64 %byteOff, ptr %escape) { ; CHECK-ALL-LABEL: @load-1byte-chunk-of-1byte-alloca( @@ -607,3 +607,12 @@ declare void @use.v8i8(<8 x i8>) declare void @use.v16i8(<16 x i8>) declare void @use.v32i8(<32 x i8>) +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; CHECK-ALL: {{.*}} +; CHECK-BE-32: {{.*}} +; CHECK-BE-64: {{.*}} +; CHECK-LE-32: {{.*}} +; CHECK-LE-64: {{.*}} +; CHECK-SCALAR: {{.*}} +; CHECK-SCALAR-32: {{.*}} +; CHECK-SCALAR-64: {{.*}} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected @@ -17,3 +17,6 @@ %arrayidx = getelementptr inbounds %struct.ST, %struct.ST* %s, i64 1, i32 2, i32 1, i64 5, i64 13 ret i32* %arrayidx } +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; IS__CGSCC____: {{.*}} +; IS__TUNIT____: {{.*}} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected @@ -16,3 +16,6 @@ %arrayidx = getelementptr inbounds %struct.ST, %struct.ST* %s, i64 1, i32 2, i32 1, i64 5, i64 13 ret i32* %arrayidx } +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; IS__CGSCC____: {{.*}} +; IS__TUNIT____: {{.*}} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected @@ -7,3 +7,5 @@ entry: ret i32 2 } +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; CHECK: {{.*}} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll.expected new file mode 100644 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll.expected @@ -0,0 +1,10 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -O0 -S < %s | FileCheck %s -check-prefix=A +; RUN: opt -O3 -S < %s | FileCheck %s -check-prefix=A + +define i32 @foo(i32 %i) { + %r = add i32 1, 1 + ret i32 %r +} +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; A: {{.*}} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected @@ -25,3 +25,16 @@ ; ret void } +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; ALL_BUT_FOUR: {{.*}} +; ALL_BUT_ONE: {{.*}} +; ALL_BUT_THREE: {{.*}} +; ALL_BUT_TWO: {{.*}} +; FOUR: {{.*}} +; ONE: {{.*}} +; ONE_AND_THREE: {{.*}} +; ONE_AND_TWO: {{.*}} +; THREE_AND_FOUR: {{.*}} +; TWO: {{.*}} +; TWO_AND_FOUR: {{.*}} +; TWO_AND_THREE: {{.*}} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test @@ -1,6 +1,3 @@ # RUN: cp -f %S/Inputs/prefix-never-matches.ll %t.ll -# RUN: %update_test_checks %t.ll 2>&1 | FileCheck %s -# RUN: FileCheck --input-file=%t.ll %s --check-prefix=OUTPUT - -# CHECK: WARNING: Prefix A had conflicting output -# OUTPUT-NOT: A: \ No newline at end of file +# RUN: %update_test_checks %t.ll +# RUN: diff -u %t.ll %S/Inputs/prefix-never-matches.ll.expected \ No newline at end of file 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 @@ -1123,6 +1123,7 @@ if printed_prefixes: output_lines.append(comment_marker + SEPARATOR) + return printed_prefixes def check_prefix(prefix): 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 @@ -150,7 +150,7 @@ lambda args: ti.args.include_generated_funcs, '--include-generated-funcs', True) - + generated_prefixes = [] if include_generated_funcs: # Generate the appropriate checks for each function. We need to emit # these in the order according to the generated output so that CHECK-LABEL @@ -163,17 +163,26 @@ args = ti.args if args.check_globals: - 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)) # Now generate all the checks. - common.add_checks_at_end(output_lines, prefix_list, builder.func_order(), - ';', lambda my_output_lines, prefixes, func: - common.add_ir_checks(my_output_lines, ';', - prefixes, - func_dict, func, False, - args.function_signature, - global_vars_seen_dict, - is_filtered=builder.is_filtered())) + generated_prefixes.extend( + common.add_checks_at_end( + output_lines, prefix_list, builder.func_order(), ';', + lambda my_output_lines, prefixes, func: common.add_ir_checks( + my_output_lines, + ';', + prefixes, + func_dict, + func, + False, + args.function_signature, + global_vars_seen_dict, + is_filtered=builder.is_filtered()))) else: # "Normal" mode. for input_line_info in ti.iterlines(output_lines): @@ -189,29 +198,40 @@ continue # Print out the various check lines here. - common.add_ir_checks(output_lines, ';', prefix_list, func_dict, - func_name, args.preserve_names, args.function_signature, - global_vars_seen_dict, - is_filtered=builder.is_filtered()) + generated_prefixes.extend( + common.add_ir_checks( + output_lines, + ';', + prefix_list, + func_dict, + func_name, + args.preserve_names, + args.function_signature, + global_vars_seen_dict, + is_filtered=builder.is_filtered())) is_in_function_start = False m = common.IR_FUNCTION_RE.match(input_line) if m and not has_checked_pre_function_globals: - if args.check_globals: - common.add_global_checks(builder.global_var_dict(), ';', prefix_list, output_lines, global_vars_seen_dict, args.preserve_names, True) - has_checked_pre_function_globals = True + 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)) + has_checked_pre_function_globals = True if common.should_add_line_to_output(input_line, prefix_set, not is_in_function): - # This input line of the function body will go as-is into the output. - # Except make leading whitespace uniform: 2 spaces. - input_line = common.SCRUB_LEADING_WHITESPACE_RE.sub(r' ', input_line) - output_lines.append(input_line) - if input_line.strip() == '}': - is_in_function = False - continue + # This input line of the function body will go as-is into the output. + # Except make leading whitespace uniform: 2 spaces. + input_line = common.SCRUB_LEADING_WHITESPACE_RE.sub(r' ', input_line) + output_lines.append(input_line) + if input_line.strip() == '}': + is_in_function = False + continue if is_in_function: - continue + continue m = common.IR_FUNCTION_RE.match(input_line) if not m: @@ -223,7 +243,13 @@ is_in_function = is_in_function_start = True if args.check_globals: - common.add_global_checks(builder.global_var_dict(), ';', prefix_list, output_lines, global_vars_seen_dict, args.preserve_names, False) + generated_prefixes.extend( + common.add_global_checks(builder.global_var_dict(), ';', prefix_list, + output_lines, global_vars_seen_dict, + args.preserve_names, False)) + if ti.args.gen_unused_prefix_body: + output_lines.extend(ti.get_checks_for_unused_prefixes( + prefix_list, generated_prefixes)) common.debug('Writing %d lines to %s...' % (len(output_lines), ti.path)) with open(ti.path, 'wb') as f: