https://alive2.llvm.org/ce/z/L5DmiE
TODO: handle <=, >, and >=
Differential D112675
[Instcombine] Add patterns to generate fneg(fabs(x)) instead of fcmp/sub/selects (part 1) mnadeem on Oct 27 2021, 4:15 PM. Authored by
Details
Diff Detail Event Timeline
Comment Actions Thanks for splitting this up and creating the Alive link! I'm still not clear if the FMF propagation is behaving as well as it could. For example, if the select has nsz, then can it always be added to the fneg? It would also help to sprinkle some extra flags like nnan and ninf into the tests, so we can tell how those are modified even though they are not required for the transform.
Comment Actions If the select is nsz, that means that if the result is zero, we don't care about its sign. That means we could copy it onto the fneg, sure. Actually, the produced fabs and fneg should always be nsz; the transform doesn't make sense otherwise. For other flags, you can probably just copy them from the select? So initialize the flags from the select, then unconditionally enable the nsz bit for both instructions, I guess. Comment Actions Removing from reviewer's ready to review list for now. Will come back to this patch when/if time permits. |
"--> -X" should be "--> -fabs(X)"