[clang] [Clang]Throw frontend error for target feature mismatch when using `flatten` attribute (PR #150044)
Abhishek Kaushik via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 23 06:59:11 PDT 2025
================
@@ -5232,9 +5232,11 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
// since otherwise we could be making a conditional call after a check for
// the proper cpu features (and it won't cause code generation issues due to
// function based code generation).
- if (TargetDecl->hasAttr<AlwaysInlineAttr>() &&
- (TargetDecl->hasAttr<TargetAttr>() ||
- (CurFuncDecl && CurFuncDecl->hasAttr<TargetAttr>())))
+ if ((TargetDecl->hasAttr<AlwaysInlineAttr>() &&
+ (TargetDecl->hasAttr<TargetAttr>() ||
+ (CurFuncDecl && CurFuncDecl->hasAttr<TargetAttr>()))) ||
+ (CurFuncDecl && CurFuncDecl->hasAttr<FlattenAttr>() &&
+ TargetDecl->hasAttr<TargetAttr>()))
----------------
abhishek-kaushik22 wrote:
>From what I understand, we only need to check that the callee function has `TargetAttr` because the error is inlining a function that uses a target feature which the caller isn't compiled for. The caller having `TargetAttr` isn't required to reproduce the crash.
https://github.com/llvm/llvm-project/pull/150044
More information about the cfe-commits
mailing list