[llvm] [Attributor] Skip AS specialization for volatile memory instructions (PR #107250)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 07:53:13 PDT 2024
================
@@ -12509,6 +12509,34 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo {
/// ------------------------ Address Space ------------------------------------
namespace {
+
+template <typename InstType>
+static bool makeChange(Attributor &A, InstType *MemInst, const Use &U,
+ Value *OriginalValue, PointerType *NewPtrTy,
+ bool UseOriginalValue) {
+ if (U.getOperandNo() != InstType::getPointerOperandIndex())
+ return false;
+
+ auto *TTI = A.getInfoCache().getAnalysisResultForFunction<TargetIRAnalysis>(
+ *MemInst->getFunction());
+ if (!TTI)
+ return false;
+
+ unsigned OldAS = MemInst->getPointerAddressSpace();
+ if (MemInst->isVolatile() && !TTI->hasVolatileVariant(MemInst, OldAS))
----------------
shiltian wrote:
For `hasVolatileVariant`, the reading seems like it needs to pass new AS to see there is the corresponding volatile variant, but in `InferAddressSpaces` it uses the old AS.
https://github.com/llvm/llvm-project/pull/107250
More information about the llvm-commits
mailing list