xref: /aosp_15_r20/external/llvm/test/Transforms/InstCombine/memset2.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -S | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Test to check that instcombine doesn't drop the address space when optimizing
4*9880d681SAndroid Build Coastguard Worker; memset.
5*9880d681SAndroid Build Coastguard Worker%struct.Moves = type { [9 x i8], i8, i8, i8, [5 x i8] }
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine i32 @test(%struct.Moves addrspace(1)* nocapture %moves) {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker; CHECK: bitcast i8 addrspace(1)* %gep to i64 addrspace(1)*
10*9880d681SAndroid Build Coastguard Worker	%gep = getelementptr inbounds %struct.Moves, %struct.Moves addrspace(1)* %moves, i32 1, i32 0, i32 9
11*9880d681SAndroid Build Coastguard Worker	 call void @llvm.memset.p1i8.i64(i8 addrspace(1)* %gep, i8 0, i64 8, i32 1, i1 false)
12*9880d681SAndroid Build Coastguard Worker	ret i32 0
13*9880d681SAndroid Build Coastguard Worker}
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memset.p1i8.i64(i8addrspace(1)* nocapture, i8, i64, i32, i1) nounwind
16