xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/isel-sink.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 -addr-sink-using-gep=1 | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Workerdefine i32 @test(i32* %X, i32 %B) {
5*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test:
6*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: ret
7*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: lea
8*9880d681SAndroid Build Coastguard Worker; CHECK: mov{{.}} $4, ({{.*}},{{.*}},4)
9*9880d681SAndroid Build Coastguard Worker; CHECK: ret
10*9880d681SAndroid Build Coastguard Worker; CHECK: mov{{.}} ({{.*}},{{.*}},4),
11*9880d681SAndroid Build Coastguard Worker; CHECK: ret
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker	; This gep should be sunk out of this block into the load/store users.
14*9880d681SAndroid Build Coastguard Worker	%P = getelementptr i32, i32* %X, i32 %B
15*9880d681SAndroid Build Coastguard Worker	%G = icmp ult i32 %B, 1234
16*9880d681SAndroid Build Coastguard Worker	br i1 %G, label %T, label %F
17*9880d681SAndroid Build Coastguard WorkerT:
18*9880d681SAndroid Build Coastguard Worker	store i32 4, i32* %P
19*9880d681SAndroid Build Coastguard Worker	ret i32 141
20*9880d681SAndroid Build Coastguard WorkerF:
21*9880d681SAndroid Build Coastguard Worker	%V = load i32, i32* %P
22*9880d681SAndroid Build Coastguard Worker	ret i32 %V
23*9880d681SAndroid Build Coastguard Worker}
24