mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-04 17:47:58 +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
|
||||
/// increase the alignment of the ultimate object, making this check succeed.
|
||||
unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
|
||||
const DataLayout *TD) {
|
||||
const DataLayout *DL) {
|
||||
assert(V->getType()->isPointerTy() &&
|
||||
"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);
|
||||
ComputeMaskedBits(V, KnownZero, KnownOne, TD);
|
||||
ComputeMaskedBits(V, KnownZero, KnownOne, DL);
|
||||
unsigned TrailZ = KnownZero.countTrailingOnes();
|
||||
|
||||
// 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);
|
||||
|
||||
if (PrefAlign > Align)
|
||||
Align = enforceKnownAlignment(V, Align, PrefAlign, TD);
|
||||
Align = enforceKnownAlignment(V, Align, PrefAlign, DL);
|
||||
|
||||
// We don't need to make any adjustment.
|
||||
return Align;
|
||||
|
Loading…
x
Reference in New Issue
Block a user