lower-bitint: Fix up VIEW_CONVERT_EXPR handling in handle_operand_addr [PR113639]
Yet another spot where we need to treat VIEW_CONVERT_EXPR differently from NOP_EXPR/CONVERT_EXPR. 2024-01-31 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/113639 * gimple-lower-bitint.cc (bitint_large_huge::handle_operand_addr): For VIEW_CONVERT_EXPR set rhs1 to its operand. * gcc.dg/bitint-79.c: New test.
This commit is contained in:
parent
9bf91fa360
commit
90ac839a47
2 changed files with 18 additions and 0 deletions
|
@ -2159,6 +2159,8 @@ bitint_large_huge::handle_operand_addr (tree op, gimple *stmt,
|
|||
gcc_assert (gimple_assign_cast_p (g));
|
||||
tree rhs1 = gimple_assign_rhs1 (g);
|
||||
bitint_prec_kind kind = bitint_prec_small;
|
||||
if (TREE_CODE (rhs1) == VIEW_CONVERT_EXPR)
|
||||
rhs1 = TREE_OPERAND (rhs1, 0);
|
||||
gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (rhs1)));
|
||||
if (TREE_CODE (TREE_TYPE (rhs1)) == BITINT_TYPE)
|
||||
kind = bitint_precision_kind (TREE_TYPE (rhs1));
|
||||
|
|
16
gcc/testsuite/gcc.dg/bitint-79.c
Normal file
16
gcc/testsuite/gcc.dg/bitint-79.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* PR tree-optimization/113639 */
|
||||
/* { dg-do compile { target bitint } } */
|
||||
/* { dg-options "-O2 -std=c23" } */
|
||||
|
||||
int j, k;
|
||||
#if __BITINT_MAXWIDTH__ >= 162
|
||||
struct S { _BitInt(162) n; };
|
||||
void bar (_BitInt(162) x);
|
||||
|
||||
void
|
||||
foo (struct S s)
|
||||
{
|
||||
bar (s.n * j);
|
||||
(void) (s.n * k);
|
||||
}
|
||||
#endif
|
Loading…
Add table
Reference in a new issue