On Mon, 18 Nov 2019, Richard Biener wrote: > On Mon, 18 Nov 2019, Jakub Jelinek wrote: > > > On Mon, Nov 18, 2019 at 10:44:14AM +0100, Richard Biener wrote: > > > The following adjusts the find_base_{term,value} heuristic when > > > looking through ANDs to the case where it is obviously not > > > aligning a base (when the LSB is set). > > > > What is specific about the LSB? I mean & 2 is obviously not an aligning > > AND either. > > It aligns 0x1 and 0x3 ;)
Oh, and of course known-zero-bits magic could have turned a & 0x7 mask to a & 0x6 one because LSB is known to be clear already ... :/ So any of these heuristics are - well - just heuristics. > > Shouldn't we recurse only if the CONST_INT_P operand has > > some set bits followed by clear bits, i.e. after the != 0 check > > compute ctz_hwi and verify that INTVAL >> ctz == -1? > > I thought of more advanced heuristics but I guess that > any contiguous set of bits with LSB unset might be aligning > if the programmer knows upper bits are zero anyways? So I fear > the == -1 test would not work reliable? > > But since find_base_term/value are broken anyways I guess we > can live with that... > > Richard.