[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
Sun Aug 10 06:08:37 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:
Thank You! I was not considering the fact that we can also disable features using the target attribute. I've added the condition and a new test for this.
https://github.com/llvm/llvm-project/pull/150044
More information about the cfe-commits
mailing list