[llvm] Riscv branch peephole opt (PR #90451)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 20:04:11 PDT 2024


topperc wrote:

> > clang -S -fno-PIC -g -march=rv64imafdc_zba_zbb_zbc_zbs -mabi=lp64d -Ofast -o xxx.S xxx.c
> 
> Sorry, these are 13 places in my local SPEC2006 perlbench. Build command: `clang -c -DSPEC_CPU -DNDEBUG -DPERL_CORE -fno-pic -DSPEC_CPU_LP64 -Wno-everything -DSPEC_CPU_LINUX_X64 -std=gnu89 -Ofast -march=rv64gc_zba_zbb_zbc_zbs -mabi=lp64d xxx.c -o xxx.o`
> 
> A list of these instruction from the above build command. If add `-mllvm -inline-threshold=3420 -mllvm -unroll-max-count=15` to build, I will get 21 places in my local SPEC2006 perlbench.
> 
> ```
> mg.c
> MI:BEQ $x0, $x0, %bb.17
> 
> perlio.c
> MI:BEQ $x0, $x0, %bb.18
> 
> pp_pack.c
> MI:BGEU $x22, renamable $x22, %bb.73
> 
> regexec.c
> MI:BEQ $x0, $x0, %bb.548
> MI:BNE $x0, $x0, %bb.548
> MI:BNE $x0, $x0, %bb.56
> MI:BEQ $x0, $x0, %bb.102
> MI:BEQ $x0, $x0, %bb.215
> MI:BNE $x0, $x0, %bb.215
> 
> toke.c
> MI:BLTU $x10, renamable $x10, %bb.1778
> 
> util.c
> MI:BNE $x0, $x0, %bb.5
> 
> Base64.c
> MI:BNE $x27, renamable $x27, %bb.33
> ```
> 

My grep of the disassembly missed the beq/bne x0, x0 cases because they are beqz/bnez with the compressed extension and I didn't check for that.

https://github.com/llvm/llvm-project/pull/90451


More information about the llvm-commits mailing list