aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorDávid Bolvanský <david.bolvansky@gmail.com>2022-03-14 21:44:59 +0100
committerDávid Bolvanský <david.bolvansky@gmail.com>2022-03-14 21:45:31 +0100
commit003c0b9307bc52605fc93c599dfe36849839ded5 (patch)
treecc4feb18b91f00e3ba5de63c783d51a948d0da83 /clang/lib/CodeGen/CodeGenFunction.h
parent84af90336fed36f7dfdc468ded39236f32bbb82e (diff)
downloadllvm-003c0b9307bc52605fc93c599dfe36849839ded5.zip
llvm-003c0b9307bc52605fc93c599dfe36849839ded5.tar.gz
llvm-003c0b9307bc52605fc93c599dfe36849839ded5.tar.bz2
[Clang] always_inline statement attribute
Motivation: ``` int test(int x, int y) { int r = 0; [[clang::always_inline]] r += foo(x, y); // force compiler to inline this function here return r; } ``` In 2018, @kuhar proposed "Introduce per-callsite inline intrinsics" in https://reviews.llvm.org/D51200 to solve this motivation case (and many others). This patch solves this problem with call site attribute. "noinline" statement attribute already landed in D119061. Also, some LLVM Inliner fixes landed so call site attribute is stronger than function attribute. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D120717
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 2636a4d..598fb7f 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -554,6 +554,9 @@ public:
/// True if the current statement has noinline attribute.
bool InNoInlineAttributedStmt = false;
+ /// True if the current statement has always_inline attribute.
+ bool InAlwaysInlineAttributedStmt = false;
+
// The CallExpr within the current statement that the musttail attribute
// applies to. nullptr if there is no 'musttail' on the current statement.
const CallExpr *MustTailCall = nullptr;