[PATCH] D97013: [LTO] Fix cloning of llvm*.used when splitting module
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 18 17:28:00 PST 2021
tejohnson added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/ModuleUtils.cpp:79
if (GV) {
- auto *CA = cast<ConstantArray>(GV->getInitializer());
- for (auto &Op : CA->operands()) {
- Constant *C = cast_or_null<Constant>(Op);
- if (InitAsSet.insert(C).second)
- Init.push_back(C);
+ if (GV->hasInitializer()) {
+ auto *CA = cast<ConstantArray>(GV->getInitializer());
----------------
I forgot to add in the description - this is needed because when we originally clone the module over, the llvm*.used globals will be declarations in the merged module. So when we go to add the new values to their used set, we need to handle deleting the old one which doesn't have an initializer.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97013/new/
https://reviews.llvm.org/D97013
More information about the llvm-commits
mailing list