1 // RUN: %clang_cc1 -emit-llvm %s -triple x86_64-unknown-linux-gnu -o - | FileCheck %s
2
3 bool bar();
4 void f(bool, bool);
5 void g(bool);
6
foo(int i)7 void foo(int i) {
8 [[clang::always_inline]] bar();
9 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ALWAYSINLINEATTR:[0-9]+]]
10 [[clang::always_inline]] (i = 4, bar());
11 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ALWAYSINLINEATTR]]
12 [[clang::always_inline]] (void)(bar());
13 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ALWAYSINLINEATTR]]
14 [[clang::always_inline]] f(bar(), bar());
15 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ALWAYSINLINEATTR]]
16 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ALWAYSINLINEATTR]]
17 // CHECK: call void @_Z1fbb({{.*}}) #[[ALWAYSINLINEATTR]]
18 [[clang::always_inline]] for (bar(); bar(); bar()) {}
19 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ALWAYSINLINEATTR]]
20 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ALWAYSINLINEATTR]]
21 // CHECK: call noundef zeroext i1 @_Z3barv() #[[ALWAYSINLINEATTR]]
22 bar();
23 // CHECK: call noundef zeroext i1 @_Z3barv()
24 [[gnu::always_inline]] bar();
25 // CHECK: call noundef zeroext i1 @_Z3barv()
26 }
27
28 struct S {
29 friend bool operator==(const S &LHS, const S &RHS);
30 };
31
func(const S & s1,const S & s2)32 void func(const S &s1, const S &s2) {
33 [[clang::always_inline]]g(s1 == s2);
34 // CHECK: call noundef zeroext i1 @_ZeqRK1SS1_({{.*}}) #[[ALWAYSINLINEATTR]]
35 // CHECK: call void @_Z1gb({{.*}}) #[[ALWAYSINLINEATTR]]
36 bool b;
37 [[clang::always_inline]] b = s1 == s2;
38 // CHECK: call noundef zeroext i1 @_ZeqRK1SS1_({{.*}}) #[[ALWAYSINLINEATTR]]
39 }
40
41 // CHECK: attributes #[[ALWAYSINLINEATTR]] = { alwaysinline }
42