nickdesaulniers created this revision.
nickdesaulniers added reviewers: void, rnk.
Herald added subscribers: cfe-commits, jdoerfert, atanasyan, jrtc27, kbarton, 
nemanjai.
Herald added a project: clang.
nickdesaulniers requested review of this revision.

This patch does 2 things:

1. the default value of StackProtectorMode, StackProtectorMode::SSPOff now 
explicitly adds the `nossp` LLVM IR fn attr.
2. it makes -fno-stack-protector/\GS_ now explictly pass `-stack-protector 0` 
to cc1, which sets the StackProtectorMode to StackProtectorMode::SSPOff.

This allows safer mixing of translation units compiled with
-fno-stack-protector and -fstack-protector* for LTO, since LLVM IR fn
attr `nossp` will prevent inlining across the two.

Fixes pr/47479.

Alternative to D90194 <https://reviews.llvm.org/D90194>+D90348 
<https://reviews.llvm.org/D90348>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90896

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CXX/special/class.dtor/p3-0x.cpp
  clang/test/CodeGen/2008-04-08-NoExceptions.c
  clang/test/CodeGen/address-safety-attr-flavors.cpp
  clang/test/CodeGen/address-safety-attr.cpp
  clang/test/CodeGen/address-space-field1.c
  clang/test/CodeGen/alias.c
  clang/test/CodeGen/arm-cmse-attr.c
  clang/test/CodeGen/attr-mustprogress-0.c
  clang/test/CodeGen/attr-mustprogress-0.cpp
  clang/test/CodeGen/attr-mustprogress-1.c
  clang/test/CodeGen/attr-mustprogress-1.cpp
  clang/test/CodeGen/attr-naked.c
  clang/test/CodeGen/attributes.c
  clang/test/CodeGen/exceptions-seh-finally.c
  clang/test/CodeGen/function-attributes.c
  clang/test/CodeGen/incomplete-function-type-2.c
  clang/test/CodeGen/memtag-attr.cpp
  clang/test/CodeGen/micromips-attr.c
  clang/test/CodeGen/mips-vector-arg.c
  clang/test/CodeGen/mips16-attr.c
  clang/test/CodeGen/mrtd.c
  clang/test/CodeGen/ms-declspecs.c
  clang/test/CodeGen/ppc64-complex-parms.c
  clang/test/CodeGen/ppc64-complex-return.c
  clang/test/CodeGen/ppc64-extend.c
  clang/test/CodeGen/pragma-weak.c
  clang/test/CodeGen/sanitize-thread-attr.cpp
  clang/test/CodeGen/sanitize-thread-no-checking-at-run-time.m
  clang/test/CodeGen/stackrealign-main.c
  clang/test/CodeGen/unwind-attr.c
  clang/test/CodeGen/xray-global-init.cpp
  clang/test/CodeGenCXX/apple-kext.cpp
  clang/test/CodeGenCXX/attr.cpp
  clang/test/CodeGenCXX/cxx11-exception-spec.cpp
  clang/test/CodeGenCXX/cxx11-noreturn.cpp
  clang/test/CodeGenCXX/derived-to-base.cpp
  clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp
  clang/test/CodeGenCXX/global-dtor-no-atexit.cpp
  clang/test/CodeGenCXX/global-init.cpp
  clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
  clang/test/CodeGenCXX/no-exceptions.cpp
  clang/test/CodeGenCXX/noinline-template.cpp
  clang/test/CodeGenCXX/optnone-def-decl.cpp
  clang/test/CodeGenCXX/reference-cast.cpp
  clang/test/CodeGenCXX/threadsafe-statics.cpp
  clang/test/CodeGenCXX/thunks.cpp
  clang/test/CodeGenCXX/virtual-base-cast.cpp
  clang/test/CodeGenObjC/gnu-exceptions.m
  clang/test/CodeGenObjC/objc-literal-tests.m
  clang/test/CodeGenObjCXX/lambda-expressions.mm
  clang/test/CodeGenOpenCL/convergent.cl
  clang/test/Driver/cl-options.c
  clang/test/PCH/objc_container.m
  
clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected

Index: clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected
===================================================================
--- clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected
+++ clang/test/utils/update_cc_test_checks/Inputs/check-attributes.cpp.funcattrs.expected
@@ -11,7 +11,7 @@
   struct RT Z;
 };
 
-// CHECK: Function Attrs: noinline nounwind optnone mustprogress
+// CHECK: Function Attrs: noinline nossp nounwind optnone mustprogress
 // CHECK-LABEL: @_Z3fooP2ST(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    [[S_ADDR:%.*]] = alloca %struct.ST*, align 8
Index: clang/test/PCH/objc_container.m
===================================================================
--- clang/test/PCH/objc_container.m
+++ clang/test/PCH/objc_container.m
@@ -21,5 +21,5 @@
 // CHECK-IR: {{call.*objc_msgSend}}
 // CHECK-IR: ret void
 
-// CHECK-IR: attributes #0 = { noinline nounwind {{.*}} }
+// CHECK-IR: attributes #0 = { noinline nossp nounwind {{.*}} }
 // CHECK-IR: attributes #1 = { nonlazybind }
Index: clang/test/Driver/cl-options.c
===================================================================
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -90,7 +90,7 @@
 // GS: "-stack-protector" "2"
 
 // RUN: %clang_cl /GS- -### -- %s 2>&1 | FileCheck -check-prefix=GS_ %s
-// GS_-NOT: -stack-protector
+// GS_: "-stack-protector" "0"
 
 // RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s
 // Gy: -ffunction-sections
