[llvm] TTI: Fix special casing vectorization costs of saturating add/sub (PR #97463)

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 02:17:14 PDT 2024


davemgreen wrote:

> So it's a question of what the default custom lowered cost is in the presence of type legalization. The code here is also ignoring the possibility of targets custom lowering with illegal types. It's pretty terrible that this needs to guess at the all the steps legalization might take later

That's kind of the point of the cost-model. I've updated some of these costs in #100988.

IMO it is easy for a target to get the legal operations correct as when people implement support for them they are already thinking about them. Custom should be OK too for the most part. But for expanded nodes the target might not have even thought about them, and the surface area is so much larger. The generic cost model should give a decent cost if it can. Obviously it is better for it to give decent costs for as many cases as it can.

I believe if #100988 goes in then what remains here should LGTM.

https://github.com/llvm/llvm-project/pull/97463


More information about the llvm-commits mailing list