Added function BoUpSLP::getCost() to calculate the scalar or vector
cost of the specified list of instructions (expected scalar
instructions) or vector - scalar cost estimation.
This seems like a weird interface, for a couple of reasons:
Splitting out a function that takes the vector and scalar type, and returns the difference, instead of having the subtraction repeated in every case, doesn't sound like a bad idea. Can you explain why this is an improvement over that, though?
Isn't the point of getCostOrDiff that you should be able to pass the vector and the scalar types, and get the difference? Why are you using two calls and then subtracting?
This looks unrelated.
This makes sense. Some minor comments inline.
This still doesn't explain under what conditions it makes sense to return a None cost.
Any reason the shuffle case can't live with the rest in getCost()?
Why not put the llvm_unreachable here? I think it'd be clearer.