2012-02-02 07:20:51 +08:00
|
|
|
; RUN: llc -fast-isel -O0 -mcpu=generic -mtriple=i386-apple-darwin10 -relocation-model=pic < %s | FileCheck %s
|
[CodeGen] Pass SDAG an ORE, and replace FastISel stats with remarks.
In the long-term, we want to replace statistics with something
finer-grained that lets us gather per-function data.
Remarks are that replacement.
Create an ORE instance in SelectionDAGISel, and pass it to
SelectionDAG.
SelectionDAG was used so that we can emit remarks from all
SelectionDAG-related code, including TargetLowering and DAGCombiner.
This isn't used in the current patch but Adam tells me he's interested
for the fp-contract combines.
Use the ORE instance to emit FastISel failures as remarks (instead of
the mix of dbgs() dumps and statistics that we currently have).
Eventually, we want to have an API that tells us whether remarks are
enabled (http://llvm.org/PR32352) so that we don't emit expensive
remarks (in this case, dumping IR) when it's not needed. For now, use
'isEnabled' as a crude replacement.
This does mean that the replacement for '-fast-isel-verbose' is now
'-pass-remarks-missed=isel'. Additionally, clang users also need to
enable remark diagnostics, using '-Rpass-missed=isel'.
This also removes '-fast-isel-verbose2': there are no static statistics
that we want to only enable in asserts builds, so we can always use
the remarks regardless of the build type.
Differential Revision: https://reviews.llvm.org/D31405
llvm-svn: 299093
2017-03-31 01:49:58 +08:00
|
|
|
; RUN: llc -fast-isel -O0 -mcpu=generic -mtriple=i386-apple-darwin10 -relocation-model=pic < %s -pass-remarks-missed=isel 2>&1 >/dev/null | FileCheck -check-prefix=STDERR -allow-empty %s
|
2010-07-10 17:00:22 +08:00
|
|
|
|
|
|
|
; This should use flds to set the return value.
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test0:
|
2010-07-10 17:00:22 +08:00
|
|
|
; CHECK: flds
|
2014-01-08 20:58:07 +08:00
|
|
|
; CHECK: retl
|
2010-07-10 17:00:22 +08:00
|
|
|
@G = external global float
|
|
|
|
define float @test0() nounwind {
|
2015-02-28 05:17:42 +08:00
|
|
|
%t = load float, float* @G
|
2010-07-10 17:00:22 +08:00
|
|
|
ret float %t
|
|
|
|
}
|
|
|
|
|
|
|
|
; This should pop 4 bytes on return.
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test1:
|
2014-01-08 20:58:07 +08:00
|
|
|
; CHECK: retl $4
|
2010-07-10 17:00:22 +08:00
|
|
|
define void @test1({i32, i32, i32, i32}* sret %p) nounwind {
|
|
|
|
store {i32, i32, i32, i32} zeroinitializer, {i32, i32, i32, i32}* %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-07-12 09:30:35 +08:00
|
|
|
; This should pop 8 bytes on return.
|
|
|
|
; CHECK-LABEL: thiscallfun:
|
|
|
|
; CHECK: retl $8
|
2016-07-14 21:54:26 +08:00
|
|
|
define x86_thiscallcc i32 @thiscallfun(i32* %this, i32 %a, i32 %b) nounwind {
|
|
|
|
; STDERR-NOT: FastISel missed terminator: ret i32 12345
|
|
|
|
ret i32 12345
|
2016-07-12 09:30:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
; Here, the callee pop doesn't fit the 16 bit immediate -- see x86-big-ret.ll
|
|
|
|
; This checks that -fast-isel doesn't miscompile this.
|
|
|
|
; CHECK-LABEL: thiscall_large:
|
|
|
|
; CHECK: popl %ecx
|
|
|
|
; CHECK-NEXT: addl $65536, %esp
|
|
|
|
; CHECK-NEXT: pushl %ecx
|
|
|
|
; CHECK-NEXT: retl
|
|
|
|
define x86_thiscallcc void @thiscall_large(i32* %this, [65533 x i8]* byval %b) nounwind {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2016-07-14 21:54:26 +08:00
|
|
|
; This should pop 4 bytes on return.
|
|
|
|
; CHECK-LABEL: stdcallfun:
|
|
|
|
; CHECK: retl $4
|
|
|
|
define x86_stdcallcc i32 @stdcallfun(i32 %a) nounwind {
|
|
|
|
; STDERR-NOT: FastISel missed terminator: ret i32 54321
|
|
|
|
ret i32 54321
|
|
|
|
}
|
|
|
|
|
2010-07-10 17:00:22 +08:00
|
|
|
; Properly initialize the pic base.
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test2:
|
2010-07-10 17:00:22 +08:00
|
|
|
; CHECK-NOT: HHH
|
2016-07-14 21:54:26 +08:00
|
|
|
; CHECK: call{{.*}}L5$pb
|
|
|
|
; CHECK-NEXT: L5$pb:
|
2010-07-10 17:00:22 +08:00
|
|
|
; CHECK-NEXT: pop
|
|
|
|
; CHECK: HHH
|
2014-01-08 20:58:07 +08:00
|
|
|
; CHECK: retl
|
2010-07-10 17:00:22 +08:00
|
|
|
@HHH = external global i32
|
|
|
|
define i32 @test2() nounwind {
|
2015-02-28 05:17:42 +08:00
|
|
|
%t = load i32, i32* @HHH
|
2010-07-10 17:00:22 +08:00
|
|
|
ret i32 %t
|
|
|
|
}
|
2011-04-29 04:19:12 +08:00
|
|
|
|
|
|
|
; Check that we fast-isel sret, and handle the callee-pops behavior correctly.
|
|
|
|
%struct.a = type { i64, i64, i64 }
|
|
|
|
define void @test3() nounwind ssp {
|
|
|
|
entry:
|
|
|
|
%tmp = alloca %struct.a, align 8
|
|
|
|
call void @test3sret(%struct.a* sret %tmp)
|
|
|
|
ret void
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test3:
|
2011-04-29 04:19:12 +08:00
|
|
|
; CHECK: subl $44
|
|
|
|
; CHECK: leal 16(%esp)
|
|
|
|
; CHECK: calll _test3sret
|
|
|
|
; CHECK: addl $40
|
|
|
|
}
|
|
|
|
declare void @test3sret(%struct.a* sret)
|
2012-05-01 00:57:15 +08:00
|
|
|
|
|
|
|
; Check that fast-isel sret works with fastcc (and does not callee-pop)
|
|
|
|
define void @test4() nounwind ssp {
|
|
|
|
entry:
|
|
|
|
%tmp = alloca %struct.a, align 8
|
|
|
|
call fastcc void @test4fastccsret(%struct.a* sret %tmp)
|
|
|
|
ret void
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test4:
|
2012-05-01 00:57:15 +08:00
|
|
|
; CHECK: subl $28
|
2016-09-26 14:42:07 +08:00
|
|
|
; CHECK: movl %esp, %ecx
|
2012-05-01 00:57:15 +08:00
|
|
|
; CHECK: calll _test4fastccsret
|
2012-08-17 20:28:26 +08:00
|
|
|
; CHECK: addl $28
|
2012-05-01 00:57:15 +08:00
|
|
|
}
|
|
|
|
declare fastcc void @test4fastccsret(%struct.a* sret)
|