Vector 'getelementptr' with scalar base is an opportunity for gather/scatter intrinsic to generate a better sequence.
While looking for uniform base, we want to use the scalar base pointer of GEP, if exists.
Details
Diff Detail
Event Timeline
Vector 'getelementptr' with scalar base is an opportunity for gather/scatter intrinsic to generate a better sequence.
While looking for uniform base, we want to use the scalar base pointer of GEP, if exists.
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
3083 | unform -> uniform | |
3083–3084 | receive -> take, perhaps? | |
3085–3086 | Perhaps IR examples for both representations might be helpful? | |
3141–3143 | else on the same line? | |
3147–3148 | Should we check that the insertelement index is 0? (or even generalize and check that the broadcast and insertelement have the same index, though that sounds unnecessary) | |
3150 | inside -> inside the | |
3157 | I'm a bit uneasy with changing IndexVal outside the if(): when the latter fails, IndexVal will be incorrect for subsequent users. Not sure it's better, but what about something like: Value *OrigIndexVal = ...; if (SDB->findValue(OrigIndexVal)) { IndexVal = OrigIndexVal; ... } | |
3158 | unnecessary end-of-line whitespace? | |
3163 | Why not EVT? |
Ahmed,
Thanks a lot for the review. I addressed all your comments and uploaded a new patch.
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
3083–3084 | Vector of pointers is the first argument of Gather/Scatter | |
3147–3148 | I submitted another patch with getSplatValue() as vector utility and planned to use it here, but it is stuck on review. | |
3157 | Actually, I don't need the IndexVal any more, but I changed the code. | |
3163 | The same interface in EVT requires Context. But I changed, the result is the same. |
This LGTM, but let's get getSplatValue figured out, commit that, and then commit this patch using getSplatValue.
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
3122 | I suppose you'll replace this logic with getSplatValue when that lands. |
I use the new interface getSplatValue().
I added more tests, Hal and James asked for.
unform -> uniform