<div dir="ltr">This ended up breaking some sanitizer attribute tests that aren't run on Windows because the blacklist file syntax treats colons specially, and they are part of Windows paths. I fixed the tests on Linux, but can someone come up with a fix to the blacklist file syntax to make these tests work?</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 22, 2015 at 12:37 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:reid@kleckner.net" target="_blank">reid@kleckner.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rnk<br>
Date: Wed Apr 22 14:37:32 2015<br>
New Revision: 235537<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=235537&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=235537&view=rev</a><br>
Log:<br>
Set normal LLVM function attributes on global initializer functions<br>
<br>
Otherwise -fno-omit-frame-pointer and other flags like it aren't<br>
applied.<br>
<br>
Basic idea taken from Gao's patch, thanks!<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D9203" target="_blank">http://reviews.llvm.org/D9203</a><br>
<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGDeclCXX.cpp<br>
    cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp<br>
    cfe/trunk/test/CodeGenCXX/global-init.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=235537&r1=235536&r2=235537&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=235537&r1=235536&r2=235537&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Wed Apr 22 14:37:32 2015<br>
@@ -259,6 +259,8 @@ llvm::Function *CodeGenModule::CreateGlo<br>
       Fn->setSection(Section);<br>
   }<br>
<br>
+  SetLLVMFunctionAttributes(nullptr, getTypes().arrangeNullaryFunction(), Fn);<br>
+<br>
   Fn->setCallingConv(getRuntimeCC());<br>
<br>
   if (!getLangOpts().Exceptions)<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp?rev=235537&r1=235536&r2=235537&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp?rev=235537&r1=235536&r2=235537&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/global-dtor-no-atexit.cpp Wed Apr 22 14:37:32 2015<br>
@@ -43,4 +43,4 @@ void func() {<br>
   static A a1, a2;<br>
 }<br>
<br>
-// CHECK: attributes [[NUW]] = { nounwind }<br>
+// CHECK: attributes [[NUW]] = { nounwind{{.*}} }<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/global-init.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/global-init.cpp?rev=235537&r1=235536&r2=235537&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/global-init.cpp?rev=235537&r1=235536&r2=235537&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/global-init.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/global-init.cpp Wed Apr 22 14:37:32 2015<br>
@@ -1,5 +1,8 @@<br>
 // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm -fexceptions %s -o - |FileCheck %s<br>
 // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm %s -o - |FileCheck -check-prefix CHECK-NOEXC %s<br>
+// RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm \<br>
+// RUN:     -momit-leaf-frame-pointer -mdisable-fp-elim %s -o - \<br>
+// RUN:   | FileCheck -check-prefix CHECK-FP %s<br>
<br>
 struct A {<br>
   A();<br>
@@ -195,11 +198,15 @@ namespace test7 {<br>
 // CHECK-NEXT:   sub<br>
 // CHECK-NEXT:   store i32 {{.*}}, i32* @_ZN5test1L1yE<br>
<br>
-// CHECK: define internal void @_GLOBAL__sub_I_global_init.cpp() section "__TEXT,__StaticInit,regular,pure_instructions" {<br>
+// CHECK: define internal void @_GLOBAL__sub_I_global_init.cpp() #{{[0-9]+}} section "__TEXT,__StaticInit,regular,pure_instructions" {<br>
 // CHECK:   call void [[TEST1_Y_INIT]]<br>
 // CHECK:   call void [[TEST1_Z_INIT]]<br>
<br>
 // rdar://problem/8090834: this should be nounwind<br>
 // CHECK-NOEXC: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUW:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" {<br>
<br>
-// CHECK-NOEXC: attributes [[NUW]] = { nounwind }<br>
+// CHECK-NOEXC: attributes [[NUW]] = { nounwind{{.*}} }<br>
+<br>
+// PR21811: attach the appropriate attribute to the global init function<br>
+// CHECK-FP: define internal void @_GLOBAL__sub_I_global_init.cpp() [[NUX:#[0-9]+]] section "__TEXT,__StaticInit,regular,pure_instructions" {<br>
+// CHECK-FP: attributes [[NUX]] = { nounwind {{.*}}"no-frame-pointer-elim-non-leaf"{{.*}} }<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>