aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-11-04 11:39:05 +0100
committerRichard Biener <rguenth@gcc.gnu.org>2024-11-05 08:28:53 +0100
commit2fc25a21820001c67258d30f0960ac9cd0f268cf (patch)
treea3212a576ab7c3a9ea5844b82c544a2674aff977 /gcc/cfgexpand.cc
parent1cc2c454033dae2dfa4ba2dc3882399cca669cb0 (diff)
downloadgcc-2fc25a21820001c67258d30f0960ac9cd0f268cf.zip
gcc-2fc25a21820001c67258d30f0960ac9cd0f268cf.tar.gz
gcc-2fc25a21820001c67258d30f0960ac9cd0f268cf.tar.bz2
middle-end/117433 - ICE with gimple BLKmode reg copy
When we end up expanding a SSA name copy with BLKmode regs which can happen for vectors, possibly wrapped in a NOP-conversion or a PAREN_EXPR and we are not optimizing we can end up with two BLKmode MEMs that expand_gimple_stmt_1 doesn't properly handle when expanding, trying to emit_move_insn them. Looking at store_expr which what expand_gimple_stmt_1 is really doing reveals a lot of magic that's missing. It eventually falls back to emit_block_move (store_expr isn't exported), so this is what I ended up using here given I think we'll only have BLKmode "registers" for vectors. PR middle-end/117433 * cfgexpand.cc (expand_gimple_stmt_1): Use emit_block_move when moving temp to BLKmode target. * gcc.dg/pr117433.c: New testcase.
Diffstat (limited to 'gcc/cfgexpand.cc')
-rw-r--r--gcc/cfgexpand.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index e35664c..f3a33ff 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -4068,8 +4068,13 @@ expand_gimple_stmt_1 (gimple *stmt)
else
{
temp = force_operand (temp, target);
- if (temp != target)
+ if (temp == target)
+ ;
+ else if (GET_MODE (target) != BLKmode)
emit_move_insn (target, temp);
+ else
+ emit_block_move (target, temp, expr_size (lhs),
+ BLOCK_OP_NORMAL);
}
}
}