[llvm] [DataLayout] Add byte specification (PR #106536)
Rohan Satapathy via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 19:10:00 PDT 2026
https://github.com/rohansatapathy commented:
Hello! I've been working on a backend for a 32-bit word-addressable ISA and decided to rebase my fork on top of `users/s-barannikov/byte/7-simplify-lib-calls` to not have to translate between middle-end byte addresses and backend word addresses. I noticed a bug and wanted to report it in case it helps this get merged in quicker.
I also noticed a bug in `MachineVerifier.cpp` which it looks like isn't covered by any of the PRs in this set (lines 1407-1415):
```cpp
if (PtrTy.isPointerOrPointerVector()) {
const DataLayout &DL = MF->getDataLayout();
unsigned AS = PtrTy.getAddressSpace();
unsigned IndexSizeInBits = DL.getIndexSize(AS) * 8; // should be DL.getIndexSizeInBits(AS)
if (OffsetTy.getScalarSizeInBits() != IndexSizeInBits) {
report("gep offset operand must match index size for address space",
MI);
}
}
```
I'm aware that this PR set is focused primarily on the middle end, but since this change is target-agnostic, I think it makes sense to include here.
I'm also happy to upstream my backend if it'll help get this merged in -- according to [this thread](https://discourse.llvm.org/t/rfc-on-non-8-bit-bytes-and-the-target-for-it/53455/46), it seems like one of the biggest objections to non-standard bytes is a lack of an in-tree backend that will make these changes testable. The backend I'm working on is a small teaching ISA for a university course, and I already have basic C test cases compiling to assembly. As I continue bringing up the backend, I'm planning to keep rebasing [my fork](https://github.com/rohansatapathy/llvm-project) on this PR set, and I'm happy to review patches as needed. Please let me know what you all think!
https://github.com/llvm/llvm-project/pull/106536
More information about the llvm-commits
mailing list