mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-21 03:00:45 +00:00
add FMF for CreateCall variant
The version with OpBundles was missed in: http://reviews.llvm.org/rL255555 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256674 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6edca6938a
commit
3f79d59152
@ -1529,8 +1529,11 @@ public:
|
||||
|
||||
CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args = None,
|
||||
ArrayRef<OperandBundleDef> OpBundles = None,
|
||||
const Twine &Name = "") {
|
||||
return Insert(CallInst::Create(Callee, Args, OpBundles), Name);
|
||||
const Twine &Name = "", MDNode *FPMathTag = nullptr) {
|
||||
CallInst *CI = CallInst::Create(Callee, Args, OpBundles);
|
||||
if (isa<FPMathOperator>(CI))
|
||||
CI = cast<CallInst>(AddFPMathAttributes(CI, FPMathTag, FMF));
|
||||
return Insert(CI, Name);
|
||||
}
|
||||
|
||||
CallInst *CreateCall(Value *Callee, ArrayRef<Value *> Args,
|
||||
|
@ -217,6 +217,11 @@ TEST_F(IRBuilderTest, FastMathFlags) {
|
||||
FCall = Builder.CreateCall(Callee, None);
|
||||
EXPECT_FALSE(FCall->hasNoNaNs());
|
||||
|
||||
Value *V =
|
||||
Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
|
||||
FCall = Builder.CreateCall(V, None);
|
||||
EXPECT_FALSE(FCall->hasNoNaNs());
|
||||
|
||||
FMF.clear();
|
||||
FMF.setNoNaNs();
|
||||
Builder.SetFastMathFlags(FMF);
|
||||
@ -226,6 +231,11 @@ TEST_F(IRBuilderTest, FastMathFlags) {
|
||||
EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
|
||||
EXPECT_TRUE(FCall->hasNoNaNs());
|
||||
|
||||
FCall = Builder.CreateCall(V, None);
|
||||
EXPECT_TRUE(Builder.getFastMathFlags().any());
|
||||
EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
|
||||
EXPECT_TRUE(FCall->hasNoNaNs());
|
||||
|
||||
Builder.clearFastMathFlags();
|
||||
|
||||
// To test a copy, make sure that a '0' and a '1' change state.
|
||||
|
Loading…
x
Reference in New Issue
Block a user