Lines Matching refs:S0
115 PHINode *getPHIOperand(BasicBlock *BB, StoreInst *S0, StoreInst *S1);
118 bool canSinkStoresAndGEPs(StoreInst *S0, StoreInst *S1) const;
211 PHINode *MergedLoadStoreMotion::getPHIOperand(BasicBlock *BB, StoreInst *S0, in getPHIOperand() argument
214 Value *Opd1 = S0->getValueOperand(); in getPHIOperand()
221 NewPN->applyMergedLocation(S0->getDebugLoc(), S1->getDebugLoc()); in getPHIOperand()
222 NewPN->addIncoming(Opd1, S0->getParent()); in getPHIOperand()
230 bool MergedLoadStoreMotion::canSinkStoresAndGEPs(StoreInst *S0, in canSinkStoresAndGEPs() argument
232 if (S0->getPointerOperand() == S1->getPointerOperand()) in canSinkStoresAndGEPs()
234 auto *GEP0 = dyn_cast<GetElementPtrInst>(S0->getPointerOperand()); in canSinkStoresAndGEPs()
237 (GEP0->getParent() == S0->getParent()) && GEP1->hasOneUse() && in canSinkStoresAndGEPs()
246 void MergedLoadStoreMotion::sinkStoresAndGEPs(BasicBlock *BB, StoreInst *S0, in sinkStoresAndGEPs() argument
248 Value *Ptr0 = S0->getPointerOperand(); in sinkStoresAndGEPs()
252 dbgs() << "Instruction Left\n"; S0->dump(); dbgs() << "\n"; in sinkStoresAndGEPs()
257 S0->andIRFlags(S1); in sinkStoresAndGEPs()
258 S0->dropUnknownNonDebugMetadata(); in sinkStoresAndGEPs()
259 S0->applyMergedLocation(S0->getDebugLoc(), S1->getDebugLoc()); in sinkStoresAndGEPs()
260 S0->mergeDIAssignID(S1); in sinkStoresAndGEPs()
264 IRBuilder<> Builder(S0); in sinkStoresAndGEPs()
265 auto Cast = Builder.CreateBitOrPointerCast(S0->getValueOperand(), in sinkStoresAndGEPs()
267 S0->setOperand(0, Cast); in sinkStoresAndGEPs()
270 StoreInst *SNew = cast<StoreInst>(S0->clone()); in sinkStoresAndGEPs()
273 if (PHINode *NewPN = getPHIOperand(BB, S0, S1)) in sinkStoresAndGEPs()
275 S0->eraseFromParent(); in sinkStoresAndGEPs()
329 auto *S0 = dyn_cast<StoreInst>(I); in mergeStores() local
330 if (!S0 || !S0->isSimple()) in mergeStores()
336 if (StoreInst *S1 = canSinkFromBlock(Pred1, S0)) { in mergeStores()
337 if (!canSinkStoresAndGEPs(S0, S1)) in mergeStores()
353 sinkStoresAndGEPs(SinkBB, S0, S1); in mergeStores()