[PATCH] D159154: [IR] Make detailed structural hash test llok at diffs

Aiden Grossman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 19:33:30 PDT 2023


aidengrossman created this revision.
Herald added a project: All.
aidengrossman requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch makes structural-hash-detailed.ll look at diffs rather than
specific values to make the test more robust against the underlying
hashing implementation while still testing that the hash value is
deterministic across multiple runs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159154

Files:
  llvm/test/Analysis/StructuralHash/structural-hash-detailed.ll


Index: llvm/test/Analysis/StructuralHash/structural-hash-detailed.ll
===================================================================
--- llvm/test/Analysis/StructuralHash/structural-hash-detailed.ll
+++ llvm/test/Analysis/StructuralHash/structural-hash-detailed.ll
@@ -1,16 +1,17 @@
-; Require 64 bits here as the hash will change depending upon whether we are on a 32-bit
-; or 64-bit platform.
-; REQUIRE: llvm-64-bits
-
 ; RUN: opt -passes='print<structural-hash><detailed>' -disable-output %s 2>&1 | FileCheck %s
 
+; Ensure that the value of the structural hash is consistent across runs to
+; check that we aren't doing something like hashing a pointer that could
+; introduce non-determinism.
+
+; RUN: opt -passes='print<structural-hash><detailed>' -disable-output %s &> %t.1
+; RUN: opt -passes='print<structural-hash><detailed>' -disable-output %s &> %t.2
+; RUN: diff %t.1 %t.2
+
 define i64 @f1(i64 %a) {
 	ret i64 %a
 }
 
-; These values here are explicitly defined to ensure that they are deterministic
-; on all 64-bit platforms and across runs.
-
-; CHECK: Module Hash: 81f1328ced269bd
-; CHECK: Function f1 Hash: 81f1328ced269bd
+; CHECK: Module Hash: {{([a-z0-9]{14,})}}
+; CHECK: Function f1 Hash: {{([a-z0-9]{14,})}}
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159154.554548.patch
Type: text/x-patch
Size: 1243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230830/20c696d5/attachment.bin>


More information about the llvm-commits mailing list