llvm.org GIT mirror llvm / e271f8c
[IRBuilder] fix CreateMaxNum to actually produce maxnum (PR36454) The bug was introduced here: https://reviews.llvm.org/rL296409 ...but the patch doesn't use maxnum and nothing else in trunk has tried since then, so the bug went unnoticed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325607 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 2 years ago
2 changed file(s) with 18 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
675675
676676 /// Create call to the maxnum intrinsic.
677677 CallInst *CreateMaxNum(Value *LHS, Value *RHS, const Twine &Name = "") {
678 return CreateBinaryIntrinsic(Intrinsic::minnum, LHS, RHS, Name);
678 return CreateBinaryIntrinsic(Intrinsic::maxnum, LHS, RHS, Name);
679679 }
680680
681681 private:
4646 BasicBlock *BB;
4747 GlobalVariable *GV;
4848 };
49
50 TEST_F(IRBuilderTest, Intrinsics) {
51 IRBuilder<> Builder(BB);
52 Value *V;
53 CallInst *Call;
54 IntrinsicInst *II;
55
56 V = Builder.CreateLoad(GV);
57
58 Call = Builder.CreateMinNum(V, V);
59 II = cast(Call);
60 EXPECT_EQ(II->getIntrinsicID(), Intrinsic::minnum);
61
62 Call = Builder.CreateMaxNum(V, V);
63 II = cast(Call);
64 EXPECT_EQ(II->getIntrinsicID(), Intrinsic::maxnum);
65 }
4966
5067 TEST_F(IRBuilderTest, Lifetime) {
5168 IRBuilder<> Builder(BB);