1; RUN: llc -mtriple=arm64-apple-ios -O3 -aarch64-collect-loh -aarch64-collect-loh-bb-only=true -aarch64-collect-loh-pre-collect-register=false < %s -o - | FileCheck %s
2; Check that the LOH analysis does not crash when the analysed chained
3; contains instructions that are filtered out.
4;
5; Before the fix for <rdar://problem/16041712>, these cases were removed
6; from the main container. Now, the deterministic container does not allow
7; to remove arbitrary values, so we have to live with garbage values.
8; <rdar://problem/16041712>
9
10%"class.H4ISP::H4ISPDevice" = type { i32 (%"class.H4ISP::H4ISPDevice"*, i32, i8*, i8*)*, i8*, i32*, %"class.H4ISP::H4ISPCameraManager"* }
11
12%"class.H4ISP::H4ISPCameraManager" = type opaque
13
14declare i32 @_ZN5H4ISP11H4ISPDevice32ISP_SelectBestMIPIFrequencyIndexEjPj(%"class.H4ISP::H4ISPDevice"*)
15
16@pH4ISPDevice = hidden global %"class.H4ISP::H4ISPDevice"* null, align 8
17
18; CHECK-LABEL: _foo:
19; CHECK: ret
20; CHECK-NOT: .loh AdrpLdrGotLdr
21define void @foo() {
22entry:
23  br label %if.then83
24if.then83:                                        ; preds = %if.end81
25  %tmp = load %"class.H4ISP::H4ISPDevice"** @pH4ISPDevice, align 8
26  %call84 = call i32 @_ZN5H4ISP11H4ISPDevice32ISP_SelectBestMIPIFrequencyIndexEjPj(%"class.H4ISP::H4ISPDevice"* %tmp) #19
27  tail call void asm sideeffect "", "~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27}"()
28  %tmp2 = load %"class.H4ISP::H4ISPDevice"** @pH4ISPDevice, align 8
29  tail call void asm sideeffect "", "~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x28}"()
30  %pCameraManager.i268 = getelementptr inbounds %"class.H4ISP::H4ISPDevice"* %tmp2, i64 0, i32 3
31  %tmp3 = load %"class.H4ISP::H4ISPCameraManager"** %pCameraManager.i268, align 8
32  %tobool.i269 = icmp eq %"class.H4ISP::H4ISPCameraManager"* %tmp3, null
33  br i1 %tobool.i269, label %if.then83, label %end
34end:
35  ret void
36}
37
38