Lines Matching defs:Opcode
225 /// Return true if V is an instruction of the specified opcode and if it
227 static BinaryOperator *isReassociableOp(Value *V, unsigned Opcode) {
229 cast<Instruction>(V)->getOpcode() == Opcode &&
385 static void IncorporateWeight(APInt &LHS, const APInt &RHS, unsigned Opcode) {
403 if (Instruction::isIdempotent(Opcode)) {
410 if (Instruction::isNilpotent(Opcode)) {
416 if (Opcode == Instruction::Add || Opcode == Instruction::FAdd) {
422 assert((Opcode == Instruction::Mul || Opcode == Instruction::FMul) &&
481 /// opcode), or is the same kind of binary operator but has a use which either
538 unsigned Opcode = I->getOpcode();
590 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) {
616 IncorporateWeight(It->second, Weight, Opcode);
629 if (BinaryOperator *BO = isReassociableOp(Op, Opcode)) {
652 cast<Instruction>(Op)->getOpcode() != Opcode
661 if ((Opcode == Instruction::Mul && BinaryOperator::isNeg(BO)) ||
662 (Opcode == Instruction::FMul && BinaryOperator::isFNeg(BO))) {
674 assert(!isReassociableOp(Op, Opcode) && "Value was morphed?");
688 assert(!isReassociableOp(V, Opcode) && "Shouldn't be a leaf!");
702 Constant *Identity = ConstantExpr::getBinOpIdentity(Opcode, I->getType());
728 unsigned Opcode = I->getOpcode();
777 BinaryOperator *BO = isReassociableOp(OldLHS, Opcode);
783 BinaryOperator *BO = isReassociableOp(OldRHS, Opcode);
808 BinaryOperator *BO = isReassociableOp(Op->getOperand(1), Opcode);
822 BinaryOperator *BO = isReassociableOp(Op->getOperand(0), Opcode);
838 NewOp = BinaryOperator::Create(Instruction::BinaryOps(Opcode),
1187 static Value *OptimizeAndOrXor(unsigned Opcode,
1198 if (Opcode == Instruction::And) // ...&X&~X = 0
1201 if (Opcode == Instruction::Or) // ...|X|~X = -1
1210 if (Opcode == Instruction::And || Opcode == Instruction::Or) {
1219 assert(Opcode == Instruction::Xor);
1875 unsigned Opcode = I->getOpcode();
1878 Cst = Cst ? ConstantExpr::get(Opcode, C, Cst) : C;
1887 if (Cst && Cst != ConstantExpr::getBinOpIdentity(Opcode, I->getType())) {
1888 if (Cst == ConstantExpr::getBinOpAbsorber(Opcode, I->getType()))
1898 switch (Opcode) {
1902 if (Value *Result = OptimizeAndOrXor(Opcode, Ops))
1943 unsigned Opcode = Op->getOpcode();
1944 while (Op->hasOneUse() && Op->user_back()->getOpcode() == Opcode &&
1959 unsigned Opcode = I->getOpcode();
1960 if (Opcode != Instruction::FMul && Opcode != Instruction::FDiv)
2009 llvm_unreachable("Unexpected Opcode!");
2135 unsigned Opcode = BO->getOpcode();
2136 if (BO->hasOneUse() && BO->user_back()->getOpcode() == Opcode) {