1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
3 ; REQUIRES: aarch64-registered-target
5 ; Test that `%addr` is sunk, after we've increased limit on the number of the memory uses to scan.
7 target triple = "aarch64-linux"
11 define void @f(ptr %p) {
14 ; CHECK-NEXT: [[SUNKADDR:%.*]] = getelementptr i8, ptr [[P:%.*]], i64 4
15 ; CHECK-NEXT: [[T0:%.*]] = load i32, ptr [[SUNKADDR]], align 4
16 ; CHECK-NEXT: [[T1:%.*]] = load i32, ptr [[SUNKADDR]], align 4
17 ; CHECK-NEXT: [[T2:%.*]] = load i32, ptr [[SUNKADDR]], align 4
18 ; CHECK-NEXT: [[T3:%.*]] = load i32, ptr [[SUNKADDR]], align 4
19 ; CHECK-NEXT: [[T4:%.*]] = load i32, ptr [[SUNKADDR]], align 4
20 ; CHECK-NEXT: [[T5:%.*]] = load i32, ptr [[SUNKADDR]], align 4
21 ; CHECK-NEXT: [[T6:%.*]] = load i32, ptr [[SUNKADDR]], align 4
22 ; CHECK-NEXT: [[T7:%.*]] = load i32, ptr [[SUNKADDR]], align 4
23 ; CHECK-NEXT: [[T8:%.*]] = load i32, ptr [[SUNKADDR]], align 4
24 ; CHECK-NEXT: [[T9:%.*]] = load i32, ptr [[SUNKADDR]], align 4
25 ; CHECK-NEXT: [[T10:%.*]] = load i32, ptr [[SUNKADDR]], align 4
26 ; CHECK-NEXT: [[T11:%.*]] = load i32, ptr [[SUNKADDR]], align 4
27 ; CHECK-NEXT: [[T12:%.*]] = load i32, ptr [[SUNKADDR]], align 4
28 ; CHECK-NEXT: [[T13:%.*]] = load i32, ptr [[SUNKADDR]], align 4
29 ; CHECK-NEXT: [[T14:%.*]] = load i32, ptr [[SUNKADDR]], align 4
30 ; CHECK-NEXT: [[T15:%.*]] = load i32, ptr [[SUNKADDR]], align 4
31 ; CHECK-NEXT: [[T16:%.*]] = load i32, ptr [[SUNKADDR]], align 4
32 ; CHECK-NEXT: [[T17:%.*]] = load i32, ptr [[SUNKADDR]], align 4
33 ; CHECK-NEXT: [[T18:%.*]] = load i32, ptr [[SUNKADDR]], align 4
34 ; CHECK-NEXT: [[SUNKADDR1:%.*]] = getelementptr i8, ptr [[P]], i64 8
35 ; CHECK-NEXT: [[T19:%.*]] = load i32, ptr [[SUNKADDR1]], align 4
36 ; CHECK-NEXT: call void @g(i32 [[T0]], i32 [[T1]], i32 [[T2]], i32 [[T3]], i32 [[T4]], i32 [[T5]], i32 [[T6]], i32 [[T7]], i32 [[T8]], i32 [[T9]], i32 [[T10]], i32 [[T11]], i32 [[T12]], i32 [[T13]], i32 [[T14]], i32 [[T15]], i32 [[T16]], i32 [[T17]], i32 [[T18]], i32 [[T19]])
37 ; CHECK-NEXT: ret void
40 %addr = getelementptr i8, ptr %p, i32 4
44 %t0 = load i32, ptr %addr
45 %t1 = load i32, ptr %addr
46 %t2 = load i32, ptr %addr
47 %t3 = load i32, ptr %addr
48 %t4 = load i32, ptr %addr
49 %t5 = load i32, ptr %addr
50 %t6 = load i32, ptr %addr
51 %t7 = load i32, ptr %addr
52 %t8 = load i32, ptr %addr
53 %t9 = load i32, ptr %addr
54 %t10 = load i32, ptr %addr
55 %t11 = load i32, ptr %addr
56 %t12 = load i32, ptr %addr
57 %t13 = load i32, ptr %addr
58 %t14 = load i32, ptr %addr
59 %t15 = load i32, ptr %addr
60 %t16 = load i32, ptr %addr
61 %t17 = load i32, ptr %addr
62 %t18 = load i32, ptr %addr
63 %addr.1 = getelementptr i8, ptr %addr, i32 4
64 %t19 = load i32, ptr %addr.1
66 call void @g(i32 %t0, i32 %t1, i32 %t2, i32 %t3, i32 %t4, i32 %t5, i32 %t6, i32 %t7,
67 i32 %t8, i32 %t9, i32 %t10, i32 %t11, i32 %t12, i32 %t13, i32 %t14, i32 %t15, i32 %t16,
68 i32 %t17, i32 %t18, i32 %t19)