[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 07:00:14 PDT 2025
================
@@ -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'}}
----------------
abhishek-kaushik22 wrote:
This is coming from tablegen, do you think we should change that as well?
```
def err_function_needs_feature : Error<
"always_inline function %1 requires target feature '%2', but would "
"be inlined into function %0 that is compiled without support for '%2'">;
```
https://github.com/llvm/llvm-project/pull/150044
More information about the cfe-commits
mailing list