llvm-project/llvm/test/CodeGen/RISCV/machine-copyprop-noop-removal.mir
Alex Bradbury dffbc030e7
[MachineCopyPropagation] Recognise and delete no-op moves produced after forwarded uses (#129889)
This change removes 189 static instances of no-op reg-reg moves (i.e.
where src == dest) across llvm-test-suite when compiled for RISC-V
rv64gc and with SPEC included.
2025-03-10 13:22:59 +00:00

75 lines
2.3 KiB
YAML

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
# RUN: llc -o - %s -mtriple=riscv64 -run-pass=machine-cp -mcp-use-is-copy-instr | FileCheck %s
## This test was added to capture a case where MachineCopyPropagation risks
## leaving a no-op register move (add, x0, reg).
---
name: ham
body: |
; CHECK-LABEL: name: ham
; CHECK: bb.0:
; CHECK-NEXT: successors: %bb.1(0x40000000), %bb.3(0x40000000)
; CHECK-NEXT: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: renamable $x11 = ANDI killed renamable $x10, 1
; CHECK-NEXT: renamable $x10 = ADDI $x0, 1
; CHECK-NEXT: BEQ killed renamable $x11, $x0, %bb.3
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.1:
; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.2(0x40000000)
; CHECK-NEXT: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: $x11 = ADDI $x0, 0
; CHECK-NEXT: BEQ renamable $x10, $x0, %bb.4
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.2:
; CHECK-NEXT: $x10 = ADDI $x0, 0
; CHECK-NEXT: PseudoRET implicit $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.3:
; CHECK-NEXT: successors: %bb.4(0x40000000), %bb.2(0x40000000)
; CHECK-NEXT: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: renamable $x11 = ADDI $x0, 1
; CHECK-NEXT: renamable $x10 = ADD killed renamable $x11, killed renamable $x10
; CHECK-NEXT: BNE renamable $x10, $x0, %bb.2
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.4:
; CHECK-NEXT: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: PseudoRET implicit $x10
bb.0:
successors: %bb.1(0x40000000), %bb.2(0x40000000)
liveins: $x10
renamable $x11 = ANDI killed renamable $x10, 1
renamable $x10 = ADDI $x0, 1
BEQ killed renamable $x11, $x0, %bb.2
bb.1:
successors: %bb.4(0x40000000), %bb.5(0x40000000)
liveins: $x10
$x11 = ADDI $x0, 0
renamable $x10 = ADD killed renamable $x11, killed renamable $x10
BEQ renamable $x10, $x0, %bb.4
bb.5:
$x10 = ADDI $x0, 0
PseudoRET implicit $x10
bb.2:
successors: %bb.4(0x40000000), %bb.5(0x40000000)
liveins: $x10
renamable $x11 = ADDI $x0, 1
renamable $x10 = ADD killed renamable $x11, killed renamable $x10
BNE renamable $x10, $x0, %bb.5
bb.4:
liveins: $x10
PseudoRET implicit $x10
...