xref: /aosp_15_r20/external/llvm/test/Transforms/InstCombine/opaque.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -disable-output
2*9880d681SAndroid Build Coastguard Worker; Checks that bitcasts are not converted into GEP when
3*9880d681SAndroid Build Coastguard Worker; when the size of an aggregate cannot be determined.
4*9880d681SAndroid Build Coastguard Worker%swift.opaque = type opaque
5*9880d681SAndroid Build Coastguard Worker%SQ = type <{ [8 x i8] }>
6*9880d681SAndroid Build Coastguard Worker%Si = type <{ i64 }>
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker%V = type <{ <{ %Vs4Int8, %Vs4Int8, %Vs4Int8, %Vs4Int8, %Vs4Int8, %Vs4Int8, %Vs4Int8, %Vs4Int8 }>, %Si, %SQ, %SQ, %Si, %swift.opaque }>
9*9880d681SAndroid Build Coastguard Worker%Vs4Int8 = type <{ i8 }>
10*9880d681SAndroid Build Coastguard Worker%swift.type = type { i64 }
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly,
13*9880d681SAndroid Build Coastguard Workeri64, i32, i1) #8
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker@_swift_slowAlloc = external global i8* (i64, i64)*
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdeclare i8* @rt_swift_slowAlloc(i64, i64)
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerdefine  %swift.opaque* @_TwTkV([24 x i8]* %dest, %swift.opaque* %src,
20*9880d681SAndroid Build Coastguard Worker%swift.type* %bios_boot_params) #0 {
21*9880d681SAndroid Build Coastguard Workerentry:
22*9880d681SAndroid Build Coastguard Worker  %0 = bitcast %swift.opaque* %src to %V*
23*9880d681SAndroid Build Coastguard Worker  %1 = call noalias i8* @rt_swift_slowAlloc(i64 40, i64 0) #11
24*9880d681SAndroid Build Coastguard Worker  %2 = bitcast [24 x i8]* %dest to i8**
25*9880d681SAndroid Build Coastguard Worker  store i8* %1, i8** %2, align 8
26*9880d681SAndroid Build Coastguard Worker  %3 = bitcast i8* %1 to %V*
27*9880d681SAndroid Build Coastguard Worker  %4 = bitcast %V* %3 to i8*
28*9880d681SAndroid Build Coastguard Worker  %5 = bitcast %V* %0 to i8*
29*9880d681SAndroid Build Coastguard Worker  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %5, i64 40, i32 1, i1 false)
30*9880d681SAndroid Build Coastguard Worker  %6 = bitcast %V* %3 to %swift.opaque*
31*9880d681SAndroid Build Coastguard Worker  ret %swift.opaque* %6
32*9880d681SAndroid Build Coastguard Worker}
33