diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll new file mode 100644 index 0000000000000..dfdc9a75a7808 --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll @@ -0,0 +1,16 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt < %s -S | FileCheck %s + +; Test case where the same meta variable appears twice in a line + +define i8 @test(i8 %p) { +; CHECK-LABEL: define i8 @test( +; CHECK-SAME: i8 [[P:%.*]]) { +; CHECK-NEXT: [[Q:%.*]] = add i8 [[P]], 1 +; CHECK-NEXT: [[X:%.*]] = mul i8 [[Q]], [[Q]] +; CHECK-NEXT: ret i8 [[X]] +; + %r = sub i8 %p, 1 + %x = mul i8 %r, %r + ret i8 %x +} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll.expected new file mode 100644 index 0000000000000..a5ffe8d4f168d --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll.expected @@ -0,0 +1,16 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt < %s -S | FileCheck %s + +; Test case where the same meta variable appears twice in a line + +define i8 @test(i8 %p) { +; CHECK-LABEL: define i8 @test( +; CHECK-SAME: i8 [[P:%.*]]) { +; CHECK-NEXT: [[Q:%.*]] = sub i8 [[P]], 1 +; CHECK-NEXT: [[X:%.*]] = mul i8 [[Q]], [[Q]] +; CHECK-NEXT: ret i8 [[X]] +; + %r = sub i8 %p, 1 + %x = mul i8 %r, %r + ret i8 %x +} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test new file mode 100644 index 0000000000000..90b41405592be --- /dev/null +++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test @@ -0,0 +1,2 @@ +# RUN: cp -f %S/Inputs/stable_ir_values6.ll %t.ll && %update_test_checks %t.ll +# RUN: diff -u %t.ll %S/Inputs/stable_ir_values6.ll.expected diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 8ed600e5629e9..0fbb73431d2cf 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -1603,7 +1603,7 @@ def __init__(self): if rhs_value.name in new_color.mapping: # Same, but for a possible commit happening on the same line - if new_color.color[rhs_value.name] == lhs_value.name: + if new_color.mapping[rhs_value.name] == lhs_value.name: continue else: break