summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2013-08-27 22:09:06 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2013-08-27 22:09:06 +0000
commit28a10aff4828bd07cfda28ccc6048c775b5b9f60 (patch)
tree099c8c05b671617773a05ea5834d999654e35b60 /llvm/test
parentaa34d79ab51fe18e30a238a227f4fe96b4fb2f7e (diff)
downloadbcm5719-llvm-28a10aff4828bd07cfda28ccc6048c775b5b9f60.tar.gz
bcm5719-llvm-28a10aff4828bd07cfda28ccc6048c775b5b9f60.zip
DataFlowSanitizer: Implement trampolines for function pointers passed to custom functions.
Differential Revision: http://llvm-reviews.chandlerc.com/D1503 llvm-svn: 189408
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt7
-rw-r--r--llvm/test/Instrumentation/DataFlowSanitizer/abilist.ll15
2 files changed, 17 insertions, 5 deletions
diff --git a/llvm/test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt b/llvm/test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt
index 42e34e44d8b..97ce5e60a54 100644
--- a/llvm/test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt
+++ b/llvm/test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt
@@ -4,8 +4,5 @@ fun:discard*=discard
fun:functional=uninstrumented
fun:functional=functional
-fun:custom1=uninstrumented
-fun:custom1=custom
-
-fun:custom2=uninstrumented
-fun:custom2=custom
+fun:custom*=uninstrumented
+fun:custom*=custom
diff --git a/llvm/test/Instrumentation/DataFlowSanitizer/abilist.ll b/llvm/test/Instrumentation/DataFlowSanitizer/abilist.ll
index 4e23bf1e700..66ddc140a08 100644
--- a/llvm/test/Instrumentation/DataFlowSanitizer/abilist.ll
+++ b/llvm/test/Instrumentation/DataFlowSanitizer/abilist.ll
@@ -16,6 +16,10 @@ declare void @custom1(i32 %a, i32 %b)
declare i32 @custom2(i32 %a, i32 %b)
+declare void @customcb(i32 (i32)* %cb)
+
+declare i32 @cb(i32)
+
; CHECK: @"dfs$f"
define void @f() {
; CHECK: %[[LABELRETURN:.*]] = alloca i16
@@ -26,6 +30,9 @@ define void @f() {
; CHECK: call i32 @__dfsw_custom2(i32 1, i32 2, i16 0, i16 0, i16* %[[LABELRETURN]])
call i32 @custom2(i32 1, i32 2)
+ ; CHECK: call void @__dfsw_customcb({{.*}} @"dfst0$customcb", i8* bitcast ({{.*}} @"dfs$cb" to i8*), i16 0)
+ call void @customcb(i32 (i32)* @cb)
+
ret void
}
@@ -58,3 +65,11 @@ define i32 (i32, i32)* @g(i32) {
; CHECK: declare void @__dfsw_custom1(i32, i32, i16, i16)
; CHECK: declare i32 @__dfsw_custom2(i32, i32, i16, i16, i16*)
+
+; CHECK-LABEL: define linkonce_odr i32 @"dfst0$customcb"(i32 (i32)*, i32, i16, i16*)
+; CHECK: %[[BC:.*]] = bitcast i32 (i32)* %0 to { i32, i16 } (i32, i16)*
+; CHECK: %[[CALL:.*]] = call { i32, i16 } %[[BC]](i32 %1, i16 %2)
+; CHECK: %[[XVAL0:.*]] = extractvalue { i32, i16 } %[[CALL]], 0
+; CHECK: %[[XVAL1:.*]] = extractvalue { i32, i16 } %[[CALL]], 1
+; CHECK: store i16 %[[XVAL1]], i16* %3
+; CHECK: ret i32 %[[XVAL0]]
OpenPOWER on IntegriCloud