================
@@ -50,6 +51,42 @@ findCallsAtConstantOffset(SmallVectorImpl<DevirtCallSite>
&DevirtCalls,
}
}
+static bool hasTypeIdLoadAtConstantOffset(const Module *M, Value *VPtr,
+ int64_t Offset, const CallInst *CI,
+ CXXABI *ABI) {
+ Triple TT(M->getTargetTriple());
+ bool HasTypeIdLoad = false;
+ for (const Use &U : VPtr->uses()) {
+ Value *User = U.getUser();
+ if (isa<BitCastInst>(User)) {
+ HasTypeIdLoad |= hasTypeIdLoadAtConstantOffset(M, User, Offset, CI, ABI);
+ } else if (isa<LoadInst>(User)) {
+ if (Offset ==
+ ABI->getOffsetFromTypeInfoSlotToAddressPoint(M->getDataLayout()))
----------------
teresajohnson wrote:
For WPD and CFI this the information about type tests and the vtable address
points are correlated from the summary during the thin link. Can we do that for
this optimization as well so that we don't need to put info about the ABI in
LLVM? E.g. see how we summarize the potential virtual calls for each type test.
Alternatively, since the presence of a possible type id load results in
conservative behavior, we may not even need to know the exact offset in this
analysis.
https://github.com/llvm/llvm-project/pull/126336
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits