[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:29:32 PDT 2023


erichkeane added subscribers: FreddyYe, craig.topper.
erichkeane added a comment.

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


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