1 // RUN: %clang_cc1 -S -emit-llvm %s -triple x86_64-unknown-linux-gnu -o - | FileCheck %s
5 [[clang::nomerge
]] A();
6 [[clang::nomerge
]] virtual ~A();
7 [[clang::nomerge
]] void f();
8 [[clang::nomerge
]] virtual void g();
9 [[clang::nomerge
]] static void f1();
18 [[clang::nomerge
]] void f(bool, bool);
19 [[clang::nomerge
]] void (*fptr
)(void);
21 void foo(int i
, A
*ap
, B
*bp
) {
22 [[clang::nomerge
]] bar();
23 [[clang::nomerge
]] (i
= 4, bar());
24 [[clang::nomerge
]] (void)(bar());
27 [[clang::nomerge
]] [] { bar(); bar(); }(); // nomerge only applies to the anonymous function call
28 [[clang::nomerge
]] for (bar(); bar(); bar()) {}
29 [[clang::nomerge
]] { asm("nop"); }
53 [[clang::nomerge
]] int g(int i
);
55 void something_else() {
59 int g(int i
) { return i
; }
61 void something_else_again() {
65 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ATTR0:[0-9]+]]
66 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ATTR0]]
67 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ATTR0]]
68 // CHECK: call noundef zeroext i1 @_Z3barv(){{$}}
69 // CHECK: call noundef zeroext i1 @_Z3barv(){{$}}
70 // CHECK: call void @_Z1fbb({{.*}}) #[[ATTR0]]
71 // CHECK: %[[FPTR:.*]] = load ptr, ptr @fptr
72 // CHECK-NEXT: call void %[[FPTR]]() #[[ATTR0]]
73 // CHECK: call void @"_ZZ3fooiP1AP1BENK3$_0clEv"{{.*}} #[[ATTR0]]
74 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ATTR0]]
75 // CHECK-LABEL: for.cond:
76 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ATTR0]]
77 // CHECK-LABEL: for.inc:
78 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ATTR0]]
79 // CHECK: call void asm sideeffect "nop"{{.*}} #[[ATTR1:[0-9]+]]
80 // CHECK: call noundef zeroext i1 @_Z3barv(){{$}}
81 // CHECK: load ptr, ptr
82 // CHECK: load ptr, ptr
83 // CHECK: %[[AG:.*]] = load ptr, ptr
84 // CHECK-NEXT: call void %[[AG]](ptr {{.*}}) #[[ATTR0]]
85 // CHECK: load ptr, ptr
86 // CHECK: load ptr, ptr
87 // CHECK: %[[BG:.*]] = load ptr, ptr
88 // CHECK-NEXT: call void %[[BG]](ptr noundef{{.*}}
89 // CHECK: call void @_ZN1AC1Ev({{.*}}) #[[ATTR0]]
90 // CHECK: call void @_ZN1A1fEv({{.*}}) #[[ATTR0]]
91 // CHECK: call void @_ZN1A1gEv({{.*}}) #[[ATTR0]]
92 // CHECK: call void @_ZN1A2f1Ev() #[[ATTR0]]
93 // CHECK: call void @_ZN1BC1Ev({{.*}}){{$}}
94 // CHECK: call void @_ZN1B1gEv({{.*}}){{$}}
95 // CHECK: call void @_ZN1BC1Ev({{.*}}){{$}}
96 // CHECK: load ptr, ptr
97 // CHECK: load ptr, ptr
98 // CHECK: %[[AG:.*]] = load ptr, ptr
99 // CHECK-NEXT: call void %[[AG]](ptr {{.*}}) #[[ATTR1]]
100 // CHECK: call void @_ZN1AD1Ev(ptr {{.*}}) #[[ATTR1]]
102 // CHECK-DAG: attributes #[[ATTR0]] = {{{.*}}nomerge{{.*}}}
103 // CHECK-DAG: attributes #[[ATTR1]] = {{{.*}}nomerge{{.*}}}