================ @@ -12603,6 +12603,18 @@ struct AAAddressSpaceImpl : public AAAddressSpace { auto CheckAddressSpace = [&](Value &Obj) { if (isa<UndefValue>(&Obj)) return true; + // Some targets relax the requirement for alloca to be in an exact address + // space, allowing it in certain other address spaces instead. These + // targets later lower alloca to the correct address space in the + // pipeline. Therefore, we need to query TTI to determine the appropriate + // address space. + if (auto *AI = dyn_cast<AllocaInst>(&Obj)) { + Function *Fn = AI->getFunction(); + auto *TTI = + A.getInfoCache().getAnalysisResultForFunction<TargetIRAnalysis>( + *Fn); + return takeAddressSpace(TTI->getAssumedAddrSpace(AI)); ---------------- shiltian wrote:
This file is in middle end, so we can't access target machine, same as InferAddressSpacePass. https://github.com/llvm/llvm-project/pull/136865 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits