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