Files
clang-p2996/llvm/test/CodeGen/Mips/micromips-gp-rc.ll
Vladimir Radosavljevic 401d123a1f [MCP] Optimize copies when src is used during backward propagation (#111130)
Before this patch, redundant COPY couldn't be removed for the following
case:
```
  $R0 = OP ...
  ... // Read of %R0
  $R1 = COPY killed $R0
```
This patch adds support for tracking the users of the source register
during backward propagation, so that we can remove the redundant COPY in
the above case and optimize it to:
```
  $R1 = OP ...
  ... // Replace all uses of %R0 with $R1
```
2024-10-23 13:37:02 +02:00

20 lines
484 B
LLVM

; RUN: llc -march=mipsel -mcpu=mips32r2 -mattr=+micromips \
; RUN: -relocation-model=pic -O3 < %s | FileCheck %s
@g = external global i32
; Function Attrs: noreturn nounwind
define void @foo() #0 {
entry:
%0 = load i32, ptr @g, align 4
tail call void @exit(i32 signext %0)
unreachable
}
; Function Attrs: noreturn
declare void @exit(i32 signext)
; CHECK: addu $gp, ${{[0-9]+}}, ${{[0-9]+}}
; CHECK: lw ${{[0-9]+}}, %got(g)($gp)
; CHECK: lw ${{[0-9]+}}, %call16(exit)($gp)