Index: clang/test/CodeGenOpenCL/convergent.cl
===================================================================
--- clang/test/CodeGenOpenCL/convergent.cl
+++ clang/test/CodeGenOpenCL/convergent.cl
@@ -139,7 +139,7 @@
   __asm__ volatile("s_barrier");
 }
 
-// CHECK: attributes #0 = { nofree noinline norecurse nounwind "
+// CHECK: attributes #0 = { nofree noinline norecurse nossp nounwind "
 // CHECK: attributes #1 = { {{[^}]*}}convergent{{[^}]*}} }
 // CHECK: attributes #2 = { {{[^}]*}}convergent{{[^}]*}} }
 // CHECK: attributes #3 = { {{[^}]*}}convergent noduplicate{{[^}]*}} }
Index: clang/test/CodeGenObjCXX/lambda-expressions.mm
===================================================================
--- clang/test/CodeGenObjCXX/lambda-expressions.mm
+++ clang/test/CodeGenObjCXX/lambda-expressions.mm
@@ -164,5 +164,5 @@
 
 #endif
 
-// ARC: attributes [[NUW]] = { noinline nounwind{{.*}} }
-// MRC: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// ARC: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
+// MRC: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGenObjC/objc-literal-tests.m
===================================================================
--- clang/test/CodeGenObjC/objc-literal-tests.m
+++ clang/test/CodeGenObjC/objc-literal-tests.m
@@ -94,4 +94,4 @@
   bar(^(void) { return YES; });
 }
 
-// CHECK: attributes [[NUW]] = { noinline {{(norecurse )?}}nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline {{(norecurse )?}}nossp nounwind{{.*}} }
Index: clang/test/CodeGenObjC/gnu-exceptions.m
===================================================================
--- clang/test/CodeGenObjC/gnu-exceptions.m
+++ clang/test/CodeGenObjC/gnu-exceptions.m
@@ -32,4 +32,4 @@
   log(1);
 }
 
-// CHECK: attributes [[TF]] = { noinline optnone "{{.*}} }
+// CHECK: attributes [[TF]] = { noinline nossp optnone "{{.*}} }
Index: clang/test/CodeGenCXX/virtual-base-cast.cpp
===================================================================
--- clang/test/CodeGenCXX/virtual-base-cast.cpp
+++ clang/test/CodeGenCXX/virtual-base-cast.cpp
@@ -82,4 +82,4 @@
 // MSVC:   add nsw i32 4, %[[offset]]
 // MSVC: }
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGenCXX/thunks.cpp
===================================================================
--- clang/test/CodeGenCXX/thunks.cpp
+++ clang/test/CodeGenCXX/thunks.cpp
@@ -542,5 +542,5 @@
 // WIN64-LABEL: define linkonce_odr dso_local void @"?foo@C@Test10@@UEAAXXZ"(
 // WIN64-LABEL: define linkonce_odr dso_local void @"?foo@C@Test10@@W7EAAXXZ"(
 
-// CHECK-NONOPT: attributes [[NUW]] = { noinline nounwind optnone uwtable{{.*}} }
-// CHECK-OPT: attributes [[NUW]] = { nounwind uwtable{{.*}} }
+// CHECK-NONOPT: attributes [[NUW]] = { noinline nossp nounwind optnone uwtable{{.*}} }
+// CHECK-OPT: attributes [[NUW]] = { nossp nounwind uwtable{{.*}} }
Index: clang/test/CodeGenCXX/threadsafe-statics.cpp
===================================================================
--- clang/test/CodeGenCXX/threadsafe-statics.cpp
+++ clang/test/CodeGenCXX/threadsafe-statics.cpp
@@ -22,6 +22,6 @@
 // NO-TSS-NOT: call void @__cxa_guard_release
 // NO-TSS: ret void
 
-// WITH-TSS: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// WITH-TSS: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
 
-// NO-TSS: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// NO-TSS: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGenCXX/reference-cast.cpp
===================================================================
--- clang/test/CodeGenCXX/reference-cast.cpp
+++ clang/test/CodeGenCXX/reference-cast.cpp
@@ -193,4 +193,4 @@
   // CHECK: store i64
 }
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGenCXX/optnone-def-decl.cpp
===================================================================
--- clang/test/CodeGenCXX/optnone-def-decl.cpp
+++ clang/test/CodeGenCXX/optnone-def-decl.cpp
@@ -89,7 +89,7 @@
 // CHECK: @_Z36user_of_forceinline_optnone_functionv() [[NORMAL]]
 // CHECK: @_Z28forceinline_optnone_functionii({{.*}}) [[OPTNONE]]
 
-// CHECK: attributes [[OPTNONE]] = { noinline nounwind optnone {{.*}} }
+// CHECK: attributes [[OPTNONE]] = { noinline nossp nounwind optnone {{.*}} }
 // CHECK: attributes [[NORMAL]] =
 // CHECK-NOT: noinline
 // CHECK-NOT: optnone
Index: clang/test/CodeGenCXX/noinline-template.cpp
===================================================================
--- clang/test/CodeGenCXX/noinline-template.cpp
+++ clang/test/CodeGenCXX/noinline-template.cpp
@@ -15,4 +15,4 @@
  strs.growStorageBy();
 }
 
-// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NI]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGenCXX/no-exceptions.cpp
===================================================================
--- clang/test/CodeGenCXX/no-exceptions.cpp
+++ clang/test/CodeGenCXX/no-exceptions.cpp
@@ -11,4 +11,4 @@
   // CHECK: ret void
 }
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
===================================================================
--- clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
+++ clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
@@ -68,4 +68,4 @@
 void delete_s(S *s) { delete[] s; }
 }
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGenCXX/global-init.cpp
===================================================================
--- clang/test/CodeGenCXX/global-init.cpp
+++ clang/test/CodeGenCXX/global-init.cpp
@@ -204,12 +204,12 @@
 
 // rdar://problem/8090834: this should be nounwind
 // CHECK-NOEXC: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUW:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" {
-// CHECK-NOEXC: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK-NOEXC: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
 
 // Make sure we mark global initializers with the no-builtins attribute.
 // CHECK-NOBUILTIN: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUW:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" {
-// CHECK-NOBUILTIN: attributes [[NUW]] = { noinline nounwind{{.*}}"no-builtins"{{.*}} }
+// CHECK-NOBUILTIN: attributes [[NUW]] = { noinline nossp nounwind{{.*}}"no-builtins"{{.*}} }
 
 // PR21811: attach the appropriate attribute to the global init function
 // CHECK-FP: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUX:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" {
-// CHECK-FP: attributes [[NUX]] = { noinline nounwind {{.*}}"frame-pointer"="non-leaf"{{.*}} }
+// CHECK-FP: attributes [[NUX]] = { noinline nossp nounwind {{.*}}"frame-pointer"="non-leaf"{{.*}} }
Index: clang/test/CodeGenCXX/global-dtor-no-atexit.cpp
===================================================================
--- clang/test/CodeGenCXX/global-dtor-no-atexit.cpp
+++ clang/test/CodeGenCXX/global-dtor-no-atexit.cpp
@@ -43,4 +43,4 @@
   static A a1, a2;
 }
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp
===================================================================
--- clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp
+++ clang/test/CodeGenCXX/exceptions-seh-filter-uwtable.cpp
@@ -35,7 +35,7 @@
 
 // Check for the uwtable attribute on the filter funclet.
 // CHECK: define internal i32 @"?filt$0@0@at@@"(i8* %exception_pointers, i8* %frame_pointer) #[[MD:[0-9]+]]
-// CHECK: attributes #[[MD]] = { nounwind uwtable
+// CHECK: attributes #[[MD]] = { nossp nounwind uwtable
 
 void at() {
   i ar;
Index: clang/test/CodeGenCXX/derived-to-base.cpp
===================================================================
--- clang/test/CodeGenCXX/derived-to-base.cpp
+++ clang/test/CodeGenCXX/derived-to-base.cpp
@@ -46,4 +46,4 @@
   }
 }
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGenCXX/cxx11-noreturn.cpp
===================================================================
--- clang/test/CodeGenCXX/cxx11-noreturn.cpp
+++ clang/test/CodeGenCXX/cxx11-noreturn.cpp
@@ -7,4 +7,4 @@
   while (g()) {}
 }
 
-// CHECK: attributes [[NR]] = { noinline noreturn nounwind{{.*}} }
+// CHECK: attributes [[NR]] = { noinline noreturn nossp nounwind{{.*}} }
Index: clang/test/CodeGenCXX/cxx11-exception-spec.cpp
===================================================================
--- clang/test/CodeGenCXX/cxx11-exception-spec.cpp
+++ clang/test/CodeGenCXX/cxx11-exception-spec.cpp
@@ -121,7 +121,7 @@
 }
 
 // CHECK: attributes [[NONE]] = { {{.*}} }
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
 // CHECK: attributes [[NUW2]] = { nounwind{{.*}} }
 
 
Index: clang/test/CodeGenCXX/attr.cpp
===================================================================
--- clang/test/CodeGenCXX/attr.cpp
+++ clang/test/CodeGenCXX/attr.cpp
@@ -31,4 +31,4 @@
 // CHECK at top of file
 extern "C" int test2() __attribute__((alias("_Z5test1v")));
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGenCXX/apple-kext.cpp
===================================================================
--- clang/test/CodeGenCXX/apple-kext.cpp
+++ clang/test/CodeGenCXX/apple-kext.cpp
@@ -40,5 +40,5 @@
 // CHECK:      call void @_ZN5test01AD1Ev([[A]]* @_ZN5test01aE)
 // CHECK-NEXT: ret void
 
-// CHECK: attributes #[[ATTR0]] = { alwaysinline nounwind {{.*}} }
-// CHECK: attributes #[[ATTR1]] = { noinline nounwind {{.*}} }
+// CHECK: attributes #[[ATTR0]] = { alwaysinline nossp nounwind {{.*}} }
+// CHECK: attributes #[[ATTR1]] = { noinline nossp nounwind {{.*}} }
Index: clang/test/CodeGen/xray-global-init.cpp
===================================================================
--- clang/test/CodeGen/xray-global-init.cpp
+++ clang/test/CodeGen/xray-global-init.cpp
@@ -10,4 +10,4 @@
 
 // Check that the xray-instruction-threshold was applied
 // CHECK: define internal void @_GLOBAL__sub_I_xray_global_init.cpp() [[NUX:#[0-9]+]] section ".text.startup" {
-// CHECK: attributes [[NUX]] = { noinline nounwind {{.*}}"xray-instruction-threshold"="1"{{.*}} }
+// CHECK: attributes [[NUX]] = { noinline nossp nounwind {{.*}}"xray-instruction-threshold"="1"{{.*}} }
Index: clang/test/CodeGen/unwind-attr.c
===================================================================
--- clang/test/CodeGen/unwind-attr.c
+++ clang/test/CodeGen/unwind-attr.c
@@ -23,7 +23,7 @@
   return 0;
 }
 
-// CHECK: attributes [[TF]] = { noinline optnone "{{.*}} }
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[TF]] = { noinline nossp optnone "{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
 
-// CHECK-NOEXC: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK-NOEXC: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGen/stackrealign-main.c
===================================================================
--- clang/test/CodeGen/stackrealign-main.c
+++ clang/test/CodeGen/stackrealign-main.c
@@ -13,7 +13,7 @@
   return 0;
 }
 
-// CHECK: attributes [[OTHER]] = { noinline nounwind optnone
+// CHECK: attributes [[OTHER]] = { noinline nossp nounwind optnone
 // CHECK-NOT: "stackrealign"
 // CHECK: }
-// CHECK: attributes [[MAIN]] = { noinline nounwind optnone {{.*}}"stackrealign"{{.*}} }
+// CHECK: attributes [[MAIN]] = { noinline nossp nounwind optnone {{.*}}"stackrealign"{{.*}} }
Index: clang/test/CodeGen/sanitize-thread-no-checking-at-run-time.m
===================================================================
--- clang/test/CodeGen/sanitize-thread-no-checking-at-run-time.m
+++ clang/test/CodeGen/sanitize-thread-no-checking-at-run-time.m
@@ -38,4 +38,4 @@
 // TSAN: define linkonce_odr hidden void @__destroy_helper_block_8_32o(i8* %0) unnamed_addr [[ATTR:#[0-9]+]]
 }
 
-// TSAN: attributes [[ATTR]] = { noinline nounwind {{.*}} "sanitize_thread_no_checking_at_run_time" {{.*}} }
+// TSAN: attributes [[ATTR]] = { noinline nossp nounwind {{.*}} "sanitize_thread_no_checking_at_run_time" {{.*}} }
Index: clang/test/CodeGen/sanitize-thread-attr.cpp
===================================================================
--- clang/test/CodeGen/sanitize-thread-attr.cpp
+++ clang/test/CodeGen/sanitize-thread-attr.cpp
@@ -54,9 +54,9 @@
 // BL: @__cxx_global_var_init{{.*}}[[NOATTR:#[0-9]+]]
 // TSAN: @__cxx_global_var_init{{.*}}[[WITH:#[0-9]+]]
 
-// WITHOUT: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
+// WITHOUT: attributes [[NOATTR]] = { noinline nossp nounwind{{.*}} }
 
-// BL: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
+// BL: attributes [[NOATTR]] = { noinline nossp nounwind{{.*}} }
 
-// TSAN: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
-// TSAN: attributes [[WITH]] = { noinline nounwind sanitize_thread{{.*}} }
+// TSAN: attributes [[NOATTR]] = { noinline nossp nounwind{{.*}} }
+// TSAN: attributes [[WITH]] = { noinline nossp nounwind sanitize_thread{{.*}} }
Index: clang/test/CodeGen/pragma-weak.c
===================================================================
--- clang/test/CodeGen/pragma-weak.c
+++ clang/test/CodeGen/pragma-weak.c
@@ -188,5 +188,5 @@
 
 int correct_linkage;
 
-// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
-// CHECK: attributes [[RN]] = { noinline nounwind optnone readnone{{.*}} }
+// CHECK: attributes [[NI]] = { noinline nossp nounwind{{.*}} }
+// CHECK: attributes [[RN]] = { noinline nossp nounwind optnone readnone{{.*}} }
Index: clang/test/CodeGen/ppc64-extend.c
===================================================================
--- clang/test/CodeGen/ppc64-extend.c
+++ clang/test/CodeGen/ppc64-extend.c
@@ -13,4 +13,4 @@
 unsigned int f4(void) { return 0; }
 // CHECK: define zeroext i32 @f4() [[NUW]]
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGen/ppc64-complex-return.c
===================================================================
--- clang/test/CodeGen/ppc64-complex-return.c
+++ clang/test/CodeGen/ppc64-complex-return.c
@@ -148,4 +148,4 @@
 // CHECK: extractvalue { i64, i64 } [[VAR8]], 1
 
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGen/ppc64-complex-parms.c
===================================================================
--- clang/test/CodeGen/ppc64-complex-parms.c
+++ clang/test/CodeGen/ppc64-complex-parms.c
@@ -191,4 +191,4 @@
 // CHECK: %[[VAR77:[A-Za-z0-9.]+]] = load i64, i64* %[[VAR76]], align 8
 // CHECK: %{{[A-Za-z0-9.]+}} = call i64 @foo_long_long(i64 %[[VAR75]], i64 %[[VAR77]])
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGen/ms-declspecs.c
===================================================================
--- clang/test/CodeGen/ms-declspecs.c
+++ clang/test/CodeGen/ms-declspecs.c
@@ -37,8 +37,8 @@
 // CHECK: call void @noalias_callee({{.*}}) [[NA:#[0-9]+]]
 void noalias_caller(int *x) { noalias_callee(x); }
 
-// CHECK: attributes [[NAKED]] = { naked noinline nounwind{{.*}} }
-// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
-// CHECK: attributes [[NI]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NAKED]] = { naked noinline nossp nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { nossp nounwind{{.*}} }
+// CHECK: attributes [[NI]] = { noinline nossp nounwind{{.*}} }
 // CHECK: attributes [[NR]] = { noreturn }
 // CHECK: attributes [[NA]] = { argmemonly nounwind{{.*}} }
