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 ```
20 lines
484 B
LLVM
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)
|