[llvm] [RISCV] Allow folding vmerge with implicit merge operand when true has tied dest (PR #78565)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 29 05:37:50 PDT 2024
lukel97 wrote:
> Could this PR replace #78403 ?
Not on its own, because the issue in #78403 stems from the fact that `DAGCombiner::foldSelectWithIdentityConstant` doesn't kick in with the sext/zext in between the binary op, so we don't transform
```
add a, (zext (vselect Cond, 0, b))
```
to
```
vselect Cond, a, (add a, (zext FVal))
```
So the vselect/vmerge won't be pulled outside the add which is needed for the vmerge peephole.
With that said, I returned to this PR because I was attempting to generalize #78403 by teaching `DAGCombiner::foldSelectWithIdentityConstant` to look through extends. That way we would have the vmerge pulled outside the add/sub, and the vmerge peephole would automatically take care of folding the mask and we wouldn't need combineVWADDWSelect. And I think we would also be able to handle muls and floating point binary ops for free too. But this PR was needed to preserve some of the test cases in #78403
https://github.com/llvm/llvm-project/pull/78565
More information about the llvm-commits
mailing list