[llvm] [Attributor] Avoid AS-cast for function pointers (PR #65825)
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 11:49:57 PDT 2024
================
@@ -12304,11 +12304,31 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo {
UsedAssumedInformation))
return ChangeStatus::UNCHANGED;
+ const auto *TTI =
+ A.getInfoCache().getAnalysisResultForFunction<TargetIRAnalysis>(
+ *CB->getFunction());
+ const DataLayout &DL = A.getDataLayout();
+ LLVMContext &Ctx = CB->getContext();
+
ChangeStatus Changed = ChangeStatus::UNCHANGED;
Value *FP = CB->getCalledOperand();
- if (FP->getType()->getPointerAddressSpace())
- FP = new AddrSpaceCastInst(FP, PointerType::get(FP->getType(), 0),
- FP->getName() + ".as0", CB);
+ unsigned ProgramAS = A.getDataLayout().getProgramAddressSpace();
----------------
jdoerfert wrote:
At this point I need to know what the AS is of the functions I compare with (in the if-cascade). I could pick one of them and use its AS, or I use the DL. This seems cleaner.
https://github.com/llvm/llvm-project/pull/65825
More information about the llvm-commits
mailing list