Implement TargetTransformInfo::hasCompatibleFunctionAttributes for X86.
authorEric Christopher <echristo@gmail.com>
Thu, 2 Jul 2015 01:11:50 +0000 (01:11 +0000)
committerEric Christopher <echristo@gmail.com>
Thu, 2 Jul 2015 01:11:50 +0000 (01:11 +0000)
commit320404f1347652cb68c02b6b086e8c330ea991b3
treea955579118faa489a9d5679fe7dc30d7f66b910d
parent5d5b914c59be6f91463e2a556f4ba2c7a0ecc6b3
Implement TargetTransformInfo::hasCompatibleFunctionAttributes for X86.

This checks subtarget feature compatibility for inlining by verifying
that the callee is a strict subset of the caller's features. This includes
the cpu as part of the subtarget we can get via the incoming functions as
the backend takes CPUs as feature sets.

This allows us to inline things like:

int foo() { return baz(); }

int __attribute__((target("sse4.2"))) bar() {
  return foo();
}

so that generic code can be inlined into specialized functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241221 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86TargetTransformInfo.cpp
lib/Target/X86/X86TargetTransformInfo.h
test/Transforms/Inline/inline-target-attr.ll [new file with mode: 0644]