Fix correct offset in ipa_get_jf_ancestor_result.
authorMartin Liska <mliska@suse.cz>
Fri, 20 Mar 2020 10:01:13 +0000 (11:01 +0100)
committerMartin Liska <mliska@suse.cz>
Fri, 20 Mar 2020 10:01:13 +0000 (11:01 +0100)
PR ipa/94232
* ipa-cp.c (ipa_get_jf_ancestor_result): Use offset in bytes. Previously
build_ref_for_offset function was used and it transforms off to bytes
from bits.

gcc/ChangeLog
gcc/ipa-cp.c

index 563be357329091b4422834d0a28fcdd9188e5a71..c7b3325876d62aef52dc9c86717388ceb1c9cf1d 100644 (file)
@@ -1,3 +1,10 @@
+2020-03-20  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/94232
+       * ipa-cp.c (ipa_get_jf_ancestor_result): Use offset in bytes. Previously
+       build_ref_for_offset function was used and it transforms off to bytes
+       from bits.
+
 2020-03-20  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/94266
index 1c17010e369fab4f51af14478069c41d5c3df696..c64e9104a94411891a82367dc79cec2d9313fcd3 100644 (file)
@@ -1356,9 +1356,10 @@ ipa_get_jf_ancestor_result (struct ipa_jump_func *jfunc, tree input)
       poly_int64 off = ipa_get_jf_ancestor_offset (jfunc);
       if (known_eq (off, 0))
        return input;
+      poly_int64 byte_offset = exact_div (off, BITS_PER_UNIT);
       return build1 (ADDR_EXPR, TREE_TYPE (input),
-                    fold_build2 (MEM_REF, TREE_TYPE (TREE_TYPE (input)),
-                                 input, build_int_cst (ptr_type_node, off)));
+                    fold_build2 (MEM_REF, TREE_TYPE (TREE_TYPE (input)), input,
+                                 build_int_cst (ptr_type_node, byte_offset)));
     }
   else
     return NULL_TREE;