[Bug tree-optimization/126045] New: spaceship_replacement has some dead code in it dealing with COND_EXPR
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 30 07:16:46 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126045
Bug ID: 126045
Summary: spaceship_replacement has some dead code in it dealing
with COND_EXPR
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: internal-improvement
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
```
else if (gimple_assign_rhs_code (use_stmt) == COND_EXPR)
{
tree cond = gimple_assign_rhs1 (use_stmt);
if (!COMPARISON_CLASS_P (cond))
return false;
cmp = TREE_CODE (cond);
lhs = TREE_OPERAND (cond, 0);
rhs = TREE_OPERAND (cond, 1);
}
...
else
{
tree cond = build2 (res_cmp, TREE_TYPE (gimple_assign_rhs1 (use_stmt)),
clhs1, crhs1);
gimple_assign_set_rhs1 (use_stmt, cond);
}
```
cond here is always SSA_NAME or a constant. So this code can be removed.
This has been dead since r13-707-g68e0063397ba82 when COND_EXPR no longer could
have a conditional in rhs1.
More information about the Gcc-bugs
mailing list