Home | History | Annotate | Download | only in InstCombine

Lines Matching refs:SI

414     if (SelectInst *SI = dyn_cast<SelectInst>(Op)) {
417 if (isSafeToLoadUnconditionally(SI->getOperand(1), SI, Align, TD) &&
418 isSafeToLoadUnconditionally(SI->getOperand(2), SI, Align, TD)) {
419 LoadInst *V1 = Builder->CreateLoad(SI->getOperand(1),
420 SI->getOperand(1)->getName()+".val");
421 LoadInst *V2 = Builder->CreateLoad(SI->getOperand(2),
422 SI->getOperand(2)->getName()+".val");
425 return SelectInst::Create(SI->getCondition(), V1, V2);
429 if (Constant *C = dyn_cast<Constant>(SI->getOperand(1)))
431 LI.setOperand(0, SI->getOperand(2));
436 if (Constant *C = dyn_cast<Constant>(SI->getOperand(2)))
438 LI.setOperand(0, SI->getOperand(1));
449 static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
450 User *CI = cast<User>(SI.getOperand(1));
473 Constant *Zero = Constant::getNullValue(Type::getInt32Ty(SI.getContext()));
509 Value *SIOp0 = SI.getOperand(0);
528 SI.setOperand(0, NewCast);
529 SI.setOperand(1, CastOp);
530 return &SI;
562 Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {
563 Value *Val = SI.getOperand(0);
564 Value *Ptr = SI.getOperand(1);
571 unsigned StoreAlign = SI.getAlignment();
576 SI.setAlignment(KnownAlign);
578 SI.setAlignment(EffectiveStoreAlign);
583 if (!SI.isSimple()) return 0;
589 return EraseInstFromFunction(SI);
593 return EraseInstFromFunction(SI);
601 BasicBlock::iterator BBI = &SI;
602 for (unsigned ScanInsts = 6; BBI != SI.getParent()->begin() && ScanInsts;
616 SI.getOperand(1))) {
631 return EraseInstFromFunction(SI);
644 if (isa<ConstantPointerNull>(Ptr) && SI.getPointerAddressSpace() == 0) {
646 SI.setOperand(0, UndefValue::get(Val->getType()));
655 return EraseInstFromFunction(SI);
660 if (Instruction *Res = InstCombineStoreToCast(*this, SI))
664 if (Instruction *Res = InstCombineStoreToCast(*this, SI))
671 BBI = &SI;
678 if (SimplifyStoreAtEndOfBlock(SI))
692 bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {
693 BasicBlock *StoreBB = SI.getParent();
722 // for example, if SI is in an infinite loop)
747 if (!OtherStore || OtherStore->getOperand(1) != SI.getOperand(1) ||
748 !SI.isSameOperationAs(OtherStore))
758 // if/then triangle. See if there is a store to the same ptr as SI that
763 if (OtherStore->getOperand(1) != SI.getOperand(1) ||
764 !SI.isSameOperationAs(OtherStore))
778 for (BasicBlock::iterator I = StoreBB->begin(); &*I != &SI; ++I) {
787 if (MergedVal != SI.getOperand(0)) {
789 PN->addIncoming(SI.getOperand(0), SI.getParent());
797 StoreInst *NewSI = new StoreInst(MergedVal, SI.getOperand(1),
798 SI.isVolatile(),
799 SI.getAlignment(),
800 SI.getOrdering(),
801 SI.getSynchScope());
806 if (MDNode *TBAATag = SI.getMetadata(LLVMContext::MD_tbaa))
813 EraseInstFromFunction(SI);