[Mlir-commits] [llvm] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)
Nikita Popov
llvmlistbot at llvm.org
Tue Feb 11 03:37:22 PST 2025
================
@@ -2398,9 +2397,16 @@ Error BitcodeReader::parseAttributeGroupBlock() {
B.addUWTableAttr(UWTableKind(Record[++i]));
else if (Kind == Attribute::AllocKind)
B.addAllocKindAttr(static_cast<AllocFnKind>(Record[++i]));
- else if (Kind == Attribute::Memory)
- B.addMemoryAttr(MemoryEffects::createFromIntValue(Record[++i]));
- else if (Kind == Attribute::Captures)
+ else if (Kind == Attribute::Memory) {
+ uint64_t EncodedME = Record[++i];
+ const uint8_t Version = (EncodedME >> 56);
+ auto ME = MemoryEffects::createFromIntValue(EncodedME &
+ 0x00FFFFFFFFFFFFFFULL);
+ if (Version < 1)
+ ME |= MemoryEffects::errnoMemOnly(
+ ME.getModRef(IRMemLocation::Other));
----------------
nikic wrote:
This is not going to do the right thing, because the old Other will be located at the new ErrnoMem, so what you'd actually have to do is copy from errno to other. It might be better to full reconstruct the MemoryEffects without going through createFromIntValue for old versions.
In any case, this needs a test. You need to create a bitcode file with the old llvm-as that has something like `memory(write, argmem: read)` and then check that llvm-dis still produces the same result (instead of `memory(errnomem: write, argmem: read)` which I think is what happens without upgrade).
https://github.com/llvm/llvm-project/pull/120783
More information about the Mlir-commits
mailing list