This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/70484] Wrong optimization with aliasing and access via char
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 01 Apr 2016 08:29:11 +0000
- Subject: [Bug rtl-optimization/70484] Wrong optimization with aliasing and access via char
- Auto-submitted: auto-generated
- References: <bug-70484-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70484
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's DSE1 that does this.
trying to replace QImode load in insn 9 from SImode store in insn 7
deferring rescan insn with uid = 9.
deferring rescan insn with uid = 17.
-- replaced the loaded MEM with (reg 92)
else if (s_info->rhs)
/* Need to see if it is possible for this store to overwrite
the value of store_info. If it is, set the rhs to NULL to
keep it from being used to remove a load. */
{
if (canon_true_dependence (s_info->mem,
GET_MODE (s_info->mem),
s_info->mem_addr,
mem, mem_addr))
{
s_info->rhs = NULL;
s_info->const_rhs = NULL;
}
it shouldn't use true_dependence but output_dependence (canon_output_dependence
is missing but trivial to add).
So the following patch fixes it.
Index: gcc/dse.c
===================================================================
--- gcc/dse.c (revision 234663)
+++ gcc/dse.c (working copy)
@@ -1609,10 +1609,7 @@ record_store (rtx body, bb_info_t bb_inf
the value of store_info. If it is, set the rhs to NULL to
keep it from being used to remove a load. */
{
- if (canon_true_dependence (s_info->mem,
- GET_MODE (s_info->mem),
- s_info->mem_addr,
- mem, mem_addr))
+ if (output_dependence (s_info->mem, mem))
{
s_info->rhs = NULL;
s_info->const_rhs = NULL;