mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
[MLIR][Bytecode] Ensure dataIt is aligned coming out of EncodingReader::alignTo.
This addresses the TODO in the code previously and checks that the address of `dataIt` is properly aligned to the requested alignment. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D137855
This commit is contained in:
@@ -103,8 +103,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Check that the current data pointer is actually at the expected
|
||||
// alignment.
|
||||
// Ensure the data iterator is now aligned. This case is unlikely because we
|
||||
// *just* went through the effort to align the data iterator.
|
||||
if (LLVM_UNLIKELY(!llvm::isAddrAligned(llvm::Align(alignment), dataIt))) {
|
||||
return emitError("expected data iterator aligned to ", alignment,
|
||||
", but got pointer: '0x" +
|
||||
llvm::utohexstr((uintptr_t)dataIt) + "'");
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user