Skip to content

Commit cbbe039

Browse files
committed
Add note to TargetInfo.h
1 parent 90daf9c commit cbbe039

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

clang/lib/CodeGen/TargetInfo.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ class TargetCodeGenInfo {
101101
/// Returns true if inlining the function call would produce incorrect code
102102
/// for the current target and should be ignored (even with the always_inline
103103
/// or flatten attributes).
104+
///
105+
/// Note: This probably should be handled in LLVM. However, the `alwaysinline`
106+
/// attribute currently means the inliner will ignore mismatched attributes
107+
/// (which sometimes can generate invalid code). So, this hook allows targets
108+
/// to avoid adding the `alwaysinline` attributes based on attributes or other
109+
/// target-specific reasons.
110+
///
111+
/// See previous discussion here:
112+
/// https://discourse.llvm.org/t/rfc-avoid-inlining-alwaysinline-functions-when-they-cannot-be-inlined/79528
104113
virtual bool
105114
wouldInliningViolateFunctionCallABI(const FunctionDecl *Caller,
106115
const FunctionDecl *Callee) const {

0 commit comments

Comments
 (0)