https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121559
Bug ID: 121559 Summary: ccp does not do copy prop when there is bit info Product: gcc Version: 16.0 Status: UNCONFIRMED Keywords: compile-time-hog Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` int a[1024]; int f(int n) { int *b = &a[n]; int *c = b; int *d = c; return *d; } int f1(int n) { int b = a[n]; b&=0x2; int c = b; int d = c; return d; } ``` In both cases ccp does not do the copy prop as the bit info takes over: For f we have: ``` Visiting statement: c_3 = b_2; which is likely CONSTANT Lattice value changed to CONSTANT 0x0 (0xfffffffffffffffc). Adding SSA edges to worklist. marking stmt to be not simulated again ``` For f1 we have: ``` Visiting statement: c_5 = b_4; which is likely CONSTANT Lattice value changed to CONSTANT 0x0 (0x2). Adding SSA edges to worklist. marking stmt to be not simulated again ``` if we comment out the `b&=2;` statement in f1 we get: ``` Visiting statement: c_4 = b_3; which is likely CONSTANT Lattice value changed to CONSTANT b_3. Adding SSA edges to worklist. marking stmt to be not simulated again ``` And then b_3 is prop'ed the rest of the way. I noticed this while looking PR 91901 and trying to see why something is missing now compared to when I did backwards walk rather than a forward walk.