diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-27 22:09:06 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-27 22:09:06 +0000 |
commit | ffba4c7e69cd0d0ef346e9845b918a030ca51ae8 (patch) | |
tree | ecdabc1734fc9dc478911f25a9400b5022514a08 /test/Instrumentation | |
parent | 7cde9d0286a8976feebb20e61612fb999527f630 (diff) | |
download | external_llvm-ffba4c7e69cd0d0ef346e9845b918a030ca51ae8.zip external_llvm-ffba4c7e69cd0d0ef346e9845b918a030ca51ae8.tar.gz external_llvm-ffba4c7e69cd0d0ef346e9845b918a030ca51ae8.tar.bz2 |
DataFlowSanitizer: Implement trampolines for function pointers passed to custom functions.
Differential Revision: http://llvm-reviews.chandlerc.com/D1503
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Instrumentation')
-rw-r--r-- | test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt | 7 | ||||
-rw-r--r-- | test/Instrumentation/DataFlowSanitizer/abilist.ll | 15 |
2 files changed, 17 insertions, 5 deletions
diff --git a/test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt b/test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt index 42e34e4..97ce5e6 100644 --- a/test/Instrumentation/DataFlowSanitizer/Inputs/abilist.txt +++ b/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/test/Instrumentation/DataFlowSanitizer/abilist.ll b/test/Instrumentation/DataFlowSanitizer/abilist.ll index 4e23bf1..66ddc14 100644 --- a/test/Instrumentation/DataFlowSanitizer/abilist.ll +++ b/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]] |