aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-09-27 13:36:12 +0200
committerRichard Biener <rguenther@suse.de>2021-09-27 15:04:32 +0200
commitd06dc8a2c73735e9496f434787ba4c93ceee5eea (patch)
tree9b48940ae8047ae9b8520c861ab4c906e6d8eaff /gcc/gimple-fold.c
parentda1f6391b7c255e4e2eea983832120eff4f7d3df (diff)
downloadgcc-d06dc8a2c73735e9496f434787ba4c93ceee5eea.zip
gcc-d06dc8a2c73735e9496f434787ba4c93ceee5eea.tar.gz
gcc-d06dc8a2c73735e9496f434787ba4c93ceee5eea.tar.bz2
middle-end/102450 - avoid type_for_size for non-existing modes
This avoids asking type_for_size for types with sizes for which no scalar integer mode exists. Instead the following uses int_mode_for_size to get the same result. 2021-09-27 Richard Biener <rguenther@suse.de> PR middle-end/102450 * gimple-fold.c (gimple_fold_builtin_memory_op): Avoid using type_for_size, instead use int_mode_for_size.
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 6fea8a6..474d0f4 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1001,9 +1001,7 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi,
return false;
scalar_int_mode mode;
- tree type = lang_hooks.types.type_for_size (ilen * 8, 1);
- if (type
- && is_a <scalar_int_mode> (TYPE_MODE (type), &mode)
+ if (int_mode_for_size (ilen * 8, 0).exists (&mode)
&& GET_MODE_SIZE (mode) * BITS_PER_UNIT == ilen * 8
&& have_insn_for (SET, mode)
/* If the destination pointer is not aligned we must be able
@@ -1013,6 +1011,7 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi,
|| (optab_handler (movmisalign_optab, mode)
!= CODE_FOR_nothing)))
{
+ tree type = build_nonstandard_integer_type (ilen * 8, 1);
tree srctype = type;
tree desttype = type;
if (src_align < GET_MODE_ALIGNMENT (mode))