Currently clang emits error when both always_inline and target attributes are on callee, but caller doesn't have some feature:
// RUN: %clang_cc1 -triple powerpc64le -target-feature -htm
__attribute__((always_inline))
__attribute__((target("htm")))
void foo() {}
void bar() { foo(); }
// error: always_inline function 'foo' requires target feature 'htm', but would be inlined into function 'bar' that is compiled without support for 'htm'But when the always_inline attribute is on caller, clang has no diagnose. If any builtin or inline asm really need the feature, backend will crash.
// RUN: %clang_cc1 -triple powerpc64le -target-feature +htm
__attribute__((always_inline))
void foo() {
// No error, but uncommenting line below triggers ICE
// __builtin_ttest();
}
__attribute__((target("no-htm")))
void bar() { foo(); }This patch will fix the second case.