Index: clang/test/CodeGen/mrtd.c
===================================================================
--- clang/test/CodeGen/mrtd.c
+++ clang/test/CodeGen/mrtd.c
@@ -25,4 +25,4 @@
 // CHECK-LABEL: define x86_stdcallcc void @quux
 // CHECK: call void (i32, ...) @qux
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGen/mips16-attr.c
===================================================================
--- clang/test/CodeGen/mips16-attr.c
+++ clang/test/CodeGen/mips16-attr.c
@@ -11,7 +11,7 @@
 
 // CHECK: define void @nofoo() [[NOMIPS16:#[0-9]+]]
 
-// CHECK: attributes [[MIPS16]] = { noinline nounwind {{.*}} "mips16" {{.*}} }
+// CHECK: attributes [[MIPS16]] = { noinline nossp nounwind {{.*}} "mips16" {{.*}} }
 
-// CHECK: attributes [[NOMIPS16]]  = { noinline nounwind {{.*}} "nomips16" {{.*}} }
+// CHECK: attributes [[NOMIPS16]]  = { noinline nossp nounwind {{.*}} "nomips16" {{.*}} }
 
Index: clang/test/CodeGen/mips-vector-arg.c
===================================================================
--- clang/test/CodeGen/mips-vector-arg.c
+++ clang/test/CodeGen/mips-vector-arg.c
@@ -26,6 +26,6 @@
   test_v4i32_2(a3, a2, a1);
 }
 
-// O32: attributes [[NUW]] = { nounwind{{.*}} }
+// O32: attributes [[NUW]] = { nossp nounwind{{.*}} }
 
-// N64: attributes [[NUW]] = { nounwind{{.*}} }
+// N64: attributes [[NUW]] = { nossp nounwind{{.*}} }
Index: clang/test/CodeGen/micromips-attr.c
===================================================================
--- clang/test/CodeGen/micromips-attr.c
+++ clang/test/CodeGen/micromips-attr.c
@@ -8,5 +8,5 @@
 
 // CHECK: define void @nofoo() [[NOMICROMIPS:#[0-9]+]]
 
-// CHECK: attributes [[MICROMIPS]] = { noinline nounwind {{.*}} "micromips" {{.*}} }
-// CHECK: attributes [[NOMICROMIPS]]  = { noinline nounwind {{.*}} "nomicromips" {{.*}} }
+// CHECK: attributes [[MICROMIPS]] = { noinline nossp nounwind {{.*}} "micromips" {{.*}} }
+// CHECK: attributes [[NOMICROMIPS]]  = { noinline nossp nounwind {{.*}} "nomicromips" {{.*}} }
Index: clang/test/CodeGen/memtag-attr.cpp
===================================================================
--- clang/test/CodeGen/memtag-attr.cpp
+++ clang/test/CodeGen/memtag-attr.cpp
@@ -9,11 +9,11 @@
 // RUN:   FileCheck -check-prefix=CHECK-MEMTAG %s
 
 int HasSanitizeMemTag() { return 1; }
-// CHECK-NO: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-MEMTAG: Function Attrs: noinline nounwind sanitize_memtag
+// CHECK-NO: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-MEMTAG: Function Attrs: noinline nossp nounwind sanitize_memtag
 
 __attribute__((no_sanitize("memtag"))) int NoSanitizeQuoteAddress() {
   return 0;
 }
-// CHECK-NO: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-MEMTAG: {{Function Attrs: noinline nounwind mustprogress$}}
+// CHECK-NO: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-MEMTAG: {{Function Attrs: noinline nossp nounwind mustprogress$}}
Index: clang/test/CodeGen/incomplete-function-type-2.c
===================================================================
--- clang/test/CodeGen/incomplete-function-type-2.c
+++ clang/test/CodeGen/incomplete-function-type-2.c
@@ -16,4 +16,4 @@
   p1(0.0);
 }
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGen/function-attributes.c
===================================================================
--- clang/test/CodeGen/function-attributes.c
+++ clang/test/CodeGen/function-attributes.c
@@ -109,11 +109,11 @@
   _setjmp(0);
 }
 
-// CHECK: attributes [[NUW]] = { nounwind optsize{{.*}} }
-// CHECK: attributes [[AI]] = { alwaysinline nounwind optsize{{.*}} }
-// CHECK: attributes [[NUW_OS_RN]] = { nounwind optsize readnone{{.*}} }
-// CHECK: attributes [[SR]] = { nounwind optsize{{.*}} "stackrealign"{{.*}} }
-// CHECK: attributes [[RT]] = { nounwind optsize returns_twice{{.*}} }
+// CHECK: attributes [[NUW]] = { nossp nounwind optsize{{.*}} }
+// CHECK: attributes [[AI]] = { alwaysinline nossp nounwind optsize{{.*}} }
+// CHECK: attributes [[NUW_OS_RN]] = { nossp nounwind optsize readnone{{.*}} }
+// CHECK: attributes [[SR]] = { nossp nounwind optsize{{.*}} "stackrealign"{{.*}} }
+// CHECK: attributes [[RT]] = { nossp nounwind optsize returns_twice{{.*}} }
 // CHECK: attributes [[NR]] = { noreturn optsize }
 // CHECK: attributes [[NUW_RN]] = { nounwind optsize readnone }
 // CHECK: attributes [[RT_CALL]] = { optsize returns_twice }
Index: clang/test/CodeGen/exceptions-seh-finally.c
===================================================================
--- clang/test/CodeGen/exceptions-seh-finally.c
+++ clang/test/CodeGen/exceptions-seh-finally.c
@@ -284,4 +284,4 @@
 
 // Look for the absence of noinline.  nounwind is expected; any further
 // attributes should be string attributes.
