Skip to content

update_test_checks: fix a simple regression #111347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

nhaehnle
Copy link
Collaborator

@nhaehnle nhaehnle commented Oct 7, 2024

Reported-by: Yingwei Zheng [email protected]
Fixes: 02debce ("update_test_checks: improve IR value name stability (#110940)")

@llvmbot
Copy link
Member

llvmbot commented Oct 7, 2024

@llvm/pr-subscribers-testing-tools

Author: Nicolai Hähnle (nhaehnle)

Changes

Reported-by: Yingwei Zheng <[email protected]>


Full diff: https://github.com/llvm/llvm-project/pull/111347.diff

4 Files Affected:

  • (added) llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll (+16)
  • (added) llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/stable_ir_values6.ll.expected (+16)
  • (added) llvm/test/tools/UpdateTestChecks/update_test_checks/stable_ir_values6.test (+2)
  • (modified) llvm/utils/UpdateTestChecks/common.py (+1-1)
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 00000000000000..dfdc9a75a78082
--- /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 00000000000000..a5ffe8d4f168db
--- /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 00000000000000..90b41405592be3
--- /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 8ed600e5629e96..0fbb73431d2cfb 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

@nhaehnle nhaehnle changed the title update_test_checks: fix asimple regression update_test_checks: fix a simple regression Oct 7, 2024
@nhaehnle
Copy link
Collaborator Author

nhaehnle commented Oct 7, 2024

I'd consider this simple and obvious enough (and it's a regression fix) that I'd just submit this once it has gone through CI.

Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@nhaehnle
Copy link
Collaborator Author

nhaehnle commented Oct 7, 2024

There's a Windows-only test failure in lld, which must be unrelated.. The rest looks fine.

@nhaehnle nhaehnle merged commit ae6af37 into llvm:main Oct 7, 2024
9 of 11 checks passed
@nhaehnle nhaehnle deleted the pub-utc-regression-fix branch October 7, 2024 09:45
Kyvangka1610 added a commit to Kyvangka1610/llvm-project that referenced this pull request Oct 7, 2024
* commit 'FETCH_HEAD':
  [X86] getIntImmCostInst - pull out repeated Imm.getBitWidth() calls. NFC.
  [X86] Add test coverage for llvm#111323
  [Driver] Use empty multilib file in another test (llvm#111352)
  [clang][OpenMP][test] Use x86_64-linux-gnu triple for test referencing avx512f feature (llvm#111337)
  [doc] Fix Kaleidoscope tutorial chapter 3 code snippet and full listing discrepancies (llvm#111289)
  [Flang][OpenMP] Improve entry block argument creation and binding (llvm#110267)
  [x86] combineMul - handle 0/-1 KnownBits cases before MUL_IMM logic (REAPPLIED)
  [llvm-dis] Fix non-deterministic disassembly across multiple inputs (llvm#110988)
  [lldb][test] TestDataFormatterLibcxxOptionalSimulator.py: change order of ifdefs
  [lldb][test] Add libcxx-simulators test for std::optional (llvm#111133)
  [x86] combineMul - use computeKnownBits directly to find MUL_IMM constant splat. (REAPPLIED)
  Reland "[lldb][test] TestDataFormatterLibcxxStringSimulator.py: add new padding layout" (llvm#111123)
  Revert "[x86] combineMul - use computeKnownBits directly to find MUL_IMM constant splat."
  update_test_checks: fix a simple regression  (llvm#111347)
  [LegalizeVectorTypes] Always widen fabs (llvm#111298)
  [lsan] Make ReportUnsuspendedThreads return bool also for Fuchsia
  [mlir][vector] Add more tests for ConvertVectorToLLVM (6/n) (llvm#111121)
  [bazel] port 9144fed
  [SystemZ] Remove inlining threshold multiplier. (llvm#106058)
  [LegalizeVectorTypes] When widening don't check for libcalls if promoted (llvm#111297)
  [clang][Driver] Improve multilib custom error reporting (llvm#110804)
  [clang][Driver] Rename "FatalError" key to "Error" in multilib.yaml (llvm#110804)
  [LLVM][Maintainers] Update release managers (llvm#111164)
  [Clang][Driver] Add option to provide path for multilib's YAML config file (llvm#109640)
  [LoopVectorize] Remove redundant code in emitSCEVChecks (llvm#111132)
  [AMDGPU] Only emit SCOPE_SYS global_wb (llvm#110636)
  [ELF] Change Ctx::target to unique_ptr (llvm#111260)
  [ELF] Pass Ctx & to some free functions
  [RISCV] Only disassemble fcvtmod.w.d if the rounding mode is rtz. (llvm#111308)
  [Clang] Remove the special-casing for RequiresExprBodyDecl in BuildResolvedCallExpr() after fd87d76 (llvm#111277)
  [ELF] Pass Ctx & to InputFile
  [clang-format] Add AlignFunctionDeclarations to AlignConsecutiveDeclarations (llvm#108241)
  [AMDGPU] Support preloading hidden kernel arguments (llvm#98861)
  [ELF] Move static nextGroupId isInGroup to LinkerDriver
  [clangd] Add ArgumentLists config option under Completion (llvm#111322)
  [ELF] Pass Ctx & to SyntheticSections
  [ELF] Pass Ctx & to Symbols
  [ELF] Pass Ctx & to Symbols
  [ELF] getRelocTargetVA: pass Ctx and Relocation. NFC
  [clang-tidy] Avoid capturing a local variable in a static lambda in UseRangesCheck (llvm#111282)
  [VPlan] Use pointer to member 0 as VPInterleaveRecipe's pointer arg. (llvm#106431)
  [clangd] Simplify ternary expressions with std::optional::value_or (NFC) (llvm#111309)
  [libc++][format][2/3] Optimizes c-string arguments. (llvm#101805)
  [RISCV] Combine RVBUnary and RVKUnary into classes that are more similar to ALU(W)_r(r/i). NFC (llvm#111279)
  [ELF] Pass Ctx & to InputFiles
  [libc] GPU RPC interface: add return value to `rpc_host_call` (llvm#111288)

Signed-off-by: kyvangka1610 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants