1 ; RUN: opt -passes='lto<O3>' -S %s | FileCheck %s
2 ; RUN: opt -std-link-opts -enable-new-pm=false -S %s | FileCheck %s
4 target triple = "arm64e-apple-darwin"
6 @A = external unnamed_addr global i8**, align 8
7 @B = external unnamed_addr global i8**, align 8
8 @C = internal unnamed_addr global i32 0, align 4
9 @D = external unnamed_addr global i32, align 4
16 %v.D = load i32, i32* @D, align 4
17 store i32 %v.D, i32* @C, align 4
20 %v.B = load i8**, i8*** @B, align 8
21 %v.A = load i8**, i8*** @A, align 8
22 %gep.1 = getelementptr inbounds i8*, i8** %v.A, i64 0
23 %v.gep.1 = load i8*, i8** %gep.1, align 8
24 %gep.2 = getelementptr inbounds i8*, i8** %v.B, i64 0
25 %v.gep.2 = load i8*, i8** %gep.2, align 8
26 %cmp = icmp eq i8* %v.gep.2, null
27 br i1 %cmp, label %exit, label %loop
30 %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
31 %gep.3 = getelementptr inbounds i8, i8* %v.gep.2, i32 %iv
32 %v.gep.3 = load i8, i8* %gep.3, align 1
33 %gep.4 = getelementptr inbounds i8, i8* %v.gep.1, i32 %iv
34 store i8 %v.gep.3, i8* %gep.4, align 1
35 %iv.next = add nuw nsw i32 %iv, 1
36 %v.C = load i32, i32* @C, align 4
37 %exit.cond = icmp sgt i32 %iv, %v.C
38 br i1 %exit.cond, label %exit, label %loop
44 declare void @clobber()