[llvm] r262829 - [DFSan] Remove an overly aggressive assert reported in PR26068.
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 06:05:09 PST 2016
Author: chandlerc
Date: Mon Mar 7 08:05:09 2016
New Revision: 262829
URL: http://llvm.org/viewvc/llvm-project?rev=262829&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
llvm/trunk/test/Instrumentation/DataFlowSanitizer/call.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp?rev=262829&r1=262828&r2=262829&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Mon Mar 7 08:05:09 2016
@@ -1412,10 +1412,6 @@ void DFSanVisitor::visitCallSite(CallSit
if (F == DFSF.DFS.DFSanVarargWrapperFn)
return;
- assert(!(cast<FunctionType>(
- CS.getCalledValue()->getType()->getPointerElementType())->isVarArg() &&
- dyn_cast<InvokeInst>(CS.getInstruction())));
-
IRBuilder<> IRB(CS.getInstruction());
DenseMap<Value *, Function *>::iterator i =
Modified: llvm/trunk/test/Instrumentation/DataFlowSanitizer/call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/DataFlowSanitizer/call.ll?rev=262829&r1=262828&r2=262829&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/DataFlowSanitizer/call.ll (original)
+++ llvm/trunk/test/Instrumentation/DataFlowSanitizer/call.ll Mon Mar 7 08:05:09 2016
@@ -2,13 +2,16 @@
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_arg_tls = external thread_local(initialexec) global [64 x i16]
-; CHECK: @__dfsan_retval_tls = external thread_local(initialexec) global i16
+; CHECK-LABEL: @__dfsan_arg_tls
+; CHECK: = external thread_local(initialexec) global [64 x i16]
+
+; CHECK-LABEL: @__dfsan_retval_tls
+; CHECK: = external thread_local(initialexec) global i16
declare i32 @f(i32)
declare float @llvm.sqrt.f32(float)
-; CHECK: @"dfs$call"
+; CHECK-LABEL: @"dfs$call"
define i32 @call() {
; CHECK: store{{.*}}__dfsan_arg_tls
; CHECK: call{{.*}}@"dfs$f"
@@ -22,3 +25,37 @@ define i32 @call() {
; CHECK: ret i32
ret i32 %r
}
+
+declare i32 @__gxx_personality_v0(...)
+
+declare i8* @__cxa_begin_catch(i8*)
+
+declare void @__cxa_end_catch()
+
+declare void @g(...)
+
+; CHECK-LABEL: @"dfs$h"
+; CHECK: personality {{.*}} @"dfs$__gxx_personality_v0" {{.*}} {
+define i32 @h() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
+entry:
+; CHECK: invoke void (...) @"dfs$g"(i32 42)
+ invoke void (...) @g(i32 42)
+ to label %try.cont unwind label %lpad
+
+lpad:
+ %0 = landingpad { i8*, i32 }
+ catch i8* null
+ %1 = extractvalue { i8*, i32 } %0, 0
+
+ ; CHECK: store {{.*}} @__dfsan_arg_tls
+ ; CHECK: call {{.*}} @"dfs$__cxa_begin_catch"
+ ; CHECK: load {{.*}} @__dfsan_retval_tls
+ %2 = tail call i8* @__cxa_begin_catch(i8* %1)
+
+ ; CHECK: call {{.*}} @"dfs$__cxa_end_catch"
+ tail call void @__cxa_end_catch()
+ br label %try.cont
+
+try.cont:
+ ret i32 0
+}
More information about the llvm-commits
mailing list