[PATCH] D70006: [ThinLTO] Fix bug when importing writeonly variables

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 07:58:44 PST 2019


evgeny777 added a comment.

> I'm a little confused about what causes the original failure mode

Assuming we have writeonly variable `foo` with non-trivial initializer, the following happens after D69561 <https://reviews.llvm.org/D69561>

1. `foo` is marked as writeonly due to change in `canImportGlobalVar`
2. `computeImportForReferencedGlobals` refuses to import `foo` because `!isReadOnly(GVS)  && GVS->refs().size()` evaluates to `true`. See HasReferencesPreventingImport
3. Import of function which uses `foo` causes declaration of `foo` to be exported to destination module
4. `foo` is internalized in source module because due to being "writeonly"


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70006/new/

https://reviews.llvm.org/D70006





More information about the llvm-commits mailing list