1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[sancov] Disable sanitizer coverage on functions using SEH

Splitting basic blocks really messes up WinEHPrepare. We can remove this
change when SEH uses the new EH IR.

llvm-svn: 246799
This commit is contained in:
Reid Kleckner 2015-09-03 20:18:29 +00:00
parent 905326fdb1
commit 00ea251f01
2 changed files with 11 additions and 6 deletions

View File

@ -31,6 +31,7 @@
#include "llvm/Transforms/Instrumentation.h" #include "llvm/Transforms/Instrumentation.h"
#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/LibCallSemantics.h"
#include "llvm/IR/CallSite.h" #include "llvm/IR/CallSite.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfo.h" #include "llvm/IR/DebugInfo.h"
@ -290,6 +291,12 @@ bool SanitizerCoverageModule::runOnFunction(Function &F) {
if (F.empty()) return false; if (F.empty()) return false;
if (F.getName().find(".module_ctor") != std::string::npos) if (F.getName().find(".module_ctor") != std::string::npos)
return false; // Should not instrument sanitizer init functions. return false; // Should not instrument sanitizer init functions.
// Don't instrument functions using SEH for now. Splitting basic blocks like
// we do for coverage breaks WinEHPrepare.
// FIXME: Remove this when SEH no longer uses landingpad pattern matching.
if (F.hasPersonalityFn() &&
isAsynchronousEHPersonality(classifyEHPersonality(F.getPersonalityFn())))
return false;
if (Options.CoverageType >= SanitizerCoverageOptions::SCK_Edge) if (Options.CoverageType >= SanitizerCoverageOptions::SCK_Edge)
SplitAllCriticalEdges(F); SplitAllCriticalEdges(F);
SmallVector<Instruction*, 8> IndirCalls; SmallVector<Instruction*, 8> IndirCalls;

View File

@ -45,14 +45,12 @@ eh.resume: ; preds = %lpad
resume { i8*, i32 } %1 resume { i8*, i32 } %1
} }
; Check that the alloca remains static and the localescape call remains in the ; Check that we don't do any instrumentation.
; entry block.
; CHECK-LABEL: define i32 @main() ; CHECK-LABEL: define i32 @main()
; CHECK-NOT: br {{.*}}label ; CHECK-NOT: load atomic i32, i32* {{.*}} monotonic, align 4, !nosanitize
; CHECK: %__exception_code = alloca i32, align 4 ; CHECK-NOT: call void @__sanitizer_cov
; CHECK-NOT: br {{.*}}label ; CHECK: ret i32
; CHECK: call void (...) @llvm.localescape(i32* nonnull %__exception_code)
; Function Attrs: nounwind ; Function Attrs: nounwind
define internal i32 @"\01?filt$0@0@main@@"() #1 { define internal i32 @"\01?filt$0@0@main@@"() #1 {