[PATCH] D108741: [GlobalDCE] Handle non-vfunc entries in vtables during VFE
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 13 09:54:17 PDT 2021
fhahn added a comment.
> As part of codesize optimization work for Swift, we'd like to add Virtual Function Elimination to Swift, very similarly to how GlobalDCE supports C++ VFE.
I think it would be good to drop this part from the description, as the change is not really related to swift; it just changes the code to ignore entries at slots without `!type`.
It seems sensible to me to ignore entries without corresponding `!type` metadata and this should be in line with the specification in langref. @pcc, @tejohnson Are there any issues you could think of?
================
Comment at: llvm/lib/Transforms/IPO/GlobalDCE.cpp:133
+
+ for (MDNode *Type : Types) {
+ uint64_t Offset =
----------------
It seems like it may be quite expensive to iterate over all types for a global, getting the pointer at the offsets and so on, possibly multiple times for the same GV. If that's the case, could we pre-compute the set of valid pointers in `VTable` and then just check against the set?
================
Comment at: llvm/test/Transforms/GlobalDCE/virtual-functions-non-vfunc-entries.ll:1
+; RUN: opt < %s -globaldce -S | FileCheck %s
+
----------------
Can you pre-commit this test and just include the diff with the changes caused by the patch?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108741/new/
https://reviews.llvm.org/D108741
More information about the llvm-commits
mailing list