fix perf regression in codegen that affected sparse multiply (#942)