Commit 2f434b97 by Olivier Hainque Committed by Olivier Hainque

fwprop.c (forward_propagate_and_simplify): Only attach a REG_EQUAL note to an…

fwprop.c (forward_propagate_and_simplify): Only attach a REG_EQUAL note to an insn if the destination is a register.

        * fwprop.c (forward_propagate_and_simplify): Only attach a
        REG_EQUAL note to an insn if the destination is a register.
        * gcse.c (try_replace_reg): Likewise.

        testsuite/
        * gnat.dg/memtrap.adb: New test.

From-SVN: r164245
parent 654a61fb
2010-09-13 Olivier Hainque <hainque@adacore.com>
* fwprop.c (forward_propagate_and_simplify): Only attach a
REG_EQUAL note to an insn if the destination is a register.
* gcse.c (try_replace_reg): Likewise.
2010-09-13 Richard Guenther <rguenther@suse.de> 2010-09-13 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45611 PR tree-optimization/45611
......
...@@ -1294,10 +1294,11 @@ forward_propagate_and_simplify (df_ref use, rtx def_insn, rtx def_set) ...@@ -1294,10 +1294,11 @@ forward_propagate_and_simplify (df_ref use, rtx def_insn, rtx def_set)
loc = &SET_SRC (use_set); loc = &SET_SRC (use_set);
/* Do not replace an existing REG_EQUAL note if the insn is not /* Do not replace an existing REG_EQUAL note if the insn is not
recognized. Either we're already replacing in the note, or recognized. Either we're already replacing in the note, or we'll
we'll separately try plugging the definition in the note and separately try plugging the definition in the note and simplifying.
simplifying. */ And only install a REQ_EQUAL note when the destination is a REG,
set_reg_equal = (note == NULL_RTX); as the note would be invalid otherwise. */
set_reg_equal = (note == NULL_RTX && REG_P (SET_DEST (use_set)));
} }
if (GET_MODE (*loc) == VOIDmode) if (GET_MODE (*loc) == VOIDmode)
......
...@@ -2351,12 +2351,10 @@ try_replace_reg (rtx from, rtx to, rtx insn) ...@@ -2351,12 +2351,10 @@ try_replace_reg (rtx from, rtx to, rtx insn)
&& validate_change (insn, &SET_SRC (set), src, 0)) && validate_change (insn, &SET_SRC (set), src, 0))
success = 1; success = 1;
/* If we've failed to do replacement, have a single SET, don't already /* If we've failed perform the replacement, have a single SET to
have a note, and have no special SET, add a REG_EQUAL note to not a REG destination and don't yet have a note, add a REG_EQUAL note
lose information. */ to not lose information. */
if (!success && note == 0 && set != 0 if (!success && note == 0 && set != 0 && REG_P (SET_DEST (set)))
&& GET_CODE (SET_DEST (set)) != ZERO_EXTRACT
&& GET_CODE (SET_DEST (set)) != STRICT_LOW_PART)
note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src)); note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src));
} }
......
2010-09-12 Olivier Hainque <hainque@adacore.com>
* gnat.dg/memtrap.adb: New test.
2010-09-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> 2010-09-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* gfortran.dg/promotion.f90: Fix options. * gfortran.dg/promotion.f90: Fix options.
......
-- { dg-do compile }
-- { dg-options "-O2" }
with System;
procedure Memtrap is
X : integer;
for X'address use System.Null_Address;
begin
X := 12;
exception
when others => null;
end;
-- { dg-final { scan-assembler "__gnat_begin_handler" } }
-- { dg-do compile }
-- { dg-options "-O2" }
with System;
procedure Memtrap is
X : integer;
for X'address use System.Null_Address;
begin
X := 12;
exception
when others => null;
end;
-- { dg-final { scan-assembler "__gnat_begin_handler|__gnat_raise_nodefer" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment