Andrew MacLeod <amacl...@redhat.com> writes: > This was a fun one! An actual bug, and it took a while to sort out. > After chasing down some red herrings, this turns out to be an issue of > interaction between the range and value masks and intervening > calculations.
(Just want to say thanks for the detailed commit message, it helps a lot with understanding how things interact.) > [...] > > It also causes a few ripples in the testsuite so 3 test cases also > needed adjustment: > > [...] > > * gcc.dg/tree-ssa/phi-opt-value-5.c : WIth the expanded ranges, CCP2 > pass use to export: > Global Exported: d_3 = [irange] int [-INF, +INF] MASK 0xfffffffe > VALUE 0x1 > and now > Global Exported: d_3 = [irange] int [-INF, -1][1, +INF] MASK > 0xfffffffe VALUE 0x1 > which in turn makes the following comment obsolete as the optimization > does happen earlier.: > /* fdiv1 requires until later than phiopt2 to be able to detect that > d is non-zero. to be able to remove the conditional. */ > Adjusted the testcase to expect everything to be taken care of by > phi-opt2 pass. The comment looks like it's still there in the patch -- does it need dropping?