Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataLayout: Fix latent issues with getMaxIndexSizeInBits #118740

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions llvm/include/llvm/IR/DataLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,6 @@ class DataLayout {
/// the backends/clients are updated.
unsigned getPointerSize(unsigned AS = 0) const;

/// Returns the maximum index size over all address spaces.
unsigned getMaxIndexSize() const;

// Index size in bytes used for address calculation,
/// rounded up to a whole number of bytes.
unsigned getIndexSize(unsigned AS) const;
Expand Down Expand Up @@ -369,9 +366,7 @@ class DataLayout {
}

/// Returns the maximum index size over all address spaces.
unsigned getMaxIndexSizeInBits() const {
return getMaxIndexSize() * 8;
}
unsigned getMaxIndexSizeInBits() const;

/// Size in bits of index used for address calculation in getelementptr.
unsigned getIndexSizeInBits(unsigned AS) const {
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/IR/DataLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,12 +740,10 @@ unsigned DataLayout::getPointerSize(unsigned AS) const {
return divideCeil(getPointerSpec(AS).BitWidth, 8);
}

unsigned DataLayout::getMaxIndexSize() const {
unsigned DataLayout::getMaxIndexSizeInBits() const {
unsigned MaxIndexSize = 0;
for (const PointerSpec &Spec : PointerSpecs)
MaxIndexSize =
std::max(MaxIndexSize, (unsigned)divideCeil(Spec.BitWidth, 8));

MaxIndexSize = std::max(MaxIndexSize, Spec.IndexBitWidth);
return MaxIndexSize;
}

Expand Down
Loading