-// CHECK: attributes [[finally_attrs]] = { nounwind "{{.*}}" }
+// CHECK: attributes [[finally_attrs]] = { nossp nounwind "{{.*}}" }
Index: clang/test/CodeGen/attributes.c
===================================================================
--- clang/test/CodeGen/attributes.c
+++ clang/test/CodeGen/attributes.c
@@ -107,8 +107,8 @@
   (*p)();
 }
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
-// CHECK: attributes [[NR]] = { noinline noreturn nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
+// CHECK: attributes [[NR]] = { noinline noreturn nossp nounwind{{.*}} }
 // CHECK: attributes [[COLDDEF]] = { cold {{.*}}}
 // CHECK: attributes [[COLDDECL]] = { cold {{.*}}}
 // CHECK: attributes [[NOCF_CHECK_FUNC]] = { nocf_check {{.*}}}
Index: clang/test/CodeGen/attr-naked.c
===================================================================
--- clang/test/CodeGen/attr-naked.c
+++ clang/test/CodeGen/attr-naked.c
@@ -23,5 +23,5 @@
 // CHECK: unreachable
 }
 
-// CHECK: attributes [[NAKED_OPTNONE]] = { naked noinline nounwind optnone{{.*}} }
-// CHECK: attributes [[NAKED]] = { naked noinline nounwind{{.*}} }
+// CHECK: attributes [[NAKED_OPTNONE]] = { naked noinline nossp nounwind optnone{{.*}} }
+// CHECK: attributes [[NAKED]] = { naked noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGen/attr-mustprogress-1.cpp
===================================================================
--- clang/test/CodeGen/attr-mustprogress-1.cpp
+++ clang/test/CodeGen/attr-mustprogress-1.cpp
@@ -7,7 +7,7 @@
 int a = 0;
 int b = 0;
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2f1v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -23,7 +23,7 @@
     ;
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone mustprogress
+// CHECK: Function Attrs: noinline nossp nounwind optnone mustprogress
 // CHECK-LABEL: @_Z2f2v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -42,7 +42,7 @@
     ;
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z1Fv(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -69,7 +69,7 @@
     ;
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2F2v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -96,7 +96,7 @@
     ;
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2w1v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_BODY:%.*]]
@@ -108,7 +108,7 @@
     ;
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone mustprogress
+// CHECK: Function Attrs: noinline nossp nounwind optnone mustprogress
 // CHECK-LABEL: @_Z2w2v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_COND:%.*]]
@@ -127,7 +127,7 @@
     ;
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z1Wv(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_COND:%.*]]
@@ -150,7 +150,7 @@
     ;
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2W2v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_BODY:%.*]]
@@ -164,7 +164,7 @@
     ;
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2d1v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
@@ -181,7 +181,7 @@
   while (1);
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone mustprogress
+// CHECK: Function Attrs: noinline nossp nounwind optnone mustprogress
 // CHECK-LABEL: @_Z2d2v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
@@ -201,7 +201,7 @@
   while (a == b);
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z1Dv(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
@@ -230,7 +230,7 @@
   while (a == b);
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2D2v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
Index: clang/test/CodeGen/attr-mustprogress-1.c
===================================================================
--- clang/test/CodeGen/attr-mustprogress-1.c
+++ clang/test/CodeGen/attr-mustprogress-1.c
@@ -7,7 +7,7 @@
 int a = 0;
 int b = 0;
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @f1(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -23,7 +23,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @f2(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -42,7 +42,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @F(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -69,7 +69,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @w1(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_BODY:%.*]]
@@ -81,7 +81,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @w2(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_COND:%.*]]
@@ -100,7 +100,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @W(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_COND:%.*]]
@@ -123,7 +123,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @d1(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
@@ -139,7 +139,7 @@
   } while (1);
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @d2(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
@@ -158,7 +158,7 @@
   } while (a == b);
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @D(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
Index: clang/test/CodeGen/attr-mustprogress-0.cpp
===================================================================
--- clang/test/CodeGen/attr-mustprogress-0.cpp
+++ clang/test/CodeGen/attr-mustprogress-0.cpp
@@ -4,7 +4,7 @@
 int a = 0;
 int b = 0;
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2f1v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -20,7 +20,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2f2v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -39,7 +39,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z1Fv(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -66,7 +66,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2w1v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_BODY:%.*]]
@@ -78,7 +78,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2w2v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_COND:%.*]]
@@ -97,7 +97,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z1Wv(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_COND:%.*]]
@@ -120,7 +120,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2d1v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
@@ -136,7 +136,7 @@
   } while (1);
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z2d2v(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
@@ -155,7 +155,7 @@
   } while (a == b);
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @_Z1Dv(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
Index: clang/test/CodeGen/attr-mustprogress-0.c
===================================================================
--- clang/test/CodeGen/attr-mustprogress-0.c
+++ clang/test/CodeGen/attr-mustprogress-0.c
@@ -5,7 +5,7 @@
 int a = 0;
 int b = 0;
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @f1(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -21,7 +21,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @f2(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -40,7 +40,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @F(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[FOR_COND:%.*]]
@@ -67,7 +67,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @w1(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_BODY:%.*]]
@@ -79,7 +79,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @w2(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_COND:%.*]]
@@ -98,7 +98,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @W(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[WHILE_COND:%.*]]
@@ -121,7 +121,7 @@
   }
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @d1(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
@@ -137,7 +137,7 @@
   } while (1);
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @d2(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
@@ -156,7 +156,7 @@
   } while (a == b);
 }
 
