summaryrefslogtreecommitdiff
path: root/gcc/loop-invariant.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-16 15:47:20 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-16 15:47:20 +0000
commita39b96b6bfbdd308b18086d8eb1f9fad36256218 (patch)
tree3280aa0470bb6a6fec83e0edd515a0c12b6a1129 /gcc/loop-invariant.c
parent95468ea2c16ae29c7da4003d0060c8fe3f75c392 (diff)
downloadgcc-a39b96b6bfbdd308b18086d8eb1f9fad36256218.tar.gz
PR rtl-optimization/26296
* Makefile.in (loop-invariant.c): Add except.h dependency. * loop-invariant.c: Include except.h. (find_invariant_insn): Ignore insns satisfying can_throw_internal. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111139 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-invariant.c')
-rw-r--r--gcc/loop-invariant.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index a57857d3831..03a0c34e6cb 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -52,6 +52,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "flags.h"
#include "df.h"
#include "hashtab.h"
+#include "except.h"
/* The data stored for the loop. */
@@ -761,16 +762,14 @@ find_invariant_insn (rtx insn, bool always_reached, bool always_executed)
|| !check_maybe_invariant (SET_SRC (set)))
return;
- if (may_trap_p (PATTERN (insn)))
- {
- if (!always_reached)
- return;
+ /* If the insn can throw exception, we cannot move it at all without changing
+ cfg. */
+ if (can_throw_internal (insn))
+ return;
- /* Unless the exceptions are handled, the behavior is undefined
- if the trap occurs. */
- if (flag_non_call_exceptions)
- return;
- }
+ /* We cannot make trapping insn executed, unless it was executed before. */
+ if (may_trap_p (PATTERN (insn)) && !always_reached)
+ return;
depends_on = BITMAP_ALLOC (NULL);
if (!check_dependencies (insn, depends_on))