aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/address-safety-attr.cpp43
-rw-r--r--test/CodeGen/attr-coldhot.c4
-rw-r--r--test/CodeGen/attr-minsize.cpp41
-rw-r--r--test/CodeGen/code-coverage.c11
-rw-r--r--test/CodeGen/stack-protector.c12
5 files changed, 54 insertions, 57 deletions
diff --git a/test/CodeGen/address-safety-attr.cpp b/test/CodeGen/address-safety-attr.cpp
index aedbbc2bcb..827f8d15b4 100644
--- a/test/CodeGen/address-safety-attr.cpp
+++ b/test/CodeGen/address-safety-attr.cpp
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address | FileCheck -check-prefix ASAN %s
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck -check-prefix=WITHOUT %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address | FileCheck -check-prefix=ASAN %s
// RUN: echo "src:%s" > %t
-// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address -fsanitize-blacklist=%t | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address -fsanitize-blacklist=%t | FileCheck -check-prefix=BL %s
// FIXME: %t is like "src:x:\path\to\clang\test\CodeGen\address-safety-attr.cpp"
// REQUIRES: shell
@@ -10,28 +10,33 @@
// when AddressSanitizer is enabled, unless no_address_safety_analysis attribute
// is present.
-// CHECK: NoAddressSafety1{{.*}}#0
-// ASAN: NoAddressSafety1{{.*}}#0
+// WITHOUT: NoAddressSafety1{{.*}}) #[[NOATTR:[0-9]+]]
+// BL: NoAddressSafety1{{.*}}) #[[NOATTR:[0-9]+]]
+// ASAN: NoAddressSafety1{{.*}}) #[[NOATTR:[0-9]+]]
__attribute__((no_address_safety_analysis))
int NoAddressSafety1(int *a) { return *a; }
-// CHECK: NoAddressSafety2{{.*}}#0
-// ASAN: NoAddressSafety2{{.*}}#0
+// WITHOUT: NoAddressSafety2{{.*}}) #[[NOATTR]]
+// BL: NoAddressSafety2{{.*}}) #[[NOATTR]]
+// ASAN: NoAddressSafety2{{.*}}) #[[NOATTR]]
__attribute__((no_address_safety_analysis))
int NoAddressSafety2(int *a);
int NoAddressSafety2(int *a) { return *a; }
-// CHECK: AddressSafetyOk{{.*}}#0
-// ASAN: AddressSafetyOk{{.*}}#1
+// WITHOUT: AddressSafetyOk{{.*}}) #[[NOATTR]]
+// BL: AddressSafetyOk{{.*}}) #[[NOATTR]]
+// ASAN: AddressSafetyOk{{.*}}) #[[WITH:[0-9]+]]
int AddressSafetyOk(int *a) { return *a; }
-// CHECK: TemplateAddressSafetyOk{{.*}}#0
-// ASAN: TemplateAddressSafetyOk{{.*}}#1
+// WITHOUT: TemplateAddressSafetyOk{{.*}}) #[[NOATTR]]
+// BL: TemplateAddressSafetyOk{{.*}}) #[[NOATTR]]
+// ASAN: TemplateAddressSafetyOk{{.*}}) #[[WITH]]
template<int i>
int TemplateAddressSafetyOk() { return i; }
-// CHECK: TemplateNoAddressSafety{{.*}}#0
-// ASAN: TemplateNoAddressSafety{{.*}}#0
+// WITHOUT: TemplateNoAddressSafety{{.*}}) #[[NOATTR]]
+// BL: TemplateNoAddressSafety{{.*}}) #[[NOATTR]]
+// ASAN: TemplateNoAddressSafety{{.*}}) #[[NOATTR]]
template<int i>
__attribute__((no_address_safety_analysis))
int TemplateNoAddressSafety() { return i; }
@@ -42,12 +47,12 @@ int force_instance = TemplateAddressSafetyOk<42>()
// Check that __cxx_global_var_init* get the address_safety attribute.
int global1 = 0;
int global2 = *(int*)((char*)&global1+1);
-// CHECK: @__cxx_global_var_init{{.*}}#1
+// WITHOUT: @__cxx_global_var_init{{.*}}#1
+// BL: @__cxx_global_var_init{{.*}}#1
// ASAN: @__cxx_global_var_init{{.*}}#2
-// CHECK: attributes #0 = { nounwind "target-features"={{.*}} }
-// CHECK: attributes #1 = { nounwind }
+// WITHOUT: attributes #[[NOATTR]] = { nounwind "target-features"={{.*}} }
+// BL: attributes #[[NOATTR]] = { nounwind "target-features"={{.*}} }
-// ASAN: attributes #0 = { nounwind "target-features"={{.*}} }
-// ASAN: attributes #1 = { address_safety nounwind "target-features"={{.*}} }
-// ASAN: attributes #2 = { address_safety nounwind }
+// ASAN: attributes #[[NOATTR]] = { nounwind "target-features"={{.*}} }
+// ASAN: attributes #[[WITH]] = { address_safety nounwind "target-features"={{.*}} }
diff --git a/test/CodeGen/attr-coldhot.c b/test/CodeGen/attr-coldhot.c
index f553b136eb..a277119708 100644
--- a/test/CodeGen/attr-coldhot.c
+++ b/test/CodeGen/attr-coldhot.c
@@ -4,8 +4,8 @@ int test1() __attribute__((__cold__)) {
return 42;
// Check that we set the optsize attribute on the function.
-// CHECK: @test1{{.*}}#0
+// CHECK: @test1{{.*}}[[ATTR:#[0-9]+]]
// CHECK: ret
}
-// CHECK: attributes #0 = { nounwind optsize "target-features"={{.*}} }
+// CHECK: attributes [[ATTR]] = { {{.*}}optsize{{.*}} }
diff --git a/test/CodeGen/attr-minsize.cpp b/test/CodeGen/attr-minsize.cpp
index 5611916f59..997194df7f 100644
--- a/test/CodeGen/attr-minsize.cpp
+++ b/test/CodeGen/attr-minsize.cpp
@@ -7,29 +7,29 @@
// Check that we set the minsize attribute on each function
// when Oz optimization level is set.
+__attribute__((minsize))
int test1() {
return 42;
-// Oz: @{{.*}}test1{{.*}}#0
-// Oz: ret
-// OTHER: @{{.*}}test1
-// OTHER-NOT: #1
-// OTHER: ret
+// Oz: @{{.*}}test1{{.*}}[[MINSIZE:#[0-9]+]]
+// OTHER: @{{.*}}test1{{.*}}[[MS:#[0-9]+]]
}
int test2() {
return 42;
-// Oz: @{{.*}}test2{{.*}}#0
+// Oz: @{{.*}}test2{{.*}}[[MINSIZE]]
// Oz: ret
// OTHER: @{{.*}}test2
-// OTHER-NOT: #1
+// OTHER-NOT: [[MS]]
// OTHER: ret
}
-__attribute__((minsize))
int test3() {
return 42;
-// Oz: @{{.*}}test3{{.*}}#0
-// OTHER: @{{.*}}test3{{.*}}#1
+// Oz: @{{.*}}test3{{.*}}[[MINSIZE]]
+// Oz: ret
+// OTHER: @{{.*}}test3
+// OTHER-NOT: [[MS]]
+// OTHER: ret
}
// Check that the minsize attribute is well propagated through
@@ -44,16 +44,16 @@ void test4(T arg) {
template
void test4<int>(int arg);
// Oz: define{{.*}}void @{{.*}}test4
-// Oz: #0
+// Oz: [[MINSIZE]]
// OTHER: define{{.*}}void @{{.*}}test4
-// OTHER: #1
+// OTHER: [[MS]]
template
void test4<float>(float arg);
// Oz: define{{.*}}void @{{.*}}test4
-// Oz: #0
+// Oz: [[MINSIZE]]
// OTHER: define{{.*}}void @{{.*}}test4
-// OTHER: #1
+// OTHER: [[MS]]
template<typename T>
void test5(T arg) {
@@ -63,18 +63,17 @@ void test5(T arg) {
template
void test5<int>(int arg);
// Oz: define{{.*}}void @{{.*}}test5
-// Oz: #0
+// Oz: [[MINSIZE]]
// OTHER: define{{.*}}void @{{.*}}test5
-// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}#1
+// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}[[MS]]
template
void test5<float>(float arg);
// Oz: define{{.*}}void @{{.*}}test5
-// Oz: #0
+// Oz: [[MINSIZE]]
// OTHER: define{{.*}}void @{{.*}}test5
-// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}#1
+// OTHER-NOT: define{{.*}}void @{{.*}}test5{{.*}}[[MS]]
-// Oz: attributes #0 = { minsize nounwind optsize readnone "target-features"={{.*}} }
+// Oz: attributes [[MINSIZE]] = { minsize{{.*}} }
-// OTHER: attributes #0 = { nounwind {{.*}}"target-features"={{.*}} }
-// OTHER: attributes #1 = { minsize nounwind {{.*}}"target-features"={{.*}} }
+// OTHER: attributes [[MS]] = { minsize nounwind{{.*}} }
diff --git a/test/CodeGen/code-coverage.c b/test/CodeGen/code-coverage.c
index 3c9392d1c5..f165e30e6f 100644
--- a/test/CodeGen/code-coverage.c
+++ b/test/CodeGen/code-coverage.c
@@ -14,10 +14,9 @@ int test1(int a) {
// Check that the noredzone flag is set on the generated functions.
-// CHECK: void @__llvm_gcov_indirect_counter_increment(i32* %{{.*}}, i64** %{{.*}}) unnamed_addr #1
-// CHECK: void @__llvm_gcov_writeout() unnamed_addr #1
-// CHECK: void @__llvm_gcov_init() unnamed_addr #1
-// CHECK: void @__gcov_flush() unnamed_addr #1
+// CHECK: void @__llvm_gcov_indirect_counter_increment(i32* %{{.*}}, i64** %{{.*}}) unnamed_addr [[NRZ:#[0-9]+]]
+// CHECK: void @__llvm_gcov_writeout() unnamed_addr [[NRZ]]
+// CHECK: void @__llvm_gcov_init() unnamed_addr [[NRZ]]
+// CHECK: void @__gcov_flush() unnamed_addr [[NRZ]]
-// CHECK: attributes #0 = { noredzone nounwind "target-features"={{.*}} }
-// CHECK: attributes #1 = { noinline noredzone }
+// CHECK: attributes [[NRZ]] = { {{.*}}noredzone{{.*}} }
diff --git a/test/CodeGen/stack-protector.c b/test/CodeGen/stack-protector.c
index b4e20cd15d..e47e5b321b 100644
--- a/test/CodeGen/stack-protector.c
+++ b/test/CodeGen/stack-protector.c
@@ -17,14 +17,8 @@ void test1(const char *msg) {
printf("%s\n", a);
}
-// NOSSP: attributes #0 = { nounwind "target-features"={{.*}} }
-// NOSSP: attributes #1 = { "target-features"={{.*}} }
-// NOSSP: attributes #2 = { nounwind }
+// NOSSP: attributes #{{.*}} = { nounwind{{.*}} }
-// WITHSSP: attributes #0 = { nounwind ssp "target-features"={{.*}} }
-// WITHSSP: attributes #1 = { "target-features"={{.*}} }
-// WITHSSP: attributes #2 = { nounwind }
+// WITHSSP: attributes #{{.*}} = { nounwind ssp{{.*}} }
-// SSPREQ: attributes #0 = { nounwind sspreq "target-features"={{.*}} }
-// SSPREQ: attributes #1 = { "target-features"={{.*}} }
-// SSPREQ: attributes #2 = { nounwind }
+// SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} }