mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
8c20158fb0
SystemZTargetLowering::emitStringWrapper() previously loaded the character into R0 before the loop and made R0 live on entry. I'd forgotten that allocatable registers weren't allowed to be live across blocks at this stage, and it confused LiveVariables enough to cause a miscompilation of f3 in memchr-02.ll. This patch instead loads R0 in the loop and leaves LICM to hoist it after RA. This is actually what I'd tried originally, but I went for the manual optimisation after noticing that R0 often wasn't being hoisted. This bug forced me to go back and look at why, now fixed as r188774. We should also try to optimize null checks so that they test the CC result of the SRST directly. The select between null and the SRST GPR result could then usually be deleted as dead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188779 91177308-0d34-0410-b5e6-96231b3b80d8
22 lines
580 B
LLVM
22 lines
580 B
LLVM
; Test memchr using SRST, with a weird but usable prototype.
|
|
;
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
|
|
|
|
declare i8 *@memchr(i8 *%src, i16 %char, i32 %len)
|
|
|
|
; Test a simple forwarded call.
|
|
define i8 *@f1(i8 *%src, i16 %char, i32 %len) {
|
|
; CHECK-LABEL: f1:
|
|
; CHECK-DAG: lgr [[REG:%r[1-5]]], %r2
|
|
; CHECK-DAG: algfr %r2, %r4
|
|
; CHECK-DAG: llcr %r0, %r3
|
|
; CHECK: [[LABEL:\.[^:]*]]:
|
|
; CHECK: srst %r2, [[REG]]
|
|
; CHECK-NEXT: jo [[LABEL]]
|
|
; CHECK: jl {{\.L.*}}
|
|
; CHECK: lghi %r2, 0
|
|
; CHECK: br %r14
|
|
%res = call i8 *@memchr(i8 *%src, i16 %char, i32 %len)
|
|
ret i8 *%res
|
|
}
|