[llvm] [CostModel][AArch64] Make extractelement, with fmul user, free whenev… (PR #111479)

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 05:03:10 PDT 2024


sushgokh wrote:

> Hi - I think what this patch is trying to do makes a lot of sense. I guess there might be a reluctance due to the way it has to do it. There is quite a lot of new code. In the past we have tried to have the cost model functions able to test generic (non-existent) instructions. Sometimes they need to know more info (especially about uses and operands), so operands get added and sometimes a CxtI instruction to get the uses from. Am I right that that approach of passing a CxtI instruction doesn't work very well in this case because there is no instruction yet? The extract is new and the mul the new user of it. It would be nice if the interface was fairly generic if we an make it, not specific to the SLP vectorizer.

Currently, the way SLP vect works is
1. If the extract user is used **out-of-SLP-tree**, you know the exact user instruction
2. If the  extract user is going to be used **in-SLP-tree**, we dont have information about the user. User=nullptr for such cases. SLP updates the users at later stage post vectorizion.

So, currently, the patch is just catering to out-of-tree users(and I realised this post uploading this patch due to my limited knowledge). I will amend this patch for in-tree users.

**Now why not have have API which uses something like CtxI ?**
If the user is out-of-tree, I can directly pass the user as single argument. But for in-tree user, we have no information(User=nullptr). In such case, we need to make more analysis and for the same reason, I need to pass array, having all extract information, as an API argument.
I hope this answers your question.

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


More information about the llvm-commits mailing list