Lines Matching defs:S0
116 PHINode *getPHIOperand(BasicBlock *BB, StoreInst *S0, StoreInst *S1);
119 bool canSinkStoresAndGEPs(StoreInst *S0, StoreInst *S1) const;
210 /// Create a PHI node in BB for the operands of S0 and S1
212 PHINode *MergedLoadStoreMotion::getPHIOperand(BasicBlock *BB, StoreInst *S0,
215 Value *Opd1 = S0->getValueOperand();
222 NewPN->applyMergedLocation(S0->getDebugLoc(), S1->getDebugLoc());
223 NewPN->addIncoming(Opd1, S0->getParent());
231 bool MergedLoadStoreMotion::canSinkStoresAndGEPs(StoreInst *S0,
233 if (S0->getPointerOperand() == S1->getPointerOperand())
235 auto *GEP0 = dyn_cast<GetElementPtrInst>(S0->getPointerOperand());
238 (GEP0->getParent() == S0->getParent()) && GEP1->hasOneUse() &&
247 void MergedLoadStoreMotion::sinkStoresAndGEPs(BasicBlock *BB, StoreInst *S0,
249 Value *Ptr0 = S0->getPointerOperand();
253 dbgs() << "Instruction Left\n"; S0->dump(); dbgs() << "\n";
258 S0->andIRFlags(S1);
260 combineMetadataForCSE(S0, S1, true);
261 S0->applyMergedLocation(S0->getDebugLoc(), S1->getDebugLoc());
262 S0->mergeDIAssignID(S1);
266 IRBuilder<> Builder(S0);
267 auto Cast = Builder.CreateBitOrPointerCast(S0->getValueOperand(),
269 S0->setOperand(0, Cast);
272 StoreInst *SNew = cast<StoreInst>(S0->clone());
275 if (PHINode *NewPN = getPHIOperand(BB, S0, S1))
277 S0->eraseFromParent();
331 auto *S0 = dyn_cast<StoreInst>(I);
332 if (!S0 || !S0->isSimple())
338 if (StoreInst *S1 = canSinkFromBlock(Pred1, S0)) {
339 if (!canSinkStoresAndGEPs(S0, S1))
355 sinkStoresAndGEPs(SinkBB, S0, S1);