[PATCH] D139311: InstCombine: Match pattern that appears in clang's __builtin_isnormal
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 16 00:52:55 PST 2022
sepavloff added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1217-1220
+/// Matches canonical form of isnan, fcmp ord x, 0
+static bool matchIsNaN(FCmpInst::Predicate P, Value *LHS, Value *RHS) {
+ return P == FCmpInst::FCMP_ORD && match(RHS, m_AnyZeroFP());
+}
----------------
As this is `fcmp ord`, the name `matchIsNotNaN` would be better.
IR producer (not necessarily clang) may chose any form of NaN check, so the check must test both forms, `fcmp ord x, const` or `fcmp ord x, x`.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1232
+/// Clang emits this pattern for doing an isfinite check in __builtin_isnormal.
+static Value *matchOrdAndUnorderedCmpInf(InstCombiner::BuilderTy &Builder,
+ FCmpInst *LHS, FCmpInst *RHS) {
----------------
The function name is not clear enough. Why not `matchFiniteTest()` or something similar?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139311/new/
https://reviews.llvm.org/D139311
More information about the llvm-commits
mailing list