[PATCH] D143479: [Clang] Emit error when caller cannot meet target feature requirement from always-inlining callee

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 06:37:10 PDT 2023


erichkeane added a comment.

In D143479#4243090 <https://reviews.llvm.org/D143479#4243090>, @erichkeane wrote:

> Hi-
> We've actually seen some regressions internally thanks to this patch, which boil down to:
>
> https://godbolt.org/z/WEer4M6ha
>
>   // compiled with -march=skylake
>   __attribute__((always_inline)) inline void foo(){}
>   
>   __attribute__((target("arch=core-avx2")))
>   void bar() {
>   foo();
>   }
>
> I believe @craig.topper and I spent a long time on these things, but I'm now questioning what `arch=` is supposed to do in this case.  We're compiling `bar` as if it is an avx2 function, so it cannot call `foo`, which has additional features. However, they were not 'disabled'.  A part of me thinks that the `arch=...` should mean "has at least these features", and the bug is thus in the code that sets the features list.
>
> What does everyone think?  attn: @FreddyYe

Based on GCC's behavior: https://godbolt.org/z/fxWzPTT9P  I suspect our behavior is consistent/correct now, and the 'regressions' are to be expected, since GCC diagnoses the same things we do (just nicer, albeit, less informative).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143479/new/

https://reviews.llvm.org/D143479



More information about the cfe-commits mailing list