diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-01-19 10:01:43 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-01-19 10:01:43 +0100 |
commit | ee2aa93e9cd0d62f840cb6614c3cd12c15301a72 (patch) | |
tree | b4fc12d41f3ec7bffef2be9a560e84efc61402d3 | |
parent | df1cd90e32bb17d34f5fdce99bd0377fe1b8e5c6 (diff) | |
download | gcc-ee2aa93e9cd0d62f840cb6614c3cd12c15301a72.zip gcc-ee2aa93e9cd0d62f840cb6614c3cd12c15301a72.tar.gz gcc-ee2aa93e9cd0d62f840cb6614c3cd12c15301a72.tar.bz2 |
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.
-rw-r--r-- | gcc/gimple-lower-bitint.cc | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/bitint-75.c | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc index e48125d..be11d77 100644 --- a/gcc/gimple-lower-bitint.cc +++ b/gcc/gimple-lower-bitint.cc @@ -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; diff --git a/gcc/testsuite/gcc.dg/bitint-75.c b/gcc/testsuite/gcc.dg/bitint-75.c new file mode 100644 index 0000000..dd8292e --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-75.c @@ -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" } */ +} |