OSDN Git Service

Only promote args when function attributes are compatible
authorTom Stellard <tstellar@redhat.com>
Wed, 16 Jan 2019 05:15:31 +0000 (05:15 +0000)
committerTom Stellard <tstellar@redhat.com>
Wed, 16 Jan 2019 05:15:31 +0000 (05:15 +0000)
commit356397dc912f7f4c4783f34700e8b95c78e0dcc4
tree1fddb3fd6885388c51a8f65c57f86edb07c8e42b
parente877ff61451c0b0d01d89a898422506f5ee5fea2
Only promote args when function attributes are compatible

Summary:
Check to make sure that the caller and the callee have compatible
function arguments before promoting arguments.  This uses the same
TargetTransformInfo queries that are used to determine if attributes
are compatible for inlining.

The goal here is to avoid breaking ABI when a called function's ABI
depends on a target feature that is not enabled in the caller.

This is a very conservative fix for PR37358.  Ideally we would have a more
sophisticated check for ABI compatiblity rather than checking if the
attributes are compatible for inlining.

Reviewers: echristo, chandlerc, eli.friedman, craig.topper

Reviewed By: echristo, chandlerc

Subscribers: nikic, xbolva00, rkruppe, alexcrichton, llvm-commits

Differential Revision: https://reviews.llvm.org/D53554

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351296 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/TargetTransformInfo.h
include/llvm/Analysis/TargetTransformInfoImpl.h
lib/Analysis/TargetTransformInfo.cpp
lib/Transforms/IPO/ArgumentPromotion.cpp
test/Transforms/ArgumentPromotion/X86/attributes.ll [new file with mode: 0644]