1; RUN: llc -relocation-model=static -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -disable-ppc-sco=false --enable-shrink-wrap=false | FileCheck %s -check-prefix=CHECK-SCO-ONLY
2; RUN: llc -relocation-model=static -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -disable-ppc-sco=false --enable-shrink-wrap=true | FileCheck %s -check-prefix=CHECK-SCO-ONLY
3; RUN: llc -relocation-model=static -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux-gnu -disable-ppc-sco=false --enable-shrink-wrap=false | FileCheck %s -check-prefix=CHECK-SCO-ONLY
4; RUN: llc -relocation-model=static -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux-gnu -disable-ppc-sco=false --enable-shrink-wrap=true | FileCheck %s -check-prefix=CHECK-SCO-ONLY
5; Edit: D63152 prevents stack popping before loads and stores, so shrink-wrap does nothing here
6%"class.clang::NamedDecl" = type { i32 }
7declare void @__assert_fail();
8
9define i8 @_ZNK5clang9NamedDecl23getLinkageAndVisibilityEv(
10    %"class.clang::NamedDecl"* %this) {
11entry:
12  %tobool = icmp eq %"class.clang::NamedDecl"* %this, null
13  br i1 %tobool, label %cond.false, label %exit
14
15cond.false:
16  tail call void @__assert_fail()
17  unreachable
18
19exit:
20  %DeclKind = getelementptr inbounds
21                            %"class.clang::NamedDecl",
22                            %"class.clang::NamedDecl"* %this, i64 0, i32 0
23  %bf.load = load i32, i32* %DeclKind, align 4
24  %call.i = tail call i8 @LVComputationKind(
25    %"class.clang::NamedDecl"* %this,
26    i32 %bf.load)
27  ret i8 %call.i
28
29; CHECK-SCO-SHRK-LABEL: _ZNK5clang9NamedDecl23getLinkageAndVisibilityEv:
30; CHECK-SCO-SHRK: b LVComputationKind
31; CHECK-SCO-SHRK: #TC_RETURNd8
32; CHECK-SCO-SHRK: stdu 1, -{{[0-9]+}}(1)
33; CHECK-SCO-SHRK: bl __assert_fail
34;
35; CHECK-SCO-ONLY-LABEL: _ZNK5clang9NamedDecl23getLinkageAndVisibilityEv:
36; CHECK-SCO-ONLY: stdu 1, -{{[0-9]+}}(1)
37; CHECK-SCO-ONLY: b LVComputationKind
38; CHECK-SCO-ONLY: #TC_RETURNd8
39; CHECK-SCO-ONLY: bl __assert_fail
40}
41
42define fastcc i8 @LVComputationKind(
43    %"class.clang::NamedDecl"* %D,
44    i32 %computation) {
45  ret i8 0
46}
47