lower-bitint: Don't use m_loads for loads used in GIMPLE_ASM [PR113464]

Like for GIMPLE_PHIs or calls, even for GIMPLE_ASMs we want
a corresponding VAR_DECL assigned for lhs SSA_NAMEs of loads
from memory, as even GIMPLE_ASM relies on those VAR_DECLs to exist.

2024-01-19  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/113464
	* gimple-lower-bitint.cc (gimple_lower_bitint): Don't try to
	optimize loads into GIMPLE_ASM stmts.

	* gcc.dg/bitint-75.c: New test.
This commit is contained in:
Jakub Jelinek 2024-01-19 10:01:43 +01:00
parent df1cd90e32
commit ee2aa93e9c
2 changed files with 13 additions and 1 deletions

View file

@ -6249,7 +6249,8 @@ gimple_lower_bitint (void)
if (is_gimple_debug (use_stmt))
continue;
if (gimple_code (use_stmt) == GIMPLE_PHI
|| is_gimple_call (use_stmt))
|| is_gimple_call (use_stmt)
|| gimple_code (use_stmt) == GIMPLE_ASM)
{
optimizable_load = false;
break;

View file

@ -0,0 +1,11 @@
/* PR tree-optimization/113464 */
/* { dg-do compile { target bitint65535 } } */
/* { dg-options "-O2 -w -std=gnu23" } */
_BitInt(65532) i;
void
foo (void)
{
__asm__ ("" : "+r" (i)); /* { dg-error "impossible constraint" } */
}