diff mbox series

[committed] Fix correct offset in ipa_get_jf_ancestor_result.

Message ID 29e81b0c-6be4-e2b8-b279-7eb962ebc223@suse.cz
State New
Headers show
Series [committed] Fix correct offset in ipa_get_jf_ancestor_result. | expand

Commit Message

Martin Liška March 20, 2020, 10 a.m. UTC
Hi.

The patch is a thinko that was introduced in r10-7273-gf3280e4c0c98e103603bafc466ea49651fe0b7f2.
It's about replacement of byte integer constant with bit integer constant. The patch is pre-approved
by Richi.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Thanks,
Martin

gcc/ChangeLog:

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.
---
  gcc/ipa-cp.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

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;