Skip to content

Commit 2a76807

Browse files
committed
[InstCombine] Propagate FMF from select instead of fcmp
1 parent 5a3776a commit 2a76807

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3915,11 +3915,10 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
39153915
// (X ugt Y) ? X : Y -> (X ole Y) ? Y : X
39163916
if (FCmp->hasOneUse() && FCmpInst::isUnordered(Pred)) {
39173917
FCmpInst::Predicate InvPred = FCmp->getInversePredicate();
3918-
// FIXME: The FMF should propagate from the select, not the fcmp.
39193918
Value *NewCond = Builder.CreateFCmpFMF(InvPred, Cmp0, Cmp1, FCmp,
39203919
FCmp->getName() + ".inv");
39213920
Value *NewSel =
3922-
Builder.CreateSelectFMF(NewCond, FalseVal, TrueVal, FCmp);
3921+
Builder.CreateSelectFMF(NewCond, FalseVal, TrueVal, &SI);
39233922
return replaceInstUsesWith(SI, NewSel);
39243923
}
39253924
}

0 commit comments

Comments
 (0)