diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp --- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp @@ -3797,13 +3797,11 @@ CallBase &CB = cast(getAssociatedValue()); Function *Callee = getAssociatedFunction(); - // Helper to lookup an assumption string. - auto HasAssumption = [](CallBase &CB, StringRef AssumptionStr) { - return hasAssumption(CB, AssumptionStr); - }; + auto &AssumptionAA = A.getAAFor( + *this, IRPosition::callsite_function(CB), DepClassTy::OPTIONAL); // Check for SPMD-mode assumptions. - if (HasAssumption(CB, "ompx_spmd_amenable")) { + if (AssumptionAA.hasAssumption("ompx_spmd_amenable")) { SPMDCompatibilityTracker.indicateOptimisticFixpoint(); indicateOptimisticFixpoint(); } @@ -3828,8 +3826,8 @@ // Unknown callees might contain parallel regions, except if they have // an appropriate assumption attached. - if (!(HasAssumption(CB, "omp_no_openmp") || - HasAssumption(CB, "omp_no_parallelism"))) + if (!(AssumptionAA.hasAssumption("omp_no_openmp") || + AssumptionAA.hasAssumption("omp_no_parallelism"))) ReachedUnknownParallelRegions.insert(&CB); // If SPMDCompatibilityTracker is not fixed, we need to give up on the @@ -4392,11 +4390,15 @@ if (F->isDeclaration()) continue; + A.getOrCreateAAFor(IRPosition::function(*F)); A.getOrCreateAAFor(IRPosition::function(*F)); if (!DisableOpenMPOptDeglobalization) A.getOrCreateAAFor(IRPosition::function(*F)); for (auto &I : instructions(*F)) { + if (auto *CB = dyn_cast(&I)) + A.getOrCreateAAFor( + IRPosition::callsite_function(*CB)); if (auto *LI = dyn_cast(&I)) { bool UsedAssumedInformation = false; A.getAssumedSimplified(IRPosition::value(*LI), /* AA */ nullptr,