Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
In general, I'd like to strongly discourage directly checking endian::system_endianness(), in favor of using the endian-sensitive read/write helpers from llvm/Support/Endian.h. For example, you can copy_n from an endian::ulittle64_t* to a uint64_t*. Using a distinct codepath for big-endian means more code, and that code gets less testing.
Thanks for the comments Eli! Didn't know about those. Will recommend the same in the future.
mlir/lib/IR/Attributes.cpp | ||
---|---|---|
573 | Created getAPIntCopyParam() to calculation parameters for copying. |
@rriddle Sorry for late response. He suggested we should not check endianenss, This means we should use the same code in BE and LE machines.
However, I think redundant copy are required in LE to use the same code. So, current patch checks the endianness to avoid it.
Do you have any thought?
Apologies for the delay. LGTM as seems we are reusing the same methods we added in the patch for parsing.
@rriddle Thanks for reviewing many times! I don't have commit access. Could you commit this patch if you don't have any other comments?
nit: I would spell out big endian in the function name, or at least put it in the comment above.