1 ; SROA fails to rewrite allocs but does rewrite some phis and delete
2 ; dead instructions. Ensure that this invalidates analyses required
4 ; RUN: opt < %s -passes=bdce,sroa,bdce -o %t -debug-pass-manager 2>&1 | FileCheck %s
5 ; CHECK: Running pass: BDCEPass on H
6 ; CHECK: Running analysis: DemandedBitsAnalysis on H
7 ; CHECK: Running pass: SROA on H
8 ; CHECK: Invalidating all non-preserved analyses for: H
9 ; CHECK: Invalidating analysis: DemandedBitsAnalysis on H
10 ; CHECK: Running pass: BDCEPass on H
11 ; CHECK: Running analysis: DemandedBitsAnalysis on H
12 ; CHECK: Finished llvm::Function pass manager run.
14 target datalayout = "e-m:e-i64:64-n32:64"
15 target triple = "powerpc64le-grtev4-linux-gnu"
17 %class.b = type { i64 }
19 declare void @D(%class.b* sret, %class.b* dereferenceable(32)) local_unnamed_addr
21 ; Function Attrs: nounwind
22 define hidden fastcc void @H(%class.b* noalias nocapture readnone, [2 x i64]) unnamed_addr {
23 %3 = alloca %class.b, align 8
24 %.sroa.0 = alloca i64, align 8
25 store i64 0, i64* %.sroa.0, align 8
26 %4 = extractvalue [2 x i64] %1, 1
27 switch i64 %4, label %6 [
33 %.sroa.0.0..sroa_cast3 = bitcast i64* %.sroa.0 to i8**
37 %7 = icmp ugt i64 %4, 5
38 %.sroa.0.0..sroa_cast5 = bitcast i64* %.sroa.0 to i8**
39 br i1 %7, label %8, label %12
42 %9 = load i8, i8* inttoptr (i64 4 to i8*), align 4
43 %10 = icmp eq i8 %9, 47
44 %11 = select i1 %10, i64 5, i64 4
48 %13 = phi i8** [ %.sroa.0.0..sroa_cast3, %5 ], [ %.sroa.0.0..sroa_cast5, %8 ], [ %.sroa.0.0..sroa_cast5, %6 ]
49 %14 = phi i64 [ 4, %5 ], [ %11, %8 ], [ 4, %6 ]
50 %15 = icmp ne i64 %4, 0
51 %16 = icmp ugt i64 %4, %14
53 br i1 %17, label %18, label %a.exit
56 %19 = tail call i8* @memchr(i8* undef, i32 signext undef, i64 undef)
57 %20 = icmp eq i8* %19, null
58 %21 = sext i1 %20 to i64
62 %22 = phi i64 [ -1, %12 ], [ %21, %18 ]
63 %23 = load i8*, i8** %13, align 8
64 %24 = sub nsw i64 %22, %14
65 %25 = bitcast %class.b* %3 to i8*
66 call void @llvm.lifetime.start.p0i8(i64 32, i8* nonnull %25)
67 %26 = icmp ult i64 %24, 2
68 br i1 %26, label %G.exit, label %27
71 %28 = getelementptr inbounds i8, i8* %23, i64 undef
72 %29 = icmp eq i8* %28, null
73 br i1 %29, label %30, label %31
79 call void @D(%class.b* nonnull sret %3, %class.b* nonnull dereferenceable(32) undef)
83 call void @llvm.lifetime.end.p0i8(i64 32, i8* nonnull %25)
90 ; Function Attrs: nounwind readonly
91 declare i8* @memchr(i8*, i32 signext, i64) local_unnamed_addr
93 ; Function Attrs: argmemonly nounwind
94 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
96 ; Function Attrs: argmemonly nounwind
97 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)