[llvm] c37bb5e - [DFSan] Remove unused DataFlowSanitizer vars
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 27 14:59:50 PDT 2020
Author: Arthur Eubanks
Date: 2020-07-27T14:59:07-07:00
New Revision: c37bb5e2a541df867d371278f6ddfaf85c299771
URL: https://github.com/llvm/llvm-project/commit/c37bb5e2a541df867d371278f6ddfaf85c299771
DIFF: https://github.com/llvm/llvm-project/commit/c37bb5e2a541df867d371278f6ddfaf85c299771.diff
LOG: [DFSan] Remove unused DataFlowSanitizer vars
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D84704
Added:
Modified:
llvm/include/llvm/Transforms/Instrumentation.h
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Instrumentation.h b/llvm/include/llvm/Transforms/Instrumentation.h
index d4373d7b39ea..f2e084041dd6 100644
--- a/llvm/include/llvm/Transforms/Instrumentation.h
+++ b/llvm/include/llvm/Transforms/Instrumentation.h
@@ -144,8 +144,7 @@ ModulePass *createInstrOrderFilePass();
// Insert DataFlowSanitizer (dynamic data flow analysis) instrumentation
ModulePass *createDataFlowSanitizerPass(
- const std::vector<std::string> &ABIListFiles = std::vector<std::string>(),
- void *(*getArgTLS)() = nullptr, void *(*getRetValTLS)() = nullptr);
+ const std::vector<std::string> &ABIListFiles = std::vector<std::string>());
// Options for sanitizer coverage instrumentation.
struct SanitizerCoverageOptions {
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index 284631900731..a5a785cb55f7 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -344,8 +344,6 @@ class DataFlowSanitizer : public ModulePass {
ConstantInt *ShadowPtrMul;
Constant *ArgTLS;
Constant *RetvalTLS;
- void *(*GetArgTLSPtr)();
- void *(*GetRetvalTLSPtr)();
FunctionType *GetArgTLSTy;
FunctionType *GetRetvalTLSTy;
Constant *GetArgTLS;
@@ -395,9 +393,8 @@ class DataFlowSanitizer : public ModulePass {
public:
static char ID;
- DataFlowSanitizer(
- const std::vector<std::string> &ABIListFiles = std::vector<std::string>(),
- void *(*getArgTLS)() = nullptr, void *(*getRetValTLS)() = nullptr);
+ DataFlowSanitizer(const std::vector<std::string> &ABIListFiles =
+ std::vector<std::string>());
bool doInitialization(Module &M) override;
bool runOnModule(Module &M) override;
@@ -490,17 +487,14 @@ char DataFlowSanitizer::ID;
INITIALIZE_PASS(DataFlowSanitizer, "dfsan",
"DataFlowSanitizer: dynamic data flow analysis.", false, false)
-ModulePass *
-llvm::createDataFlowSanitizerPass(const std::vector<std::string> &ABIListFiles,
- void *(*getArgTLS)(),
- void *(*getRetValTLS)()) {
- return new DataFlowSanitizer(ABIListFiles, getArgTLS, getRetValTLS);
+ModulePass *llvm::createDataFlowSanitizerPass(
+ const std::vector<std::string> &ABIListFiles) {
+ return new DataFlowSanitizer(ABIListFiles);
}
DataFlowSanitizer::DataFlowSanitizer(
- const std::vector<std::string> &ABIListFiles, void *(*getArgTLS)(),
- void *(*getRetValTLS)())
- : ModulePass(ID), GetArgTLSPtr(getArgTLS), GetRetvalTLSPtr(getRetValTLS) {
+ const std::vector<std::string> &ABIListFiles)
+ : ModulePass(ID) {
std::vector<std::string> AllABIListFiles(std::move(ABIListFiles));
AllABIListFiles.insert(AllABIListFiles.end(), ClABIListFiles.begin(),
ClABIListFiles.end());
@@ -613,22 +607,6 @@ bool DataFlowSanitizer::doInitialization(Module &M) {
FunctionType::get(Type::getVoidTy(*Ctx), DFSanMemTransferCallbackArgs,
/*isVarArg=*/false);
- if (GetArgTLSPtr) {
- Type *ArgTLSTy = ArrayType::get(ShadowTy, 64);
- ArgTLS = nullptr;
- GetArgTLSTy = FunctionType::get(PointerType::getUnqual(ArgTLSTy), false);
- GetArgTLS = ConstantExpr::getIntToPtr(
- ConstantInt::get(IntptrTy, uintptr_t(GetArgTLSPtr)),
- PointerType::getUnqual(GetArgTLSTy));
- }
- if (GetRetvalTLSPtr) {
- RetvalTLS = nullptr;
- GetRetvalTLSTy = FunctionType::get(PointerType::getUnqual(ShadowTy), false);
- GetRetvalTLS = ConstantExpr::getIntToPtr(
- ConstantInt::get(IntptrTy, uintptr_t(GetRetvalTLSPtr)),
- PointerType::getUnqual(GetRetvalTLSTy));
- }
-
ColdCallWeights = MDBuilder(*Ctx).createBranchWeights(1, 1000);
return true;
}
@@ -816,20 +794,16 @@ bool DataFlowSanitizer::runOnModule(Module &M) {
bool Changed = false;
- if (!GetArgTLSPtr) {
- Type *ArgTLSTy = ArrayType::get(ShadowTy, 64);
- ArgTLS = Mod->getOrInsertGlobal("__dfsan_arg_tls", ArgTLSTy);
- if (GlobalVariable *G = dyn_cast<GlobalVariable>(ArgTLS)) {
- Changed |= G->getThreadLocalMode() != GlobalVariable::InitialExecTLSModel;
- G->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
- }
+ Type *ArgTLSTy = ArrayType::get(ShadowTy, 64);
+ ArgTLS = Mod->getOrInsertGlobal("__dfsan_arg_tls", ArgTLSTy);
+ if (GlobalVariable *G = dyn_cast<GlobalVariable>(ArgTLS)) {
+ Changed |= G->getThreadLocalMode() != GlobalVariable::InitialExecTLSModel;
+ G->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
}
- if (!GetRetvalTLSPtr) {
- RetvalTLS = Mod->getOrInsertGlobal("__dfsan_retval_tls", ShadowTy);
- if (GlobalVariable *G = dyn_cast<GlobalVariable>(RetvalTLS)) {
- Changed |= G->getThreadLocalMode() != GlobalVariable::InitialExecTLSModel;
- G->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
- }
+ RetvalTLS = Mod->getOrInsertGlobal("__dfsan_retval_tls", ShadowTy);
+ if (GlobalVariable *G = dyn_cast<GlobalVariable>(RetvalTLS)) {
+ Changed |= G->getThreadLocalMode() != GlobalVariable::InitialExecTLSModel;
+ G->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
}
ExternalShadowMask =
More information about the llvm-commits
mailing list