[llvm] [WPD] Dereference `GlobalAlias` targets (PR #215880)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 13 07:57:18 PDT 2026
================
@@ -1147,6 +1147,10 @@ bool DevirtModule::tryFindVirtualCallTargets(
// target.
auto *GV = dyn_cast<GlobalValue>(C);
assert(GV);
+ if (!GV->isInterposable())
+ if (auto *GA = dyn_cast<GlobalAlias>(GV))
+ if (!GA->isInterposable())
----------------
teresajohnson wrote:
This is effectively doing the same check as the one 2 lines up, since GA = GV. I think you meant to check the aliasee object (which you are doing correctly in the ThinLTO case further down). Might make sense to do the check in a single if statement like you are doing there too. I.e.:
```
assert(GV);
if (auto *GA = dyn_cast<GlobalAlias>(GV))
if (!GA->isInterposable() && !GA->getAliaseeObject()->isInterposable())
GV = GA->getAliaseeObject();
```
I guess all the tests in the PR so far are for the ThinLTO case. You could presumably test this one in llvm/test/Transforms/WholeProgramDevirt/.
https://github.com/llvm/llvm-project/pull/215880
More information about the llvm-commits
mailing list