InstCombine: Match pattern that appears in clang's __builtin_isnormal
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sat, 3 Dec 2022 19:13:50 +0000 (14:13 -0500)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 19 Dec 2022 13:09:22 +0000 (08:09 -0500)
commiteffde7f43e26091678dcd5a8f3eb8f344f1be8a7
tree39458d66f99eebbca56bae2565b8f38d590b18c0
parentea067b70ea7a5a2842852ed6b04ef9f4e0dfe907
InstCombine: Match pattern that appears in clang's __builtin_isnormal

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.
llvm/include/llvm/IR/InstrTypes.h
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/and-fcmp.ll
llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll