In this patch, the "nnan" requirement is removed for the canonicalization of select with fcmp to fabs.
(i) FSub logic: Remove check for nnan flag presence in fsub. Example: https://alive2.llvm.org/ce/z/751svg (fsub).
(ii) FNeg logic: Remove check for the presence of nnan and nsz flag in fneg. Example: https://alive2.llvm.org/ce/z/a_fsdp (fneg).
Details
- Reviewers
spatel nlopes aqjune - Commits
- rG5f6b4ce7de65: [InstCombine] Remove nnan requirement for transformation to fabs from select
rGa9a176ca3bb0: [InstCombine] Remove nnan requirement for transformation to fabs from select
rG6180ce2e2abe: [InstCombine] Remove nnan requirement for transformation to fabs from select
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
It would be good to mention in the description *why* this is being done, why this is okay (alive2 link would suffice)
This was discussed as a follow-up for D101727.
I originally added the nnan check to these transforms to be extra safe (and so watch for potential fallout on out-of-tree targets), but it's not necessary in the default LLVM FP environment to preserve exact bits of a nnan.
Ie, the sign of nnan will always be cleared by fabs, but not in the original code.
I'm not sure what the tests are showing. I would expect there to be 4 tests corresponding to each code change with no nnan that are now getting transformed?
Please pre-commit all tests with baseline CHECKs as a preliminary patch (no review is needed for that).
If you do not have commit access, now is a good time to request it. :)
https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access
That looks fine - please commit the tests to main, so we'll just have test *diffs* in this patch.
You do not need to open a new Phab review for the tests only.
Just push an NFC patch to main once you get commit access.
I committed this patch by mistake. I am extremely sorry about this.
I've reverted the commit.
FWIW reading through the disscussion i would think this has been basically accepted, if not stamped yet for formal reasons of wanting the tests to be precommitted.
I have pre-committed the tests and updated the diff. Commit link: https://reviews.llvm.org/rG56e7b6c3924d7ba8db70c38235a77ed8208795eb .
I was out for a few days, so I missed the last few comments. IIUC, the patch was reverted, so I'll re-open the review, mark as accepted, and then you can commit cleanly.
llvm/test/Transforms/InstCombine/fabs.ll | ||
---|---|---|
252–253 | The comment had not been updated and is wrong now. |
llvm/test/Transforms/InstCombine/fabs.ll | ||
---|---|---|
252–253 | Ohh, thanks for finding it out! I am removing this comment. |
The comment had not been updated and is wrong now.