ExtractElement does not produce a vector out of a vector, so there's no need to
call a gather once done.
Fix #54469
Credits to npopov@redhat.com for the original approach.
Paths
| Differential D126012
[Scalarizer] No need to gather a scattered extracted element ClosedPublic Authored by serge-sans-paille on May 19 2022, 1:23 PM.
Details Summary ExtractElement does not produce a vector out of a vector, so there's no need to Fix #54469 Credits to npopov@redhat.com for the original approach.
Diff Detail
Event TimelineComment Actions There is another patch for this issue in D123684. Haven't looked at either variant yet, but the approach there looks quite different. Comment Actions My current thinking here is that we shouldn't be making this gather() call at all. The code seems to be effectively treating the result of the extractelement as a 1-vector, which doesn't make a lot of sense to me. I tried the following patch, that just replaces the extractelement with the scattered value: https://gist.github.com/nikic/d09ace51902e03e5b0cf04c528f87c49 Apart from one dead instruction, this seems to be working fine with tests. What do you think?
serge-sans-paille retitled this revision from [Scalarizer] Support loading from an extracted vector of pointer to [Scalarizer] No need to gather a scattered extracted element. Comment ActionsFollow @nikic approach there, it's clean and simple. Just fix a little edge case in the finish routine. Note that I could have checked the size of the cleanup vector, but I felt like a more explicit approach would be better. Comment Actions LGTM
This revision is now accepted and ready to land.Jun 21 2022, 8:09 AM This revision was landed with ongoing or failed builds.Jun 21 2022, 9:46 AM Closed by commit rGaaf1630ac38c: [Scalarizer] No need to gather a scattered extracted element (authored by serge-sans-paille). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 438741 llvm/lib/Transforms/Scalar/Scalarizer.cpp
llvm/test/Transforms/Scalarizer/global-bug.ll
llvm/test/Transforms/Scalarizer/vector-of-pointer-to-vector.ll
|
Spurious change :)