This is for Swift VFE support. In some vtable forms that Swift emits, the "base" of a relative pointer is not the global symbol itself directly, but a GEP into it -- so the pointer is relative to a particular field in the global. So getPointerAtOffset() needs to be able to see through the GEP and allow it in a SUB expression, to correctly recognize the offset as a vtable slot.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LGTM, thanks!
llvm/lib/Analysis/TypeMetadataUtils.cpp | ||
---|---|---|
129 | given that this is only used at a single point, maybe define it as a lambda at the use, so all the swift specific code is kept close together? | |
llvm/test/Transforms/GlobalDCE/virtual-functions-relative-pointers-gep.ll | ||
2 | new tests probably should use the new pm syntax (-passes='globaldce') |
given that this is only used at a single point, maybe define it as a lambda at the use, so all the swift specific code is kept close together?