Used InstCombine to enable VMLAV and Add instructions to generate VMLAVA instead with regression tests.
Details
Diff Detail
Event Timeline
llvm/test/Transforms/InstCombine/ARM/vmldava.ll | ||
---|---|---|
3 | This is not the right test file for this patch? |
Changed tests to show original IR (vmlav and add instructions) being transformed to use vmlava, run using opt -instcombine -S -mtriple=arm -o - %s instead.
This seems good to me.
The part I am a little unsure about is that it is converting add(vmlav) into a new vmlava, but we are starting at the vmlav to do it. So need to set the insertion point and use replaceAllUsesWith/eraseInstFromFunction. I couldn't find anything else that worked like that in instcombine, but maybe just missed it. It seems to work just fine like this, but it might be cause potential problems with the way instcombine iterates? It hasn't caused any problems we have seen though.
I think this is good, but give it a day or two before committing in case anyone knows that this will be a problem.
Yes, this is not the typical code construct for instcombine. But given that we've (finally!) moved the target-specific combines out of the generic code files, I think this is the only way to match this kind of pattern.
There are similar constructs for generic patterns with phi ops and load/store, so this should be good too.
Can you quickly run clang-format on the patch too