-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[Clang]Throw frontend error for target feature mismatch when using flatten
attribute
#150044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang Author: Abhishek Kaushik (abhishek-kaushik22) ChangesFixes #149866 Full diff: https://github.com/llvm/llvm-project/pull/150044.diff 2 Files Affected:
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 0bceecec6e555..589716460b2de 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -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>()))
checkTargetFeatures(Loc, FD);
}
diff --git a/clang/test/CodeGen/target-features-error-3.c b/clang/test/CodeGen/target-features-error-3.c
new file mode 100644
index 0000000000000..8900edfa257c7
--- /dev/null
+++ b/clang/test/CodeGen/target-features-error-3.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o -
+
+typedef double __v2df __attribute__((__vector_size__(16)));
+
+__v2df __attribute__((target("sse4.1"))) foo() {
+ __v2df v = {0.0, 0.0};
+ return __builtin_ia32_roundpd(v, 2);
+}
+
+__v2df __attribute__((flatten)) bar() {
+ return foo(); // expected-error {{always_inline function 'foo' requires target feature 'sse4.1', but would be inlined into function 'bar' that is compiled without support for 'sse4.1'}}
+}
|
@topperc can you please review since you've reviewed similar commits in the past? |
@efriedma-quic can you please review again? |
Ping! |
…llvm#153217) I was looking over this pass and noticed it was using shared pointers for CompositeNodes. However, all nodes are owned by the deinterleaving graph and are not released until the graph is destroyed. This means a bump allocator and raw pointers can be used, which have a simpler ownership model and less overhead than shared pointers. The changes in this PR are to: - Add a `SpecificBumpPtrAllocator<CompositeNode>` to the `ComplexDeinterleavingGraph` - This allocates new nodes and will deallocate them when the graph is destroyed - Replace `NodePtr` and `RawNodePtr` with `CompositeNode *`
In the AGPR case this will be an 8 byte instruction, which is part of why this case is a pain to deal with in the first place.
…#137299) Using early returns tends to make the code easier to read, without any changes to the generated code.
This change adds support for MemberExpr with VarDecl ComplexType Issue: llvm#141365
This patch handle struct of fixed vector and struct of array of fixed vector correctly for VLS calling convention in EmitFunctionProlog, EmitFunctionEpilog and EmitCall. stack on: llvm#147173
The previous version of the code would prevent the use of the compiler builtins.
…de (llvm#154305) In streaming mode, both the @llvm.aarch64.sme.cnts and @llvm.aarch64.sve.cnt intrinsics are equivalent. For SVE, cnt* is lowered in instCombineIntrinsic to @llvm.sme.vscale(). This patch lowers the SME intrinsic similarly when in streaming-mode.
…154452) This is a cherry pick of llvm#154053 with a fix for bad handling of endianess when loading float and double litteral from the binary. --------- Co-authored-by: Ferdinand Lemaire <ferdinand.lemaire@woven-planet.global> Co-authored-by: Jessica Paquette <jessica.paquette@woven-planet.global> Co-authored-by: Luc Forget <luc.forget@woven.toyota>
… -mattr argument. NFC. The unnecessary quotes prevents DOS scripts from executing the RUN line.
/llvm-project/clang/lib/CodeGen/Targets/RISCV.cpp:865:9: error: unused variable 'FixedSrcTy' [-Werror,-Wunused-variable] auto *FixedSrcTy = cast<llvm::FixedVectorType>(SrcTy); ^ 1 error generated.
…vm#154326) A couple of minor readability changes now that we're not supporting both intrinsics and records.
Add trailing newlines to the following files to comply with POSIX standards: - llvm/lib/Target/RISCV/RISCVInstrInfoXSpacemiT.td - llvm/test/MC/RISCV/xsmtvdot-invalid.s - llvm/test/MC/RISCV/xsmtvdot-valid.s Closes llvm#151706
…context" (llvm#154458) The immediate evaluation context needs the lambda scope info to propagate some flags, however that LSI was removed in ActOnFinishFunctionBody which happened before rebuilding a lambda expression. The last attempt destroyed LSI at the end of the block scope, after which we still need it in DiagnoseShadowingLambdaDecls. This also converts the wrapper function to default arguments as a drive-by fix, as well as does some cleanup. Fixes llvm#145776
…lvm#154340) Adds legalization support for `G_TRUNC_SSAT_S`, `G_TRUNC_SSAT_S`, `G_TRUNC_USAT_U` instructions for GlobalISel.
Whether the argument is fixed is now available via ArgFlags, so make use of it. The previous implementation was quite problematic, because it stored the number of fixed arguments in a global variable, which is not thread safe.
…4289) If FunctionAttrs infers additional attributes on a function, it also invalidates analysis on callers of that function. The way it does this right now limits this to calls with matching signature. However, the function attributes will also be used when the signatures do not match. Use getCalledOperand() to avoid a signature check. This is not a correctness fix, just improves analysis quality. I noticed this due to llvm#144497 (comment), where LICM ends up with a stale MemoryDef that could be a MemoryUse (which is a bug in LICM, but still non-optimal).
…ection by name only (llvm#154159) The AArch64 build attribute specification now allows switching to an already-defined subsection using its name alone, without repeating the optionality and type parameters. This patch updates the parser to support that behavior. Spec reference: https://github.com/ARM-software/abi-aa/pull/230/files
…ilability. (llvm#154143) The FEAT_SVE_B16B16 arithmetic instructions are only available to streaming mode functions when SME2 is available.
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Sorry for this I don't know what happened here, I just did a rebase from main :( |
Fixes #149866