From: Evgeniy Stepanov Date: Tue, 10 May 2016 00:33:07 +0000 (+0000) Subject: Don't inline functions with different SafeStack attributes. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3d318a084fcfb24163a46c086959aeb7075a8fb;p=llvm Don't inline functions with different SafeStack attributes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268999 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/Attributes.td b/include/llvm/IR/Attributes.td index b774f7a44ff..ebad03bf6bd 100644 --- a/include/llvm/IR/Attributes.td +++ b/include/llvm/IR/Attributes.td @@ -190,6 +190,7 @@ class CompatRule { def : CompatRule<"isEqual">; def : CompatRule<"isEqual">; def : CompatRule<"isEqual">; +def : CompatRule<"isEqual">; class MergeRule { // The name of the function called to merge the attributes of the caller and diff --git a/test/Transforms/Inline/attributes.ll b/test/Transforms/Inline/attributes.ll index 62b10fb3beb..c1c5e7c70c7 100644 --- a/test/Transforms/Inline/attributes.ll +++ b/test/Transforms/Inline/attributes.ll @@ -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" {