1; RUN: llc %s -o - -fast-isel=true -O1 -verify-machineinstrs | FileCheck %s
2
3target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
4target triple = "arm64-apple-ios8.0.0"
5
6; The machine verifier was asserting on this test because the AND instruction was
7; sunk below the test which killed %tmp340.
8; The kill flags on the test had to be cleared because the AND was going to read
9; registers in a BB after the test instruction.
10
11; CHECK: %bb343
12; CHECK: and
13
14define i32 @test(i32* %ptr) {
15bb:
16  br label %.thread
17
18.thread:                                          ; preds = %.thread, %bb
19  %loc = phi i32 [ %next_iter, %.thread ], [ 0, %bb ]
20  %next_iter = lshr i32 %loc, 1
21  %tmp340 = sub i32 %loc, 1
22  %tmp341 = and i32 %tmp340, 1
23  %tmp342 = icmp eq i32 %tmp341, 0
24  br i1 %tmp342, label %bb343, label %.thread
25
26bb343:                                            ; preds = %.thread
27  store i32 %tmp341, i32* %ptr, align 4
28  ret i32 -1
29}
30