-
- // Now that we know the set of equivalent source pointers for the load
- // instruction, look to see if there are any load or store candidates that are
- // identical.
- //
- std::map<BasicBlock*, std::vector<LoadInst*> > CandidateLoads;
- std::map<BasicBlock*, std::vector<StoreInst*> > CandidateStores;
-
- for (Value::use_iterator UI = PointerSource->use_begin(),
- UE = PointerSource->use_end(); UI != UE; ++UI)
- if (LoadInst *Cand = dyn_cast<LoadInst>(*UI)) {// Is a load of source?
- if (Cand->getParent()->getParent() == F && // In the same function?
- Cand != LI && !Cand->isVolatile()) // Not LI itself?
- CandidateLoads[Cand->getParent()].push_back(Cand); // Got one...
- } else if (StoreInst *Cand = dyn_cast<StoreInst>(*UI)) {
- if (Cand->getParent()->getParent() == F && !Cand->isVolatile() &&
- Cand->getOperand(1) == PointerSource) // It's a store THROUGH the ptr.
- CandidateStores[Cand->getParent()].push_back(Cand);
- }
-
- // Get alias analysis & dominators.
- AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
- DominatorSet &DomSetInfo = getAnalysis<DominatorSet>();
- Value *LoadPtr = LI->getOperand(0);