forked from OSchip/llvm-project
[dfsan] Remove hard-coded shadow width in more tests
As a preparation step for fast8 support, we need to update the tests to pass in both modes. That requires generalizing the shadow width and remove any hard coded references that assume it's always 2 bytes. Reviewed By: stephan.yichao.zhao Differential Revision: https://reviews.llvm.org/D97884
This commit is contained in:
parent
5bdc5e7efd
commit
6b7b53f5b9
|
@ -2,6 +2,9 @@
|
|||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; CHECK: @__dfsan_shadow_width_bits = weak_odr constant i32 [[#SBITS:]]
|
||||
; CHECK: @__dfsan_shadow_width_bytes = weak_odr constant i32 [[#SBYTES:]]
|
||||
|
||||
; CHECK: i32 @discard(i32 %a, i32 %b)
|
||||
define i32 @discard(i32 %a, i32 %b) {
|
||||
ret i32 0
|
||||
|
@ -14,23 +17,23 @@ define i32 @functional(i32 %a, i32 %b) {
|
|||
}
|
||||
|
||||
; CHECK: define i32 (i32, i32)* @discardg(i32 %0)
|
||||
; CHECK: %[[CALL:.*]] = call { i32 (i32, i32)*, i16 } @"dfs$g"(i32 %0, i16 0)
|
||||
; CHECK: %[[XVAL:.*]] = extractvalue { i32 (i32, i32)*, i16 } %[[CALL]], 0
|
||||
; CHECK: %[[CALL:.*]] = call { i32 (i32, i32)*, i[[#SBITS]] } @"dfs$g"(i32 %0, i[[#SBITS]] 0)
|
||||
; CHECK: %[[XVAL:.*]] = extractvalue { i32 (i32, i32)*, i[[#SBITS]] } %[[CALL]], 0
|
||||
; CHECK: ret {{.*}} %[[XVAL]]
|
||||
@discardg = alias i32 (i32, i32)* (i32), i32 (i32, i32)* (i32)* @g
|
||||
|
||||
declare void @custom1(i32 %a, i32 %b)
|
||||
|
||||
; CHECK: define linkonce_odr { i32, i16 } @"dfsw$custom2"(i32 %0, i32 %1, i16 %2, i16 %3)
|
||||
; CHECK: %[[LABELRETURN2:.*]] = alloca i16
|
||||
; CHECK: define linkonce_odr { i32, i[[#SBITS]] } @"dfsw$custom2"(i32 %0, i32 %1, i[[#SBITS]] %2, i[[#SBITS]] %3)
|
||||
; CHECK: %[[LABELRETURN2:.*]] = alloca i[[#SBITS]]
|
||||
; CHECK: %[[RV:.*]] = call i32 @__dfsw_custom2
|
||||
; CHECK: %[[RVSHADOW:.*]] = load i16, i16* %[[LABELRETURN2]]
|
||||
; CHECK: %[[RVSHADOW:.*]] = load i[[#SBITS]], i[[#SBITS]]* %[[LABELRETURN2]]
|
||||
; CHECK: insertvalue {{.*}}[[RV]], 0
|
||||
; CHECK: insertvalue {{.*}}[[RVSHADOW]], 1
|
||||
; CHECK: ret { i32, i16 }
|
||||
; CHECK: ret { i32, i[[#SBITS]] }
|
||||
declare i32 @custom2(i32 %a, i32 %b)
|
||||
|
||||
; CHECK: define linkonce_odr void @"dfsw$custom3"(i32 %0, i16 %1, i16* %2, ...)
|
||||
; CHECK: define linkonce_odr void @"dfsw$custom3"(i32 %0, i[[#SBITS]] %1, i[[#SBITS]]* %2, ...)
|
||||
; CHECK: call void @__dfsan_vararg_wrapper(i8*
|
||||
; CHECK: unreachable
|
||||
declare void @custom3(i32 %a, ...)
|
||||
|
@ -43,30 +46,30 @@ declare i32 @cb(i32)
|
|||
|
||||
; CHECK: @"dfs$f"
|
||||
define void @f(i32 %x) {
|
||||
; CHECK: %[[LABELVA2:.*]] = alloca [2 x i16]
|
||||
; CHECK: %[[LABELVA1:.*]] = alloca [2 x i16]
|
||||
; CHECK: %[[LABELRETURN:.*]] = alloca i16
|
||||
; CHECK: %[[LABELVA2:.*]] = alloca [2 x i[[#SBITS]]]
|
||||
; CHECK: %[[LABELVA1:.*]] = alloca [2 x i[[#SBITS]]]
|
||||
; CHECK: %[[LABELRETURN:.*]] = alloca i[[#SBITS]]
|
||||
|
||||
; CHECK: call void @__dfsw_custom1(i32 1, i32 2, i16 zeroext 0, i16 zeroext 0)
|
||||
; CHECK: call void @__dfsw_custom1(i32 1, i32 2, i[[#SBITS]] zeroext 0, i[[#SBITS]] zeroext 0)
|
||||
call void @custom1(i32 1, i32 2)
|
||||
|
||||
; CHECK: call i32 @__dfsw_custom2(i32 1, i32 2, i16 zeroext 0, i16 zeroext 0, i16* %[[LABELRETURN]])
|
||||
; CHECK: call i32 @__dfsw_custom2(i32 1, i32 2, i[[#SBITS]] zeroext 0, i[[#SBITS]] zeroext 0, i[[#SBITS]]* %[[LABELRETURN]])
|
||||
call i32 @custom2(i32 1, i32 2)
|
||||
|
||||
; CHECK: call void @__dfsw_customcb({{.*}} @"dfst0$customcb", i8* bitcast ({{.*}} @"dfs$cb" to i8*), i16 zeroext 0)
|
||||
; CHECK: call void @__dfsw_customcb({{.*}} @"dfst0$customcb", i8* bitcast ({{.*}} @"dfs$cb" to i8*), i[[#SBITS]] zeroext 0)
|
||||
call void @customcb(i32 (i32)* @cb)
|
||||
|
||||
; CHECK: %[[LABELVA1_0:.*]] = getelementptr inbounds [2 x i16], [2 x i16]* %[[LABELVA1]], i32 0, i32 0
|
||||
; CHECK: store i16 0, i16* %[[LABELVA1_0]]
|
||||
; CHECK: %[[LABELVA1_1:.*]] = getelementptr inbounds [2 x i16], [2 x i16]* %[[LABELVA1]], i32 0, i32 1
|
||||
; CHECK: store i16 %{{.*}}, i16* %[[LABELVA1_1]]
|
||||
; CHECK: %[[LABELVA1_0A:.*]] = getelementptr inbounds [2 x i16], [2 x i16]* %[[LABELVA1]], i32 0, i32 0
|
||||
; CHECK: call void (i32, i16, i16*, ...) @__dfsw_custom3(i32 1, i16 zeroext 0, i16* %[[LABELVA1_0A]], i32 2, i32 %{{.*}})
|
||||
; CHECK: %[[LABELVA1_0:.*]] = getelementptr inbounds [2 x i[[#SBITS]]], [2 x i[[#SBITS]]]* %[[LABELVA1]], i32 0, i32 0
|
||||
; CHECK: store i[[#SBITS]] 0, i[[#SBITS]]* %[[LABELVA1_0]]
|
||||
; CHECK: %[[LABELVA1_1:.*]] = getelementptr inbounds [2 x i[[#SBITS]]], [2 x i[[#SBITS]]]* %[[LABELVA1]], i32 0, i32 1
|
||||
; CHECK: store i[[#SBITS]] %{{.*}}, i[[#SBITS]]* %[[LABELVA1_1]]
|
||||
; CHECK: %[[LABELVA1_0A:.*]] = getelementptr inbounds [2 x i[[#SBITS]]], [2 x i[[#SBITS]]]* %[[LABELVA1]], i32 0, i32 0
|
||||
; CHECK: call void (i32, i[[#SBITS]], i[[#SBITS]]*, ...) @__dfsw_custom3(i32 1, i[[#SBITS]] zeroext 0, i[[#SBITS]]* %[[LABELVA1_0A]], i32 2, i32 %{{.*}})
|
||||
call void (i32, ...) @custom3(i32 1, i32 2, i32 %x)
|
||||
|
||||
; CHECK: %[[LABELVA2_0:.*]] = getelementptr inbounds [2 x i16], [2 x i16]* %[[LABELVA2]], i32 0, i32 0
|
||||
; CHECK: %[[LABELVA2_0A:.*]] = getelementptr inbounds [2 x i16], [2 x i16]* %[[LABELVA2]], i32 0, i32 0
|
||||
; CHECK: call i32 (i32, i16, i16*, i16*, ...) @__dfsw_custom4(i32 1, i16 zeroext 0, i16* %[[LABELVA2_0A]], i16* %[[LABELRETURN]], i32 2, i32 3)
|
||||
; CHECK: %[[LABELVA2_0:.*]] = getelementptr inbounds [2 x i[[#SBITS]]], [2 x i[[#SBITS]]]* %[[LABELVA2]], i32 0, i32 0
|
||||
; CHECK: %[[LABELVA2_0A:.*]] = getelementptr inbounds [2 x i[[#SBITS]]], [2 x i[[#SBITS]]]* %[[LABELVA2]], i32 0, i32 0
|
||||
; CHECK: call i32 (i32, i[[#SBITS]], i[[#SBITS]]*, i[[#SBITS]]*, ...) @__dfsw_custom4(i32 1, i[[#SBITS]] zeroext 0, i[[#SBITS]]* %[[LABELVA2_0A]], i[[#SBITS]]* %[[LABELRETURN]], i32 2, i32 3)
|
||||
call i32 (i32, ...) @custom4(i32 1, i32 2, i32 3)
|
||||
|
||||
ret void
|
||||
|
@ -78,23 +81,24 @@ define i32 (i32, i32)* @g(i32) {
|
|||
ret i32 (i32, i32)* @custom2
|
||||
}
|
||||
|
||||
; CHECK: define { i32, i16 } @"dfs$adiscard"(i32 %0, i32 %1, i16 %2, i16 %3)
|
||||
; CHECK: define { i32, i[[#SBITS]] } @"dfs$adiscard"(i32 %0, i32 %1, i[[#SBITS]] %2, i[[#SBITS]] %3)
|
||||
; CHECK: %[[CALL:.*]] = call i32 @discard(i32 %0, i32 %1)
|
||||
; CHECK: %[[IVAL0:.*]] = insertvalue { i32, i16 } undef, i32 %[[CALL]], 0
|
||||
; CHECK: %[[IVAL1:.*]] = insertvalue { i32, i16 } %[[IVAL0]], i16 0, 1
|
||||
; CHECK: ret { i32, i16 } %[[IVAL1]]
|
||||
; CHECK: %[[IVAL0:.*]] = insertvalue { i32, i[[#SBITS]] } undef, i32 %[[CALL]], 0
|
||||
; CHECK: %[[IVAL1:.*]] = insertvalue { i32, i[[#SBITS]] } %[[IVAL0]], i[[#SBITS]] 0, 1
|
||||
; CHECK: ret { i32, i[[#SBITS]] } %[[IVAL1]]
|
||||
@adiscard = alias i32 (i32, i32), i32 (i32, i32)* @discard
|
||||
|
||||
; CHECK: declare void @__dfsw_custom1(i32, i32, i16, i16)
|
||||
; CHECK: declare i32 @__dfsw_custom2(i32, i32, i16, i16, i16*)
|
||||
; CHECK: declare void @__dfsw_custom1(i32, i32, i[[#SBITS]], i[[#SBITS]])
|
||||
; CHECK: declare i32 @__dfsw_custom2(i32, i32, i[[#SBITS]], i[[#SBITS]], i[[#SBITS]]*)
|
||||
|
||||
; CHECK-LABEL: define linkonce_odr i32 @"dfst0$customcb"(i32 (i32)* %0, i32 %1, i16 %2, i16* %3)
|
||||
; 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-LABEL: define linkonce_odr i32 @"dfst0$customcb"
|
||||
; CHECK-SAME: (i32 (i32)* %0, i32 %1, i[[#SBITS]] %2, i[[#SBITS]]* %3)
|
||||
; CHECK: %[[BC:.*]] = bitcast i32 (i32)* %0 to { i32, i[[#SBITS]] } (i32, i[[#SBITS]])*
|
||||
; CHECK: %[[CALL:.*]] = call { i32, i[[#SBITS]] } %[[BC]](i32 %1, i[[#SBITS]] %2)
|
||||
; CHECK: %[[XVAL0:.*]] = extractvalue { i32, i[[#SBITS]] } %[[CALL]], 0
|
||||
; CHECK: %[[XVAL1:.*]] = extractvalue { i32, i[[#SBITS]] } %[[CALL]], 1
|
||||
; CHECK: store i[[#SBITS]] %[[XVAL1]], i[[#SBITS]]* %3
|
||||
; CHECK: ret i32 %[[XVAL0]]
|
||||
|
||||
; CHECK: declare void @__dfsw_custom3(i32, i16, i16*, ...)
|
||||
; CHECK: declare i32 @__dfsw_custom4(i32, i16, i16*, i16*, ...)
|
||||
; CHECK: declare void @__dfsw_custom3(i32, i[[#SBITS]], i[[#SBITS]]*, ...)
|
||||
; CHECK: declare i32 @__dfsw_custom4(i32, i[[#SBITS]], i[[#SBITS]]*, i[[#SBITS]]*, ...)
|
||||
|
|
|
@ -2,9 +2,12 @@
|
|||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; CHECK: @__dfsan_shadow_width_bits = weak_odr constant i32 [[#SBITS:]]
|
||||
; CHECK: @__dfsan_shadow_width_bytes = weak_odr constant i32 [[#SBYTES:]]
|
||||
|
||||
; CHECK-LABEL: @"dfs$unreachable_bb1"
|
||||
define i8 @unreachable_bb1() {
|
||||
; CHECK: ret { i8, i16 } { i8 1, i16 0 }
|
||||
; CHECK: ret { i8, i[[#SBITS]] } { i8 1, i[[#SBITS]] 0 }
|
||||
; CHECK-NOT: bb2:
|
||||
; CHECK-NOT: bb3:
|
||||
; CHECK-NOT: bb4:
|
||||
|
|
|
@ -2,14 +2,17 @@
|
|||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; CHECK: @__dfsan_shadow_width_bits = weak_odr constant i32 [[#SBITS:]]
|
||||
; CHECK: @__dfsan_shadow_width_bytes = weak_odr constant i32 [[#SBYTES:]]
|
||||
|
||||
define i8 @add(i8 %a, i8 %b) {
|
||||
; CHECK: @"dfs$add"
|
||||
; CHECK-DAG: %[[ALABEL:.*]] = load [[SHADOWTYPE:i16]], [[SHADOWTYPE]]* bitcast ([[ARGTLSTYPE:\[100 x i64\]]]* @__dfsan_arg_tls to [[SHADOWTYPE]]*), align [[ALIGN:2]]
|
||||
; CHECK-DAG: %[[BLABEL:.*]] = load [[SHADOWTYPE]], [[SHADOWTYPE]]* inttoptr (i64 add (i64 ptrtoint ([[ARGTLSTYPE]]* @__dfsan_arg_tls to i64), i64 2) to [[SHADOWTYPE]]*), align [[ALIGN]]
|
||||
; CHECK: %[[UNION:.*]] = call zeroext [[SHADOWTYPE]] @__dfsan_union([[SHADOWTYPE]] zeroext %[[ALABEL]], [[SHADOWTYPE]] zeroext %[[BLABEL]])
|
||||
; CHECK: %[[ADDLABEL:.*]] = phi [[SHADOWTYPE]] [ %[[UNION]], {{.*}} ], [ %[[ALABEL]], {{.*}} ]
|
||||
; CHECK-DAG: %[[ALABEL:.*]] = load i[[#SBITS]], i[[#SBITS]]* bitcast ([[ARGTLSTYPE:\[100 x i64\]]]* @__dfsan_arg_tls to i[[#SBITS]]*), align [[ALIGN:2]]
|
||||
; CHECK-DAG: %[[BLABEL:.*]] = load i[[#SBITS]], i[[#SBITS]]* inttoptr (i64 add (i64 ptrtoint ([[ARGTLSTYPE]]* @__dfsan_arg_tls to i64), i64 2) to i[[#SBITS]]*), align [[ALIGN]]
|
||||
; CHECK: %[[UNION:.*]] = call zeroext i[[#SBITS]] @__dfsan_union(i[[#SBITS]] zeroext %[[ALABEL]], i[[#SBITS]] zeroext %[[BLABEL]])
|
||||
; CHECK: %[[ADDLABEL:.*]] = phi i[[#SBITS]] [ %[[UNION]], {{.*}} ], [ %[[ALABEL]], {{.*}} ]
|
||||
; CHECK: add i8
|
||||
; CHECK: store [[SHADOWTYPE]] %[[ADDLABEL]], [[SHADOWTYPE]]* bitcast ([100 x i64]* @__dfsan_retval_tls to [[SHADOWTYPE]]*), align [[ALIGN]]
|
||||
; CHECK: store i[[#SBITS]] %[[ADDLABEL]], i[[#SBITS]]* bitcast ([100 x i64]* @__dfsan_retval_tls to i[[#SBITS]]*), align [[ALIGN]]
|
||||
; CHECK: ret i8
|
||||
%c = add i8 %a, %b
|
||||
ret i8 %c
|
||||
|
|
|
@ -2,28 +2,32 @@
|
|||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; CHECK: @__dfsan_shadow_width_bits = weak_odr constant i32 [[#SBITS:]]
|
||||
; CHECK: @__dfsan_shadow_width_bytes = weak_odr constant i32 [[#SBYTES:]]
|
||||
|
||||
define i8 @load8(i8* %p) {
|
||||
; CHECK: call void @__dfsan_load_callback(i16 %{{.*}}, i8* %p)
|
||||
; CHECK: call void @__dfsan_load_callback(i[[#SBITS]] %[[LABEL:.*]], i8* %p)
|
||||
; CHECK: %a = load i8, i8* %p
|
||||
|
||||
; CHECK: store i[[#SBITS]] %[[LABEL]], i[[#SBITS]]* bitcast ({{.*}}* @__dfsan_retval_tls to i[[#SBITS]]*)
|
||||
|
||||
%a = load i8, i8* %p
|
||||
ret i8 %a
|
||||
}
|
||||
|
||||
define void @store8(i8* %p, i8 %a) {
|
||||
; CHECK: store i16 %[[l:.*]], i16* %{{.*}}
|
||||
; CHECK: call void @__dfsan_store_callback(i16 %[[l]], i8* %p)
|
||||
; CHECK: store i[[#SBITS]] %[[LABEL:.*]], i[[#SBITS]]* %{{.*}}
|
||||
; CHECK: call void @__dfsan_store_callback(i[[#SBITS]] %[[LABEL]], i8* %p)
|
||||
; CHECK: store i8 %a, i8* %p
|
||||
|
||||
|
||||
store i8 %a, i8* %p
|
||||
ret void
|
||||
}
|
||||
|
||||
define i1 @cmp(i8 %a, i8 %b) {
|
||||
; CHECK: call void @__dfsan_cmp_callback(i16 %[[l:.*]])
|
||||
; CHECK: call void @__dfsan_cmp_callback(i[[#SBITS]] %[[CMPLABEL:.*]])
|
||||
; CHECK: %c = icmp ne i8 %a, %b
|
||||
; CHECK: store i16 %[[l]], i16* bitcast ({{.*}}* @__dfsan_retval_tls to i16*)
|
||||
|
||||
; CHECK: store i[[#SBITS]] %[[CMPLABEL]], i[[#SBITS]]* bitcast ({{.*}}* @__dfsan_retval_tls to i[[#SBITS]]*)
|
||||
|
||||
%c = icmp ne i8 %a, %b
|
||||
ret i1 %c
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
; RUN: opt < %s -dfsan -dfsan-args-abi -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s
|
||||
; RUN: opt < %s -dfsan -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s
|
||||
|
||||
; CHECK: @__dfsan_shadow_width_bits = weak_odr constant i32 [[#SBITS:]]
|
||||
; CHECK: @__dfsan_shadow_width_bytes = weak_odr constant i32 [[#SBYTES:]]
|
||||
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; Declare a custom varargs function.
|
||||
|
@ -11,12 +14,12 @@ define void @call_custom_varargs(i8* %buf) {
|
|||
;; All arguments have an annotation. Check that the transformed function
|
||||
;; preserves each annotation.
|
||||
|
||||
; CHECK: call zeroext i16 (i64, i16, i16*, i16*, ...)
|
||||
; CHECK: @__dfsw_custom_varargs
|
||||
; CHECK: i64 signext 200
|
||||
; CHECK: i8* nonnull
|
||||
; CHECK: i64 zeroext 20
|
||||
; CHECK: i32 signext 1
|
||||
; CHECK: call zeroext i16 (i64, i[[#SBITS]], i[[#SBITS]]*, i[[#SBITS]]*, ...)
|
||||
; CHECK-SAME: @__dfsw_custom_varargs
|
||||
; CHECK-SAME: i64 signext 200
|
||||
; CHECK-SAME: i8* nonnull
|
||||
; CHECK-SAME: i64 zeroext 20
|
||||
; CHECK-SAME: i32 signext 1
|
||||
%call = call zeroext i16 (i64, ...) @custom_varargs(
|
||||
i64 signext 200,
|
||||
i8* nonnull %buf,
|
||||
|
|
|
@ -2,25 +2,28 @@
|
|||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; CHECK: @__dfsan_shadow_width_bits = weak_odr constant i32 [[#SBITS:]]
|
||||
; CHECK: @__dfsan_shadow_width_bytes = weak_odr constant i32 [[#SBYTES:]]
|
||||
|
||||
declare i32 @g()
|
||||
|
||||
; CHECK: define { i32, i16 } @"dfs$f"(i32 %0, i32 %1, i16 %2, i16 %3)
|
||||
; CHECK: define { i32, i[[#SBITS]] } @"dfs$f"(i32 %0, i32 %1, i[[#SBITS]] %2, i[[#SBITS]] %3)
|
||||
define i32 @f(i32, i32) {
|
||||
; CHECK: [[LOCALLABELALLOCA:%.*]] = alloca i16
|
||||
; CHECK: [[LOCALLABELALLOCA:%.*]] = alloca i[[#SBITS]]
|
||||
%i = alloca i32
|
||||
; CHECK: [[ARGCMP1:%.*]] = icmp ne i16 %3, 0
|
||||
; CHECK: [[ARGCMP1:%.*]] = icmp ne i[[#SBITS]] %3, 0
|
||||
; CHECK: br i1 [[ARGCMP1]]
|
||||
; CHECK: [[ARGCMP2:%.*]] = icmp ne i16 %2, 0
|
||||
; CHECK: [[ARGCMP2:%.*]] = icmp ne i[[#SBITS]] %2, 0
|
||||
; CHECK: br i1 [[ARGCMP2]]
|
||||
%x = add i32 %0, %1
|
||||
store i32 %x, i32* %i
|
||||
; CHECK: [[CALL:%.*]] = call { i32, i16 } @"dfs$g"()
|
||||
; CHECK: [[CALLLABEL:%.*]] = extractvalue { i32, i16 } [[CALL]], 1
|
||||
; CHECK: [[CALLCMP:%.*]] = icmp ne i16 [[CALLLABEL]], 0
|
||||
; CHECK: [[CALL:%.*]] = call { i32, i[[#SBITS]] } @"dfs$g"()
|
||||
; CHECK: [[CALLLABEL:%.*]] = extractvalue { i32, i[[#SBITS]] } [[CALL]], 1
|
||||
; CHECK: [[CALLCMP:%.*]] = icmp ne i[[#SBITS]] [[CALLLABEL]], 0
|
||||
; CHECK: br i1 [[CALLCMP]]
|
||||
%call = call i32 @g()
|
||||
; CHECK: [[LOCALLABEL:%.*]] = load i16, i16* [[LOCALLABELALLOCA]]
|
||||
; CHECK: [[LOCALCMP:%.*]] = icmp ne i16 [[LOCALLABEL]], 0
|
||||
; CHECK: [[LOCALLABEL:%.*]] = load i[[#SBITS]], i[[#SBITS]]* [[LOCALLABELALLOCA]]
|
||||
; CHECK: [[LOCALCMP:%.*]] = icmp ne i[[#SBITS]] [[LOCALLABEL]], 0
|
||||
; CHECK: br i1 [[LOCALCMP]]
|
||||
%load = load i32, i32* %i
|
||||
ret i32 %load
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: opt < %s -dfsan -S | FileCheck %s
|
||||
; RUN: opt < %s -dfsan -S | FileCheck %s --check-prefixes=CHECK,CHECK16
|
||||
; RUN: opt < %s -dfsan -dfsan-fast-16-labels=true -S | FileCheck %s --check-prefixes=CHECK,CHECK16
|
||||
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
|
||||
target triple = "aarch64-unknown-linux-gnu"
|
||||
|
||||
|
@ -7,7 +8,7 @@ define i32 @test(i32 %a, i32* nocapture readonly %b) #0 {
|
|||
; CHECK: %[[RV:.*]] load{{.*}}__dfsan_shadow_ptr_mask
|
||||
; CHECK: ptrtoint i32* {{.*}} to i64
|
||||
; CHECK: and {{.*}}%[[RV:.*]]
|
||||
; CHECK: mul i64
|
||||
; CHECK16: mul i64
|
||||
%1 = load i32, i32* %b, align 4
|
||||
%2 = add nsw i32 %1, %a
|
||||
ret i32 %2
|
||||
|
|
|
@ -2,11 +2,15 @@
|
|||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; CHECK: @__dfsan_shadow_width_bits = weak_odr constant i32 [[#SBITS:]]
|
||||
; CHECK: @__dfsan_shadow_width_bytes = weak_odr constant i32 [[#SBYTES:]]
|
||||
|
||||
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)
|
||||
|
||||
define void @ms(i8* %p, i8 %v) {
|
||||
; CHECK-LABEL: @"dfs$ms"(i8* %0, i8 %1, i16 %2, i16 %3)
|
||||
; CHECK: call void @__dfsan_set_label(i16 %3, i32 0, i8* %0, i64 1)
|
||||
; CHECK-LABEL: @"dfs$ms"
|
||||
; CHECK-SAME: (i8* %0, i8 %1, i[[#SBITS]] %2, i[[#SBITS]] %3)
|
||||
; CHECK: call void @__dfsan_set_label(i[[#SBITS]] %3, i32 0, i8* %0, i64 1)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p, i8 %v, i64 1, i1 1)
|
||||
ret void
|
||||
}
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
; RUN: opt < %s -dfsan -S | FileCheck %s --check-prefix=LEGACY
|
||||
; RUN: opt < %s -dfsan -dfsan-fast-16-labels=true -S | FileCheck %s --check-prefix=FAST16
|
||||
; RUN: opt < %s -dfsan -S | FileCheck %s --check-prefixes=CHECK,LEGACY
|
||||
; RUN: opt < %s -dfsan -dfsan-fast-16-labels=true -S | FileCheck %s --check-prefixes=CHECK,FAST
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
define {i32, i32} @test({i32, i32} %a, i1 %c) {
|
||||
; LEGACY: [[AL:%.*]] = load i16, i16* bitcast ([100 x i64]* @__dfsan_arg_tls to i16*), align [[ALIGN:2]]
|
||||
; LEGACY: [[PL:%.*]] = phi i16 [ [[AL]], %T ], [ [[AL]], %F ]
|
||||
; LEGACY: store i16 [[PL]], i16* bitcast ([100 x i64]* @__dfsan_retval_tls to i16*), align [[ALIGN]]
|
||||
; CHECK: @__dfsan_shadow_width_bits = weak_odr constant i32 [[#SBITS:]]
|
||||
; CHECK: @__dfsan_shadow_width_bytes = weak_odr constant i32 [[#SBYTES:]]
|
||||
|
||||
; FAST16: [[AL:%.*]] = load { i16, i16 }, { i16, i16 }* bitcast ([100 x i64]* @__dfsan_arg_tls to { i16, i16 }*), align [[ALIGN:2]]
|
||||
; FAST16: [[AL0:%.*]] = insertvalue { i16, i16 } [[AL]], i16 0, 0
|
||||
; FAST16: [[AL1:%.*]] = insertvalue { i16, i16 } [[AL]], i16 0, 1
|
||||
; FAST16: [[PL:%.*]] = phi { i16, i16 } [ [[AL0]], %T ], [ [[AL1]], %F ]
|
||||
; FAST16: store { i16, i16 } [[PL]], { i16, i16 }* bitcast ([100 x i64]* @__dfsan_retval_tls to { i16, i16 }*), align [[ALIGN]]
|
||||
define {i32, i32} @test({i32, i32} %a, i1 %c) {
|
||||
; LEGACY: [[AL:%.*]] = load i[[#SBITS]], i[[#SBITS]]* bitcast ([100 x i64]* @__dfsan_arg_tls to i[[#SBITS]]*), align [[ALIGN:2]]
|
||||
; LEGACY: [[PL:%.*]] = phi i[[#SBITS]] [ [[AL]], %T ], [ [[AL]], %F ]
|
||||
; LEGACY: store i[[#SBITS]] [[PL]], i[[#SBITS]]* bitcast ([100 x i64]* @__dfsan_retval_tls to i[[#SBITS]]*), align [[ALIGN]]
|
||||
|
||||
; FAST: [[AL:%.*]] = load { [[ST:i[0-9]+]], i[[#SBITS]] }, { i[[#SBITS]], i[[#SBITS]] }* bitcast ([100 x i64]* @__dfsan_arg_tls to { i[[#SBITS]], i[[#SBITS]] }*), align [[ALIGN:2]]
|
||||
; FAST: [[AL0:%.*]] = insertvalue { i[[#SBITS]], i[[#SBITS]] } [[AL]], i[[#SBITS]] 0, 0
|
||||
; FAST: [[AL1:%.*]] = insertvalue { i[[#SBITS]], i[[#SBITS]] } [[AL]], i[[#SBITS]] 0, 1
|
||||
; FAST: [[PL:%.*]] = phi { i[[#SBITS]], i[[#SBITS]] } [ [[AL0]], %T ], [ [[AL1]], %F ]
|
||||
; FAST: store { i[[#SBITS]], i[[#SBITS]] } [[PL]], { i[[#SBITS]], i[[#SBITS]] }* bitcast ([100 x i64]* @__dfsan_retval_tls to { i[[#SBITS]], i[[#SBITS]] }*), align [[ALIGN]]
|
||||
|
||||
entry:
|
||||
br i1 %c, label %T, label %F
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
; RUN: opt < %s -dfsan -dfsan-args-abi -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s
|
||||
; RUN: opt < %s -dfsan -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s
|
||||
; RUN: opt < %s -dfsan -dfsan-args-abi -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s --check-prefixes=CHECK,ARGS_ABI
|
||||
; RUN: opt < %s -dfsan -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s --check-prefixes=CHECK,TLS_ABI
|
||||
|
||||
; CHECK: @__dfsan_shadow_width_bits = weak_odr constant i32 [[#SBITS:]]
|
||||
; CHECK: @__dfsan_shadow_width_bytes = weak_odr constant i32 [[#SBYTES:]]
|
||||
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
|
@ -11,7 +14,8 @@ define i8 @call_uninstrumented_internal_fun(i8 %in) {
|
|||
%call = call i8 @uninstrumented_internal_fun(i8 %in)
|
||||
ret i8 %call
|
||||
}
|
||||
; CHECK: define internal {{(i8|{ i8, i16 })}} @"dfsw$uninstrumented_internal_fun"
|
||||
; TLS_ABI: define internal i8 @"dfsw$uninstrumented_internal_fun"
|
||||
; ARGS_ABI: define internal { i8, i[[#SBITS]] } @"dfsw$uninstrumented_internal_fun"
|
||||
|
||||
define private i8 @uninstrumented_private_fun(i8 %in) {
|
||||
ret i8 %in
|
||||
|
@ -21,4 +25,5 @@ define i8 @call_uninstrumented_private_fun(i8 %in) {
|
|||
%call = call i8 @uninstrumented_private_fun(i8 %in)
|
||||
ret i8 %call
|
||||
}
|
||||
; CHECK: define private {{(i8|{ i8, i16 })}} @"dfsw$uninstrumented_private_fun"
|
||||
; TLS_ABI: define private i8 @"dfsw$uninstrumented_private_fun"
|
||||
; ARGS_ABI: define private { i8, i[[#SBITS]] } @"dfsw$uninstrumented_private_fun"
|
||||
|
|
Loading…
Reference in New Issue