xref: /llvm-project/llvm/test/Transforms/MergeFunc/cfi-function-merging.ll (revision e06fc2b2e0651b60e8d21b46f9708bc74d8e4f16)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2;; Check the cases involving internal CFI instrumented functions where we do not expect functions to be merged.
3; RUN: opt -S -passes=mergefunc < %s | FileCheck %s
4
5; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
6declare i1 @llvm.type.test(ptr, metadata) #6
7
8define internal void @A__on_zero_sharedEv(ptr noundef nonnull align 8 dereferenceable(32) %this) {
9; CHECK-LABEL: define internal void @A__on_zero_sharedEv
10; CHECK-SAME: (ptr noundef nonnull align 8 dereferenceable(32) [[THIS:%.*]]) {
11; CHECK-NEXT:  entry:
12; CHECK-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, align 8
13; CHECK-NEXT:    store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
14; CHECK-NEXT:    [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
15; CHECK-NEXT:    [[VTABLE:%.*]] = load ptr, ptr [[THIS1]], align 8
16; CHECK-NEXT:    [[TMP0:%.*]] = call i1 @llvm.type.test(ptr [[VTABLE]], metadata [[META0:![0-9]+]]), !nosanitize !1
17; CHECK-NEXT:    ret void
18;
19entry:
20  %this.addr = alloca ptr, align 8
21  store ptr %this, ptr %this.addr, align 8
22  %this1 = load ptr, ptr %this.addr, align 8
23  %vtable = load ptr, ptr %this1, align 8
24  %0 = call i1 @llvm.type.test(ptr %vtable, metadata !11), !nosanitize !47
25  ret void
26}
27
28; Function Attrs: mustprogress noinline nounwind optnone uwtable
29define internal void @B__on_zero_sharedEv(ptr noundef nonnull align 8 dereferenceable(32) %this) {
30; CHECK-LABEL: define internal void @B__on_zero_sharedEv
31; CHECK-SAME: (ptr noundef nonnull align 8 dereferenceable(32) [[THIS:%.*]]) {
32; CHECK-NEXT:  entry:
33; CHECK-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, align 8
34; CHECK-NEXT:    store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
35; CHECK-NEXT:    [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
36; CHECK-NEXT:    [[VTABLE:%.*]] = load ptr, ptr [[THIS1]], align 8
37; CHECK-NEXT:    [[TMP0:%.*]] = call i1 @llvm.type.test(ptr [[VTABLE]], metadata [[META2:![0-9]+]]), !nosanitize !1
38; CHECK-NEXT:    ret void
39;
40entry:
41  %this.addr = alloca ptr, align 8
42  store ptr %this, ptr %this.addr, align 8
43  %this1 = load ptr, ptr %this.addr, align 8
44  %vtable = load ptr, ptr %this1, align 8
45  %0 = call i1 @llvm.type.test(ptr %vtable, metadata !22), !nosanitize !47
46  ret void
47}
48
49!10 = !{i64 16, !11}
50!11 = distinct !{}
51!21 = !{i64 16, !22}
52!22 = distinct !{}
53!47 = !{}
54