[llvm] [Reland][InstCombine] Fix FMF propagation in `foldSelectIntoOp` (PR #114499)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 19:54:10 PDT 2024
================
@@ -564,6 +561,14 @@ Instruction *InstCombinerImpl::foldSelectIntoOp(SelectInst &SI, Value *TrueVal,
BinaryOperator *BO =
BinaryOperator::Create(TVI->getOpcode(), FalseVal, NewSel);
BO->copyIRFlags(TVI);
+ if (isa<FPMathOperator>(&SI)) {
+ // Merge poison generating flags from the select.
+ BO->setHasNoNaNs(BO->hasNoNaNs() && FMF.noNaNs());
+ BO->setHasNoInfs(BO->hasNoInfs() && FMF.noInfs());
----------------
arsenm wrote:
We do need better API for this intersect of value flag pattern
https://github.com/llvm/llvm-project/pull/114499
More information about the llvm-commits
mailing list