[PATCH] D132923: [RISCV] Support peephole optimization to fold vmerge.vvm that has tail agnostic policy and unmasked intrinsics.

Jianjian Guan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 15 23:37:31 PDT 2022


jacquesguan added a comment.

In D132923#3784667 <https://reviews.llvm.org/D132923#3784667>, @reames wrote:

> Can you land the new tests and rebase please?  I want to be able to study the test diffs.

Done, I land the test first and rebase to it.



================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:2656
+      Policy = RISCVII::TAIL_AGNOSTIC;
+    } else
       continue;
----------------
reames wrote:
> This else handles everything which isn't a vmerge right?
> 
> If so, the code would be cleaner if it could be written as:
> 
> ```
> if (not a vmerge)
>   continue;
> 
> if (TA) {
> } else {
> }
> ```
Since rebase to main, these code form was changed.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:2715
     SmallVector<SDValue, 8> Ops;
-    Ops.push_back(Merge);
+    if (RISCVII::hasVecPolicyOp(TII->get(MaskedOpc).TSFlags)) 
+      Ops.push_back(False);
----------------
fakepaper56 wrote:
> jacquesguan wrote:
> > fakepaper56 wrote:
> > > Why you test vector policy of `MaskedOpc` here?
> > Thanks, it's a mistake, I am intended to check whether `MaskedOpc` has mergeop here. Fixed now.
> I think we should have merge operand and vector policy operand to make sure the result is same as the original VMERGE_TU nodes. I am sorry that I ignore it. I open a new revision D133302 to refine the code.
Done, I changed to assert.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132923/new/

https://reviews.llvm.org/D132923



More information about the llvm-commits mailing list