1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O3 -mtriple=aarch64-arm < %s | FileCheck %s
4 ; Run at O3 to make sure we can optimize load/store instructions after Machine
5 ; Block Placement takes place using Tail Duplication Threshold = 4.
7 define void @foo(i1 %cond, ptr %ptr) {
9 ; CHECK: // %bb.0: // %entry
10 ; CHECK-NEXT: tbz w0, #0, .LBB0_2
11 ; CHECK-NEXT: // %bb.1: // %if.then
12 ; CHECK-NEXT: ldp x9, x8, [x1, #8]
13 ; CHECK-NEXT: str xzr, [x1, #16]
14 ; CHECK-NEXT: cmp x8, x9
15 ; CHECK-NEXT: b.lt .LBB0_3
16 ; CHECK-NEXT: b .LBB0_4
17 ; CHECK-NEXT: .LBB0_2: // %if.else
18 ; CHECK-NEXT: ldp x8, x9, [x1]
19 ; CHECK-NEXT: cmp x8, x9
20 ; CHECK-NEXT: b.ge .LBB0_4
21 ; CHECK-NEXT: .LBB0_3: // %exit1
22 ; CHECK-NEXT: str xzr, [x1, #8]
23 ; CHECK-NEXT: .LBB0_4: // %common.ret
26 br i1 %cond, label %if.then, label %if.else
29 %0 = getelementptr inbounds i64, ptr %ptr, i64 2
30 %1 = load i64, ptr %0, align 8
31 store i64 0, ptr %0, align 8
35 %2 = load i64, ptr %ptr, align 8
39 %3 = phi i64 [ %1, %if.then ], [ %2, %if.else ]
40 %4 = getelementptr inbounds i64, ptr %ptr, i64 1
41 %5 = load i64, ptr %4, align 8
42 %6 = icmp slt i64 %3, %5
43 br i1 %6, label %exit1, label %exit2
46 store i64 0, ptr %4, align 8