================ @@ -2294,10 +2294,14 @@ collectPromotionCandidates(MemorySSA *MSSA, AliasAnalysis *AA, Loop *L) { AliasSetTracker AST(BatchAA); auto IsPotentiallyPromotable = [L](const Instruction *I) { - if (const auto *SI = dyn_cast<StoreInst>(I)) - return L->isLoopInvariant(SI->getPointerOperand()); - if (const auto *LI = dyn_cast<LoadInst>(I)) - return L->isLoopInvariant(LI->getPointerOperand()); + if (const auto *SI = dyn_cast<StoreInst>(I)) { + const Value *PtrOp = SI->getPointerOperand(); + return !isa<ConstantData>(PtrOp) && L->isLoopInvariant(PtrOp); ---------------- jayfoad wrote:
Surely ConstantData is just constant, so it is guaranteed to be loop-invariant, so this should be: ```suggestion return isa<ConstantData>(PtrOp) || L->isLoopInvariant(PtrOp); ``` And couldn't the ConstantData check be done inside of isLoopInvariant? https://github.com/llvm/llvm-project/pull/134690 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits