Home | History | Annotate | Download | only in InstCombine

Lines Matching full:instruction

133   Instruction::BinaryOps Opcode = I.getOpcode();
243 Instruction *New = BinaryOperator::Create(Opcode, A, B);
263 static bool LeftDistributesOverRight(Instruction::BinaryOps LOp,
264 Instruction::BinaryOps ROp) {
269 case Instruction::And:
274 case Instruction::Or:
275 case Instruction::Xor:
279 case Instruction::Mul:
284 case Instruction::Add:
285 case Instruction::Sub:
289 case Instruction::Or:
294 case Instruction::And:
302 static bool RightDistributesOverLeft(Instruction::BinaryOps LOp,
303 Instruction::BinaryOps ROp) {
304 if (Instruction::isCommutative(ROp))
321 Instruction::BinaryOps TopLevelOpcode = I.getOpcode(); // op
325 // The instruction has the form "(A op' B) op (C op' D)". Try to factorize
329 Instruction::BinaryOps InnerOpcode = Op0->getOpcode(); // op'
332 bool InnerCommutative = Instruction::isCommutative(InnerOpcode);
336 // Does the instruction have the form "(A op' B) op (A op' D)" or, in the
358 // Does the instruction have the form "(A op' B) op (C op' B)" or, in the
381 // The instruction has the form "(A op' B) op C". See if expanding it out
384 Instruction::BinaryOps InnerOpcode = Op0->getOpcode(); // op'
393 (Instruction::isCommutative(InnerOpcode) && L == B && R == A))
398 // Otherwise, create a new instruction.
406 // The instruction has the form "A op (B op' C)". See if expanding it out
409 Instruction::BinaryOps InnerOpcode = Op1->getOpcode(); // op'
418 (Instruction::isCommutative(InnerOpcode) && L == C && R == B))
423 // Otherwise, create a new instruction.
433 // dyn_castNegVal - Given a 'sub' instruction, return the RHS of the instruction
451 // dyn_castFNegVal - Given a 'fsub' instruction, return the RHS of the
452 // instruction if the LHS is a constant negative zero (which is the 'negate'
470 static Value *FoldOperationIntoSelectOperand(Instruction &I, Value *SO,
499 llvm_unreachable("Unknown binary instruction type!");
502 // FoldOpIntoSelect - Given an instruction with a select as one operand and a
506 Instruction *InstCombiner::FoldOpIntoSelect(Instruction &Op, SelectInst *SI) {
539 /// FoldOpIntoPhi - Given a binary operator, cast instruction, or select which
540 /// has a PHI node as operand #0, see if we can fold the instruction into the
543 Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I) {
553 // Walk the use list for the instruction, comparing them to I.
556 Instruction *User = cast<Instruction>(*UI);
586 // instruction, but insert another equivalent one, leading to infinite
671 Instruction *User = cast<Instruction>(*UI++);
742 Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
783 // Combine Indices - If the source pointer to this getelementptr instruction
784 // is a getelementptr instruction, combine the indices of the two
785 // getelementptr instructions into a single instruction.
944 } else if (Instruction *Inst =dyn_cast<Instruction>(GEP.getOperand(1))){
945 if (Inst->getOpcode() == Instruction::Shl &&
952 } else if (Inst->getOpcode() == Instruction::Mul &&
973 // Insert the new GEP instruction.
1002 // If this GEP instruction doesn't move the pointer, just replace the GEP
1010 if (Instruction *I = visitBitCast(*BCI)) {
1062 Instruction *InstCombiner::visitMalloc(Instruction &MI) {
1071 Instruction *I = cast<Instruction>(*UI);
1093 Instruction *InstCombiner::visitFree(CallInst &FI) {
1104 // If we have 'free null' delete the instruction. This can happen in stl code
1114 Instruction *InstCombiner::visitBranchInst(BranchInst &BI) {
1165 Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) {
1167 if (Instruction *I = dyn_cast<Instruction>(Cond)) {
1168 if (I->getOpcode() == Instruction::Add)
1183 Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
1209 // We're extracting from an insertvalue instruction, compare the indices
1266 // and replace it with a traditional binary instruction.
1345 /// TryToSinkInstruction - Try to move the specified instruction from its
1347 /// safe to move the instruction past all of the instructions between it and the
1349 static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
1395 SmallVector<Instruction*, 128> InstrsForInstCombineWorklist;
1405 Instruction *Inst = BBI++;
1407 // DCE instruction if trivially dead.
1415 // ConstantProp instruction if trivially constant.
1508 Instruction *Term = BB->getTerminator();
1530 Instruction *I = Worklist.RemoveOne();
1533 // Check to see if we can DCE the instruction.
1542 // Instruction isn't dead, see if we can constant propagate it.
1555 // See if we can trivially sink this instruction to a successor basic block.
1558 Instruction *UserInst = cast<Instruction>(I->use_back());
1580 // Okay, the CFG is simple enough, try to sink this instruction.
1585 // Now that we have an instruction, try combining it to simplify it.
1595 if (Instruction *Result = visit(*I)) {
1597 // Should we replace the old instruction with a new one?
1604 // Everything uses the new instruction now.
1607 // Push the new instruction and any users onto the worklist.
1611 // Move the name to the new instruction first.
1614 // Insert the new instruction into the basic block...
1631 // If the instruction was modified, it's possible that it is now dead.