mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-23 01:30:19 +00:00
Teach getOrEnforceKnownAlignment about address spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187629 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
72bc423e7f
commit
186f8f9d41
@ -928,12 +928,13 @@ static unsigned enforceKnownAlignment(Value *V, unsigned Align,
|
|||||||
/// and it is more than the alignment of the ultimate object, see if we can
|
/// and it is more than the alignment of the ultimate object, see if we can
|
||||||
/// increase the alignment of the ultimate object, making this check succeed.
|
/// increase the alignment of the ultimate object, making this check succeed.
|
||||||
unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
|
unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
|
||||||
const DataLayout *TD) {
|
const DataLayout *DL) {
|
||||||
assert(V->getType()->isPointerTy() &&
|
assert(V->getType()->isPointerTy() &&
|
||||||
"getOrEnforceKnownAlignment expects a pointer!");
|
"getOrEnforceKnownAlignment expects a pointer!");
|
||||||
unsigned BitWidth = TD ? TD->getPointerSizeInBits() : 64;
|
unsigned BitWidth = DL ? DL->getPointerTypeSizeInBits(V->getType()) : 64;
|
||||||
|
|
||||||
APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);
|
APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);
|
||||||
ComputeMaskedBits(V, KnownZero, KnownOne, TD);
|
ComputeMaskedBits(V, KnownZero, KnownOne, DL);
|
||||||
unsigned TrailZ = KnownZero.countTrailingOnes();
|
unsigned TrailZ = KnownZero.countTrailingOnes();
|
||||||
|
|
||||||
// Avoid trouble with ridiculously large TrailZ values, such as
|
// Avoid trouble with ridiculously large TrailZ values, such as
|
||||||
@ -946,7 +947,7 @@ unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
|
|||||||
Align = std::min(Align, +Value::MaximumAlignment);
|
Align = std::min(Align, +Value::MaximumAlignment);
|
||||||
|
|
||||||
if (PrefAlign > Align)
|
if (PrefAlign > Align)
|
||||||
Align = enforceKnownAlignment(V, Align, PrefAlign, TD);
|
Align = enforceKnownAlignment(V, Align, PrefAlign, DL);
|
||||||
|
|
||||||
// We don't need to make any adjustment.
|
// We don't need to make any adjustment.
|
||||||
return Align;
|
return Align;
|
||||||
|
Loading…
Reference in New Issue
Block a user