https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116435

            Bug ID: 116435
           Summary: there are 3 rtx_hashes
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: internal-improvement
          Severity: enhancement
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

There are 3 different rtx_hashes:
cse.cc: hash_rtx
cselib.cc: cselib_hash_rtx
lra.cc: lra_rtx_hash

Currently lra_rtx_hash uses iterative_hash_object in some places
cselib_hash_rtx was just moved over to use inchash::hash in
r15-2218-g44e065a52fa606

hash_rtx and lra_rtx_hash still just does an addition to add on to the hash.
It would be useful to merge all 3 into one. At the bare min inchash::hash
should be used instead of addition since that helps with collisions.

One other thing is hash_rtx produces some interesting collisions too:
```
[14:26] <PatrickONeill> I have 2 patterns that hash to the same value using the
default const_rtx hasher:
[14:26] <PatrickONeill> hash -663464470:
[14:26] <PatrickONeill> (const_vector:RVVM4DI repeat [
[14:26] <PatrickONeill>         (const_int 8589934593 [0x200000001])
[14:26] <PatrickONeill>     ])
[14:26] <PatrickONeill> hash -663464470:
[14:26] <PatrickONeill> (const_vector:RVVM4SF repeat [
[14:26] <PatrickONeill>         (const_double:SF 1.0e+0 [0x0.8p+1])
[14:26] <PatrickONeill>         (const_double:SF 2.0e+0 [0x0.8p+2])
[14:26] <PatrickONeill>     ])
```

Reply via email to