================
@@ -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);
----------------
nikic wrote:

It's loop invariant -- the point here is to skip promotion for constant data, 
even if its loop invariant, because promotion works by iterating over the use 
list. In practice, this basically means that we'll not try to promote 
loads/stores to null pointers, which is just a bugpoint/reduce-ism.

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

Reply via email to