public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3725] Fix handling of parm_offset in ipa-modref on 32bit targets.
@ 2020-10-08 12:14 Jan Hubicka
0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2020-10-08 12:14 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2bdf324fb33d67f0850139040df0c0390258ab38
commit r11-3725-g2bdf324fb33d67f0850139040df0c0390258ab38
Author: Jan Hubicka <jh@suse.cz>
Date: Thu Oct 8 14:13:54 2020 +0200
Fix handling of parm_offset in ipa-modref on 32bit targets.
* ipa-modref.c (get_access): Fix handling of offsets.
* tree-ssa-alias.c (modref_may_conflict): Watch for overflows.
Diff:
---
gcc/ipa-modref.c | 13 +++++++++----
gcc/tree-ssa-alias.c | 26 ++++++++++++++++----------
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index a5fa33a35de..5868aa97484 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -318,8 +318,7 @@ get_access (ao_ref *ref)
0, -1, false};
if (TREE_CODE (base) == MEM_REF || TREE_CODE (base) == TARGET_MEM_REF)
{
- tree offset = TREE_CODE (base) == MEM_REF
- ? TREE_OPERAND (base, 1) : NULL_TREE;
+ tree memref = base;
base = TREE_OPERAND (base, 0);
if (TREE_CODE (base) == SSA_NAME
&& SSA_NAME_IS_DEFAULT_DEF (base)
@@ -336,8 +335,14 @@ get_access (ao_ref *ref)
}
a.parm_index++;
}
- a.parm_offset_known
- = offset && wi::to_poly_offset (offset).to_shwi (&a.parm_offset);
+ if (TREE_CODE (memref) == MEM_REF)
+ {
+ a.parm_offset_known
+ = wi::to_poly_wide (TREE_OPERAND
+ (memref, 1)).to_shwi (&a.parm_offset);
+ }
+ else
+ a.parm_offset_known = false;
}
else
a.parm_index = -1;
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index d85f378a8ae..97255987e79 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2546,16 +2546,22 @@ modref_may_conflict (const gimple *stmt,
else
{
ao_ref ref2;
-
- ao_ref_init_from_ptr_and_range
- (&ref2, arg, true,
- access_node->offset
- + (access_node->parm_offset
- << LOG2_BITS_PER_UNIT), access_node->size,
- access_node->max_size);
- ref2.ref_alias_set = ref_set;
- ref2.base_alias_set = base_set;
- if (refs_may_alias_p_1 (&ref2, ref, tbaa_p))
+ poly_offset_int off = (poly_offset_int)access_node->offset
+ + ((poly_offset_int)access_node->parm_offset
+ << LOG2_BITS_PER_UNIT);
+ poly_int64 off2;
+ if (off.to_shwi (&off2))
+ {
+ ao_ref_init_from_ptr_and_range
+ (&ref2, arg, true, off2,
+ access_node->size,
+ access_node->max_size);
+ ref2.ref_alias_set = ref_set;
+ ref2.base_alias_set = base_set;
+ if (refs_may_alias_p_1 (&ref2, ref, tbaa_p))
+ return true;
+ }
+ else if (ptr_deref_may_alias_ref_p_1 (arg, ref))
return true;
}
num_tests++;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-08 12:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08 12:14 [gcc r11-3725] Fix handling of parm_offset in ipa-modref on 32bit targets Jan Hubicka
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).