llvm.org GIT mirror llvm / 4ab6b1f
IRBuilder: Add overload for intrinsics without args git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333443 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 1 year, 4 months ago
3 changed file(s) with 17 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
631631 Value *LHS, Value *RHS,
632632 const Twine &Name = "");
633633
634 /// Create a call to intrinsic \p ID with no operands.
635 CallInst *CreateIntrinsic(Intrinsic::ID ID,
636 Instruction *FMFSource = nullptr,
637 const Twine &Name = "");
638
634639 /// Create a call to intrinsic \p ID with 1 or more operands assuming the
635640 /// intrinsic and all operands have the same type. If \p FMFSource is
636641 /// provided, copy fast-math-flags from that instruction to the intrinsic.
668668 }
669669
670670 CallInst *IRBuilderBase::CreateIntrinsic(Intrinsic::ID ID,
671 Instruction *FMFSource,
672 const Twine &Name) {
673 Module *M = BB->getModule();
674 Function *Fn = Intrinsic::getDeclaration(M, ID);
675 return createCallHelper(Fn, {}, this, Name);
676 }
677
678 CallInst *IRBuilderBase::CreateIntrinsic(Intrinsic::ID ID,
671679 ArrayRef Args,
672680 Instruction *FMFSource,
673681 const Twine &Name) {
6262 Call = Builder.CreateMaxNum(V, V);
6363 II = cast(Call);
6464 EXPECT_EQ(II->getIntrinsicID(), Intrinsic::maxnum);
65
66 Call = Builder.CreateIntrinsic(Intrinsic::readcyclecounter);
67 II = cast(Call);
68 EXPECT_EQ(II->getIntrinsicID(), Intrinsic::readcyclecounter);
6569 }
6670
6771 TEST_F(IRBuilderTest, Lifetime) {