From 9d33785f57daf29dc0c106c919da319fe1906bc6 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Thu, 21 Jan 2021 16:33:49 +0000 Subject: tree-ssa-mathopts: Use proper poly_int64 comparison with param_avoid_fma_max_bits [PR 98766] We ICE here because we end up comparing a poly_int64 with a scalar using <= rather than maybe_le. This patch fixes that in the way rich suggests in the PR. gcc/ChangeLog: PR tree-optimization/98766 * tree-ssa-math-opts.c (convert_mult_to_fma): Use maybe_le when comparing against type size with param_avoid_fma_max_bits. gcc/testsuite/ChangeLog: PR tree-optimization/98766 * gcc.dg/pr98766.c: New test. --- gcc/tree-ssa-math-opts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/tree-ssa-math-opts.c') diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index d6201d3..c4a6492 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -3252,8 +3252,8 @@ convert_mult_to_fma (gimple *mul_stmt, tree op1, tree op2, bool check_defer = (state->m_deferring_p - && (tree_to_shwi (TYPE_SIZE (type)) - <= param_avoid_fma_max_bits)); + && maybe_le (tree_to_poly_int64 (TYPE_SIZE (type)), + param_avoid_fma_max_bits)); bool defer = check_defer; bool seen_negate_p = false; /* Make sure that the multiplication statement becomes dead after -- cgit v1.1