[InstSimplify] fold fma/fmuladd with a NaN or undef operand

This is intended to be similar to the constant folding results from
D67446
and earlier, but not all operands are constant in these tests, so the
responsibility for folding is left to InstSimplify.

Differential Revision: https://reviews.llvm.org/D67721

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373455 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel
2019-10-02 12:12:02 +00:00
parent e1e678465b
commit 43b05ab4b9
2 changed files with 21 additions and 24 deletions
+9
View File
@@ -5186,6 +5186,15 @@ static Value *simplifyIntrinsic(CallBase *Call, const SimplifyQuery &Q) {
}
return nullptr;
}
case Intrinsic::fma:
case Intrinsic::fmuladd: {
Value *Op0 = Call->getArgOperand(0);
Value *Op1 = Call->getArgOperand(1);
Value *Op2 = Call->getArgOperand(2);
if (Value *V = simplifyFPOp({ Op0, Op1, Op2 }))
return V;
return nullptr;
}
default:
return nullptr;
}