https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65028
--- Comment #59 from Martin Jambor <jamborm at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #36) > We end up with algnment unkonwn instead of a. (did not managed to reproduce > the wrong alignment here). What about the following: It is certainly better than what I had there before, except that unless I read it wrong, I think there are two bugs: > Index: ipa-cp.c > =================================================================== > --- ipa-cp.c (revision 220789) > +++ ipa-cp.c (working copy) > @@ -1409,6 +1409,60 @@ propagate_context_accross_jump_function > return ret; > } > > +/* Decrease alignment info DEST to be at most CUR. */ > + > +static bool > +decrease_alignment (ipa_alignment *dest, ipa_alignment cur) > +{ > + bool changed = false; > + > + if (!cur.known) > + return false; I really think this should be return set_alignment_to_bottom (dest); If some known alignment has been already propagated to DEST along a different edge and now along the current edge an unknown alignment is coming in, then the result value of the lattice must be BOTTOM and not the previous alignment this code leaves in place. > + if (!dest->known) > + { > + *dest = cur; > + return true; > + } > + if (dest->align == cur.align > + && dest->misalign == cur.misalign) > + return false; > + > + if (dest->align > cur.align) > + { > + dest->align = cur.align; > + if (cur.align) > + dest->misalign > + = dest->misalign % cur.align; > + changed = true; > + } > + if (dest->align && (dest->misalign != (cur.misalign % dest->align))) > + { > + int diff = abs (dest->misalign > + - (cur.misalign % dest->align)); > + dest->align = MIN (dest->align, (unsigned)diff & - diff); > + if (dest->align) > + dest->misalign > + = dest->misalign % dest->align; > + changed = true; > + } > + return changed; > +} > + > +/* Increase alignment info DEST to be at least CUR. */ > + > +static bool > +increase_alignment (ipa_alignment *dest, ipa_alignment cur) > +{ > + if (!dest->known) > + return false; I think this condition always exits. DEST is caller's CUR which was read from jfunc->alignment which is always going to be unknown for PASS_THROUGH and ANCESTOR jump functions at the moment. Perhaps you meant if (!cur.known) ? > + if (!cur.known || dest->align < cur.align) > + { again here, I think you meant !des->.known. Apart from that, this is clearly an improvement, thanks.