[llvm] r268999 - Don't inline functions with different SafeStack attributes.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 17:33:07 PDT 2016


Author: eugenis
Date: Mon May  9 19:33:07 2016
New Revision: 268999

URL: http://llvm.org/viewvc/llvm-project?rev=268999&view=rev
Log:
Don't inline functions with different SafeStack attributes.

Modified:
    llvm/trunk/include/llvm/IR/Attributes.td
    llvm/trunk/test/Transforms/Inline/attributes.ll

Modified: llvm/trunk/include/llvm/IR/Attributes.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.td?rev=268999&r1=268998&r2=268999&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Attributes.td (original)
+++ llvm/trunk/include/llvm/IR/Attributes.td Mon May  9 19:33:07 2016
@@ -190,6 +190,7 @@ class CompatRule<string F> {
 def : CompatRule<"isEqual<SanitizeAddressAttr>">;
 def : CompatRule<"isEqual<SanitizeThreadAttr>">;
 def : CompatRule<"isEqual<SanitizeMemoryAttr>">;
+def : CompatRule<"isEqual<SafeStackAttr>">;
 
 class MergeRule<string F> {
   // The name of the function called to merge the attributes of the caller and

Modified: llvm/trunk/test/Transforms/Inline/attributes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/attributes.ll?rev=268999&r1=268998&r2=268999&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/attributes.ll (original)
+++ llvm/trunk/test/Transforms/Inline/attributes.ll Mon May  9 19:33:07 2016
@@ -17,6 +17,10 @@ define i32 @sanitize_memory_callee(i32 %
   ret i32 %i
 }
 
+define i32 @safestack_callee(i32 %i) safestack {
+  ret i32 %i
+}
+
 define i32 @alwaysinline_callee(i32 %i) alwaysinline {
   ret i32 %i
 }
@@ -33,6 +37,10 @@ define i32 @alwaysinline_sanitize_memory
   ret i32 %i
 }
 
+define i32 @alwaysinline_safestack_callee(i32 %i) alwaysinline safestack {
+  ret i32 %i
+}
+
 
 ; Check that:
 ;  * noattr callee is inlined into noattr caller,
@@ -110,6 +118,17 @@ define i32 @test_sanitize_thread(i32 %ar
 ; CHECK-NEXT: @noattr_callee
 ; CHECK-NEXT: ret i32
 }
+
+define i32 @test_safestack(i32 %arg) safestack {
+  %x1 = call i32 @noattr_callee(i32 %arg)
+  %x2 = call i32 @safestack_callee(i32 %x1)
+  %x3 = call i32 @alwaysinline_callee(i32 %x2)
+  %x4 = call i32 @alwaysinline_safestack_callee(i32 %x3)
+  ret i32 %x4
+; CHECK-LABEL: @test_safestack(
+; CHECK-NEXT: @noattr_callee
+; CHECK-NEXT: ret i32
+}
 
 ; Check that a function doesn't get inlined if target-cpu strings don't match
 ; exactly.




More information about the llvm-commits mailing list