@@ -39,8 +39,7 @@ static Value *getNewICmpValue(unsigned Code, bool Sign, Value *LHS, Value *RHS,
39
39
// / This is the complement of getFCmpCode, which turns an opcode and two
40
40
// / operands into either a FCmp instruction, or a true/false constant.
41
41
static Value *getFCmpValue (unsigned Code, Value *LHS, Value *RHS,
42
- InstCombiner::BuilderTy &Builder,
43
- FastMathFlags FMF) {
42
+ InstCombiner::BuilderTy &Builder, FMFSource FMF) {
44
43
FCmpInst::Predicate NewPred;
45
44
if (Constant *TorF = getPredForFCmpCode (Code, LHS->getType (), NewPred))
46
45
return TorF;
@@ -1406,8 +1405,7 @@ static Value *matchIsFiniteTest(InstCombiner::BuilderTy &Builder, FCmpInst *LHS,
1406
1405
return nullptr ;
1407
1406
1408
1407
return Builder.CreateFCmpFMF (FCmpInst::getOrderedPredicate (PredR), RHS0, RHS1,
1409
- LHS->getFastMathFlags () &
1410
- RHS->getFastMathFlags ());
1408
+ FMFSource::intersect (LHS, RHS));
1411
1409
}
1412
1410
1413
1411
Value *InstCombinerImpl::foldLogicOfFCmps (FCmpInst *LHS, FCmpInst *RHS,
@@ -1444,7 +1442,7 @@ Value *InstCombinerImpl::foldLogicOfFCmps(FCmpInst *LHS, FCmpInst *RHS,
1444
1442
// Intersect the fast math flags.
1445
1443
// TODO: We can union the fast math flags unless this is a logical select.
1446
1444
return getFCmpValue (NewPred, LHS0, LHS1, Builder,
1447
- LHS-> getFastMathFlags () & RHS-> getFastMathFlags ( ));
1445
+ FMFSource::intersect (LHS, RHS));
1448
1446
}
1449
1447
1450
1448
// This transform is not valid for a logical select.
@@ -1461,8 +1459,8 @@ Value *InstCombinerImpl::foldLogicOfFCmps(FCmpInst *LHS, FCmpInst *RHS,
1461
1459
// Ignore the constants because they are obviously not NANs:
1462
1460
// (fcmp ord x, 0.0) & (fcmp ord y, 0.0) -> (fcmp ord x, y)
1463
1461
// (fcmp uno x, 0.0) | (fcmp uno y, 0.0) -> (fcmp uno x, y)
1464
- return Builder.CreateFCmpFMF (
1465
- PredL, LHS0, RHS0, LHS-> getFastMathFlags () & RHS-> getFastMathFlags ( ));
1462
+ return Builder.CreateFCmpFMF (PredL, LHS0, RHS0,
1463
+ FMFSource::intersect (LHS, RHS ));
1466
1464
}
1467
1465
}
1468
1466
0 commit comments