xref: /llvm-project/llvm/test/ThinLTO/X86/Inputs/devirt_external_comdat_same_guid.ll (revision d5d3eb16b7ab72529c83dacb2889811491e48909)
12cefb939STeresa Johnsontarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
22cefb939STeresa Johnsontarget triple = "x86_64-grtev4-linux-gnu"
32cefb939STeresa Johnson
42cefb939STeresa Johnsonsource_filename = "-"
52cefb939STeresa Johnson
6*d5d3eb16SFangrui Song%struct.A = type { ptr }
72cefb939STeresa Johnson%struct.B = type { %struct.A }
82cefb939STeresa Johnson
92cefb939STeresa Johnson$_ZTV1B = comdat any
102cefb939STeresa Johnson
11*d5d3eb16SFangrui Song@_ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, comdat, !type !0, !type !1
122cefb939STeresa Johnson
13*d5d3eb16SFangrui Songdefine i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 comdat($_ZTV1B) {
142cefb939STeresa Johnson   ret i32 0;
152cefb939STeresa Johnson}
162cefb939STeresa Johnson
17*d5d3eb16SFangrui Songdefine i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 comdat($_ZTV1B) {
182cefb939STeresa Johnson   ret i32 0;
192cefb939STeresa Johnson}
202cefb939STeresa Johnson
21*d5d3eb16SFangrui Songdefine i32 @test2(ptr %obj, i32 %a) {
222cefb939STeresa Johnsonentry:
23*d5d3eb16SFangrui Song  %vtable2 = load ptr, ptr %obj
24*d5d3eb16SFangrui Song  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1B")
252cefb939STeresa Johnson  call void @llvm.assume(i1 %p2)
262cefb939STeresa Johnson
27*d5d3eb16SFangrui Song  %fptrptr = getelementptr ptr, ptr %vtable2, i32 1
28*d5d3eb16SFangrui Song  %fptr33 = load ptr, ptr %fptrptr, align 8
292cefb939STeresa Johnson
30*d5d3eb16SFangrui Song  %call4 = tail call i32 %fptr33(ptr nonnull %obj, i32 %a)
312cefb939STeresa Johnson  ret i32 %call4
322cefb939STeresa Johnson}
332cefb939STeresa Johnson
342cefb939STeresa Johnsonattributes #0 = { noinline optnone }
352cefb939STeresa Johnson
36*d5d3eb16SFangrui Songdeclare i1 @llvm.type.test(ptr, metadata)
372cefb939STeresa Johnsondeclare void @llvm.assume(i1)
382cefb939STeresa Johnson
392cefb939STeresa Johnson!0 = !{i64 16, !"_ZTS1A"}
402cefb939STeresa Johnson!1 = !{i64 16, !"_ZTS1B"}
41