mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
6ff59a16a0
of loops. Previously, two consecutive calls to function "func" would result in the following sequence of instructions: 1. load $16, %got(func)($gp) // load address of lazy-binding stub. 2. move $25, $16 3. jalr $25 // jump to lazy-binding stub. 4. nop 5. move $25, $16 6. jalr $25 // jump to lazy-binding stub again. With this patch, the second call directly jumps to func's address, bypassing the lazy-binding resolution routine: 1. load $25, %got(func)($gp) // load address of lazy-binding stub. 2. jalr $25 // jump to lazy-binding stub. 3. nop 4. load $25, %got(func)($gp) // load resolved address of func. 5. jalr $25 // directly jump to func. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191591 91177308-0d34-0410-b5e6-96231b3b80d8
42 lines
1022 B
LLVM
42 lines
1022 B
LLVM
; RUN: llc -march=mipsel < %s | FileCheck %s
|
|
|
|
; CHECK-LABEL: foo6:
|
|
; CHECK: %while.body
|
|
; CHECK: lw $25, %call16(foo2)(${{[0-9]+}})
|
|
; CHECK: jalr $25
|
|
; CHECK: %while.end
|
|
|
|
define void @foo6(i32 %n) {
|
|
entry:
|
|
%tobool1 = icmp eq i32 %n, 0
|
|
br i1 %tobool1, label %while.end, label %while.body
|
|
|
|
while.body: ; preds = %entry, %while.body
|
|
%n.addr.02 = phi i32 [ %dec, %while.body ], [ %n, %entry ]
|
|
%dec = add nsw i32 %n.addr.02, -1
|
|
tail call void @foo2()
|
|
%tobool = icmp eq i32 %dec, 0
|
|
br i1 %tobool, label %while.end, label %while.body
|
|
|
|
while.end: ; preds = %while.body, %entry
|
|
ret void
|
|
}
|
|
|
|
declare void @foo2()
|
|
|
|
; CHECK-LABEL: foo1:
|
|
; CHECK: lw $25, %call16(foo2)(${{[0-9]+}})
|
|
; CHECK: jalr $25
|
|
; CHECK: lw $25, %call16(foo2)(${{[0-9]+}})
|
|
; CHECK: jalr $25
|
|
; CHECK: lw $25, %call16(foo2)(${{[0-9]+}})
|
|
; CHECK: jalr $25
|
|
|
|
define void @foo1() {
|
|
entry:
|
|
tail call void @foo2()
|
|
tail call void @foo2()
|
|
tail call void @foo2()
|
|
ret void
|
|
}
|