diff --git a/src/midend/SysYIRGenerator.cpp b/src/midend/SysYIRGenerator.cpp index 7ff316a..541c976 100644 --- a/src/midend/SysYIRGenerator.cpp +++ b/src/midend/SysYIRGenerator.cpp @@ -389,26 +389,7 @@ void SysYIRGenerator::compute() { case BinaryOp::ADD: resultValue = builder.createAddInst(lhs, rhs); break; case BinaryOp::SUB: resultValue = builder.createSubInst(lhs, rhs); break; case BinaryOp::MUL: resultValue = builder.createMulInst(lhs, rhs); break; - case BinaryOp::DIV: { - ConstantInteger *rhsConst = dynamic_cast(rhs); - if (rhsConst) { - int divisor = rhsConst->getInt(); - if (divisor > 0 && (divisor & (divisor - 1)) == 0) { - int shift = 0; - int temp = divisor; - while (temp > 1) { - temp >>= 1; - shift++; - } - resultValue = builder.createSRAInst(lhs, ConstantInteger::get(shift)); - } else { - resultValue = builder.createDivInst(lhs, rhs); - } - } else { - resultValue = builder.createDivInst(lhs, rhs); - } - break; - } + case BinaryOp::DIV: resultValue = builder.createDivInst(lhs, rhs); break; case BinaryOp::MOD: resultValue = builder.createRemInst(lhs, rhs); break; } } else if (commonType == Type::getFloatType()) {