Skip to content

Invalid transformation around division constant folding

Compiling this Cmm program with -O1 and GHC 8.10.7

test ( bits64 buffer ) {
  bits64 ret;
  (ret) = prim %popcnt8(%divu(bits8[buffer + (0 :: bits64)], (2 :: bits8)));
  return (ret);
}

Results in a -dcmm-lint failure:

Cmm lint error:
  in basic block c4
    in MachOp application: 
      I8[R1] >> 1 :: W8
    op is expecting:  [W8, W64]
    arguments provide:  [I8, I8]
Program was:
  {offset
    c4: // global
        //tick src<hi.cmm:(1,24)-(5,1)>
        (_c2::I64) = call MO_PopCnt W8(I8[R1] >> 1 :: W8);
        R1 = _c2::I64;
        call (P64[Sp])(R1) args: 8, res: 0, upd: 8;
  }
Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information