[PATCH] D139311: InstCombine: Match pattern that appears in clang's __builtin_isnormal

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 05:15:25 PST 2022


arsenm created this revision.
arsenm added reviewers: jcranmer-intel, foad, nlopes, andrew.w.kaylor, kpn, sepavloff, bkramer.
Herald added a subscriber: hiraditya.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

and (fcmp ord x, 0), (fcmp u* x, inf) -> fcmp o* x, inf
and (fcmp ord x, 0), (fcmp u* fabs(x), inf) -> fcmp o* x, inf

      

Clang emits this peculiar pattern as an isfinite check in
__builtin_isnormal which can be simplified. We should fix clang to
emit this in the first place, but should also fold it here.


https://reviews.llvm.org/D139311

Files:
  llvm/include/llvm/IR/InstrTypes.h
  llvm/lib/IR/Instructions.cpp
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/and-fcmp.ll
  llvm/test/Transforms/InstCombine/unordered-compare-and-ordered.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139311.480061.patch
Type: text/x-patch
Size: 32342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221205/9683d9d6/attachment.bin>


More information about the llvm-commits mailing list