llvm.org GIT mirror llvm / 9daf569
[DFSan] Remove an overly aggressive assert reported in PR26068. This code has been successfully used to bootstrap libc++ in a no-asserts mode for a very long time, so the code that follows cannot be completely incorrect. I've added a test that shows the current behavior for this kind of code with DFSan. If it is desirable for DFSan to do something special when processing an invoke of a variadic function, it can be added, but we shouldn't keep an assert that we've been ignoring due to release builds anyways. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262829 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 4 years ago
2 changed file(s) with 40 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
14111411 if (F == DFSF.DFS.DFSanVarargWrapperFn)
14121412 return;
14131413
1414 assert(!(cast(
1415 CS.getCalledValue()->getType()->getPointerElementType())->isVarArg() &&
1416 dyn_cast(CS.getInstruction())));
1417
14181414 IRBuilder<> IRB(CS.getInstruction());
14191415
14201416 DenseMap::iterator i =
11 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"
22 target triple = "x86_64-unknown-linux-gnu"
33
4 ; CHECK: @__dfsan_arg_tls = external thread_local(initialexec) global [64 x i16]
5 ; CHECK: @__dfsan_retval_tls = external thread_local(initialexec) global i16
4 ; CHECK-LABEL: @__dfsan_arg_tls
5 ; CHECK: = external thread_local(initialexec) global [64 x i16]
6
7 ; CHECK-LABEL: @__dfsan_retval_tls
8 ; CHECK: = external thread_local(initialexec) global i16
69
710 declare i32 @f(i32)
811 declare float @llvm.sqrt.f32(float)
912
10 ; CHECK: @"dfs$call"
13 ; CHECK-LABEL: @"dfs$call"
1114 define i32 @call() {
1215 ; CHECK: store{{.*}}__dfsan_arg_tls
1316 ; CHECK: call{{.*}}@"dfs$f"
2124 ; CHECK: ret i32
2225 ret i32 %r
2326 }
27
28 declare i32 @__gxx_personality_v0(...)
29
30 declare i8* @__cxa_begin_catch(i8*)
31
32 declare void @__cxa_end_catch()
33
34 declare void @g(...)
35
36 ; CHECK-LABEL: @"dfs$h"
37 ; CHECK: personality {{.*}} @"dfs$__gxx_personality_v0" {{.*}} {
38 define i32 @h() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
39 entry:
40 ; CHECK: invoke void (...) @"dfs$g"(i32 42)
41 invoke void (...) @g(i32 42)
42 to label %try.cont unwind label %lpad
43
44 lpad:
45 %0 = landingpad { i8*, i32 }
46 catch i8* null
47 %1 = extractvalue { i8*, i32 } %0, 0
48
49 ; CHECK: store {{.*}} @__dfsan_arg_tls
50 ; CHECK: call {{.*}} @"dfs$__cxa_begin_catch"
51 ; CHECK: load {{.*}} @__dfsan_retval_tls
52 %2 = tail call i8* @__cxa_begin_catch(i8* %1)
53
54 ; CHECK: call {{.*}} @"dfs$__cxa_end_catch"
55 tail call void @__cxa_end_catch()
56 br label %try.cont
57
58 try.cont:
59 ret i32 0
60 }