[PATCH] D101264: [IR] Optimize mayBeDerefined for known linkages. NFC
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 27 22:19:52 PDT 2021
jdoerfert added a comment.
Doesn't this change `internal/appending/private dso_local` with "semantic interposition" enabled? TBH, it might just be that those do not make sense (though we seem not to assert on them).
I can see the value of avoiding the roundtrip through isInterposable but the argument by @dblaikie that we should not duplicate stuff is valid too. Though, we already duplicate some stuff.
Maybe, as a compromise to "clean it up", we make a compile time constant array of linkage information
struct LinkageInformation {
llvm::Optional<bool> MayBeDerefinedReturn;
...
};
LinakageInformation LIs[LinkageTypes::__LAST] = {
LinkageInformation{llvm::None, ...}, // ExternalLinkage
...
LinkageInformation{true, ...}, // WeakODRLinkage
};
bool mayBeDerefined() const {
if (LIs[getLinkage()].MayBeDerefinedReturn) return *LIs[getLinkage()].MayBeDerefinedReturn;
return isInterposable();
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101264/new/
https://reviews.llvm.org/D101264
More information about the llvm-commits
mailing list