]> granicus.if.org Git - llvm/commitdiff
Don't inline functions with different SafeStack attributes.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Tue, 10 May 2016 00:33:07 +0000 (00:33 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Tue, 10 May 2016 00:33:07 +0000 (00:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268999 91177308-0d34-0410-b5e6-96231b3b80d8

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

index b774f7a44ffaeaf8c74a78af24cddbe15488ccab..ebad03bf6bdae3b62b612064be3a2db53d483e7c 100644 (file)
@@ -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
index 62b10fb3beb5b3699d21cc2a1ee77e326ca26366..c1c5e7c70c7d297c7c9ac46fa50f77ff240db2c9 100644 (file)
@@ -17,6 +17,10 @@ define i32 @sanitize_memory_callee(i32 %i) sanitize_memory {
   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_callee(i32 %i) alwaysinline sanitize_me
   ret i32 %i
 }
 
+define i32 @alwaysinline_safestack_callee(i32 %i) alwaysinline safestack {
+  ret i32 %i
+}
+
 
 ; Check that:
 ;  * noattr callee is inlined into noattr caller,
@@ -111,6 +119,17 @@ define i32 @test_sanitize_thread(i32 %arg) sanitize_thread {
 ; 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.
 define i32 @test_target_cpu_callee0(i32 %i) "target-cpu"="corei7" {