[PATCH] D78403: Infer alignment of loads with unspecified alignment in IR/bitcode parsing.
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 21 21:05:09 PDT 2020
mehdi_amini added inline comments.
================
Comment at: llvm/include/llvm/Bitcode/BitcodeReader.h:108
+ LLVMContext &Context, DataLayoutCallbackTy DataLayoutCallback =
+ [](StringRef) { return None; });
----------------
I think a better default is an empty function_ref instead of a lambda: I suspect you can write it this way `DataLayoutCallbackTy DataLayoutCallback = {}`
================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:3626
+ if (SeenFirstFunctionBody)
+ return error("datalayout too late in module");
std::string S;
----------------
Are you making invalid bitcode that was valid before here?
I'd rather avoid doing this, can we check `if (SeenFirstFunctionBody && DataLayoutCallback)`?
(which also implies to not provide a callback from any tool when not needed (and make sure the default argument for the callback is everywhere an empty function_ref)
================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:4846
+ if (!Align && !Ty->isSized())
+ return error("load of unsized type");
+ if (!Align)
----------------
Is there valid bitcode out-there that could be hit by this?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78403/new/
https://reviews.llvm.org/D78403
More information about the llvm-commits
mailing list