[PATCH] D142787: [GVN] Don't count debug instructions when limit the number of checked instructions

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 29 23:30:30 PST 2023


mkazantsev added a comment.

There are other limits like that where we dont' care about it:

  // Find non-clobbered value for Loc memory location in extended basic block
  // (chain of basic blocks with single predecessors) starting From instruction.
  static Value *findDominatingValue(const MemoryLocation &Loc, Type *LoadTy,
                                    Instruction *From, AAResults *AA) {
    uint32_t NumVisitedInsts = 0;
    BasicBlock *FromBB = From->getParent();
    BatchAAResults BatchAA(*AA);
    for (BasicBlock *BB = FromBB; BB; BB = BB->getSinglePredecessor())
      for (auto I = BB == FromBB ? From->getReverseIterator() : BB->rbegin(),
                E = BB->rend();
           I != E; ++I) {
        // Stop the search if limit is reached.
        if (++NumVisitedInsts > MaxNumVisitedInsts)
          return nullptr;
        Instruction *Inst = &*I;
        if (isModSet(BatchAA.getModRefInfo(Inst, Loc)))
          return nullptr;
        if (auto *LI = dyn_cast<LoadInst>(Inst))
          if (LI->getPointerOperand() == Loc.Ptr && LI->getType() == LoadTy)
            return LI;
      }
    return nullptr;
  }

Why getting GVN to work here despite giant CT cost is important?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142787/new/

https://reviews.llvm.org/D142787



More information about the llvm-commits mailing list