1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=mergefunc -S < %s | FileCheck %s
4 ; This test makes sure that the mergefunc pass does not merge functions
5 ; that have different nonnull assertions.
9 define void @f1(ptr %0, ptr %1) {
11 ; CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[TMP1:%.*]], align 8, !nonnull !0
12 ; CHECK-NEXT: store ptr [[TMP3]], ptr [[TMP0:%.*]], align 8
13 ; CHECK-NEXT: ret void
15 %3 = load ptr, ptr %1, align 8, !nonnull !0
16 store ptr %3, ptr %0, align 8
20 define void @f2(ptr %0, ptr %1) {
22 ; CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[TMP1:%.*]], align 8
23 ; CHECK-NEXT: store ptr [[TMP3]], ptr [[TMP0:%.*]], align 8
24 ; CHECK-NEXT: ret void
26 %3 = load ptr, ptr %1, align 8
27 store ptr %3, ptr %0, align 8
31 define void @noundef(ptr %0, ptr %1) {
32 ; CHECK-LABEL: @noundef(
33 ; CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[TMP1:%.*]], align 8, !noundef !0
34 ; CHECK-NEXT: store ptr [[TMP3]], ptr [[TMP0:%.*]], align 8
35 ; CHECK-NEXT: ret void
37 %3 = load ptr, ptr %1, align 8, !noundef !0
38 store ptr %3, ptr %0, align 8
42 define void @noalias_1(ptr %0, ptr %1) {
43 ; CHECK-LABEL: @noalias_1(
44 ; CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[TMP1:%.*]], align 8, !noalias !1
45 ; CHECK-NEXT: store ptr [[TMP3]], ptr [[TMP0:%.*]], align 8, !alias.scope !1
46 ; CHECK-NEXT: ret void
48 %3 = load ptr, ptr %1, align 8, !noalias !4
49 store ptr %3, ptr %0, align 8, !alias.scope !4
53 define void @noundef_dbg(ptr %0, ptr %1) {
54 ; CHECK-LABEL: @noundef_dbg(
55 ; CHECK-NEXT: tail call void @noundef(ptr [[TMP0:%.*]], ptr [[TMP1:%.*]])
56 ; CHECK-NEXT: ret void
58 %3 = load ptr, ptr %1, align 8, !noundef !0, !dbg !1
59 store ptr %3, ptr %0, align 8
63 ; FIXME: This is merged despite different noalias metadata.
64 define void @noalias_2(ptr %0, ptr %1) {
65 ; CHECK-LABEL: @noalias_2(
66 ; CHECK-NEXT: tail call void @noalias_1(ptr [[TMP0:%.*]], ptr [[TMP1:%.*]])
67 ; CHECK-NEXT: ret void
69 %3 = load ptr, ptr %1, align 8, !noalias !7
70 store ptr %3, ptr %0, align 8, !alias.scope !7