Patchwork [committed] Fix PR54704

login
register
mail settings
Submitter Dehao Chen
Date Sept. 25, 2012, 9:28 p.m.
Message ID <CAO2gOZX=FUzpdNFBvmy_HGBMefYamNm_TB6GTwHavkxoPPQjkw@mail.gmail.com>
Download mbox | patch
Permalink /patch/186894/
State New
Headers show

Comments

Dehao Chen - Sept. 25, 2012, 9:28 p.m.
Hi,

This patch (fixed by Richard, I just helped testing) fixes a bug in
the hash function which leads to too many collisions and a 3x compile
time overhead for tramp3d. After applying the patch, the compile time
of tramp3d returns to normal (the same as no block-location patch).

Bootstrapped and passed all gcc regression tests.

As the bug itself is obvious, I'll check in the patch to trunk now.

Thanks,
Dehao

libcpp/ChangeLog:
2012-09-25  Dehao Chen  <dehao@google.com>

        PR middle-end/54704
        * line-map.c (location_adhoc_data_hash): Fix the hash function.

Patch

Index: libcpp/line-map.c
===================================================================
--- libcpp/line-map.c (revision 191743)
+++ libcpp/line-map.c (working copy)
@@ -58,7 +58,7 @@  location_adhoc_data_hash (const void *l)
 {
   const struct location_adhoc_data *lb =
       (const struct location_adhoc_data *) l;
-  return (hashval_t) lb->locus + (size_t) &lb->data;
+  return (hashval_t) lb->locus + (size_t) lb->data;
 }

 /* Compare function for location_adhoc_data hashtable.  */