[llvm] [InstCombine] Simplify FMF propagation. NFC. (PR #121899)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 7 00:39:52 PST 2025
================
@@ -1699,12 +1699,11 @@ static Instruction *reassociateFCmps(BinaryOperator &BO,
// and (fcmp ord X, 0), (and (fcmp ord Y, 0), Z) --> and (fcmp ord X, Y), Z
// or (fcmp uno X, 0), (or (fcmp uno Y, 0), Z) --> or (fcmp uno X, Y), Z
- Value *NewFCmp = Builder.CreateFCmp(NanPred, X, Y);
- if (auto *NewFCmpInst = dyn_cast<FCmpInst>(NewFCmp)) {
- // Intersect FMF from the 2 source fcmps.
- NewFCmpInst->copyIRFlags(Op0);
- NewFCmpInst->andIRFlags(BO10);
- }
+ // Intersect FMF from the 2 source fcmps.
+ Value *NewFCmp =
+ Builder.CreateFCmpFMF(NanPred, X, Y,
+ cast<Instruction>(Op0)->getFastMathFlags() &
+ cast<Instruction>(BO10)->getFastMathFlags());
----------------
arsenm wrote:
Might as well cast directly to FastMathOperator?
https://github.com/llvm/llvm-project/pull/121899
More information about the llvm-commits
mailing list