aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-lower-bitint.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-12-22 12:28:06 +0100
committerJakub Jelinek <jakub@redhat.com>2023-12-22 12:28:06 +0100
commitf5198f0264e773d3b5d55f09a579313b0b231527 (patch)
tree558a7967d6ec98620ea5a60e23b301e49dfaae0a /gcc/gimple-lower-bitint.cc
parentd3defa435e9d04d6ab6585ac184989941c7ad51e (diff)
downloadgcc-f5198f0264e773d3b5d55f09a579313b0b231527.zip
gcc-f5198f0264e773d3b5d55f09a579313b0b231527.tar.gz
gcc-f5198f0264e773d3b5d55f09a579313b0b231527.tar.bz2
lower-bitint: Handle unreleased SSA_NAMEs from earlier passes gracefully [PR113102]
On the following testcase earlier passes leave around an unreleased SSA_NAME - non-GIMPLE_NOP SSA_NAME_DEF_STMT which isn't in any bb. The following patch makes bitint lowering resistent against those, the first hunk is where we'd for certain kinds of stmts try to ammend them and the latter is where we'd otherwise try to remove them, neither of which works. The other loops over all SSA_NAMEs either already also check gimple_bb (SSA_NAME_DEF_STMT (s)) or it doesn't matter that much if we process it or not (worst case it means e.g. the pass wouldn't return early even when it otherwise could). 2023-12-22 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/113102 * gimple-lower-bitint.cc (gimple_lower_bitint): Handle unreleased large/huge _BitInt SSA_NAMEs. * gcc.dg/bitint-59.c: New test.
Diffstat (limited to 'gcc/gimple-lower-bitint.cc')
-rw-r--r--gcc/gimple-lower-bitint.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc
index 8809389..0910477 100644
--- a/gcc/gimple-lower-bitint.cc
+++ b/gcc/gimple-lower-bitint.cc
@@ -5827,7 +5827,7 @@ gimple_lower_bitint (void)
tree_code rhs_code;
/* Unoptimize certain constructs to simpler alternatives to
avoid having to lower all of them. */
- if (is_gimple_assign (stmt))
+ if (is_gimple_assign (stmt) && gimple_bb (stmt))
switch (rhs_code = gimple_assign_rhs_code (stmt))
{
default:
@@ -6690,6 +6690,11 @@ gimple_lower_bitint (void)
release_ssa_name (s);
continue;
}
+ if (gimple_bb (g) == NULL)
+ {
+ release_ssa_name (s);
+ continue;
+ }
if (gimple_code (g) != GIMPLE_ASM)
{
gimple_stmt_iterator gsi = gsi_for_stmt (g);