If we use a custom printer we could annotate the instructions with their cost.
This could prove useful for keeping track of cost model changes.
We could use that in existing lit tests and get something like:
%6 = add <4 x i32> %shuffle, %4 Cost: -3 %7 = bitcast i32* %idxS0 to <4 x i32>* store <4 x i32> %6, <4 x i32>* %7, align 8 Cost: -3 ret void
There are some issues though:
- The cost of inserts/extracts is not currently being mapped well to the generated instructions, so this needs more work
- The dump contains dead instructions that are not being removed by SLP.