Revert "Specify target triple in alwaysinline tests."
Revert "Always_inline codegen rewrite."

Breaks gdb & lldb tests.
Breaks on Fedora 22 x86_64.

llvm-svn: 247491
diff --git a/clang/test/CodeGen/always-inline.c b/clang/test/CodeGen/always-inline.c
index ed8ecc7..c9fd1ae 100644
--- a/clang/test/CodeGen/always-inline.c
+++ b/clang/test/CodeGen/always-inline.c
@@ -1,9 +1,7 @@
 // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
 // RUN: %clang_cc1 -fno-inline -emit-llvm %s -o - | FileCheck %s
 
-// CHECK-LABEL: define void @i_want_bar()
 // CHECK-NOT: foo
-// CHECK: ret void
 
 void bar() {
 }
diff --git a/clang/test/CodeGen/always_inline-unused.c b/clang/test/CodeGen/always_inline-unused.c
deleted file mode 100644
index eb733f7..0000000
--- a/clang/test/CodeGen/always_inline-unused.c
+++ /dev/null
@@ -1,31 +0,0 @@
-// Test alwaysinline definitions w/o any non-direct-call uses.
-// None of the declarations are emitted. Stub are only emitted when the original
-// function can not be discarded.
-
-// RUN: %clang_cc1 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s
-
-void __attribute__((__always_inline__)) f1() {}
-inline void __attribute__((__always_inline__)) f2() {}
-static inline void __attribute__((__always_inline__)) f3() {}
-inline void __attribute__((gnu_inline, __always_inline__)) f4() {}
-static inline void __attribute__((gnu_inline, __always_inline__)) f5() {}
-inline void __attribute__((visibility("hidden"), __always_inline__)) f6() {}
-inline void __attribute__((visibility("hidden"), gnu_inline, __always_inline__)) f7() {}
-
-void g() {
-  f1();
-  f2();
-  f3();
-  f4();
-  f5();
-  f6();
-  f7();
-}
-
-// CHECK: define void @f1()
-// CHECK-NOT: void @f2()
-// CHECK-NOT: void @f3()
-// CHECK: define void @f4()
-// CHECK-NOT: void @f5()
-// CHECK-NOT: void @f6()
-// CHECK: define hidden void @f7()
diff --git a/clang/test/CodeGen/always_inline-wrappers.c b/clang/test/CodeGen/always_inline-wrappers.c
deleted file mode 100644
index d52a7ba..0000000
--- a/clang/test/CodeGen/always_inline-wrappers.c
+++ /dev/null
@@ -1,108 +0,0 @@
-// Test different kinds of alwaysinline definitions.
-
-// RUN: %clang_cc1 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-INLINE
-// RUN: %clang_cc1 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-USE
-// RUN: %clang_cc1 -disable-llvm-optzns -fno-inline -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK
-// RUN: %clang_cc1 -disable-llvm-optzns -fno-inline -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-USE
-
-void __attribute__((__always_inline__)) f1() {}
-inline void __attribute__((__always_inline__)) f2() {}
-static inline void __attribute__((__always_inline__)) f3() {}
-inline void __attribute__((gnu_inline, __always_inline__)) f4() {}
-static inline void __attribute__((gnu_inline, __always_inline__)) f5() {}
-inline void __attribute__((visibility("hidden"), __always_inline__)) f6() {}
-inline void __attribute__((visibility("hidden"), gnu_inline, __always_inline__)) f7() {}
-
-void g() {
-  f1();
-  f2();
-  f3();
-  f4();
-  f5();
-  f6();
-  f7();
-}
-
-void (*p)(void);
-void h() {
-  p = f1;
-  p = f2;
-  p = f3;
-  p = f4;
-  p = f5;
-  p = f6;
-  p = f7;
-}
-
-void (*const cp1)(void) = f1;
-void (*p1)(void) = f1;
-void (*p2)(int) = (void (*)(int))f1;
-
-void __attribute__((__always_inline__)) f8(void(*f)(void)) {}
-
-void call() {
-  f8(f1);
-}
-
-// CHECK-DAG: define internal void @f1.alwaysinline() #[[AI:[0-9]+]]
-// CHECK-DAG: define internal void @f2.alwaysinline() #[[AI_IH:[0-9]+]]
-// CHECK-DAG: define internal void @f3.alwaysinline() #[[AI_IH]]
-// CHECK-DAG: define internal void @f4.alwaysinline() #[[AI_IH]]
-// CHECK-DAG: define internal void @f5.alwaysinline() #[[AI_IH]]
-// CHECK-DAG: define internal void @f6.alwaysinline() #[[AI_IH]]
-// CHECK-DAG: define internal void @f7.alwaysinline() #[[AI_IH]]
-
-
-// CHECK-DAG: define void @f1() #[[NOAI:[01-9]+]]
-// CHECK-DAG: musttail call void @f1.alwaysinline()
-
-// CHECK-DAG: declare void @f2() #[[NOAI:[01-9]+]]
-
-// CHECK-DAG: define internal void @f3() #[[NOAI:[01-9]+]]
-// CHECK-DAG: musttail call void @f3.alwaysinline()
-
-// CHECK-DAG: define void @f4() #[[NOAI:[01-9]+]]
-// CHECK-DAG: musttail call void @f4.alwaysinline()
-
-// CHECK-DAG: define internal void @f5() #[[NOAI:[01-9]+]]
-// CHECK-DAG: musttail call void @f5.alwaysinline()
-
-// CHECK-DAG: declare hidden void @f6() #[[NOAI:[01-9]+]]
-
-// CHECK-DAG: define hidden void @f7() #[[NOAI:[01-9]+]]
-// CHECK-DAG: musttail call void @f7.alwaysinline()
-
-
-// CHECK-DAG: @cp1 = constant void ()* @f1, align
-// CHECK-DAG: @p1 = global void ()* @f1, align
-// CHECK-DAG: @p2 = global void (i32)* bitcast (void ()* @f1 to void (i32)*), align
-
-// CHECK: attributes #[[AI]] = {{.*alwaysinline.*}}
-// CHECK-INLINE: attributes #[[AI_IH]] = {{.*alwaysinline.*inlinehint.*}}
-// CHECK-NOT: attributes #[[NOAI]] = {{.*alwaysinline.*}}
-
-// CHECK-USE-LABEL: define void @g()
-// CHECK-USE-NEXT:   entry:
-// CHECK-USE-NEXT:     call void @f1.alwaysinline()
-// CHECK-USE-NEXT:     call void @f2.alwaysinline()
-// CHECK-USE-NEXT:     call void @f3.alwaysinline()
-// CHECK-USE-NEXT:     call void @f4.alwaysinline()
-// CHECK-USE-NEXT:     call void @f5.alwaysinline()
-// CHECK-USE-NEXT:     call void @f6.alwaysinline()
-// CHECK-USE-NEXT:     call void @f7.alwaysinline()
-// CHECK-USE-NEXT:     ret void
-
-// CHECK-USE-LABEL: define void @h()
-// CHECK-USE-NEXT:   entry:
-// CHECK-USE-NEXT:     store void ()* @f1,
-// CHECK-USE-NEXT:     store void ()* @f2,
-// CHECK-USE-NEXT:     store void ()* @f3,
-// CHECK-USE-NEXT:     store void ()* @f4,
-// CHECK-USE-NEXT:     store void ()* @f5,
-// CHECK-USE-NEXT:     store void ()* @f6,
-// CHECK-USE-NEXT:     store void ()* @f7,
-// CHECK-USE-NEXT:     ret void
-
-// CHECK-USE-LABEL:  define void @call()
-// CHECK-USE:           call void @f8.alwaysinline(void ()* @f1)
-// CHECK-USE:           ret void
diff --git a/clang/test/CodeGen/always_inline.c b/clang/test/CodeGen/always_inline.c
index 99a1649..c91fd43 100644
--- a/clang/test/CodeGen/always_inline.c
+++ b/clang/test/CodeGen/always_inline.c
@@ -1,5 +1,8 @@
-// RUN: %clang -target x86_64-pc-linux-gnu -emit-llvm -S -o - %s | FileCheck %s
-// RUN: %clang -target x86_64-pc-linux-gnu -mllvm -disable-llvm-optzns -emit-llvm -S -o - %s | FileCheck %s --check-prefix=CHECK-NO-OPTZNS
+// RUN: %clang -emit-llvm -S -o %t %s
+// RUN: not grep '@f0' %t
+// RUN: not grep 'call ' %t
+// RUN: %clang -mllvm -disable-llvm-optzns -emit-llvm -S -o %t %s
+// RUN: grep '@f0' %t | count 2
 
 //static int f0() { 
 static int __attribute__((always_inline)) f0() { 
@@ -15,14 +18,3 @@
 int f2() { return 7; }
 int f3(void) { return f2(); }
 
-// CHECK-LABEL: define i32 @f1()
-// CHECK: ret i32 1
-// CHECK-LABEL: define i32 @f2()
-// CHECK: ret i32 7
-// CHECK-LABEL: define i32 @f3()
-// CHECK: ret i32 7
-
-// CHECK-NO-OPTZNS: define i32 @f3()
-// CHECK-NO-OPTZNS-NEXT: entry:
-// CHECK-NO-OPTZNS-NEXT:   call i32 @f2.alwaysinline()
-// CHECK-NO-OPTZNS-NEXT:   ret i32
diff --git a/clang/test/CodeGen/function-attributes.c b/clang/test/CodeGen/function-attributes.c
index 4a7d4fc..177ad84 100644
--- a/clang/test/CodeGen/function-attributes.c
+++ b/clang/test/CodeGen/function-attributes.c
@@ -25,8 +25,8 @@
 
 void f7(unsigned short x) { }
 
-// CHECK: define void @f8()
-// CHECK: [[NUW:#[0-9]+]]
+// CHECK-LABEL: define void @f8()
+// CHECK: [[AI:#[0-9]+]]
 // CHECK: {
 void __attribute__((always_inline)) f8(void) { }
 
@@ -129,6 +129,7 @@
 }
 
 // CHECK: attributes [[NUW]] = { nounwind optsize readnone{{.*}} }
+// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize readnone{{.*}} }
 // CHECK: attributes [[ALIGN]] = { nounwind optsize readnone alignstack=16{{.*}} }
 // CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} }
 // CHECK: attributes [[NR]] = { noreturn nounwind optsize }
diff --git a/clang/test/CodeGen/pr9614.c b/clang/test/CodeGen/pr9614.c
index d264ef3..63cb5af 100644
--- a/clang/test/CodeGen/pr9614.c
+++ b/clang/test/CodeGen/pr9614.c
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-pc-linux -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK0
-// RUN: %clang_cc1 -triple x86_64-pc-linux -O1 -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK1
+// RUN: %clang_cc1 -triple x86_64-pc-linux -emit-llvm %s -o - | FileCheck %s
 
 extern void foo_alias (void) __asm ("foo");
 inline void foo (void) {
@@ -25,7 +24,7 @@
 
 void f(void) {
   foo();
-  int x = abs(0);
+  abs(0);
   strrchr_foo("", '.');
   prefetch();
   memchr("", '.', 0);
@@ -33,10 +32,9 @@
 
 // CHECK-LABEL: define void @f()
 // CHECK: call void @foo()
-// CHECK: call i32 @abs(
+// CHECK: call i32 @abs(i32 0)
 // CHECK: call i8* @strrchr(
-// CHECK0: call void @llvm.prefetch(
-// CHECK1: call void @prefetch.alwaysinline(
+// CHECK: call void @llvm.prefetch(
 // CHECK: call i8* @memchr(
 // CHECK: ret void
 
diff --git a/clang/test/CodeGenCXX/alwaysinline.cpp b/clang/test/CodeGenCXX/alwaysinline.cpp
deleted file mode 100644
index c694ae4..0000000
--- a/clang/test/CodeGenCXX/alwaysinline.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// Test different kinds of alwaysinline *structor definitions.
-
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CALL
-
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -mconstructor-aliases -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -mconstructor-aliases -disable-llvm-optzns -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CALL
-
-struct A1 {
-  __attribute__((__always_inline__)) A1() {}
-  __attribute__((__always_inline__)) ~A1() {}
-};
-
-void g1() {
-  A1 a1;
-}
-
-struct A2 {
-  inline __attribute__((__always_inline__)) A2() {}
-  inline __attribute__((__always_inline__)) ~A2() {}
-};
-
-void g2() {
-  A2 a2;
-}
-
-struct A3 {
-  inline __attribute__((gnu_inline, __always_inline__)) A3() {}
-  inline __attribute__((gnu_inline, __always_inline__)) ~A3() {}
-};
-
-void g3() {
-  A3 a3;
-}
-
-// CHECK-DAG: define internal void @_ZN2A1C1Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI:[01-9]+]]
-// CHECK-DAG: define internal void @_ZN2A1C2Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]]
-// CHECK-DAG: define internal void @_ZN2A1D1Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]]
-// CHECK-DAG: define internal void @_ZN2A1D2Ev.alwaysinline(%struct.A1* %this) unnamed_addr #[[AI]]
-
-// CHECK-DAG: define internal void @_ZN2A2C1Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH:[01-9]+]]
-// CHECK-DAG: define internal void @_ZN2A2C2Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH]]
-// CHECK-DAG: define internal void @_ZN2A2D1Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH]]
-// CHECK-DAG: define internal void @_ZN2A2D2Ev.alwaysinline(%struct.A2* %this) unnamed_addr #[[AIIH]]
-
-// CHECK-DAG: define internal void @_ZN2A3C1Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]]
-// CHECK-DAG: define internal void @_ZN2A3C2Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]]
-// CHECK-DAG: define internal void @_ZN2A3D1Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]]
-// CHECK-DAG: define internal void @_ZN2A3D2Ev.alwaysinline(%struct.A3* %this) unnamed_addr #[[AIIH]]
-
-// CHECK-DAG: attributes #[[AI]] = {{.*alwaysinline.*}}
-// CHECK-DAG: attributes #[[AIIH]] = {{.*alwaysinline.*inlinehint.*}}
-// CHECK-NOT: attributes #[[NOAI]] = {{.*alwaysinline.*}}
-
-// CHECK-CALL-LABEL: define void @_Z2g1v()
-// CHECK-CALL:       call void @_ZN2A1C1Ev.alwaysinline
-// CHECK-CALL:       call void @_ZN2A1D1Ev.alwaysinline
-// CHECK-CALL:       ret void
-
-// CHECK-CALL-LABEL: define void @_Z2g2v()
-// CHECK-CALL:       call void @_ZN2A2C1Ev.alwaysinline
-// CHECK-CALL:       call void @_ZN2A2D1Ev.alwaysinline
-// CHECK-CALL:       ret void
-
-// CHECK-CALL-LABEL: define void @_Z2g3v()
-// CHECK-CALL:       call void @_ZN2A3C1Ev.alwaysinline
-// CHECK-CALL:       call void @_ZN2A3D1Ev.alwaysinline
-// CHECK-CALL:       ret void
diff --git a/clang/test/Frontend/optimization-remark-line-directive.c b/clang/test/Frontend/optimization-remark-line-directive.c
index 23d63c9..f4c0011 100644
--- a/clang/test/Frontend/optimization-remark-line-directive.c
+++ b/clang/test/Frontend/optimization-remark-line-directive.c
@@ -5,9 +5,8 @@
 // RUN: %clang_cc1 %s -Rpass=inline -gline-tables-only -dwarf-column-info -emit-llvm-only -verify
 
 int foo(int x, int y) __attribute__((always_inline));
-// expected-remark@+1 {{foo.alwaysinline inlined into foo}}
 int foo(int x, int y) { return x + y; }
 
-// expected-remark@+2 {{foo.alwaysinline inlined into bar}} expected-note@+2 {{could not determine the original source location for /bad/path/to/original.c:1230:25}}
+// expected-remark@+2 {{foo inlined into bar}} expected-note@+2 {{could not determine the original source location for /bad/path/to/original.c:1230:25}}
 #line 1230 "/bad/path/to/original.c"
 int bar(int j) { return foo(j, j - 2); }
diff --git a/clang/test/Frontend/optimization-remark.c b/clang/test/Frontend/optimization-remark.c
index 604fec0..6ada003 100644
--- a/clang/test/Frontend/optimization-remark.c
+++ b/clang/test/Frontend/optimization-remark.c
@@ -32,8 +32,6 @@
 // CHECK-NOT: !llvm.dbg.cu = !{
 
 int foo(int x, int y) __attribute__((always_inline));
-// expected-remark@+2 {{foo.alwaysinline should always be inlined}}
-// expected-remark@+1 {{foo.alwaysinline inlined into foo}}
 int foo(int x, int y) { return x + y; }
 
 float foz(int x, int y) __attribute__((noinline));
@@ -47,7 +45,7 @@
 // expected-remark@+5 {{foz will not be inlined into bar}}
 // expected-remark@+4 {{foz should never be inlined}}
 // expected-remark@+3 {{foz will not be inlined into bar}}
-// expected-remark@+2 {{foo.alwaysinline should always be inlined}}
-// expected-remark@+1 {{foo.alwaysinline inlined into bar}}
+// expected-remark@+2 {{foo should always be inlined}}
+// expected-remark@+1 {{foo inlined into bar}}
   return foo(j, j - 2) * foz(j - 2, j);
 }
diff --git a/clang/test/Modules/cxx-irgen.cpp b/clang/test/Modules/cxx-irgen.cpp
index 73d1746..7cdb0d6 100644
--- a/clang/test/Modules/cxx-irgen.cpp
+++ b/clang/test/Modules/cxx-irgen.cpp
@@ -26,14 +26,14 @@
   };
 }
 
-// CHECK-DAG: define internal i32 @_ZN1SIiE1gEv.alwaysinline() #[[ALWAYS_INLINE:.*]] align
+// CHECK-DAG: define available_externally hidden {{.*}}{{signext i32|i32}} @_ZN1SIiE1gEv({{.*}} #[[ALWAYS_INLINE:.*]] align
 int a = S<int>::g();
 
 int b = h();
 
 // CHECK-DAG: define linkonce_odr {{.*}}{{signext i32|i32}} @_Z3minIiET_S0_S0_(i32
 int c = min(1, 2);
-// CHECK-DAG: define internal {{.*}}{{signext i32|i32}} @_ZN1SIiE1fEv.alwaysinline() #[[ALWAYS_INLINE]] align
+// CHECK: define available_externally {{.*}}{{signext i32|i32}} @_ZN1SIiE1fEv({{.*}} #[[ALWAYS_INLINE]] align
 
 namespace ImplicitSpecialMembers {
   // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1BC2ERKS0_(