-// CHECK: Function Attrs: noinline nounwind optnone
+// CHECK: Function Attrs: noinline nossp nounwind optnone
 // CHECK-LABEL: @D(
 // CHECK-NEXT:  entry:
 // CHECK-NEXT:    br label [[DO_BODY:%.*]]
Index: clang/test/CodeGen/arm-cmse-attr.c
===================================================================
--- clang/test/CodeGen/arm-cmse-attr.c
+++ clang/test/CodeGen/arm-cmse-attr.c
@@ -38,6 +38,6 @@
 
 // CHECK-NOSE-NOT: cmse_nonsecure_entry
 // CHECK-NOSE-NOT: cmse_nonsecure_call
-// CHECK-SE: attributes #0 = { nounwind
+// CHECK-SE: attributes #0 = { nossp nounwind
 // CHECK-SE: attributes #1 = { {{.*}} "cmse_nonsecure_entry"
 // CHECK-SE: attributes #2 = { {{.*}} "cmse_nonsecure_call"
Index: clang/test/CodeGen/alias.c
===================================================================
--- clang/test/CodeGen/alias.c
+++ clang/test/CodeGen/alias.c
@@ -83,9 +83,9 @@
 // CHECKCC: call arm_aapcs_vfpcc  i32 @inner_weak(i32 %{{.*}})
 // CHECKCC: define internal arm_aapcs_vfpcc i32 @inner_weak(i32 %a) [[NUW]] {
 
-// CHECKBASIC: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECKBASIC: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
 
-// CHECKCC: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECKCC: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
 
 void test8_bar() {}
 void test8_foo() __attribute__((weak, alias("test8_bar")));
Index: clang/test/CodeGen/address-space-field1.c
===================================================================
--- clang/test/CodeGen/address-space-field1.c
+++ clang/test/CodeGen/address-space-field1.c
@@ -37,4 +37,4 @@
   p1->b = p2->a;
 }
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGen/address-safety-attr.cpp
===================================================================
--- clang/test/CodeGen/address-safety-attr.cpp
+++ clang/test/CodeGen/address-safety-attr.cpp
@@ -142,13 +142,13 @@
 // BLFUNC: @__cxx_global_var_init{{.*}}[[WITH:#[0-9]+]]
 // ASAN: @__cxx_global_var_init{{.*}}[[WITH:#[0-9]+]]
 
-// WITHOUT: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
+// WITHOUT: attributes [[NOATTR]] = { noinline nossp nounwind{{.*}} }
 
-// BLFILE: attributes [[WITH]] = { noinline nounwind sanitize_address{{.*}} }
-// BLFILE: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
+// BLFILE: attributes [[WITH]] = { noinline nossp nounwind sanitize_address{{.*}} }
+// BLFILE: attributes [[NOATTR]] = { noinline nossp nounwind{{.*}} }
 
-// BLFUNC: attributes [[WITH]] = { noinline nounwind sanitize_address{{.*}} }
-// BLFUNC: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
+// BLFUNC: attributes [[WITH]] = { noinline nossp nounwind sanitize_address{{.*}} }
+// BLFUNC: attributes [[NOATTR]] = { noinline nossp nounwind{{.*}} }
 
-// ASAN: attributes [[WITH]] = { noinline nounwind sanitize_address{{.*}} }
-// ASAN: attributes [[NOATTR]] = { noinline nounwind{{.*}} }
+// ASAN: attributes [[WITH]] = { noinline nossp nounwind sanitize_address{{.*}} }
+// ASAN: attributes [[NOATTR]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CodeGen/address-safety-attr-flavors.cpp
===================================================================
--- clang/test/CodeGen/address-safety-attr-flavors.cpp
+++ clang/test/CodeGen/address-safety-attr-flavors.cpp
@@ -25,51 +25,51 @@
 // RUN:   FileCheck -check-prefix=CHECK-KHWASAN %s
 
 int HasSanitizeAddress() { return 1; }
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-ASAN: Function Attrs: noinline nounwind sanitize_address mustprogress
-// CHECK-KASAN: Function Attrs: noinline nounwind sanitize_address mustprogress
-// CHECK-HWASAN: Function Attrs: noinline nounwind sanitize_hwaddress mustprogress
-// CHECK-KHWASAN: Function Attrs: noinline nounwind sanitize_hwaddress mustprogress
+// CHECK-NOASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-ASAN: Function Attrs: noinline nossp nounwind sanitize_address mustprogress
+// CHECK-KASAN: Function Attrs: noinline nossp nounwind sanitize_address mustprogress
+// CHECK-HWASAN: Function Attrs: noinline nossp nounwind sanitize_hwaddress mustprogress
+// CHECK-KHWASAN: Function Attrs: noinline nossp nounwind sanitize_hwaddress mustprogress
 
 __attribute__((no_sanitize("address"))) int NoSanitizeQuoteAddress() {
   return 0;
 }
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-ASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-KASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-HWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress mustprogress$}}
-// CHECK-KHWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress mustprogress$}}
+// CHECK-NOASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-ASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-KASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-HWASAN: {{Function Attrs: noinline nossp nounwind sanitize_hwaddress mustprogress$}}
+// CHECK-KHWASAN: {{Function Attrs: noinline nossp nounwind sanitize_hwaddress mustprogress$}}
 
 __attribute__((no_sanitize_address)) int NoSanitizeAddress() { return 0; }
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-ASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-KASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-HWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress mustprogress$}}
-// CHECK-KHWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress mustprogress$}}
+// CHECK-NOASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-ASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-KASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-HWASAN: {{Function Attrs: noinline nossp nounwind sanitize_hwaddress mustprogress$}}
+// CHECK-KHWASAN: {{Function Attrs: noinline nossp nounwind sanitize_hwaddress mustprogress$}}
 
 __attribute__((no_sanitize("kernel-address"))) int NoSanitizeKernelAddress() {
   return 0;
 }
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-ASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-KASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-HWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress mustprogress$}}
-// CHECK-KHWASAN: {{Function Attrs: noinline nounwind sanitize_hwaddress mustprogress$}}
+// CHECK-NOASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-ASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-KASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-HWASAN: {{Function Attrs: noinline nossp nounwind sanitize_hwaddress mustprogress$}}
+// CHECK-KHWASAN: {{Function Attrs: noinline nossp nounwind sanitize_hwaddress mustprogress$}}
 
 __attribute__((no_sanitize("hwaddress"))) int NoSanitizeHWAddress() {
   return 0;
 }
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-ASAN: {{Function Attrs: noinline nounwind sanitize_address mustprogress$}}
-// CHECK-KASAN: {{Function Attrs: noinline nounwind sanitize_address mustprogress$}}
-// CHECK-HWASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-KHWASAN: {{Function Attrs: noinline nounwind mustprogress$}}
+// CHECK-NOASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-ASAN: {{Function Attrs: noinline nossp nounwind sanitize_address mustprogress$}}
+// CHECK-KASAN: {{Function Attrs: noinline nossp nounwind sanitize_address mustprogress$}}
+// CHECK-HWASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-KHWASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
 
 __attribute__((no_sanitize("kernel-hwaddress"))) int NoSanitizeKernelHWAddress() {
   return 0;
 }
