Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / attr-alwaysinline.cpp
blob2873a3f5de969e9b786ead8b8a09a266b099a970
1 // RUN: %clang_cc1 -S -emit-llvm %s -triple x86_64-unknown-linux-gnu -o - | FileCheck %s
3 bool bar();
4 void f(bool, bool);
5 void g(bool);
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()
28 struct S {
29 friend bool operator==(const S &LHS, const S &RHS);
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]]
41 // CHECK: attributes #[[ALWAYSINLINEATTR]] = { alwaysinline }