r374503 - Revert 374481 "[tsan, msan] Insert module constructors in a module pass"

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 19:44:20 PDT 2019


Author: nico
Date: Thu Oct 10 19:44:20 2019
New Revision: 374503

URL: http://llvm.org/viewvc/llvm-project?rev=374503&view=rev
Log:
Revert 374481 "[tsan,msan] Insert module constructors in a module pass"

CodeGen/sanitizer-module-constructor.c fails on mac and windows, see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/11424

Removed:
    cfe/trunk/test/CodeGen/sanitizer-module-constructor.c
Modified:
    cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=374503&r1=374502&r2=374503&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Oct 10 19:44:20 2019
@@ -974,7 +974,6 @@ static void addSanitizersAtO0(ModulePass
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-    MPM.addPass(MemorySanitizerPass({}));
     MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({})));
   }
 
@@ -984,7 +983,6 @@ static void addSanitizersAtO0(ModulePass
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
-    MPM.addPass(ThreadSanitizerPass());
     MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
   }
 }
@@ -1164,23 +1162,16 @@ void EmitAssemblyHelper::EmitAssemblyWit
             [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
               FPM.addPass(BoundsCheckingPass());
             });
-      if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-        PB.registerPipelineStartEPCallback([](ModulePassManager &MPM) {
-          MPM.addPass(MemorySanitizerPass({}));
-        });
+      if (LangOpts.Sanitize.has(SanitizerKind::Memory))
         PB.registerOptimizerLastEPCallback(
             [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
               FPM.addPass(MemorySanitizerPass({}));
             });
-      }
-      if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
-        PB.registerPipelineStartEPCallback(
-            [](ModulePassManager &MPM) { MPM.addPass(ThreadSanitizerPass()); });
+      if (LangOpts.Sanitize.has(SanitizerKind::Thread))
         PB.registerOptimizerLastEPCallback(
             [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
               FPM.addPass(ThreadSanitizerPass());
             });
-      }
       if (LangOpts.Sanitize.has(SanitizerKind::Address)) {
         PB.registerPipelineStartEPCallback([&](ModulePassManager &MPM) {
           MPM.addPass(

Removed: cfe/trunk/test/CodeGen/sanitizer-module-constructor.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sanitizer-module-constructor.c?rev=374502&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/sanitizer-module-constructor.c (original)
+++ cfe/trunk/test/CodeGen/sanitizer-module-constructor.c (removed)
@@ -1,22 +0,0 @@
-// RUN: %clang_cc1 -fsanitize=address -emit-llvm -O3 -fdebug-pass-manager -fexperimental-new-pass-manager -o - %s 2>&1 | FileCheck %s
-// RUN: %clang_cc1 -fsanitize=thread -emit-llvm -O3 -fdebug-pass-manager -fexperimental-new-pass-manager -o - %s 2>&1 | FileCheck %s
-// RUN: %clang_cc1 -fsanitize=memory -emit-llvm -O3 -fdebug-pass-manager -fexperimental-new-pass-manager -o - %s 2>&1 | FileCheck %s
-
-// This is regression test for PR42877
-
-typedef struct a *b;
-struct a {
-  int c;
-};
-int d;
-b e;
-static void f(b g) {
-  for (d = g->c;;)
-    ;
-}
-void h() { f(e); }
-
-// CHECK: Running pass: {{.*}}SanitizerPass on {{.*}}sanitizer-module-constructor.c
-// CHECK-NOT: Running pass: LoopSimplifyPass on {{.*}}san.module_ctor
-// CHECK: Running analysis: DominatorTreeAnalysis on {{.*}}san.module_ctor
-// CHECK: Running pass: LoopSimplifyPass on {{.*}}san.module_ctor




More information about the cfe-commits mailing list