[PATCH] D153607: [CSKY] Optimize conditional branch

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 00:40:25 PDT 2023


benshi001 added a comment.

In D153607#4462762 <https://reviews.llvm.org/D153607#4462762>, @zixuan-wu wrote:

> need more case about bhz/bhsz?

It is hard to add tests for

  def : Pat<(brcond (i32 (setge GPR:$rs1, (i32 1))), bb:$imm16),
            (BHZ32 GPR:$rs1, bb:$imm16)>;

Since the original IR pattern

  %icmp = icmp sge i32 %x, 1
  br i1 %icmp, label %label1, label %label2

is always transformed to an equivalent form

  %icmp = icmp slt i32 %x, 1
  br i1 %icmp, label %label2, label %label1

before reaching to the CSKY backend.

And `BHSZ32` has the same issue.

I add these two Pat for `BHSZ32` and `BHZ32`, just in case for future changes in the DAG combine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153607



More information about the llvm-commits mailing list