Skip to content

Commit 315bd96

Browse files
committed
Use std::make_tuple instead initializer list
Hopefully this pleases GCC-5 and fixes the build error: LowerExpectIntrinsic.cpp:62:53: error: converting to 'std::tuple<unsigned int, unsigned int>' from initializer list would use explicit constructor 'constexpr std::tuple<_T1, _T2>::tuple(_U1&&, _U2&&) [with _U1 = llvm::cl::opt<unsigned int>&; _U2 = llvm::cl::opt<unsigned int>&; <template-parameter-2-3> = void; _T1 = unsigned int; _T2 = unsigned int]' return {LikelyBranchWeight, UnlikelyBranchWeight}; Differential Revision: https://reviews.llvm.org/D82325
1 parent 1357c06 commit 315bd96

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ std::tuple<uint32_t, uint32_t> getBranchWeight(Intrinsic::ID IntrinsicID,
5959
CallInst *CI, int BranchCount) {
6060
if (IntrinsicID == Intrinsic::expect) {
6161
// __builtin_expect
62-
return {LikelyBranchWeight, UnlikelyBranchWeight};
62+
return std::make_tuple(LikelyBranchWeight.getValue(),
63+
UnlikelyBranchWeight.getValue());
6364
} else {
6465
// __builtin_expect_with_probability
6566
assert(CI->getNumOperands() >= 3 &&
@@ -71,7 +72,7 @@ std::tuple<uint32_t, uint32_t> getBranchWeight(Intrinsic::ID IntrinsicID,
7172
double FalseProb = (1.0 - TrueProb) / (BranchCount - 1);
7273
uint32_t LikelyBW = ceil((TrueProb * (double)(INT32_MAX - 1)) + 1.0);
7374
uint32_t UnlikelyBW = ceil((FalseProb * (double)(INT32_MAX - 1)) + 1.0);
74-
return {LikelyBW, UnlikelyBW};
75+
return std::make_tuple(LikelyBW, UnlikelyBW);
7576
}
7677
}
7778

0 commit comments

Comments
 (0)