[PATCH] D82325: Use std::make_tuple instead initializer list

Lei Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 12:54:38 PDT 2020


antiagainst created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
antiagainst updated this revision to Diff 272518.
antiagainst added a comment.
antiagainst retitled this revision from "Use stdd::make_tuple instead initializer list" to "Use std::make_tuple instead initializer list".
antiagainst added reviewers: rriddle, mehdi_amini, LukeZhuang.

Fix typo


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:🆑:opt<unsigned int>&; _U2 =
llvm:🆑:opt<unsigned int>&; <template-parameter-2-3> = void; _T1 =
unsigned int; _T2 = unsigned int]'

  return {LikelyBranchWeight, UnlikelyBranchWeight};


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82325

Files:
  llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp


Index: llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
+++ llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
@@ -59,7 +59,8 @@
                                                CallInst *CI, int BranchCount) {
   if (IntrinsicID == Intrinsic::expect) {
     // __builtin_expect
-    return {LikelyBranchWeight, UnlikelyBranchWeight};
+    return std::make_tuple(LikelyBranchWeight.getValue(),
+                           UnlikelyBranchWeight.getValue());
   } else {
     // __builtin_expect_with_probability
     assert(CI->getNumOperands() >= 3 &&
@@ -71,7 +72,7 @@
     double FalseProb = (1.0 - TrueProb) / (BranchCount - 1);
     uint32_t LikelyBW = ceil((TrueProb * (double)(INT32_MAX - 1)) + 1.0);
     uint32_t UnlikelyBW = ceil((FalseProb * (double)(INT32_MAX - 1)) + 1.0);
-    return {LikelyBW, UnlikelyBW};
+    return std::make_tuple(LikelyBW, UnlikelyBW);
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82325.272518.patch
Type: text/x-patch
Size: 1008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200622/ccb4cd9e/attachment.bin>


More information about the llvm-commits mailing list