Home | History | Annotate | Download | only in InstCombine

Lines Matching refs:SI

437     if (SelectInst *SI = dyn_cast<SelectInst>(Op)) {
440 if (isSafeToLoadUnconditionally(SI->getOperand(1), SI, Align, DL) &&
441 isSafeToLoadUnconditionally(SI->getOperand(2), SI, Align, DL)) {
442 LoadInst *V1 = Builder->CreateLoad(SI->getOperand(1),
443 SI->getOperand(1)->getName()+".val");
444 LoadInst *V2 = Builder->CreateLoad(SI->getOperand(2),
445 SI->getOperand(2)->getName()+".val");
448 return SelectInst::Create(SI->getCondition(), V1, V2);
452 if (Constant *C = dyn_cast<Constant>(SI->getOperand(1)))
454 LI.setOperand(0, SI->getOperand(2));
459 if (Constant *C = dyn_cast<Constant>(SI->getOperand(2)))
461 LI.setOperand(0, SI->getOperand(1));
472 static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
473 User *CI = cast<User>(SI.getOperand(1));
496 Constant *Zero = Constant::getNullValue(Type::getInt32Ty(SI.getContext()));
560 Value *SIOp0 = SI.getOperand(0);
563 SI.setOperand(0, NewCast);
564 SI.setOperand(1, CastOp);
565 return &SI;
597 Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {
598 Value *Val = SI.getOperand(0);
599 Value *Ptr = SI.getOperand(1);
606 unsigned StoreAlign = SI.getAlignment();
611 SI.setAlignment(KnownAlign);
613 SI.setAlignment(EffectiveStoreAlign);
618 if (!SI.isSimple()) return nullptr;
624 return EraseInstFromFunction(SI);
628 return EraseInstFromFunction(SI);
636 BasicBlock::iterator BBI = &SI;
637 for (unsigned ScanInsts = 6; BBI != SI.getParent()->begin() && ScanInsts;
651 SI.getOperand(1))) {
666 return EraseInstFromFunction(SI);
679 if (isa<ConstantPointerNull>(Ptr) && SI.getPointerAddressSpace() == 0) {
681 SI.setOperand(0, UndefValue::get(Val->getType()));
690 return EraseInstFromFunction(SI);
695 if (Instruction *Res = InstCombineStoreToCast(*this, SI))
699 if (Instruction *Res = InstCombineStoreToCast(*this, SI))
706 BBI = &SI;
713 if (SimplifyStoreAtEndOfBlock(SI))
727 bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {
728 BasicBlock *StoreBB = SI.getParent();
757 // for example, if SI is in an infinite loop)
782 if (!OtherStore || OtherStore->getOperand(1) != SI.getOperand(1) ||
783 !SI.isSameOperationAs(OtherStore))
793 // if/then triangle. See if there is a store to the same ptr as SI that
798 if (OtherStore->getOperand(1) != SI.getOperand(1) ||
799 !SI.isSameOperationAs(OtherStore))
813 for (BasicBlock::iterator I = StoreBB->begin(); &*I != &SI; ++I) {
822 if (MergedVal != SI.getOperand(0)) {
824 PN->addIncoming(SI.getOperand(0), SI.getParent());
832 StoreInst *NewSI = new StoreInst(MergedVal, SI.getOperand(1),
833 SI.isVolatile(),
834 SI.getAlignment(),
835 SI.getOrdering(),
836 SI.getSynchScope());
841 if (MDNode *TBAATag = SI.getMetadata(LLVMContext::MD_tbaa))
848 EraseInstFromFunction(SI);