summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/config/rs6000/rs6000-p8swap.cc20
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr106091.c15
2 files changed, 33 insertions, 2 deletions
diff --git a/gcc/config/rs6000/rs6000-p8swap.cc b/gcc/config/rs6000/rs6000-p8swap.cc
index d301bc3fe59..62f5ca5bff4 100644
--- a/gcc/config/rs6000/rs6000-p8swap.cc
+++ b/gcc/config/rs6000/rs6000-p8swap.cc
@@ -1688,7 +1688,15 @@ replace_swapped_aligned_store (swap_web_entry *insn_entry,
gcc_assert ((GET_CODE (new_body) == SET)
&& MEM_P (SET_DEST (new_body)));
- set_block_for_insn (new_insn, BLOCK_FOR_INSN (store_insn));
+ basic_block bb = BLOCK_FOR_INSN (store_insn);
+ set_block_for_insn (new_insn, bb);
+ /* Handle REG_EH_REGION note. */
+ if (cfun->can_throw_non_call_exceptions && BB_END (bb) == store_insn)
+ {
+ rtx note = find_reg_note (store_insn, REG_EH_REGION, NULL_RTX);
+ if (note)
+ add_reg_note (new_insn, REG_EH_REGION, XEXP (note, 0));
+ }
df_insn_rescan (new_insn);
df_insn_delete (store_insn);
@@ -1782,7 +1790,15 @@ replace_swapped_aligned_load (swap_web_entry *insn_entry, rtx swap_insn)
gcc_assert ((GET_CODE (new_body) == SET)
&& MEM_P (SET_SRC (new_body)));
- set_block_for_insn (new_insn, BLOCK_FOR_INSN (def_insn));
+ basic_block bb = BLOCK_FOR_INSN (def_insn);
+ set_block_for_insn (new_insn, bb);
+ /* Handle REG_EH_REGION note. */
+ if (cfun->can_throw_non_call_exceptions && BB_END (bb) == def_insn)
+ {
+ rtx note = find_reg_note (def_insn, REG_EH_REGION, NULL_RTX);
+ if (note)
+ add_reg_note (new_insn, REG_EH_REGION, XEXP (note, 0));
+ }
df_insn_rescan (new_insn);
df_insn_delete (def_insn);
diff --git a/gcc/testsuite/gcc.target/powerpc/pr106091.c b/gcc/testsuite/gcc.target/powerpc/pr106091.c
new file mode 100644
index 00000000000..61ce8cf4733
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr106091.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O -fnon-call-exceptions -fno-tree-dce -fno-tree-forwprop -w" } */
+
+/* Verify there is no ICE. */
+
+typedef short __attribute__ ((__vector_size__ (64))) V;
+V v, w;
+
+inline V foo (V a, V b);
+
+V
+foo (V a, V b)
+{
+ b &= v < b;
+ return (V){foo (b, w)[3], (V){}[3]};
+}