Update optimization passes to handle inalloca arguments

Summary:
I searched Transforms/ and Analysis/ for 'ByVal' and updated those call
sites to check for inalloca if appropriate.

I added tests for any change that would allow an optimization to fire on
inalloca.

Reviewers: nlewycky

Differential Revision: http://llvm-reviews.chandlerc.com/D2449

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200281 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Kleckner
2014-01-28 02:38:36 +00:00
parent 1386d3f885
commit 59bec0e3c0
14 changed files with 124 additions and 20 deletions

View File

@ -311,8 +311,9 @@ void llvm::ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne,
if (Argument *A = dyn_cast<Argument>(V)) {
unsigned Align = 0;
if (A->hasByValAttr()) {
// Get alignment information off byval arguments if specified in the IR.
if (A->hasByValOrInAllocaAttr()) {
// Get alignment information off byval/inalloca arguments if specified in
// the IR.
Align = A->getParamAlignment();
} else if (TD && A->hasStructRetAttr()) {
// An sret parameter has at least the ABI alignment of the return type.
@ -2070,9 +2071,9 @@ bool llvm::isKnownNonNull(const Value *V, const TargetLibraryInfo *TLI) {
// Alloca never returns null, malloc might.
if (isa<AllocaInst>(V)) return true;
// A byval argument is never null.
// A byval or inalloca argument is never null.
if (const Argument *A = dyn_cast<Argument>(V))
return A->hasByValAttr();
return A->hasByValOrInAllocaAttr();
// Global values are not null unless extern weak.
if (const GlobalValue *GV = dyn_cast<GlobalValue>(V))