[llvm] d944cab - [IR] Make detailed structural hash test look at diffs
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 30 10:32:15 PDT 2023
Author: Aiden Grossman
Date: 2023-08-30T10:31:58-07:00
New Revision: d944cab731f1077d8e800fb7c1a91e6fb6b3bb14
URL: https://github.com/llvm/llvm-project/commit/d944cab731f1077d8e800fb7c1a91e6fb6b3bb14
DIFF: https://github.com/llvm/llvm-project/commit/d944cab731f1077d8e800fb7c1a91e6fb6b3bb14.diff
LOG: [IR] Make detailed structural hash test look at diffs
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.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D159154
Added:
Modified:
llvm/test/Analysis/StructuralHash/structural-hash-detailed.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/StructuralHash/structural-hash-detailed.ll b/llvm/test/Analysis/StructuralHash/structural-hash-detailed.ll
index 153fd4c5cd4a64..b6ba6ce6ee9bf3 100644
--- a/llvm/test/Analysis/StructuralHash/structural-hash-detailed.ll
+++ b/llvm/test/Analysis/StructuralHash/structural-hash-detailed.ll
@@ -1,16 +1,19 @@
-; 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
+; 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 2>&1 | FileCheck %s
+; 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
+
+; Check that we get valid output in the detailed case.
+
+; cat %t.1 | FileCheck %s
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,})}}
More information about the llvm-commits
mailing list