This is an archive of the discontinued LLVM Phabricator instance.

InstCombine: Fold and/or of fcmp into class
ClosedPublic

Authored by arsenm on Feb 15 2023, 1:31 AM.

Details

Summary

This is motivated by patterns like !isfinite || zero. The AMDGPU math
libraries have a lot of patterns like this, and I'm trying to fix the
code to be more portable and less dependent on directly calling class
intrinsics.

I believe this is the first place where new is.fpclass calls are
introduced. There are more class-like compares that could be
recognized; this is a set I currently care about plus a few extras.

I swear I posted this before but can't seem to find it

Diff Detail

Event Timeline

arsenm created this revision.Feb 15 2023, 1:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2023, 1:31 AM
arsenm requested review of this revision.Feb 15 2023, 1:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2023, 1:31 AM
Herald added a subscriber: wdng. · View Herald Transcript

I swear I posted this before but can't seem to find it

It was in the origincal incarnation of https://reviews.llvm.org/D139130?vs=on&id=479367

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
1503

Do you need to worry about IsLogicalSelect here? (@nikic, @craig.topper?)

arsenm added inline comments.Feb 21 2023, 4:34 PM
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
1503

I've tried to come up with a case where it mattered and I can't seem to find one

arsenm added inline comments.Feb 21 2023, 5:34 PM
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
1503

I managed to get a case where it's true with fast math flags. Will check what alive2 thinks

arsenm added inline comments.Feb 21 2023, 6:19 PM
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
1503

https://alive2.llvm.org/ce/z/s58K3N is the case, seems to be fine

arsenm updated this revision to Diff 499346.Feb 21 2023, 6:40 PM

add a logical and/or case

foad accepted this revision.Feb 22 2023, 6:31 AM

add a logical and/or case

Thanks. LGTM.

This revision is now accepted and ready to land.Feb 22 2023, 6:31 AM