[Bug target/96373] SVE miscompilation on vectorized division loop, leading to FP exception

rsandifo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 4 14:59:24 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96373

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> (In reply to rsandifo@gcc.gnu.org from comment #1)
> > I could have sworn there was a reason why we didn't do this,
> > on the basis that we already failed to take FP exceptions into
> > account when vectorising normal gassigns.  But I can't remember
> > what the reason was now, or find any notes about it. :-(
> 
> Well, we refuse to if-convert a stmt that can possibly trap.
> whilelo is like "if-conversion" here.  Not sure what's the reason
> to ever excempt stmts from the while mask.
Exempting them is mostly an optimisation.  After vectorisation
we lose the information about whether the predication is optional
or required for correctness, so we have to assume that it's
required for correctness.

> > Anyway, we have all the infrastructure to do it, so it should
> > be easy to fix.
> 
> So for if-conversion it is
> 
>   if ((! gimple_vuse (stmt)
>        || gimple_could_trap_p_1 (stmt, false, false)
>        || ! ifcvt_memrefs_wont_trap (stmt, refs))
>       && gimple_could_trap_p (stmt))
>     {
>       if (ifcvt_can_predicate (stmt))
>         {
>           gimple_set_plf (stmt, GF_PLF_2, true);
>           need_to_predicate = true;
>           return true;
> 
> which means for non-memory gimple_could_trap_p (stmt) - sth you can
> easily check I guess.
Yeah.


More information about the Gcc-bugs mailing list