public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/ieee)] Fix correct offset in ipa_get_jf_ancestor_result.
@ 2020-04-16 22:31 Michael Meissner
  0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2020-04-16 22:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7d4549b2cd209eb621453ce13be7ffd84ffa720a

commit 7d4549b2cd209eb621453ce13be7ffd84ffa720a
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Mar 20 11:01:13 2020 +0100

    Fix correct offset in ipa_get_jf_ancestor_result.
    
            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.

Diff:
---
 gcc/ChangeLog | 7 +++++++
 gcc/ipa-cp.c  | 5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 563be357329..c7b3325876d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 1c17010e369..c64e9104a94 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-16 22:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 22:31 [gcc(refs/users/meissner/heads/ieee)] Fix correct offset in ipa_get_jf_ancestor_result Michael Meissner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).