1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc < %s -mtriple=aarch64 -aarch64-enable-sink-fold=true -global-isel | FileCheck %s
4 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
5 target triple = "arm64-apple-macosx13.5.0"
7 ; Check we don't crash here with a use-after-free.
9 define i32 @nsis_BZ2_bzDecompress(ptr %pos.i, i1 %cmp661.not3117.i, i1 %exitcond.not.i) {
10 ; CHECK-LABEL: nsis_BZ2_bzDecompress:
11 ; CHECK: // %bb.0: // %entry
12 ; CHECK-NEXT: b .LBB0_2
13 ; CHECK-NEXT: .LBB0_1: // %while.end671.i
14 ; CHECK-NEXT: // in Loop: Header=BB0_2 Depth=1
15 ; CHECK-NEXT: strb w8, [x0]
16 ; CHECK-NEXT: tbnz w2, #0, .LBB0_4
17 ; CHECK-NEXT: .LBB0_2: // %for.body653.i
18 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
19 ; CHECK-NEXT: ldrb w8, [x0]
20 ; CHECK-NEXT: tbnz w1, #0, .LBB0_1
21 ; CHECK-NEXT: // %bb.3: // %while.body663.i
22 ; CHECK-NEXT: // in Loop: Header=BB0_2 Depth=1
23 ; CHECK-NEXT: mov x9, xzr
24 ; CHECK-NEXT: ldrb w9, [x9]
25 ; CHECK-NEXT: strb wzr, [x0, x9]
26 ; CHECK-NEXT: b .LBB0_1
27 ; CHECK-NEXT: .LBB0_4: // %for.end677.i
28 ; CHECK-NEXT: mov w0, wzr
31 br label %for.body653.i
33 for.body653.i: ; preds = %while.end671.i, %entry
34 %0 = load i8, ptr null, align 1
35 %idxprom657.i2 = zext i8 %0 to i64
36 %1 = load i8, ptr %pos.i, align 1
37 br i1 %cmp661.not3117.i, label %while.end671.i, label %while.body663.i
39 while.body663.i: ; preds = %for.body653.i
40 %arrayidx669.i = getelementptr [6 x i8], ptr %pos.i, i64 0, i64 %idxprom657.i2
41 store i8 0, ptr %arrayidx669.i, align 1
42 br label %while.end671.i
44 while.end671.i: ; preds = %while.body663.i, %for.body653.i
45 store i8 %1, ptr %pos.i, align 1
46 br i1 %exitcond.not.i, label %for.end677.i, label %for.body653.i
48 for.end677.i: ; preds = %while.end671.i