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