mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
The alignment of an sret parameter is known: it must be at least the
alignment of the return type. Teach the optimizers this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165226 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -308,11 +308,20 @@ void llvm::ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne,
|
||||
}
|
||||
|
||||
if (Argument *A = dyn_cast<Argument>(V)) {
|
||||
// Get alignment information off byval arguments if specified in the IR.
|
||||
if (A->hasByValAttr())
|
||||
if (unsigned Align = A->getParamAlignment())
|
||||
KnownZero = APInt::getLowBitsSet(BitWidth,
|
||||
CountTrailingZeros_32(Align));
|
||||
unsigned Align = 0;
|
||||
|
||||
if (A->hasByValAttr()) {
|
||||
// Get alignment information off byval 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.
|
||||
Type *EltTy = cast<PointerType>(A->getType())->getElementType();
|
||||
if (EltTy->isSized())
|
||||
Align = TD->getABITypeAlignment(EltTy);
|
||||
}
|
||||
|
||||
if (Align)
|
||||
KnownZero = APInt::getLowBitsSet(BitWidth, CountTrailingZeros_32(Align));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user