[PATCH] D87204: [EarlyCSE] Force hash collision with EXPENSIVE_CHECKS

Bryan Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 6 05:52:08 PDT 2020


bryanpkc created this revision.
bryanpkc added reviewers: lebedev.ri, spatel, efriedma, JosephTremoulet, nikic.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
bryanpkc requested review of this revision.

This patch turns on `EarlyCSEDebugHash` when `EXPENSIVE_CHECKS` is defined, to
help detect inconsistencies between hashing and equivalence tests.

Running CTMark at O2 <https://reviews.llvm.org/owners/package/2/> and O3 <https://reviews.llvm.org/owners/package/3/> shows that this change does not significantly
increase the compile time, both with a baseline release build with assertions
enabled, and a release build with assertions and expensive checks enabled.

  Program                                        O2     O2-debughash diff
   test-suite...ark/tramp3d-v4/tramp3d-v4.test    31.10  32.64        4.9%
   test-sutie...:: CTMark/ClamAV/clamscan.test    21.25  21.65        1.8%
   test-suite...TMark/7zip/7zip-benchmark.test    50.85  51.46        1.2%
   test-suite :: CTMark/kimwitu++/kc.test         19.14  19.23        0.4%
   test-suite...-typeset/consumer-typeset.test    16.01  16.07        0.4%
   test-suite :: CTMark/lencode/lencod.test       22.79  22.86        0.3%
   test-suite...Mark/mafft/pairlocalalign.test    13.16  13.14       -0.2%
   test-suite :: CTMark/SPASS/SPASS.test          19.50  19.13       -1.9%
   test-suite :: CTMark/Bullet/bullet.test        37.42  36.66       -2.0%
   test-suite...:: CTMark/sqlite3/sqlite3.test    21.44  20.78       -3.1%
   Geomean difference                                                 0.2%
  
  Program                                        ExpnsvO3 ExpnsvO3-dbghsh diff
   test-suite...ark/tramp3d-v4/tramp3d-v4.test   1829.05  1976.60          8.1%
   test-suite...Mark/mafft/pairlocalalign.test     28.06    28.39          1.2%
   test-suite...-typeset/consumer-typeset.test     33.73    33.88          0.4%
   test-suite...TMark/7zip/7zip-benchmark.test     99.23    99.19         -0.0%
   test-suite :: CTMark/lencode/lencod.test        47.97    47.90         -0.1%
   test-suite :: CTMark/SPASS/SPASS.test           39.19    39.09         -0.3%
   test-sutie...:: CTMark/ClamAV/clamscan.test     40.95    40.70         -0.6%
   test-suite :: CTMark/Bullet/bullet.test         73.79    73.32         -0.6%
   test-suite :: CTMark/kimwitu++/kc.test         18.32    136.15         -1.6%
   Geomean difference                                                      0.7%


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87204

Files:
  llvm/lib/Transforms/Scalar/EarlyCSE.cpp


Index: llvm/lib/Transforms/Scalar/EarlyCSE.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+++ llvm/lib/Transforms/Scalar/EarlyCSE.cpp
@@ -84,9 +84,16 @@
              "for faster compile. Caps the MemorySSA clobbering calls."));
 
 static cl::opt<bool> EarlyCSEDebugHash(
-    "earlycse-debug-hash", cl::init(false), cl::Hidden,
-    cl::desc("Perform extra assertion checking to verify that SimpleValue's hash "
-             "function is well-behaved w.r.t. its isEqual predicate"));
+    "earlycse-debug-hash",
+#ifdef EXPENSIVE_CHECKS
+    cl::init(true),
+#else
+    cl::init(false),
+#endif
+    cl::Hidden,
+    cl::desc(
+        "Perform extra assertion checking to verify that SimpleValue's hash "
+        "function is well-behaved w.r.t. its isEqual predicate"));
 
 //===----------------------------------------------------------------------===//
 // SimpleValue


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87204.290138.patch
Type: text/x-patch
Size: 945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200906/850cb9a0/attachment.bin>


More information about the llvm-commits mailing list