llvm.org GIT mirror llvm / 3f79d59
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 Sanjay Patel 3 years ago
2 changed file(s) with 15 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
15281528
15291529 CallInst *CreateCall(Value *Callee, ArrayRef Args = None,
15301530 ArrayRef OpBundles = None,
1531 const Twine &Name = "") {
1532 return Insert(CallInst::Create(Callee, Args, OpBundles), Name);
1531 const Twine &Name = "", MDNode *FPMathTag = nullptr) {
1532 CallInst *CI = CallInst::Create(Callee, Args, OpBundles);
1533 if (isa(CI))
1534 CI = cast(AddFPMathAttributes(CI, FPMathTag, FMF));
1535 return Insert(CI, Name);
15331536 }
15341537
15351538 CallInst *CreateCall(Value *Callee, ArrayRef Args,
216216 FCall = Builder.CreateCall(Callee, None);
217217 EXPECT_FALSE(FCall->hasNoNaNs());
218218
219 Value *V =
220 Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
221 FCall = Builder.CreateCall(V, None);
222 EXPECT_FALSE(FCall->hasNoNaNs());
223
219224 FMF.clear();
220225 FMF.setNoNaNs();
221226 Builder.SetFastMathFlags(FMF);
222227
223228 FCall = Builder.CreateCall(Callee, None);
229 EXPECT_TRUE(Builder.getFastMathFlags().any());
230 EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
231 EXPECT_TRUE(FCall->hasNoNaNs());
232
233 FCall = Builder.CreateCall(V, None);
224234 EXPECT_TRUE(Builder.getFastMathFlags().any());
225235 EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
226236 EXPECT_TRUE(FCall->hasNoNaNs());