mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
add1a68f21
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. llvm-svn: 188779
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
|
|
}
|