-// CHECK-NOASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-ASAN: {{Function Attrs: noinline nounwind sanitize_address mustprogress$}}
-// CHECK-KASAN: {{Function Attrs: noinline nounwind sanitize_address mustprogress$}}
-// CHECK-HWASAN: {{Function Attrs: noinline nounwind mustprogress$}}
-// CHECK-KHWASAN: {{Function Attrs: noinline nounwind mustprogress$}}
+// CHECK-NOASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-ASAN: {{Function Attrs: noinline nossp nounwind sanitize_address mustprogress$}}
+// CHECK-KASAN: {{Function Attrs: noinline nossp nounwind sanitize_address mustprogress$}}
+// CHECK-HWASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
+// CHECK-KHWASAN: {{Function Attrs: noinline nossp nounwind mustprogress$}}
Index: clang/test/CodeGen/2008-04-08-NoExceptions.c
===================================================================
--- clang/test/CodeGen/2008-04-08-NoExceptions.c
+++ clang/test/CodeGen/2008-04-08-NoExceptions.c
@@ -9,4 +9,4 @@
 
 // CHECK-NOT: declare void @f() [[NUW]]
 
-// CHECK: attributes [[NUW]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[NUW]] = { noinline nossp nounwind{{.*}} }
Index: clang/test/CXX/special/class.dtor/p3-0x.cpp
===================================================================
--- clang/test/CXX/special/class.dtor/p3-0x.cpp
+++ clang/test/CXX/special/class.dtor/p3-0x.cpp
@@ -176,4 +176,4 @@
 template <typename T>
 TVC<T>::~TVC() {}
 
-// CHECK: attributes [[ATTRGRP]] = { noinline nounwind{{.*}} }
+// CHECK: attributes [[ATTRGRP]] = { noinline nossp nounwind{{.*}} }
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3010,6 +3010,8 @@
       StackProtectorLevel = LangOptions::SSPStrong;
     else if (A->getOption().matches(options::OPT_fstack_protector_all))
       StackProtectorLevel = LangOptions::SSPReq;
+    else if (A->getOption().matches(options::OPT_fno_stack_protector))
+      StackProtectorLevel = LangOptions::SSPOff;
   } else {
     StackProtectorLevel = DefaultStackProtectorLevel;
   }
@@ -6746,11 +6748,13 @@
 
   // This controls whether or not we emit stack-protector instrumentation.
   // In MSVC, Buffer Security Check (/GS) is on by default.
+  LangOptions::StackProtectorMode SPM = LangOptions::SSPOff;
   if (!isNVPTX && Args.hasFlag(options::OPT__SLASH_GS, options::OPT__SLASH_GS_,
                                /*Default=*/true)) {
-    CmdArgs.push_back("-stack-protector");
-    CmdArgs.push_back(Args.MakeArgString(Twine(LangOptions::SSPStrong)));
+    SPM = LangOptions::SSPStrong;
   }
+  CmdArgs.push_back("-stack-protector");
+  CmdArgs.push_back(Args.MakeArgString(Twine(SPM)));
 
   // Emit CodeView if -Z7, -Zd, or -gline-tables-only are present.
   if (Arg *DebugInfoArg =
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -1642,7 +1642,8 @@
   if (!hasUnwindExceptions(LangOpts))
     B.addAttribute(llvm::Attribute::NoUnwind);
 
-  if (D && D->hasAttr<NoStackProtectorAttr>())
+  if (LangOpts.getStackProtector() == LangOptions::SSPOff ||
+      (D && D->hasAttr<NoStackProtectorAttr>()))
     B.addAttribute(llvm::Attribute::NoStackProtect);
   else if (LangOpts.getStackProtector() == LangOptions::SSPOn)
     B.addAttribute(llvm::Attribute::StackProtect);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D90896: [Clang][D... Nick Desaulniers via Phabricator via cfe-commits

Reply via email to