Lines Matching full:instruction
139 Instruction::BinaryOps Opcode = I.getOpcode();
140 if (Opcode != Instruction::Add &&
141 Opcode != Instruction::Sub) {
156 if (Opcode == Instruction::Add) {
202 Instruction::BinaryOps Opcode = I.getOpcode();
342 static bool LeftDistributesOverRight(Instruction::BinaryOps LOp,
343 Instruction::BinaryOps ROp) {
348 case Instruction::And:
353 case Instruction::Or:
354 case Instruction::Xor:
358 case Instruction::Mul:
363 case Instruction::Add:
364 case Instruction::Sub:
368 case Instruction::Or:
373 case Instruction::And:
381 static bool RightDistributesOverLeft(Instruction::BinaryOps LOp,
382 Instruction::BinaryOps ROp) {
383 if (Instruction::isCommutative(ROp))
400 Instruction::BinaryOps TopLevelOpcode = I.getOpcode(); // op
404 // The instruction has the form "(A op' B) op (C op' D)". Try to factorize
408 Instruction::BinaryOps InnerOpcode = Op0->getOpcode(); // op'
411 bool InnerCommutative = Instruction::isCommutative(InnerOpcode);
415 // Does the instruction have the form "(A op' B) op (A op' D)" or, in the
437 // Does the instruction have the form "(A op' B) op (C op' B)" or, in the
460 // The instruction has the form "(A op' B) op C". See if expanding it out
463 Instruction::BinaryOps InnerOpcode = Op0->getOpcode(); // op'
472 (Instruction::isCommutative(InnerOpcode) && L == B && R == A))
477 // Otherwise, create a new instruction.
485 // The instruction has the form "A op (B op' C)". See if expanding it out
488 Instruction::BinaryOps InnerOpcode = Op1->getOpcode(); // op'
497 (Instruction::isCommutative(InnerOpcode) && L == C && R == B))
502 // Otherwise, create a new instruction.
512 // dyn_castNegVal - Given a 'sub' instruction, return the RHS of the instruction
530 // dyn_castFNegVal - Given a 'fsub' instruction, return the RHS of the
531 // instruction if the LHS is a constant negative zero (which is the 'negate'
549 static Value *FoldOperationIntoSelectOperand(Instruction &I, Value *SO,
578 llvm_unreachable("Unknown binary instruction type!");
581 // FoldOpIntoSelect - Given an instruction with a select as one operand and a
585 Instruction *InstCombiner::FoldOpIntoSelect(Instruction &Op, SelectInst *SI) {
618 /// FoldOpIntoPhi - Given a binary operator, cast instruction, or select which
619 /// has a PHI node as operand #0, see if we can fold the instruction into the
622 Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I) {
632 // Walk the use list for the instruction, comparing them to I.
635 Instruction *User = cast<Instruction>(*UI);
665 // instruction, but insert another equivalent one, leading to infinite
750 Instruction *User = cast<Instruction>(*UI++);
870 std::pair<Instruction*, unsigned> Parent;
896 if (BO->getOpcode() == Instruction::Mul) {
934 if (logScale > 0 && BO->getOpcode() == Instruction::Shl &&
967 if (Cast->getOpcode() == Instruction::SExt) {
989 if (Cast->getOpcode() == Instruction::Trunc) {
1036 Instruction *Ancestor = Parent.first;
1048 } else if (Ancestor->getOpcode() == Instruction::Trunc) {
1054 assert((Ancestor->getOpcode() != Instruction::SExt || NoSignedWrap) &&
1067 Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
1109 // Combine Indices - If the source pointer to this getelementptr instruction
1110 // is a getelementptr instruction, combine the indices of the two
1111 // getelementptr instructions into a single instruction.
1333 // If this GEP instruction doesn't move the pointer, just replace the GEP
1341 if (Instruction *I = visitBitCast(*BCI)) {
1378 isAllocSiteRemovable(Instruction *AI, SmallVectorImpl<WeakVH> &Users,
1380 SmallVector<Instruction*, 4> Worklist;
1384 Instruction *PI = Worklist.pop_back_val();
1387 Instruction *I = cast<Instruction>(*UI);
1393 case Instruction::BitCast:
1394 case Instruction::GetElementPtr:
1399 case Instruction::ICmp: {
1408 case Instruction::Call:
1441 case Instruction::Store: {
1455 Instruction *InstCombiner::visitAllocSite(Instruction &MI) {
1462 Instruction *I = cast_or_null<Instruction>(&*Users[i]);
1508 static Instruction *
1551 Instruction *InstCombiner::visitFree(CallInst &FI) {
1562 // If we have 'free null' delete the instruction. This can happen in stl code
1574 if (Instruction *I = tryToMoveFreeBeforeNullTest(FI))
1582 Instruction *InstCombiner::visitBranchInst(BranchInst &BI) {
1630 Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) {
1632 if (Instruction *I = dyn_cast<Instruction>(Cond)) {
1633 if (I->getOpcode() == Instruction::Add)
1654 Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
1672 // We're extracting from an insertvalue instruction, compare the indices
1729 // and replace it with a traditional binary instruction.
1848 Instruction *InstCombiner::visitLandingPadInst(LandingPadInst &LI) {
1857 SmallVector<Value *, 16> NewClauses; // - Clauses for the new instruction;
1858 bool CleanupFlag = LI.isCleanup(); // - The new instruction is a cleanup.
1980 assert(MakeNewInstruction && "New filter but not a new instruction!");
2001 // new landingpad instruction if it does.
2115 // If we changed any of the clauses, replace the old landingpad instruction
2146 /// TryToSinkInstruction - Try to move the specified instruction from its
2148 /// safe to move the instruction past all of the instructions between it and the
2150 static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
2197 SmallVector<Instruction*, 128> InstrsForInstCombineWorklist;
2207 Instruction *Inst = BBI++;
2209 // DCE instruction if trivially dead.
2217 // ConstantProp instruction if trivially constant.
2315 Instruction *EndInst = BB->getTerminator(); // Last not to be deleted.
2317 // Delete the next to last instruction.
2319 Instruction *Inst = --I;
2336 Instruction *I = Worklist.RemoveOne();
2339 // Check to see if we can DCE the instruction.
2348 // Instruction isn't dead, see if we can constant propagate it.
2361 // See if we can trivially sink this instruction to a successor basic block.
2364 Instruction *UserInst = cast<Instruction>(I->use_back());
2386 // Okay, the CFG is simple enough, try to sink this instruction.
2391 // Now that we have an instruction, try combining it to simplify it.
2401 if (Instruction *Result = visit(*I)) {
2403 // Should we replace the old instruction with a new one?
2410 // Everything uses the new instruction now.
2413 // Move the name to the new instruction first.
2416 // Push the new instruction and any users onto the worklist.
2420 // Insert the new instruction into the basic block...
2438 // If the instruction was modified, it's possible that it is now dead.
2466 /// replaceAllUsesWith - override so that instruction replacement
2467 /// can be defined in terms of the instruction combiner framework.
2468 virtual void replaceAllUsesWith(Instruction *I, Value *With) const {