[clang] [clang][Interp] Implement builintin_expect (PR #69713)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 20 05:29:44 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff ba8565fbcb975e2d067ce3ae5a7dbaae4953edd3 12cb6e61a8e77a7800fda0ae4dd1148e76844da8 -- clang/lib/AST/Interp/InterpBuiltin.cpp clang/test/AST/Interp/builtin-functions.cpp clang/test/Sema/builtin-expect-with-probability.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/AST/Interp/InterpBuiltin.cpp b/clang/lib/AST/Interp/InterpBuiltin.cpp
index d5b694a97ca1..fb6c1dc7a257 100644
--- a/clang/lib/AST/Interp/InterpBuiltin.cpp
+++ b/clang/lib/AST/Interp/InterpBuiltin.cpp
@@ -450,8 +450,7 @@ static bool interp__builtin_popcount(InterpState &S, CodePtr OpPC,
// __builtin_expect_with_probability(long, long, double)
static bool interp__builtin_expect(InterpState &S, CodePtr OpPC,
const InterpFrame *Frame,
- const Function *Func,
- const CallExpr *Call) {
+ const Function *Func, const CallExpr *Call) {
// The return value is simply the value of the first parameter.
// We ignore the probability.
unsigned NumArgs = Call->getNumArgs();
@@ -459,9 +458,9 @@ static bool interp__builtin_expect(InterpState &S, CodePtr OpPC,
assert(NumArgs == 2 || NumArgs == 3);
- // The top of the stack is the probability (either as a long for builtin_expect()
- // or as a float for builtin_expect_with_probability()), which we want to ignore
- // entirely.
+ // The top of the stack is the probability (either as a long for
+ // builtin_expect() or as a float for builtin_expect_with_probability()),
+ // which we want to ignore entirely.
size_t LongSize = align(primSize(getLongPrimType(S))) * 2;
unsigned Offset = LongSize;
if (NumArgs == 3)
``````````
</details>
https://github.com/llvm/llvm-project/pull/69713
More information about the cfe-commits
mailing list