// Try to convert *lit to 1 RegRegRegShift/RegRegShift form.
bool ArmMir2Lir::GetEasyMultiplyOp(int lit, ArmMir2Lir::EasyMultiplyOp* op) {
+ if (lit == 0) {
+ // Special case for *divide-by-zero*. The ops won't actually be used to generate code, as
+ // GenArithOpIntLit will directly generate exception-throwing code, and multiply-by-zero will
+ // have been optimized away earlier.
+ op->op = kOpInvalid;
+ return true;
+ }
+
if (IsPowerOfTwo(lit)) {
op->op = kOpLsl;
- op->shift = LowestSetBit(lit);
+ op->shift = CTZ(lit);
return true;
}