https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78542
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The SSA propagator does:
Visiting statement:
_11 = {x_4, x_4, x_4, x_4};
which is likely CONSTANT
Lattice value changed to VARYING. Adding SSA edges to worklist.
Visiting statement:
_12 = BIT_FIELD_REF <_11, 32, 0>;
which is likely CONSTANT
Applying pattern match.pd:3627, gimple-match.c:67610
Match-and-simplified BIT_FIELD_REF <_11, 32, 0> to x_4
Lattice value changed to CONSTANT x_6(D). Adding SSA edges to worklist.
marking stmt to be not simulated again
so while _11 is VARYING we still optimize the BIT_FIELD_REF optimistically,
namely to x_6(D) instead of x_4 using
Visiting PHI node: x_4 = PHI <x_6(D)(2), 1(3)>
Argument #0 (2 -> 3 executable)
x_6(D) Value: CONSTANT x_6(D)
Argument #1 (3 -> 3 not executable)
PHI node value: CONSTANT x_6(D)
Lattice value changed to CONSTANT x_6(D). Adding SSA edges to worklist.
this node will be visited again but the above not.
The issue is valueization here:
simplified = ccp_fold (stmt);
if (simplified && TREE_CODE (simplified) == SSA_NAME)
{
ccp_prop_value_t *val = get_value (simplified);
if (val && val->lattice_val != VARYING)
{
fold_undefer_overflow_warnings (true, stmt, 0);
return *val;
}
ccp_fold (correctly) returns x_4 but then we valueize to x_6(D).