From e304caa4e59b92e063bda89e29147bd7237eac3a Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sun, 20 Jul 2014 21:00:51 +0000 Subject: [PATCH] cse.c (exp_equiv_p): For GCSE... * cse.c (exp_equiv_p) : For GCSE, return 0 for expressions with different trapping status if -fnon-call-exceptions is enabled. From-SVN: r212879 --- gcc/ChangeLog | 5 +++++ gcc/cse.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0e5a2985eea..efb67bac4c0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-07-20 Eric Botcazou + + * cse.c (exp_equiv_p) : For GCSE, return 0 for expressions with + different trapping status if -fnon-call-exceptions is enabled. + 2014-07-20 Eric Botcazou * expr.c (store_field): Handle VOIDmode for calls that return values diff --git a/gcc/cse.c b/gcc/cse.c index bb88b52aa36..34f93643cdf 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -2687,6 +2687,13 @@ exp_equiv_p (const_rtx x, const_rtx y, int validate, bool for_gcse) the same attributes share the same mem_attrs data structure. */ if (MEM_ATTRS (x) != MEM_ATTRS (y)) return 0; + + /* If we are handling exceptions, we cannot consider two expressions + with different trapping status as equivalent, because simple_mem + might accept one and reject the other. */ + if (cfun->can_throw_non_call_exceptions + && (MEM_NOTRAP_P (x) != MEM_NOTRAP_P (y))) + return 0; } break;