[PATCH] D79895: Add a new warning to warn when passing uninitialized variables as const reference parameters to a function

2020-05-21 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks accepted this revision.
aeubanks added a comment.
This revision is now accepted and ready to land.

One last nit, otherwise lgtm. But I'm not super familiar with this area, it'd 
be good to get another review from somebody more familiar.




Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:1590-1600
+// flush all const reference uses diags
+for (const auto &P : constRefUses) {
+  const VarDecl *vd = P.first;
+  const MappedType &V = P.second;
+
+  UsesVec *vec = V.getPointer();
+  for (const auto &U : *vec) {

zequanwu wrote:
> rsmith wrote:
> > Do we want any idiomatic-self-init special-case handling here? For example:
> > 
> > ```
> > void f(const int&);
> > void g() {
> >   int a = a;
> >   f(a);
> > }
> > ```
> > 
> > Following the logic above, should that warn on the `int a = a;` not on the 
> > `f(a)` call? Or should we warn only on the `f(a)` call itself in this case? 
> > It seems like it might be surprising to say that `a` is "uninitialized" 
> > here, since an initializer was provided, even though it was a garbage one.
> For this case, I think we should warn at `int a = a`, like the comment in 
> `DiagnoseUninitializedUse` said, 
> https://github.com/llvm/llvm-project/blob/master/clang/lib/Sema/AnalysisBasedWarnings.cpp#L986-L996
> 
> `f(a)` is considered as accessing `a`.
Doesn't `DiagnoseUninitializedUse` say that we shouldn't warn at `int a = a`?



Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:1523
 
-  MappedType &getUses(const VarDecl *vd) {
+  MappedType &getUses(UsesMap &uses, const VarDecl *vd) {
 MappedType &V = uses[vd];

this is very confusing since it shadows the `uses` member variable from 
UninitValsDiagReporter


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79895/new/

https://reviews.llvm.org/D79895



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80692: Run Coverage pass before other *San passes under new pass manager, round 2

2020-05-27 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya.
Herald added projects: clang, LLVM.
aeubanks added reviewers: vitalybuka, leonardchan.

This was attempted once before in https://reviews.llvm.org/D79698, but
was reverted due to the coverage pass running in the wrong part of the
pipeline. This commit puts it in the same place as the other sanitizers.

This changes PassBuilder.OptimizerLastEPCallbacks to work on a
ModulePassManager instead of a FunctionPassManager. That is because
SanitizerCoverage cannot (easily) be split into a module pass and a
function pass like some of the other sanitizers since in its current
implementation it conditionally inserts module constructors based on
whether or not it successfully modified functions.

This fixes compiler-rt/test/msan/coverage-levels.cpp under the new pass
manager (last check-msan test).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80692

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -194,7 +194,7 @@
 });
   if (tryParsePipelineText(PB, OptimizerLastEPPipeline))
 PB.registerOptimizerLastEPCallback(
-[&PB, VerifyEachPass, DebugLogging](FunctionPassManager &PM,
+[&PB, VerifyEachPass, DebugLogging](ModulePassManager &PM,
 PassBuilder::OptimizationLevel) {
   ExitOnError Err("Unable to parse OptimizerLastEP pipeline: ");
   Err(PB.parsePassPipeline(PM, OptimizerLastEPPipeline, VerifyEachPass,
Index: llvm/lib/Passes/PassBuilder.cpp
===
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -1072,12 +1072,12 @@
   if (PTO.Coroutines)
 OptimizePM.addPass(CoroCleanupPass());
 
-  for (auto &C : OptimizerLastEPCallbacks)
-C(OptimizePM, Level);
-
   // Add the core optimizing pipeline.
   MPM.addPass(createModuleToFunctionPassAdaptor(std::move(OptimizePM)));
 
+  for (auto &C : OptimizerLastEPCallbacks)
+C(MPM, Level);
+
   if (PTO.CallGraphProfile)
 MPM.addPass(CGProfilePass());
 
Index: llvm/include/llvm/Passes/PassBuilder.h
===
--- llvm/include/llvm/Passes/PassBuilder.h
+++ llvm/include/llvm/Passes/PassBuilder.h
@@ -600,7 +600,7 @@
   /// is not triggered at O0. Extensions to the O0 pipeline should append their
   /// passes to the end of the overall pipeline.
   void registerOptimizerLastEPCallback(
-  const std::function &C) {
+  const std::function &C) {
 OptimizerLastEPCallbacks.push_back(C);
   }
 
@@ -728,7 +728,7 @@
   CGSCCOptimizerLateEPCallbacks;
   SmallVector, 2>
   VectorizerStartEPCallbacks;
-  SmallVector, 2>
+  SmallVector, 2>
   OptimizerLastEPCallbacks;
   // Module callbacks
   SmallVector, 2>
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -32,6 +32,7 @@
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/ModuleSummaryIndex.h"
+#include "llvm/IR/PassManager.h"
 #include "llvm/IR/Verifier.h"
 #include "llvm/LTO/LTOBackend.h"
 #include "llvm/MC/MCAsmInfo.h"
@@ -1001,6 +1002,15 @@
   const Triple &TargetTriple,
   const LangOptions &LangOpts,
   const CodeGenOptions &CodeGenOpts) {
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+MPM.addPass(ModuleSanitizerCoveragePass(
+SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+CodeGenOpts.SanitizeCoverageBlacklistFiles));
+  }
+
   auto ASanPass = [&](SanitizerMask Mask, bool CompileKernel) {
 MPM.addPass(RequireAnalysisPass());
 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
@@ -1249,6 +1259,20 @@
 [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
   FPM.addPass(BoundsCheckingPass());
 });
+
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+PB.registerOptimizerLastEPCallback(
+[this](ModulePassManager &MPM,
+   PassBuilder::OptimizationLevel Level) {
+  auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+  MPM.addPass(ModuleSanitizerCoveragePass(
+  SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,

[PATCH] D80692: Run Coverage pass before other *San passes under new pass manager, round 2

2020-05-28 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks marked 2 inline comments as done.
aeubanks added inline comments.



Comment at: llvm/include/llvm/Passes/PassBuilder.h:597-598
   ///
   /// This extension point allows adding optimizations at the very end of the
   /// function optimization pipeline. A key difference between this and the
   /// legacy PassManager's OptimizerLast callback is that this extension point

leonardchan wrote:
> Will need to change the wording on this if this doesn't handle function 
> passes anymore.
This doesn't say that `registerOptimizerLastEPCallback()` handles function 
passes, it says it handles passes that will run right after all the default 
function optimization passes. I believe that's still true. The passes were 
previously added at the end of `OptimizePM`, now they're added right after 
`OptimizePM`, which is the same thing.



Comment at: llvm/lib/Passes/PassBuilder.cpp:1078
 
+  for (auto &C : OptimizerLastEPCallbacks)
+C(MPM, Level);

leonardchan wrote:
> Would it be better to add another `SmallVector` and `register*Calback()` for 
> modules in in `PassBuilder` that we could loop through here instead of 
> changing how these extension points work?
> 
> I imagine it would still be meaningful in the future to be able to add 
> function passes at the end of the function optimization pipeline.
You can still add function passes via `createModuleToFunctionPassAdaptor()`, 
which is what I've done here for the existing usages. Given that the number of 
calls to `registerOptimizerLastEPCallback()` is small, I don't see a huge 
benefit to create a both a vector of module passes and function passes that run 
at the same place. If in the future we end up calling 
`registerOptimizerLastEPCallback()` with lots of function passes we can revisit 
this but for now it seems unnecessary.

This change doesn't change the ordering of any passes aside from sanitizer 
coverage (I believe), all usages of `registerOptimizerLastEPCallback()` will 
still end up putting the passes in the same place in the pipeline.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80692/new/

https://reviews.llvm.org/D80692



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80692: Run Coverage pass before other *San passes under new pass manager, round 2

2020-05-28 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D80692#2061219 , @leonardchan wrote:

> Would be worthwhile to write a small test that asserts Sancov runs before the 
> other sanitizers under the new PM?
>
> Aside from this, LGTM.


Asserting that sancov runs before other sanitizers seems like overspecification 
to me. Really all we want to know is that something like msan + sancov work 
together, and there are tests for that which we are fixing with this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80692/new/

https://reviews.llvm.org/D80692



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80692: Run Coverage pass before other *San passes under new pass manager, round 2

2020-05-28 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG922fa2fce38b: Run Coverage pass before other *San passes 
under new pass manager, round 2 (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80692/new/

https://reviews.llvm.org/D80692

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -194,7 +194,7 @@
 });
   if (tryParsePipelineText(PB, OptimizerLastEPPipeline))
 PB.registerOptimizerLastEPCallback(
-[&PB, VerifyEachPass, DebugLogging](FunctionPassManager &PM,
+[&PB, VerifyEachPass, DebugLogging](ModulePassManager &PM,
 PassBuilder::OptimizationLevel) {
   ExitOnError Err("Unable to parse OptimizerLastEP pipeline: ");
   Err(PB.parsePassPipeline(PM, OptimizerLastEPPipeline, VerifyEachPass,
Index: llvm/lib/Passes/PassBuilder.cpp
===
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -1073,12 +1073,12 @@
   if (PTO.Coroutines)
 OptimizePM.addPass(CoroCleanupPass());
 
-  for (auto &C : OptimizerLastEPCallbacks)
-C(OptimizePM, Level);
-
   // Add the core optimizing pipeline.
   MPM.addPass(createModuleToFunctionPassAdaptor(std::move(OptimizePM)));
 
+  for (auto &C : OptimizerLastEPCallbacks)
+C(MPM, Level);
+
   if (PTO.CallGraphProfile)
 MPM.addPass(CGProfilePass());
 
Index: llvm/include/llvm/Passes/PassBuilder.h
===
--- llvm/include/llvm/Passes/PassBuilder.h
+++ llvm/include/llvm/Passes/PassBuilder.h
@@ -600,7 +600,7 @@
   /// is not triggered at O0. Extensions to the O0 pipeline should append their
   /// passes to the end of the overall pipeline.
   void registerOptimizerLastEPCallback(
-  const std::function &C) {
+  const std::function &C) {
 OptimizerLastEPCallbacks.push_back(C);
   }
 
@@ -728,7 +728,7 @@
   CGSCCOptimizerLateEPCallbacks;
   SmallVector, 2>
   VectorizerStartEPCallbacks;
-  SmallVector, 2>
+  SmallVector, 2>
   OptimizerLastEPCallbacks;
   // Module callbacks
   SmallVector, 2>
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -32,6 +32,7 @@
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/ModuleSummaryIndex.h"
+#include "llvm/IR/PassManager.h"
 #include "llvm/IR/Verifier.h"
 #include "llvm/LTO/LTOBackend.h"
 #include "llvm/MC/MCAsmInfo.h"
@@ -1001,6 +1002,15 @@
   const Triple &TargetTriple,
   const LangOptions &LangOpts,
   const CodeGenOptions &CodeGenOpts) {
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+MPM.addPass(ModuleSanitizerCoveragePass(
+SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+CodeGenOpts.SanitizeCoverageBlacklistFiles));
+  }
+
   auto ASanPass = [&](SanitizerMask Mask, bool CompileKernel) {
 MPM.addPass(RequireAnalysisPass());
 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
@@ -1249,6 +1259,20 @@
 [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
   FPM.addPass(BoundsCheckingPass());
 });
+
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+PB.registerOptimizerLastEPCallback(
+[this](ModulePassManager &MPM,
+   PassBuilder::OptimizationLevel Level) {
+  auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+  MPM.addPass(ModuleSanitizerCoveragePass(
+  SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+  CodeGenOpts.SanitizeCoverageBlacklistFiles));
+});
+  }
+
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
 int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
 bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
@@ -1257,17 +1281,19 @@
   MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
 });
 PB.registerOptimizerLastEPCallback(
-[TrackOrigins, Recover](FunctionPassManager &FPM,
+[TrackOrigins, Recover](ModulePassManager &MPM,
 

[PATCH] D80692: Run Coverage pass before other *San passes under new pass manager, round 2

2020-05-28 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 267073.
aeubanks added a comment.

I foolishly submitted without running check-all, and it turns out this broke a 
test under check-clang.
Looks like https://reviews.llvm.org/D62888 added tests in sancov-new-pm.c to 
make sure that sancov + LTO work together, but they won't after this change 
since the (Thin)LTO pipeline doesn't run things under 
`registerOptimizerLastEPCallback()`. So I deleted those tests. Other sanitizers 
don't work under LTO right now (at least for non-O0) because of the same thing. 
Does this make sense?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80692/new/

https://reviews.llvm.org/D80692

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/test/CodeGen/sancov-new-pm.c
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -194,7 +194,7 @@
 });
   if (tryParsePipelineText(PB, OptimizerLastEPPipeline))
 PB.registerOptimizerLastEPCallback(
-[&PB, VerifyEachPass, DebugLogging](FunctionPassManager &PM,
+[&PB, VerifyEachPass, DebugLogging](ModulePassManager &PM,
 PassBuilder::OptimizationLevel) {
   ExitOnError Err("Unable to parse OptimizerLastEP pipeline: ");
   Err(PB.parsePassPipeline(PM, OptimizerLastEPPipeline, VerifyEachPass,
Index: llvm/lib/Passes/PassBuilder.cpp
===
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -1073,12 +1073,12 @@
   if (PTO.Coroutines)
 OptimizePM.addPass(CoroCleanupPass());
 
-  for (auto &C : OptimizerLastEPCallbacks)
-C(OptimizePM, Level);
-
   // Add the core optimizing pipeline.
   MPM.addPass(createModuleToFunctionPassAdaptor(std::move(OptimizePM)));
 
+  for (auto &C : OptimizerLastEPCallbacks)
+C(MPM, Level);
+
   if (PTO.CallGraphProfile)
 MPM.addPass(CGProfilePass());
 
Index: llvm/include/llvm/Passes/PassBuilder.h
===
--- llvm/include/llvm/Passes/PassBuilder.h
+++ llvm/include/llvm/Passes/PassBuilder.h
@@ -600,7 +600,7 @@
   /// is not triggered at O0. Extensions to the O0 pipeline should append their
   /// passes to the end of the overall pipeline.
   void registerOptimizerLastEPCallback(
-  const std::function &C) {
+  const std::function &C) {
 OptimizerLastEPCallbacks.push_back(C);
   }
 
@@ -728,7 +728,7 @@
   CGSCCOptimizerLateEPCallbacks;
   SmallVector, 2>
   VectorizerStartEPCallbacks;
-  SmallVector, 2>
+  SmallVector, 2>
   OptimizerLastEPCallbacks;
   // Module callbacks
   SmallVector, 2>
Index: clang/test/CodeGen/sancov-new-pm.c
===
--- clang/test/CodeGen/sancov-new-pm.c
+++ clang/test/CodeGen/sancov-new-pm.c
@@ -1,10 +1,6 @@
 // Test that SanitizerCoverage works under the new pass manager.
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -O2 -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O2
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto -O2 -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O2
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto=thin -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto=thin -O2 -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O2,CHECK-O2-THINLTO
 
 extern void *memcpy(void *, const void *, unsigned long);
 extern int printf(const char *restrict, ...);
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -32,6 +32,7 @@
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/ModuleSummaryIndex.h"
+#include "llvm/IR/PassManager.h"
 #include "llvm/IR/Verifier.h"
 #include "llvm/LTO/LTOBackend.h"
 #include "llvm/MC/MCAsmInfo.h"
@@ -1001,6 +1002,15 @@
   const Triple &TargetTriple,
   const LangOptions &LangOpts,
   const CodeGenOptions &CodeGenOpts) {
+  if (CodeGenOpts.SanitizeCoverage

[PATCH] D80692: Run Coverage pass before other *San passes under new pass manager, round 2

2020-05-28 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 267087.
aeubanks added a comment.

Update some CHECKs


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80692/new/

https://reviews.llvm.org/D80692

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/test/CodeGen/sancov-new-pm.c
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -194,7 +194,7 @@
 });
   if (tryParsePipelineText(PB, OptimizerLastEPPipeline))
 PB.registerOptimizerLastEPCallback(
-[&PB, VerifyEachPass, DebugLogging](FunctionPassManager &PM,
+[&PB, VerifyEachPass, DebugLogging](ModulePassManager &PM,
 PassBuilder::OptimizationLevel) {
   ExitOnError Err("Unable to parse OptimizerLastEP pipeline: ");
   Err(PB.parsePassPipeline(PM, OptimizerLastEPPipeline, VerifyEachPass,
Index: llvm/lib/Passes/PassBuilder.cpp
===
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -1073,12 +1073,12 @@
   if (PTO.Coroutines)
 OptimizePM.addPass(CoroCleanupPass());
 
-  for (auto &C : OptimizerLastEPCallbacks)
-C(OptimizePM, Level);
-
   // Add the core optimizing pipeline.
   MPM.addPass(createModuleToFunctionPassAdaptor(std::move(OptimizePM)));
 
+  for (auto &C : OptimizerLastEPCallbacks)
+C(MPM, Level);
+
   if (PTO.CallGraphProfile)
 MPM.addPass(CGProfilePass());
 
Index: llvm/include/llvm/Passes/PassBuilder.h
===
--- llvm/include/llvm/Passes/PassBuilder.h
+++ llvm/include/llvm/Passes/PassBuilder.h
@@ -600,7 +600,7 @@
   /// is not triggered at O0. Extensions to the O0 pipeline should append their
   /// passes to the end of the overall pipeline.
   void registerOptimizerLastEPCallback(
-  const std::function &C) {
+  const std::function &C) {
 OptimizerLastEPCallbacks.push_back(C);
   }
 
@@ -728,7 +728,7 @@
   CGSCCOptimizerLateEPCallbacks;
   SmallVector, 2>
   VectorizerStartEPCallbacks;
-  SmallVector, 2>
+  SmallVector, 2>
   OptimizerLastEPCallbacks;
   // Module callbacks
   SmallVector, 2>
Index: clang/test/CodeGen/sancov-new-pm.c
===
--- clang/test/CodeGen/sancov-new-pm.c
+++ clang/test/CodeGen/sancov-new-pm.c
@@ -1,10 +1,6 @@
 // Test that SanitizerCoverage works under the new pass manager.
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -O2 -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O2
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto -O2 -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O2
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto=thin -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto=thin -O2 -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O2,CHECK-O2-THINLTO
 
 extern void *memcpy(void *, const void *, unsigned long);
 extern int printf(const char *restrict, ...);
@@ -29,10 +25,10 @@
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_cmp2(i16 zeroext, i16 zeroext)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_cmp4(i32 zeroext, i32 zeroext)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_cmp8(i64, i64)
-// CHECK-O2-THINLTO-NOT: declare void @__sanitizer_cov_trace_const_cmp1(i8 zeroext, i8 zeroext)
+// CHECK-O2-NOT: declare void @__sanitizer_cov_trace_const_cmp1(i8 zeroext, i8 zeroext)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_const_cmp2(i16 zeroext, i16 zeroext)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_const_cmp4(i32 zeroext, i32 zeroext)
-// CHECK-O2-THINLTO-NOT: declare void @__sanitizer_cov_trace_const_cmp8(i64, i64)
+// CHECK-O2-NOT: declare void @__sanitizer_cov_trace_const_cmp8(i64, i64)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_div4(i32 zeroext)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_div8(i64)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_gep(i64)
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp

[PATCH] D80692: Run Coverage pass before other *San passes under new pass manager, round 2

2020-05-28 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1285e8bcac2c: Run Coverage pass before other *San passes 
under new pass manager, round 2 (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80692/new/

https://reviews.llvm.org/D80692

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/test/CodeGen/sancov-new-pm.c
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -194,7 +194,7 @@
 });
   if (tryParsePipelineText(PB, OptimizerLastEPPipeline))
 PB.registerOptimizerLastEPCallback(
-[&PB, VerifyEachPass, DebugLogging](FunctionPassManager &PM,
+[&PB, VerifyEachPass, DebugLogging](ModulePassManager &PM,
 PassBuilder::OptimizationLevel) {
   ExitOnError Err("Unable to parse OptimizerLastEP pipeline: ");
   Err(PB.parsePassPipeline(PM, OptimizerLastEPPipeline, VerifyEachPass,
Index: llvm/lib/Passes/PassBuilder.cpp
===
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -1073,12 +1073,12 @@
   if (PTO.Coroutines)
 OptimizePM.addPass(CoroCleanupPass());
 
-  for (auto &C : OptimizerLastEPCallbacks)
-C(OptimizePM, Level);
-
   // Add the core optimizing pipeline.
   MPM.addPass(createModuleToFunctionPassAdaptor(std::move(OptimizePM)));
 
+  for (auto &C : OptimizerLastEPCallbacks)
+C(MPM, Level);
+
   if (PTO.CallGraphProfile)
 MPM.addPass(CGProfilePass());
 
Index: llvm/include/llvm/Passes/PassBuilder.h
===
--- llvm/include/llvm/Passes/PassBuilder.h
+++ llvm/include/llvm/Passes/PassBuilder.h
@@ -600,7 +600,7 @@
   /// is not triggered at O0. Extensions to the O0 pipeline should append their
   /// passes to the end of the overall pipeline.
   void registerOptimizerLastEPCallback(
-  const std::function &C) {
+  const std::function &C) {
 OptimizerLastEPCallbacks.push_back(C);
   }
 
@@ -728,7 +728,7 @@
   CGSCCOptimizerLateEPCallbacks;
   SmallVector, 2>
   VectorizerStartEPCallbacks;
-  SmallVector, 2>
+  SmallVector, 2>
   OptimizerLastEPCallbacks;
   // Module callbacks
   SmallVector, 2>
Index: clang/test/CodeGen/sancov-new-pm.c
===
--- clang/test/CodeGen/sancov-new-pm.c
+++ clang/test/CodeGen/sancov-new-pm.c
@@ -1,10 +1,6 @@
 // Test that SanitizerCoverage works under the new pass manager.
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -O2 -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O2
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto -O2 -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O2
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto=thin -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O0
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=fuzzer %s -fexperimental-new-pass-manager -flto=thin -O2 -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-O2,CHECK-O2-THINLTO
 
 extern void *memcpy(void *, const void *, unsigned long);
 extern int printf(const char *restrict, ...);
@@ -29,10 +25,10 @@
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_cmp2(i16 zeroext, i16 zeroext)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_cmp4(i32 zeroext, i32 zeroext)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_cmp8(i64, i64)
-// CHECK-O2-THINLTO-NOT: declare void @__sanitizer_cov_trace_const_cmp1(i8 zeroext, i8 zeroext)
+// CHECK-O2-NOT: declare void @__sanitizer_cov_trace_const_cmp1(i8 zeroext, i8 zeroext)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_const_cmp2(i16 zeroext, i16 zeroext)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_const_cmp4(i32 zeroext, i32 zeroext)
-// CHECK-O2-THINLTO-NOT: declare void @__sanitizer_cov_trace_const_cmp8(i64, i64)
+// CHECK-O2-NOT: declare void @__sanitizer_cov_trace_const_cmp8(i64, i64)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_div4(i32 zeroext)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_div8(i64)
 // CHECK-O0-DAG: declare void @__sanitizer_cov_trace_gep(i64)
Index: clang/lib/CodeGen/BackendUtil.cpp
==

[PATCH] D83519: [NewPM] Support optnone under new pass manager

2020-07-17 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 278871.
aeubanks added a comment.

Remove required passes part
Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83519/new/

https://reviews.llvm.org/D83519

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Passes/StandardInstrumentations.h
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Feature/optnone-opt.ll
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -260,7 +260,7 @@
 }
   }
   PassInstrumentationCallbacks PIC;
-  StandardInstrumentations SI;
+  StandardInstrumentations SI(DebugPM);
   SI.registerCallbacks(PIC);
 
   PipelineTuningOptions PTO;
Index: llvm/test/Feature/optnone-opt.ll
===
--- llvm/test/Feature/optnone-opt.ll
+++ llvm/test/Feature/optnone-opt.ll
@@ -1,9 +1,15 @@
-; RUN: opt -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O0
-; RUN: opt -O1 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1
-; RUN: opt -O2 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3
-; RUN: opt -O3 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3
-; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-MORE
-; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-LOOP
+; RUN: opt -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O0
+; RUN: opt -O1 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1
+; RUN: opt -O2 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1 --check-prefix=O2O3
+; RUN: opt -O3 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1 --check-prefix=O2O3
+; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=MORE
+; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -enable-new-pm=0 -S -debug %s 2>&1 | FileCheck %s --check-prefix=LOOP
+; RUN: opt -enable-npm-optnone -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O0
+; RUN: opt -enable-npm-optnone -O1 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1
+; RUN: opt -enable-npm-optnone -O2 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
+; RUN: opt -enable-npm-optnone -O3 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
+; RUN: opt -enable-npm-optnone -dce -gvn-hoist -loweratomic -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-MORE
+; RUN: opt -enable-npm-optnone -indvars -licm -loop-deletion -loop-idiom -loop-instsimplify -loop-reduce -loop-unroll -simple-loop-unswitch -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-LOOP
 
 ; REQUIRES: asserts
 
@@ -34,32 +40,53 @@
 attributes #0 = { optnone noinline }
 
 ; Nothing that runs at -O0 gets skipped.
-; OPT-O0-NOT: Skipping pass
+; O0-NOT: Skipping pass
+; NPM-O0-NOT: Skipping pass
 
 ; IR passes run at -O1 and higher.
-; OPT-O1-DAG: Skipping pass 'Aggressive Dead Code Elimination'
-; OPT-O1-DAG: Skipping pass 'Combine redundant instructions'
-; OPT-O1-DAG: Skipping pass 'Early CSE'
-; OPT-O1-DAG: Skipping pass 'Reassociate expressions'
-; OPT-O1-DAG: Skipping pass 'Simplify the CFG'
-; OPT-O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation'
+; O1-DAG: Skipping pass 'Aggressive Dead Code Elimination'
+; O1-DAG: Skipping pass 'Combine redundant instructions'
+; O1-DAG: Skipping pass 'Early CSE'
+; O1-DAG: Skipping pass 'Reassociate expressions'
+; O1-DAG: Skipping pass 'Simplify the CFG'
+; O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation'
+; NPM-O1-DAG: Skipping pass: SimplifyCFGPass
+; NPM-O1-DAG: Skipping pass: SROA
+; NPM-O1-DAG: Skipping pass: EarlyCSEPass
+; NPM-O1-DAG: Skipping pass: LowerExpectIntrinsicPass
+; NPM-O1-DAG: Skipping pass: PromotePass
+; NPM-O1-DAG: Skipping pass: InstCombinePass
 
 ; Additional IR passes run at -O2 and higher.
-; OPT-O2O3-DAG: Skipping pass 'Global Value Numbering'
-; OPT-O2O3-DAG: Skipping pass 'SLP Vectorizer'
+; O2O3-DAG: Skipping pass 'Global Value Numbering'
+; O2O3-DAG: Skipping pass 'SLP Vectorizer'
+; NPM-O2O3-DAG: Skipping pass: GVN
+; NPM-O2O3-DAG: Skipping pass: SLPVectorizerPass
 
 ; Additional IR passes that opt doesn't turn on by default.
-; OPT-MORE-DAG: Skipping pass 'Dead Code Elimination'
-; OPT-MORE-DAG: Skipping pass 'Dead Instruc

[PATCH] D83519: [NewPM] Support optnone under new pass manager

2020-07-17 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D83519#2158938 , @ychen wrote:

> In D83519#2144616 , @aeubanks wrote:
>
> > In D83519#2144463 , @aeubanks 
> > wrote:
> >
> > > In D83519#2144403 , @ychen wrote:
> > >
> > > > High-level request: how about split this patch into two, the first for 
> > > > the `require` pass part; the second for the PassInstrument callback. 
> > > > Then we could discuss the choices of first patch and D82344 
> > > > .
> > >
> > >
> > > Good idea, will split the patch and take a closer look at your patch.
> >
> >
> > I split the required passes part into https://reviews.llvm.org/D83575.
>
>
> Could you remove the `Required` part of this patch?


Done. The test now fails because your patch for required passes hasn't been 
submitted yet, after that's submitted this one should be good to go.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83519/new/

https://reviews.llvm.org/D83519



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D83519: [NewPM] Support optnone under new pass manager

2020-07-20 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 279313.
aeubanks marked 4 inline comments as done.
aeubanks added a comment.

Address comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83519/new/

https://reviews.llvm.org/D83519

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Passes/StandardInstrumentations.h
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Feature/optnone-opt.ll
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -261,7 +261,7 @@
 }
   }
   PassInstrumentationCallbacks PIC;
-  StandardInstrumentations SI;
+  StandardInstrumentations SI(DebugPM);
   SI.registerCallbacks(PIC);
 
   PipelineTuningOptions PTO;
Index: llvm/test/Feature/optnone-opt.ll
===
--- llvm/test/Feature/optnone-opt.ll
+++ llvm/test/Feature/optnone-opt.ll
@@ -1,9 +1,15 @@
-; RUN: opt -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O0
-; RUN: opt -O1 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1
-; RUN: opt -O2 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3
-; RUN: opt -O3 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3
-; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-MORE
-; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-LOOP
+; RUN: opt -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O0
+; RUN: opt -O1 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1
+; RUN: opt -O2 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1 --check-prefix=O2O3
+; RUN: opt -O3 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1 --check-prefix=O2O3
+; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=MORE
+; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -enable-new-pm=0 -S -debug %s 2>&1 | FileCheck %s --check-prefix=LOOP
+; RUN: opt -enable-npm-optnone -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O0
+; RUN: opt -enable-npm-optnone -O1 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1
+; RUN: opt -enable-npm-optnone -O2 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
+; RUN: opt -enable-npm-optnone -O3 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
+; RUN: opt -enable-npm-optnone -dce -gvn-hoist -loweratomic -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-MORE
+; RUN: opt -enable-npm-optnone -indvars -licm -loop-deletion -loop-idiom -loop-instsimplify -loop-reduce -loop-unroll -simple-loop-unswitch -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-LOOP
 
 ; REQUIRES: asserts
 
@@ -34,32 +40,53 @@
 attributes #0 = { optnone noinline }
 
 ; Nothing that runs at -O0 gets skipped.
-; OPT-O0-NOT: Skipping pass
+; O0-NOT: Skipping pass
+; NPM-O0-NOT: Skipping pass
 
 ; IR passes run at -O1 and higher.
-; OPT-O1-DAG: Skipping pass 'Aggressive Dead Code Elimination'
-; OPT-O1-DAG: Skipping pass 'Combine redundant instructions'
-; OPT-O1-DAG: Skipping pass 'Early CSE'
-; OPT-O1-DAG: Skipping pass 'Reassociate expressions'
-; OPT-O1-DAG: Skipping pass 'Simplify the CFG'
-; OPT-O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation'
+; O1-DAG: Skipping pass 'Aggressive Dead Code Elimination'
+; O1-DAG: Skipping pass 'Combine redundant instructions'
+; O1-DAG: Skipping pass 'Early CSE'
+; O1-DAG: Skipping pass 'Reassociate expressions'
+; O1-DAG: Skipping pass 'Simplify the CFG'
+; O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation'
+; NPM-O1-DAG: Skipping pass: SimplifyCFGPass
+; NPM-O1-DAG: Skipping pass: SROA
+; NPM-O1-DAG: Skipping pass: EarlyCSEPass
+; NPM-O1-DAG: Skipping pass: LowerExpectIntrinsicPass
+; NPM-O1-DAG: Skipping pass: PromotePass
+; NPM-O1-DAG: Skipping pass: InstCombinePass
 
 ; Additional IR passes run at -O2 and higher.
-; OPT-O2O3-DAG: Skipping pass 'Global Value Numbering'
-; OPT-O2O3-DAG: Skipping pass 'SLP Vectorizer'
+; O2O3-DAG: Skipping pass 'Global Value Numbering'
+; O2O3-DAG: Skipping pass 'SLP Vectorizer'
+; NPM-O2O3-DAG: Skipping pass: GVN
+; NPM-O2O3-DAG: Skipping pass: SLPVectorizerPass
 
 ; Additional IR passes that opt doesn't turn on by default.
-; OPT-MORE-DAG: Skipping pass 'Dead Code Elimination'
-; OPT-MORE-DAG: Sk

[PATCH] D83519: [NewPM] Support optnone under new pass manager

2020-07-21 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 279563.
aeubanks added a comment.

Rename OptNoneInstrumentation


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83519/new/

https://reviews.llvm.org/D83519

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Passes/StandardInstrumentations.h
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Feature/optnone-opt.ll
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -261,7 +261,7 @@
 }
   }
   PassInstrumentationCallbacks PIC;
-  StandardInstrumentations SI;
+  StandardInstrumentations SI(DebugPM);
   SI.registerCallbacks(PIC);
 
   PipelineTuningOptions PTO;
Index: llvm/test/Feature/optnone-opt.ll
===
--- llvm/test/Feature/optnone-opt.ll
+++ llvm/test/Feature/optnone-opt.ll
@@ -1,9 +1,15 @@
-; RUN: opt -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O0
-; RUN: opt -O1 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1
-; RUN: opt -O2 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3
-; RUN: opt -O3 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3
-; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-MORE
-; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-LOOP
+; RUN: opt -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O0
+; RUN: opt -O1 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1
+; RUN: opt -O2 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1 --check-prefix=O2O3
+; RUN: opt -O3 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1 --check-prefix=O2O3
+; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=MORE
+; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -enable-new-pm=0 -S -debug %s 2>&1 | FileCheck %s --check-prefix=LOOP
+; RUN: opt -enable-npm-optnone -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O0
+; RUN: opt -enable-npm-optnone -O1 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1
+; RUN: opt -enable-npm-optnone -O2 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
+; RUN: opt -enable-npm-optnone -O3 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
+; RUN: opt -enable-npm-optnone -dce -gvn-hoist -loweratomic -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-MORE
+; RUN: opt -enable-npm-optnone -indvars -licm -loop-deletion -loop-idiom -loop-instsimplify -loop-reduce -loop-unroll -simple-loop-unswitch -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-LOOP
 
 ; REQUIRES: asserts
 
@@ -34,32 +40,53 @@
 attributes #0 = { optnone noinline }
 
 ; Nothing that runs at -O0 gets skipped.
-; OPT-O0-NOT: Skipping pass
+; O0-NOT: Skipping pass
+; NPM-O0-NOT: Skipping pass
 
 ; IR passes run at -O1 and higher.
-; OPT-O1-DAG: Skipping pass 'Aggressive Dead Code Elimination'
-; OPT-O1-DAG: Skipping pass 'Combine redundant instructions'
-; OPT-O1-DAG: Skipping pass 'Early CSE'
-; OPT-O1-DAG: Skipping pass 'Reassociate expressions'
-; OPT-O1-DAG: Skipping pass 'Simplify the CFG'
-; OPT-O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation'
+; O1-DAG: Skipping pass 'Aggressive Dead Code Elimination'
+; O1-DAG: Skipping pass 'Combine redundant instructions'
+; O1-DAG: Skipping pass 'Early CSE'
+; O1-DAG: Skipping pass 'Reassociate expressions'
+; O1-DAG: Skipping pass 'Simplify the CFG'
+; O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation'
+; NPM-O1-DAG: Skipping pass: SimplifyCFGPass
+; NPM-O1-DAG: Skipping pass: SROA
+; NPM-O1-DAG: Skipping pass: EarlyCSEPass
+; NPM-O1-DAG: Skipping pass: LowerExpectIntrinsicPass
+; NPM-O1-DAG: Skipping pass: PromotePass
+; NPM-O1-DAG: Skipping pass: InstCombinePass
 
 ; Additional IR passes run at -O2 and higher.
-; OPT-O2O3-DAG: Skipping pass 'Global Value Numbering'
-; OPT-O2O3-DAG: Skipping pass 'SLP Vectorizer'
+; O2O3-DAG: Skipping pass 'Global Value Numbering'
+; O2O3-DAG: Skipping pass 'SLP Vectorizer'
+; NPM-O2O3-DAG: Skipping pass: GVN
+; NPM-O2O3-DAG: Skipping pass: SLPVectorizerPass
 
 ; Additional IR passes that opt doesn't turn on by default.
-; OPT-MORE-DAG: Skipping pass 'Dead Code Elimination'
-; OPT-MORE-DAG: Skipping pass 'Dead Instruction 

[PATCH] D83519: [NewPM] Support optnone under new pass manager

2020-07-21 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb13b85818218: [NewPM] Support optnone under new pass manager 
(authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83519/new/

https://reviews.llvm.org/D83519

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Passes/StandardInstrumentations.h
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Feature/optnone-opt.ll
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -261,7 +261,7 @@
 }
   }
   PassInstrumentationCallbacks PIC;
-  StandardInstrumentations SI;
+  StandardInstrumentations SI(DebugPM);
   SI.registerCallbacks(PIC);
 
   PipelineTuningOptions PTO;
Index: llvm/test/Feature/optnone-opt.ll
===
--- llvm/test/Feature/optnone-opt.ll
+++ llvm/test/Feature/optnone-opt.ll
@@ -1,9 +1,15 @@
-; RUN: opt -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O0
-; RUN: opt -O1 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1
-; RUN: opt -O2 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3
-; RUN: opt -O3 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3
-; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-MORE
-; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-LOOP
+; RUN: opt -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O0
+; RUN: opt -O1 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1
+; RUN: opt -O2 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1 --check-prefix=O2O3
+; RUN: opt -O3 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1 --check-prefix=O2O3
+; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=MORE
+; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -enable-new-pm=0 -S -debug %s 2>&1 | FileCheck %s --check-prefix=LOOP
+; RUN: opt -enable-npm-optnone -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O0
+; RUN: opt -enable-npm-optnone -O1 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1
+; RUN: opt -enable-npm-optnone -O2 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
+; RUN: opt -enable-npm-optnone -O3 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
+; RUN: opt -enable-npm-optnone -dce -gvn-hoist -loweratomic -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-MORE
+; RUN: opt -enable-npm-optnone -indvars -licm -loop-deletion -loop-idiom -loop-instsimplify -loop-reduce -loop-unroll -simple-loop-unswitch -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-LOOP
 
 ; REQUIRES: asserts
 
@@ -34,32 +40,53 @@
 attributes #0 = { optnone noinline }
 
 ; Nothing that runs at -O0 gets skipped.
-; OPT-O0-NOT: Skipping pass
+; O0-NOT: Skipping pass
+; NPM-O0-NOT: Skipping pass
 
 ; IR passes run at -O1 and higher.
-; OPT-O1-DAG: Skipping pass 'Aggressive Dead Code Elimination'
-; OPT-O1-DAG: Skipping pass 'Combine redundant instructions'
-; OPT-O1-DAG: Skipping pass 'Early CSE'
-; OPT-O1-DAG: Skipping pass 'Reassociate expressions'
-; OPT-O1-DAG: Skipping pass 'Simplify the CFG'
-; OPT-O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation'
+; O1-DAG: Skipping pass 'Aggressive Dead Code Elimination'
+; O1-DAG: Skipping pass 'Combine redundant instructions'
+; O1-DAG: Skipping pass 'Early CSE'
+; O1-DAG: Skipping pass 'Reassociate expressions'
+; O1-DAG: Skipping pass 'Simplify the CFG'
+; O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation'
+; NPM-O1-DAG: Skipping pass: SimplifyCFGPass
+; NPM-O1-DAG: Skipping pass: SROA
+; NPM-O1-DAG: Skipping pass: EarlyCSEPass
+; NPM-O1-DAG: Skipping pass: LowerExpectIntrinsicPass
+; NPM-O1-DAG: Skipping pass: PromotePass
+; NPM-O1-DAG: Skipping pass: InstCombinePass
 
 ; Additional IR passes run at -O2 and higher.
-; OPT-O2O3-DAG: Skipping pass 'Global Value Numbering'
-; OPT-O2O3-DAG: Skipping pass 'SLP Vectorizer'
+; O2O3-DAG: Skipping pass 'Global Value Numbering'
+; O2O3-DAG: Skipping pass 'SLP Vectorizer'
+; NPM-O2O3-DAG: Skipping pass: GVN
+; NPM-O2O3-DAG: Skipping pass: SLPVectorizerPass
 
 ; Additional IR passes that opt doesn't turn on by default.
-; OPT-MORE-DAG: Skipping pass

[Differential] D83519: [NewPM] Support optnone under new pass manager

2020-07-21 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb13b85818218: [NewPM] Support optnone under new pass manager 
(authored by aeubanks).

Changed prior to commit:
  https://reviews.llvm.org/D83519?vs=278871&id=279055#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83519/new/

https://reviews.llvm.org/D83519

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Passes/StandardInstrumentations.h
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Feature/optnone-opt.ll
  llvm/tools/opt/NewPMDriver.cpp

Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -261,7 +261,7 @@
 }
   }
   PassInstrumentationCallbacks PIC;
-  StandardInstrumentations SI;
+  StandardInstrumentations SI(DebugPM);
   SI.registerCallbacks(PIC);
 
   PipelineTuningOptions PTO;
Index: llvm/test/Feature/optnone-opt.ll
===
--- llvm/test/Feature/optnone-opt.ll
+++ llvm/test/Feature/optnone-opt.ll
@@ -1,9 +1,15 @@
-; RUN: opt -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O0
-; RUN: opt -O1 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1
-; RUN: opt -O2 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3
-; RUN: opt -O3 -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-O1 --check-prefix=OPT-O2O3
-; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-MORE
-; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -S -debug %s 2>&1 | FileCheck %s --check-prefix=OPT-LOOP
+; RUN: opt -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O0
+; RUN: opt -O1 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1
+; RUN: opt -O2 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1 --check-prefix=O2O3
+; RUN: opt -O3 -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=O1 --check-prefix=O2O3
+; RUN: opt -dce -die -gvn-hoist -loweratomic -S -debug -enable-new-pm=0 %s 2>&1 | FileCheck %s --check-prefix=MORE
+; RUN: opt -indvars -licm -loop-deletion -loop-extract -loop-idiom -loop-instsimplify -loop-reduce -loop-reroll -loop-rotate -loop-unroll -loop-unswitch -enable-new-pm=0 -S -debug %s 2>&1 | FileCheck %s --check-prefix=LOOP
+; RUN: opt -enable-npm-optnone -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O0
+; RUN: opt -enable-npm-optnone -O1 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1
+; RUN: opt -enable-npm-optnone -O2 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
+; RUN: opt -enable-npm-optnone -O3 -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-O1 --check-prefix=NPM-O2O3
+; RUN: opt -enable-npm-optnone -dce -gvn-hoist -loweratomic -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-MORE
+; RUN: opt -enable-npm-optnone -indvars -licm -loop-deletion -loop-idiom -loop-instsimplify -loop-reduce -loop-unroll -simple-loop-unswitch -S -debug-pass-manager -enable-new-pm %s 2>&1 | FileCheck %s --check-prefix=NPM-LOOP
 
 ; REQUIRES: asserts
 
@@ -34,32 +40,53 @@
 attributes #0 = { optnone noinline }
 
 ; Nothing that runs at -O0 gets skipped.
-; OPT-O0-NOT: Skipping pass
+; O0-NOT: Skipping pass
+; NPM-O0-NOT: Skipping pass
 
 ; IR passes run at -O1 and higher.
-; OPT-O1-DAG: Skipping pass 'Aggressive Dead Code Elimination'
-; OPT-O1-DAG: Skipping pass 'Combine redundant instructions'
-; OPT-O1-DAG: Skipping pass 'Early CSE'
-; OPT-O1-DAG: Skipping pass 'Reassociate expressions'
-; OPT-O1-DAG: Skipping pass 'Simplify the CFG'
-; OPT-O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation'
+; O1-DAG: Skipping pass 'Aggressive Dead Code Elimination'
+; O1-DAG: Skipping pass 'Combine redundant instructions'
+; O1-DAG: Skipping pass 'Early CSE'
+; O1-DAG: Skipping pass 'Reassociate expressions'
+; O1-DAG: Skipping pass 'Simplify the CFG'
+; O1-DAG: Skipping pass 'Sparse Conditional Constant Propagation'
+; NPM-O1-DAG: Skipping pass: SimplifyCFGPass
+; NPM-O1-DAG: Skipping pass: SROA
+; NPM-O1-DAG: Skipping pass: EarlyCSEPass
+; NPM-O1-DAG: Skipping pass: LowerExpectIntrinsicPass
+; NPM-O1-DAG: Skipping pass: PromotePass
+; NPM-O1-DAG: Skipping pass: InstCombinePass
 
 ; Additional IR passes run at -O2 and higher.
-; OPT-O2O3-DAG: Skipping pass 'Global Value Numbering'
-; OPT-O2O3-DAG: Skipping pass 'SLP Vectorizer'
+; O2O3-DAG: Skipping pass 'Global Value Numbering'

[PATCH] D84707: [DFSan][NewPM] Port DataFlowSanitizer to NewPM

2020-07-27 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
Herald added subscribers: llvm-commits, cfe-commits, aaron.ballman, hiraditya.
Herald added projects: clang, LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84707

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/bindings/go/llvm/InstrumentationBindings.cpp
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Transforms/Instrumentation.h
  llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
  llvm/test/Instrumentation/DataFlowSanitizer/call.ll

Index: llvm/test/Instrumentation/DataFlowSanitizer/call.ll
===
--- llvm/test/Instrumentation/DataFlowSanitizer/call.ll
+++ llvm/test/Instrumentation/DataFlowSanitizer/call.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -dfsan -S | FileCheck %s
+; RUN: opt < %s -passes=dfsan -S | FileCheck %s
 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"
 
Index: llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
===
--- llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
+++ llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
@@ -119,7 +119,7 @@
   initializeHWAddressSanitizerLegacyPassPass(Registry);
   initializeThreadSanitizerLegacyPassPass(Registry);
   initializeModuleSanitizerCoverageLegacyPassPass(Registry);
-  initializeDataFlowSanitizerPass(Registry);
+  initializeDataFlowSanitizerLegacyPassPass(Registry);
 }
 
 /// LLVMInitializeInstrumentation - C binding for
Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -46,6 +46,7 @@
 //
 //===--===//
 
+#include "llvm/Transforms/Instrumentation/DataFlowSanitizer.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/DepthFirstIterator.h"
@@ -78,6 +79,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/MDBuilder.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/PassManager.h"
 #include "llvm/IR/Type.h"
 #include "llvm/IR/User.h"
 #include "llvm/IR/Value.h"
@@ -292,7 +294,7 @@
   llvm::makeArrayRef(ArgumentAttributes));
 }
 
-class DataFlowSanitizer : public ModulePass {
+class DataFlowSanitizer {
   friend struct DFSanFunction;
   friend class DFSanVisitor;
 
@@ -390,14 +392,12 @@
   void initializeCallbackFunctions(Module &M);
   void initializeRuntimeFunctions(Module &M);
 
-public:
-  static char ID;
+  bool init(Module &M);
 
-  DataFlowSanitizer(const std::vector &ABIListFiles =
-std::vector());
+public:
+  DataFlowSanitizer(const std::vector &ABIListFiles);
 
-  bool doInitialization(Module &M) override;
-  bool runOnModule(Module &M) override;
+  bool runImpl(Module &M);
 };
 
 struct DFSanFunction {
@@ -482,19 +482,8 @@
 
 } // end anonymous namespace
 
-char DataFlowSanitizer::ID;
-
-INITIALIZE_PASS(DataFlowSanitizer, "dfsan",
-"DataFlowSanitizer: dynamic data flow analysis.", false, false)
-
-ModulePass *llvm::createDataFlowSanitizerPass(
-const std::vector &ABIListFiles) {
-  return new DataFlowSanitizer(ABIListFiles);
-}
-
 DataFlowSanitizer::DataFlowSanitizer(
-const std::vector &ABIListFiles)
-: ModulePass(ID) {
+const std::vector &ABIListFiles) {
   std::vector AllABIListFiles(std::move(ABIListFiles));
   AllABIListFiles.insert(AllABIListFiles.end(), ClABIListFiles.begin(),
  ClABIListFiles.end());
@@ -559,7 +548,7 @@
   ArgumentIndexMapping);
 }
 
-bool DataFlowSanitizer::doInitialization(Module &M) {
+bool DataFlowSanitizer::init(Module &M) {
   Triple TargetTriple(M.getTargetTriple());
   bool IsX86_64 = TargetTriple.getArch() == Triple::x86_64;
   bool IsMIPS64 = TargetTriple.isMIPS64();
@@ -785,7 +774,9 @@
 DFSanLoadStoreCmpCallbackFnTy);
 }
 
-bool DataFlowSanitizer::runOnModule(Module &M) {
+bool DataFlowSanitizer::runImpl(Module &M) {
+  init(M);
+
   if (ABIList.isIn(M, "skip"))
 return false;
 
@@ -1817,3 +1808,37 @@
   DFSF.PHIFixups.push_back(std::make_pair(&PN, ShadowPN));
   DFSF.setShadow(&PN, ShadowPN);
 }
+
+class DataFlowSanitizerLegacyPass : public ModulePass {
+private:
+  std::vector ABIListFiles;
+
+public:
+  static char ID;
+
+  DataFlowSanitizerLegacyPass(
+  const std::vector &ABIListFiles = std::vector())
+  : ModulePass(ID), ABIListFiles(ABIListFiles) {}
+
+  bool runOnModule(Module &M

[PATCH] D84707: [DFSan][NewPM] Port DataFlowSanitizer to NewPM

2020-07-27 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 281109.
aeubanks added a comment.

Address review comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84707/new/

https://reviews.llvm.org/D84707

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/bindings/go/llvm/InstrumentationBindings.cpp
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Transforms/Instrumentation.h
  llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
  llvm/test/Instrumentation/DataFlowSanitizer/call.ll

Index: llvm/test/Instrumentation/DataFlowSanitizer/call.ll
===
--- llvm/test/Instrumentation/DataFlowSanitizer/call.ll
+++ llvm/test/Instrumentation/DataFlowSanitizer/call.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -dfsan -S | FileCheck %s
+; RUN: opt < %s -passes=dfsan -S | FileCheck %s
 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"
 
Index: llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
===
--- llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
+++ llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
@@ -119,7 +119,7 @@
   initializeHWAddressSanitizerLegacyPassPass(Registry);
   initializeThreadSanitizerLegacyPassPass(Registry);
   initializeModuleSanitizerCoverageLegacyPassPass(Registry);
-  initializeDataFlowSanitizerPass(Registry);
+  initializeDataFlowSanitizerLegacyPassPass(Registry);
 }
 
 /// LLVMInitializeInstrumentation - C binding for
Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -46,6 +46,7 @@
 //
 //===--===//
 
+#include "llvm/Transforms/Instrumentation/DataFlowSanitizer.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/DepthFirstIterator.h"
@@ -78,6 +79,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/MDBuilder.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/PassManager.h"
 #include "llvm/IR/Type.h"
 #include "llvm/IR/User.h"
 #include "llvm/IR/Value.h"
@@ -292,7 +294,7 @@
   llvm::makeArrayRef(ArgumentAttributes));
 }
 
-class DataFlowSanitizer : public ModulePass {
+class DataFlowSanitizer {
   friend struct DFSanFunction;
   friend class DFSanVisitor;
 
@@ -390,14 +392,12 @@
   void initializeCallbackFunctions(Module &M);
   void initializeRuntimeFunctions(Module &M);
 
-public:
-  static char ID;
+  bool init(Module &M);
 
-  DataFlowSanitizer(const std::vector &ABIListFiles =
-std::vector());
+public:
+  DataFlowSanitizer(const std::vector &ABIListFiles);
 
-  bool doInitialization(Module &M) override;
-  bool runOnModule(Module &M) override;
+  bool runImpl(Module &M);
 };
 
 struct DFSanFunction {
@@ -482,19 +482,8 @@
 
 } // end anonymous namespace
 
-char DataFlowSanitizer::ID;
-
-INITIALIZE_PASS(DataFlowSanitizer, "dfsan",
-"DataFlowSanitizer: dynamic data flow analysis.", false, false)
-
-ModulePass *llvm::createDataFlowSanitizerPass(
-const std::vector &ABIListFiles) {
-  return new DataFlowSanitizer(ABIListFiles);
-}
-
 DataFlowSanitizer::DataFlowSanitizer(
-const std::vector &ABIListFiles)
-: ModulePass(ID) {
+const std::vector &ABIListFiles) {
   std::vector AllABIListFiles(std::move(ABIListFiles));
   AllABIListFiles.insert(AllABIListFiles.end(), ClABIListFiles.begin(),
  ClABIListFiles.end());
@@ -559,7 +548,7 @@
   ArgumentIndexMapping);
 }
 
-bool DataFlowSanitizer::doInitialization(Module &M) {
+bool DataFlowSanitizer::init(Module &M) {
   Triple TargetTriple(M.getTargetTriple());
   bool IsX86_64 = TargetTriple.getArch() == Triple::x86_64;
   bool IsMIPS64 = TargetTriple.isMIPS64();
@@ -785,7 +774,9 @@
 DFSanLoadStoreCmpCallbackFnTy);
 }
 
-bool DataFlowSanitizer::runOnModule(Module &M) {
+bool DataFlowSanitizer::runImpl(Module &M) {
+  init(M);
+
   if (ABIList.isIn(M, "skip"))
 return false;
 
@@ -1817,3 +1808,37 @@
   DFSF.PHIFixups.push_back(std::make_pair(&PN, ShadowPN));
   DFSF.setShadow(&PN, ShadowPN);
 }
+
+class DataFlowSanitizerLegacyPass : public ModulePass {
+private:
+  std::vector ABIListFiles;
+
+public:
+  static char ID;
+
+  DataFlowSanitizerLegacyPass(
+  const std::vector &ABIListFiles = std::vector())
+  : ModulePass(ID), ABIListFiles(ABIListFiles) {}
+
+  bool run

[PATCH] D84707: [DFSan][NewPM] Port DataFlowSanitizer to NewPM

2020-07-27 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks marked an inline comment as done.
aeubanks added inline comments.



Comment at: llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h:11
+
+#include "llvm/IR/Function.h"
+#include "llvm/IR/Module.h"

ychen wrote:
> Is Function.h needed?
Nope, removed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84707/new/

https://reviews.llvm.org/D84707

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D84774: [NewPM][PassInstrument] Add PrintPass callback to StandardInstrumentations

2020-07-28 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks accepted this revision.
aeubanks added a comment.

Thanks for doing this!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84774/new/

https://reviews.llvm.org/D84774

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D84707: [DFSan][NewPM] Port DataFlowSanitizer to NewPM

2020-07-29 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added inline comments.



Comment at: llvm/lib/Passes/PassRegistry.def:92
 MODULE_PASS("verify", VerifierPass())
+MODULE_PASS("dfsan", DataFlowSanitizerPass())
 MODULE_PASS("asan-module", ModuleAddressSanitizerPass(/*CompileKernel=*/false, 
false, true, false))

morehouse wrote:
> Nit:  maybe "dfsan-module" for consistency?
Almost all of the others have both a module and function pass, so the "-module" 
is to distinguish between those. I think sancov-module is the only one that 
doesn't fit that, and I actually did want to rename it to sancov.

I'd like to keep the name the same as the legacy pass for migration reasons 
(basically so I don't have to touch every dfsan test).



Comment at: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:778
+bool DataFlowSanitizer::runImpl(Module &M) {
+  init(M);
+

morehouse wrote:
> Do we need a bool to avoid calling `init` more than once?
A new `DataFlowSanitizer` is constructed for each `run`/`runOnModule` so that 
shouldn't be necessary.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84707/new/

https://reviews.llvm.org/D84707

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D84707: [DFSan][NewPM] Port DataFlowSanitizer to NewPM

2020-07-29 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG71d0a2b8a313: [DFSan][NewPM] Port DataFlowSanitizer to NewPM 
(authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84707/new/

https://reviews.llvm.org/D84707

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/bindings/go/llvm/InstrumentationBindings.cpp
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Transforms/Instrumentation.h
  llvm/include/llvm/Transforms/Instrumentation/DataFlowSanitizer.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
  llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
  llvm/test/Instrumentation/DataFlowSanitizer/call.ll

Index: llvm/test/Instrumentation/DataFlowSanitizer/call.ll
===
--- llvm/test/Instrumentation/DataFlowSanitizer/call.ll
+++ llvm/test/Instrumentation/DataFlowSanitizer/call.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -dfsan -S | FileCheck %s
+; RUN: opt < %s -passes=dfsan -S | FileCheck %s
 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"
 
Index: llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
===
--- llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
+++ llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
@@ -119,7 +119,7 @@
   initializeHWAddressSanitizerLegacyPassPass(Registry);
   initializeThreadSanitizerLegacyPassPass(Registry);
   initializeModuleSanitizerCoverageLegacyPassPass(Registry);
-  initializeDataFlowSanitizerPass(Registry);
+  initializeDataFlowSanitizerLegacyPassPass(Registry);
 }
 
 /// LLVMInitializeInstrumentation - C binding for
Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===
--- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -46,6 +46,7 @@
 //
 //===--===//
 
+#include "llvm/Transforms/Instrumentation/DataFlowSanitizer.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/DepthFirstIterator.h"
@@ -78,6 +79,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/MDBuilder.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/PassManager.h"
 #include "llvm/IR/Type.h"
 #include "llvm/IR/User.h"
 #include "llvm/IR/Value.h"
@@ -292,7 +294,7 @@
   llvm::makeArrayRef(ArgumentAttributes));
 }
 
-class DataFlowSanitizer : public ModulePass {
+class DataFlowSanitizer {
   friend struct DFSanFunction;
   friend class DFSanVisitor;
 
@@ -390,14 +392,12 @@
   void initializeCallbackFunctions(Module &M);
   void initializeRuntimeFunctions(Module &M);
 
-public:
-  static char ID;
+  bool init(Module &M);
 
-  DataFlowSanitizer(const std::vector &ABIListFiles =
-std::vector());
+public:
+  DataFlowSanitizer(const std::vector &ABIListFiles);
 
-  bool doInitialization(Module &M) override;
-  bool runOnModule(Module &M) override;
+  bool runImpl(Module &M);
 };
 
 struct DFSanFunction {
@@ -482,19 +482,8 @@
 
 } // end anonymous namespace
 
-char DataFlowSanitizer::ID;
-
-INITIALIZE_PASS(DataFlowSanitizer, "dfsan",
-"DataFlowSanitizer: dynamic data flow analysis.", false, false)
-
-ModulePass *llvm::createDataFlowSanitizerPass(
-const std::vector &ABIListFiles) {
-  return new DataFlowSanitizer(ABIListFiles);
-}
-
 DataFlowSanitizer::DataFlowSanitizer(
-const std::vector &ABIListFiles)
-: ModulePass(ID) {
+const std::vector &ABIListFiles) {
   std::vector AllABIListFiles(std::move(ABIListFiles));
   AllABIListFiles.insert(AllABIListFiles.end(), ClABIListFiles.begin(),
  ClABIListFiles.end());
@@ -559,7 +548,7 @@
   ArgumentIndexMapping);
 }
 
-bool DataFlowSanitizer::doInitialization(Module &M) {
+bool DataFlowSanitizer::init(Module &M) {
   Triple TargetTriple(M.getTargetTriple());
   bool IsX86_64 = TargetTriple.getArch() == Triple::x86_64;
   bool IsMIPS64 = TargetTriple.isMIPS64();
@@ -785,7 +774,9 @@
 DFSanLoadStoreCmpCallbackFnTy);
 }
 
-bool DataFlowSanitizer::runOnModule(Module &M) {
+bool DataFlowSanitizer::runImpl(Module &M) {
+  init(M);
+
   if (ABIList.isIn(M, "skip"))
 return false;
 
@@ -1817,3 +1808,37 @@
   DFSF.PHIFixups.push_back(std::make_pair(&PN, ShadowPN));
   DFSF.setShadow(&PN, ShadowPN);
 }
+
+class DataFlowSanitizerLegacyPass : public ModulePass {
+private:
+  std::vector ABIListFiles;
+
+public:
+  static char ID;
+
+  DataFlowSanitizer

[PATCH] D77962: PR38490: Support reading values out of __uuidof(X) expressions during constant evaluation.

2020-04-13 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:3949
+  // Special-case reading from __uuidof expressions so we don't have to
+  // construct an APValue for the whole uuid.
+  if (LVal.Designator.isOnePastTheEnd()) {

For my knowledge, why try to avoid constructing an APValue for the whole uuid? 
Is special casing this necessary?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77962/new/

https://reviews.llvm.org/D77962



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81273: [WIP] Enable new pass manager as default DO NOT SUBMIT

2020-06-05 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
Herald added subscribers: llvm-commits, cfe-commits, mgorny.
Herald added projects: clang, LLVM.

Just for bot testing

Depends on D81175 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81273

Files:
  clang/CMakeLists.txt
  llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
  llvm/utils/gn/secondary/clang/test/BUILD.gn


Index: llvm/utils/gn/secondary/clang/test/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/test/BUILD.gn
+++ llvm/utils/gn/secondary/clang/test/BUILD.gn
@@ -57,7 +57,7 @@
 # builds exist, to make sure it's a toolchain var.
 "CMAKE_CXX_COMPILER=c++",
 "ENABLE_BACKTRACES=1",
-"ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=0",
+"ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=1",
 "LLVM_HOST_TRIPLE=$llvm_current_triple",
 "LLVM_LIT_TOOLS_DIR=",  # Intentionally empty, matches cmake build.
 "LLVM_USE_SANITIZER=",
Index: llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
+++ llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
@@ -34,7 +34,7 @@
 "BACKEND_PACKAGE_STRING=LLVM ${llvm_version}git",
 "ENABLE_LINKER_BUILD_ID=",
 "ENABLE_X86_RELAX_RELOCATIONS=",
-"ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=",
+"ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=1",
 "CLANG_ENABLE_OBJC_REWRITER=1",  # FIXME: flag?
 "CLANG_SYSTEMZ_DEFAULT_ARCH=z10",
   ]
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -256,7 +256,7 @@
 set(ENABLE_X86_RELAX_RELOCATIONS OFF CACHE BOOL
 "enable x86 relax relocations by default")
 
-set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER FALSE CACHE BOOL
+set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER TRUE CACHE BOOL
   "Enable the experimental new pass manager by default.")
 
 set(CLANG_SPAWN_CC1 OFF CACHE BOOL


Index: llvm/utils/gn/secondary/clang/test/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/test/BUILD.gn
+++ llvm/utils/gn/secondary/clang/test/BUILD.gn
@@ -57,7 +57,7 @@
 # builds exist, to make sure it's a toolchain var.
 "CMAKE_CXX_COMPILER=c++",
 "ENABLE_BACKTRACES=1",
-"ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=0",
+"ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=1",
 "LLVM_HOST_TRIPLE=$llvm_current_triple",
 "LLVM_LIT_TOOLS_DIR=",  # Intentionally empty, matches cmake build.
 "LLVM_USE_SANITIZER=",
Index: llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
===
--- llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
+++ llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
@@ -34,7 +34,7 @@
 "BACKEND_PACKAGE_STRING=LLVM ${llvm_version}git",
 "ENABLE_LINKER_BUILD_ID=",
 "ENABLE_X86_RELAX_RELOCATIONS=",
-"ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=",
+"ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=1",
 "CLANG_ENABLE_OBJC_REWRITER=1",  # FIXME: flag?
 "CLANG_SYSTEMZ_DEFAULT_ARCH=z10",
   ]
Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -256,7 +256,7 @@
 set(ENABLE_X86_RELAX_RELOCATIONS OFF CACHE BOOL
 "enable x86 relax relocations by default")
 
-set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER FALSE CACHE BOOL
+set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER TRUE CACHE BOOL
   "Enable the experimental new pass manager by default.")
 
 set(CLANG_SPAWN_CC1 OFF CACHE BOOL
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81323: Move *San module passes later in the NPM pipeline

2020-06-05 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
aeubanks added reviewers: leonardchan, vitalybuka.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This fixes pr33372.cpp under the new pass manager.

ASan adds padding to globals. For example, it will change a {i32, i32, i32} to 
a {{i32, i32, i32}, [52 x i8]}. However, when loading from the {i32, i32, i32}, 
InstCombine may (after various optimizations) end up loading 16 bytes instead 
of 12, likely because it thinks the [52 x i8] padding is ok to load from. But 
ASan checks that padding should not be loaded from.

Ultimately this is an issue of *San passes wanting to be run after all 
optimizations. This change moves the module passes right next to the 
corresponding function passes.

Also remove comment that's no longer relevant, this is the last ASan/MSan/TSan 
failure under the NPM (hopefully...).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81323

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1265,7 +1265,6 @@
 
   // Register callbacks to schedule sanitizer passes at the appropriate 
part of
   // the pipeline.
-  // FIXME: either handle asan/the remaining sanitizers or error out
   if (LangOpts.Sanitize.has(SanitizerKind::LocalBounds))
 PB.registerScalarOptimizerLateEPCallback(
 [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) 
{
@@ -1288,48 +1287,38 @@
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
 int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
 bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
-PB.registerPipelineStartEPCallback(
-[TrackOrigins, Recover](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
-});
 PB.registerOptimizerLastEPCallback(
 [TrackOrigins, Recover](ModulePassManager &MPM,
 PassBuilder::OptimizationLevel Level) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
   MPM.addPass(createModuleToFunctionPassAdaptor(
   MemorySanitizerPass({TrackOrigins, Recover, false})));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
-PB.registerPipelineStartEPCallback(
-[](ModulePassManager &MPM) { MPM.addPass(ThreadSanitizerPass()); 
});
 PB.registerOptimizerLastEPCallback(
 [](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
+  MPM.addPass(ThreadSanitizerPass());
   MPM.addPass(
   createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Address)) {
-PB.registerPipelineStartEPCallback([&](ModulePassManager &MPM) {
-  MPM.addPass(
-  RequireAnalysisPass());
-});
 bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Address);
 bool UseAfterScope = CodeGenOpts.SanitizeAddressUseAfterScope;
-PB.registerOptimizerLastEPCallback(
-[Recover, UseAfterScope](ModulePassManager &MPM,
- PassBuilder::OptimizationLevel Level) {
-  MPM.addPass(
-  createModuleToFunctionPassAdaptor(AddressSanitizerPass(
-  /*CompileKernel=*/false, Recover, UseAfterScope)));
-});
 bool ModuleUseAfterScope = asanUseGlobalsGC(TargetTriple, CodeGenOpts);
 bool UseOdrIndicator = CodeGenOpts.SanitizeAddressUseOdrIndicator;
-PB.registerPipelineStartEPCallback(
-[Recover, ModuleUseAfterScope,
- UseOdrIndicator](ModulePassManager &MPM) {
+PB.registerOptimizerLastEPCallback(
+[Recover, UseAfterScope, ModuleUseAfterScope, UseOdrIndicator](
+ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
+  MPM.addPass(
+  RequireAnalysisPass());
   MPM.addPass(ModuleAddressSanitizerPass(
   /*CompileKernel=*/false, Recover, ModuleUseAfterScope,
   UseOdrIndicator));
+  MPM.addPass(
+  createModuleToFunctionPassAdaptor(AddressSanitizerPass(
+  /*CompileKernel=*/false, Recover, UseAfterScope)));
 });
   }
   if (Optional Options = getGCOVOptions(CodeGenOpts))


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1265,7 +1265,6 @@
 
   // Register callbacks to schedule sanitizer passes at the appropriate part of
   // the pi

[PATCH] D81323: Move *San module passes later in the NPM pipeline

2020-06-05 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

This is causing some tests under check-clang to fail, taking a look.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81323/new/

https://reviews.llvm.org/D81323



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81323: Move *San module passes later in the NPM pipeline

2020-06-05 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 268993.
aeubanks added a comment.

Update some tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81323/new/

https://reviews.llvm.org/D81323

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/test/CodeGen/asan-new-pm.ll
  clang/test/CodeGen/sanitizer-module-constructor.c

Index: clang/test/CodeGen/sanitizer-module-constructor.c
===
--- clang/test/CodeGen/sanitizer-module-constructor.c
+++ clang/test/CodeGen/sanitizer-module-constructor.c
@@ -19,4 +19,3 @@
 // 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
Index: clang/test/CodeGen/asan-new-pm.ll
===
--- clang/test/CodeGen/asan-new-pm.ll
+++ clang/test/CodeGen/asan-new-pm.ll
@@ -1,12 +1,8 @@
 ; Test that ASan runs with the new pass manager
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s
 
-; DAG-CHECK: @llvm.global_ctors = {{.*}}@asan.module_ctor
+; CHECK-DAG: @llvm.global_ctors = {{.*}}@asan.module_ctor
 
 define i32 @test_load(i32* %a) sanitize_address {
 entry:
@@ -16,13 +12,11 @@
 
 ; CHECK: __asan_init
 
-; DAG-CHECK: define internal void @asan.module_ctor() {
+; CHECK-DAG: define internal void @asan.module_ctor() {
 ; CHECK:   {{.*}} call void @__asan_init()
 ; CHECK:   {{.*}} call void @__asan_version_mismatch_check_v8()
 ; CHECK:   ret void
 ; CHECK: }
 
-; DAG-CHECK: __asan_version_mismatch_check_v8
+; CHECK-DAG: __asan_version_mismatch_check_v8
 
-; This is not used in ThinLTO
-; DAG-LTO: __asan_report_load4
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1265,7 +1265,6 @@
 
   // Register callbacks to schedule sanitizer passes at the appropriate part of
   // the pipeline.
-  // FIXME: either handle asan/the remaining sanitizers or error out
   if (LangOpts.Sanitize.has(SanitizerKind::LocalBounds))
 PB.registerScalarOptimizerLateEPCallback(
 [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
@@ -1288,48 +1287,38 @@
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
 int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
 bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
-PB.registerPipelineStartEPCallback(
-[TrackOrigins, Recover](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
-});
 PB.registerOptimizerLastEPCallback(
 [TrackOrigins, Recover](ModulePassManager &MPM,
 PassBuilder::OptimizationLevel Level) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
   MPM.addPass(createModuleToFunctionPassAdaptor(
   MemorySanitizerPass({TrackOrigins, Recover, false})));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
-PB.registerPipelineStartEPCallback(
-[](ModulePassManager &MPM) { MPM.addPass(ThreadSanitizerPass()); });
 PB.registerOptimizerLastEPCallback(
 [](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
+  MPM.addPass(ThreadSanitizerPass());
   MPM.add

[PATCH] D81323: Move *San module passes later in the NPM pipeline

2020-06-05 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

Could you take a look again at the test changes?
LTO + sanitizers doesn't work under NPM because [1] never ends up calling the 
passes registered via registerOptimizerLastEPCallback().

[1] 
https://github.com/llvm/llvm-project/blob/e429cffd4f228f70c1d9df0e5d77c08590dd9766/clang/lib/CodeGen/BackendUtil.cpp#L1352


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81323/new/

https://reviews.llvm.org/D81323



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81323: Move *San module passes later in the NPM pipeline

2020-06-08 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc07339c6754e: Move *San module passes later in the NPM 
pipeline (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81323/new/

https://reviews.llvm.org/D81323

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/test/CodeGen/asan-new-pm.ll
  clang/test/CodeGen/sanitizer-module-constructor.c

Index: clang/test/CodeGen/sanitizer-module-constructor.c
===
--- clang/test/CodeGen/sanitizer-module-constructor.c
+++ clang/test/CodeGen/sanitizer-module-constructor.c
@@ -19,4 +19,3 @@
 // 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
Index: clang/test/CodeGen/asan-new-pm.ll
===
--- clang/test/CodeGen/asan-new-pm.ll
+++ clang/test/CodeGen/asan-new-pm.ll
@@ -1,12 +1,8 @@
 ; Test that ASan runs with the new pass manager
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s
 
-; DAG-CHECK: @llvm.global_ctors = {{.*}}@asan.module_ctor
+; CHECK-DAG: @llvm.global_ctors = {{.*}}@asan.module_ctor
 
 define i32 @test_load(i32* %a) sanitize_address {
 entry:
@@ -16,13 +12,11 @@
 
 ; CHECK: __asan_init
 
-; DAG-CHECK: define internal void @asan.module_ctor() {
+; CHECK-DAG: define internal void @asan.module_ctor() {
 ; CHECK:   {{.*}} call void @__asan_init()
 ; CHECK:   {{.*}} call void @__asan_version_mismatch_check_v8()
 ; CHECK:   ret void
 ; CHECK: }
 
-; DAG-CHECK: __asan_version_mismatch_check_v8
+; CHECK-DAG: __asan_version_mismatch_check_v8
 
-; This is not used in ThinLTO
-; DAG-LTO: __asan_report_load4
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1265,7 +1265,6 @@
 
   // Register callbacks to schedule sanitizer passes at the appropriate part of
   // the pipeline.
-  // FIXME: either handle asan/the remaining sanitizers or error out
   if (LangOpts.Sanitize.has(SanitizerKind::LocalBounds))
 PB.registerScalarOptimizerLateEPCallback(
 [](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
@@ -1288,48 +1287,38 @@
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
 int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
 bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
-PB.registerPipelineStartEPCallback(
-[TrackOrigins, Recover](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
-});
 PB.registerOptimizerLastEPCallback(
 [TrackOrigins, Recover](ModulePassManager &MPM,
 PassBuilder::OptimizationLevel Level) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
   MPM.addPass(createModuleToFunctionPassAdaptor(
   MemorySanitizerPass({TrackOrigins, Recover, false})));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
-PB.registerPipelineStartEPCallback(
-[](ModulePassManager &MPM) { MPM.addPass(ThreadSanitizerPass()); });
 PB.registerOptimizerLastEPCallback(
 [](ModulePassManager &MPM, PassBuilder::Optimizatio

[PATCH] D81481: Change debuginfo check for addHeapAllocSiteMetadata

2020-06-09 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
aeubanks added a reviewer: akhuang.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Move check inside of addHeapAllocSiteMetadata().
Change check to DebugInfo <= DebugLineTablesOnly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81481

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGExprCXX.cpp


Index: clang/lib/CodeGen/CGExprCXX.cpp
===
--- clang/lib/CodeGen/CGExprCXX.cpp
+++ clang/lib/CodeGen/CGExprCXX.cpp
@@ -1639,8 +1639,7 @@
   EmitNewDeleteCall(*this, allocator, allocatorType, allocatorArgs);
 
 // Set !heapallocsite metadata on the call to operator new.
-if (CGM.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo &&
-getDebugInfo())
+if (getDebugInfo())
   if (auto *newCall = dyn_cast(RV.getScalarVal()))
 getDebugInfo()->addHeapAllocSiteMetadata(newCall, allocType,
  E->getExprLoc());
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2149,6 +2149,9 @@
 void CGDebugInfo::addHeapAllocSiteMetadata(llvm::CallBase *CI,
QualType AllocatedTy,
SourceLocation Loc) {
+  if (CGM.getCodeGenOpts().getDebugInfo() <=
+  codegenoptions::DebugLineTablesOnly)
+return;
   llvm::MDNode *node;
   if (AllocatedTy->isVoidType())
 node = llvm::MDNode::get(CGM.getLLVMContext(), None);


Index: clang/lib/CodeGen/CGExprCXX.cpp
===
--- clang/lib/CodeGen/CGExprCXX.cpp
+++ clang/lib/CodeGen/CGExprCXX.cpp
@@ -1639,8 +1639,7 @@
   EmitNewDeleteCall(*this, allocator, allocatorType, allocatorArgs);
 
 // Set !heapallocsite metadata on the call to operator new.
-if (CGM.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo &&
-getDebugInfo())
+if (getDebugInfo())
   if (auto *newCall = dyn_cast(RV.getScalarVal()))
 getDebugInfo()->addHeapAllocSiteMetadata(newCall, allocType,
  E->getExprLoc());
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2149,6 +2149,9 @@
 void CGDebugInfo::addHeapAllocSiteMetadata(llvm::CallBase *CI,
QualType AllocatedTy,
SourceLocation Loc) {
+  if (CGM.getCodeGenOpts().getDebugInfo() <=
+  codegenoptions::DebugLineTablesOnly)
+return;
   llvm::MDNode *node;
   if (AllocatedTy->isVoidType())
 node = llvm::MDNode::get(CGM.getLLVMContext(), None);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81481: Change debuginfo check for addHeapAllocSiteMetadata

2020-06-09 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbc38793852c0: Change debuginfo check for 
addHeapAllocSiteMetadata (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81481/new/

https://reviews.llvm.org/D81481

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGExprCXX.cpp


Index: clang/lib/CodeGen/CGExprCXX.cpp
===
--- clang/lib/CodeGen/CGExprCXX.cpp
+++ clang/lib/CodeGen/CGExprCXX.cpp
@@ -1639,8 +1639,7 @@
   EmitNewDeleteCall(*this, allocator, allocatorType, allocatorArgs);
 
 // Set !heapallocsite metadata on the call to operator new.
-if (CGM.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo &&
-getDebugInfo())
+if (getDebugInfo())
   if (auto *newCall = dyn_cast(RV.getScalarVal()))
 getDebugInfo()->addHeapAllocSiteMetadata(newCall, allocType,
  E->getExprLoc());
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2149,6 +2149,9 @@
 void CGDebugInfo::addHeapAllocSiteMetadata(llvm::CallBase *CI,
QualType AllocatedTy,
SourceLocation Loc) {
+  if (CGM.getCodeGenOpts().getDebugInfo() <=
+  codegenoptions::DebugLineTablesOnly)
+return;
   llvm::MDNode *node;
   if (AllocatedTy->isVoidType())
 node = llvm::MDNode::get(CGM.getLLVMContext(), None);


Index: clang/lib/CodeGen/CGExprCXX.cpp
===
--- clang/lib/CodeGen/CGExprCXX.cpp
+++ clang/lib/CodeGen/CGExprCXX.cpp
@@ -1639,8 +1639,7 @@
   EmitNewDeleteCall(*this, allocator, allocatorType, allocatorArgs);
 
 // Set !heapallocsite metadata on the call to operator new.
-if (CGM.getCodeGenOpts().getDebugInfo() != codegenoptions::NoDebugInfo &&
-getDebugInfo())
+if (getDebugInfo())
   if (auto *newCall = dyn_cast(RV.getScalarVal()))
 getDebugInfo()->addHeapAllocSiteMetadata(newCall, allocType,
  E->getExprLoc());
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2149,6 +2149,9 @@
 void CGDebugInfo::addHeapAllocSiteMetadata(llvm::CallBase *CI,
QualType AllocatedTy,
SourceLocation Loc) {
+  if (CGM.getCodeGenOpts().getDebugInfo() <=
+  codegenoptions::DebugLineTablesOnly)
+return;
   llvm::MDNode *node;
   if (AllocatedTy->isVoidType())
 node = llvm::MDNode::get(CGM.getLLVMContext(), None);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81422: Change filecheck default to dump input on failure

2020-06-16 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

FWIW I didn't see this change initially but was pleasantly surprised with the 
extra output when debugging a newly added (relatively small) test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81422/new/

https://reviews.llvm.org/D81422



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D83013: [LPM] Port CGProfilePass from NPM to LPM

2020-07-05 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D83013#2132070 , @echristo wrote:

> Adding Chandler and Alina here as well.
>
> In general, I don't think that this is such a great idea. Being able to have 
> this sort of thing work more reliably is one of the reasons for the new pass 
> manager. I think I'd like to see this split out into an old versus new pass 
> manager pass to avoid the difficulty of cleaning this up after we finish 
> migrating llvm to the new pass manager. This also seems to add some technical 
> debt around options and other enablement which is also less than ideal. Is 
> this compelling to add right now versus finishing work migrating llvm 
> completely to the new pass manager and removing the old one? From speaking 
> with Alina I think that work should be done in a short while.
>
> Thanks.
>
> -eric


I don't think we're that close yet, probably at least a couple months out, 
there are lots of loose ends to be tied up. I'll make a post soon in llvm-dev 
(maybe first we can sync up again) about what I think needs to be done before 
the NPM switch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83013/new/

https://reviews.llvm.org/D83013



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D83519: [NewPM] Support optnone under new pass manager

2020-07-09 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
Herald added a reviewer: bollu.
Herald added subscribers: llvm-commits, cfe-commits, jfb, dexonsmith, 
steven_wu, hiraditya.
Herald added projects: clang, LLVM.

This uses pass instrumentation callbacks to skip optional passes.
PassInfoMixin now declares that passes inheriting from it are by default
optional. Using RequiredPassInfoMixin overrides the pass to be required.
The new OptNoneInstrumentation is part of StandardInstrumentations.

The feature of skipping optional passes for optnone functions under NPM
is gated on a -enable-npm-optnone flag. Currently it is by default
false. That is because we still need to mark all required passes to be
required. Otherwise optnone functions will start behaving incorrectly.
After that is done in following changes, we can remove the flag and
always enable this.

All adaptors/managers must be required, since the pass(es) they are
wrapping may be required.

In the future, opt-bisect will use this same mechanmism of determining
which passes are required/optional.

Depends on D83498 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83519

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Analysis/CGSCCPassManager.h
  llvm/include/llvm/IR/PassInstrumentation.h
  llvm/include/llvm/IR/PassManager.h
  llvm/include/llvm/IR/PassManagerInternal.h
  llvm/include/llvm/Passes/StandardInstrumentations.h
  llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
  llvm/lib/IR/PassTimingInfo.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Feature/optnone-opt.ll
  llvm/tools/opt/NewPMDriver.cpp
  llvm/unittests/IR/PassBuilderCallbacksTest.cpp
  polly/include/polly/ScopPass.h

Index: polly/include/polly/ScopPass.h
===
--- polly/include/polly/ScopPass.h
+++ polly/include/polly/ScopPass.h
@@ -204,7 +204,7 @@
 
 template 
 class FunctionToScopPassAdaptor
-: public PassInfoMixin> {
+: public RequiredPassInfoMixin> {
 public:
   explicit FunctionToScopPassAdaptor(ScopPassT Pass) : Pass(std::move(Pass)) {}
 
Index: llvm/unittests/IR/PassBuilderCallbacksTest.cpp
===
--- llvm/unittests/IR/PassBuilderCallbacksTest.cpp
+++ llvm/unittests/IR/PassBuilderCallbacksTest.cpp
@@ -317,18 +317,20 @@
   PassInstrumentationCallbacks Callbacks;
 
   MockPassInstrumentationCallbacks() {
-ON_CALL(*this, runBeforePass(_, _)).WillByDefault(Return(true));
+ON_CALL(*this, runBeforePass(_, _, _)).WillByDefault(Return(true));
   }
-  MOCK_METHOD2(runBeforePass, bool(StringRef PassID, llvm::Any));
+  MOCK_METHOD3(runBeforePass,
+   bool(StringRef PassID, bool PassIsRequired, llvm::Any));
   MOCK_METHOD2(runAfterPass, void(StringRef PassID, llvm::Any));
   MOCK_METHOD1(runAfterPassInvalidated, void(StringRef PassID));
   MOCK_METHOD2(runBeforeAnalysis, void(StringRef PassID, llvm::Any));
   MOCK_METHOD2(runAfterAnalysis, void(StringRef PassID, llvm::Any));
 
   void registerPassInstrumentation() {
-Callbacks.registerBeforePassCallback([this](StringRef P, llvm::Any IR) {
-  return this->runBeforePass(P, IR);
-});
+Callbacks.registerBeforePassCallback(
+[this](StringRef P, bool PassIsRequired, llvm::Any IR) {
+  return this->runBeforePass(P, PassIsRequired, IR);
+});
 Callbacks.registerAfterPassCallback(
 [this](StringRef P, llvm::Any IR) { this->runAfterPass(P, IR); });
 Callbacks.registerAfterPassInvalidatedCallback(
@@ -347,7 +349,7 @@
 // Make sure to avoid ignoring Mock passes/analysis, we definitely want
 // to check these explicitly.
 EXPECT_CALL(*this,
-runBeforePass(Not(HasNameRegex("Mock")), HasName(IRName)))
+runBeforePass(Not(HasNameRegex("Mock")), _, HasName(IRName)))
 .Times(AnyNumber());
 EXPECT_CALL(*this, runAfterPass(Not(HasNameRegex("Mock")), HasName(IRName)))
 .Times(AnyNumber());
@@ -497,7 +499,7 @@
   // PassInstrumentation calls should happen in-sequence, in the same order
   // as passes/analyses are scheduled.
   ::testing::Sequence PISequence;
-  EXPECT_CALL(CallbacksHandle, runBeforePass(HasNameRegex("MockPassHandle"),
+  EXPECT_CALL(CallbacksHandle, runBeforePass(HasNameRegex("MockPassHandle"), _,
  HasName("")))
   .InSequence(PISequence);
   EXPECT_CALL(CallbacksHandle,
@@ -525,7 +527,7 @@
   CallbacksHandle.ignoreNonMockPassInstrumentation("");
 
   // Skip the pass by returning false.
-  EXPECT_CALL(CallbacksHandle, runBeforePass(HasNameRegex("MockPassHandle"),
+  EXPECT_CALL(CallbacksHandle, runBeforePass(HasNameRegex("MockPassHandle"), _,
  HasName("")))
   .WillOnce(Return(false));
 
@@ -575,7 +577,7 @@
   // as passes/analyses are scheduled.
   ::testing::Sequence PISequence;
   EXP

[PATCH] D83519: [NewPM] Support optnone under new pass manager

2020-07-09 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks marked an inline comment as done.
aeubanks added inline comments.



Comment at: llvm/include/llvm/IR/PassInstrumentation.h:150
 for (auto &C : Callbacks->BeforePassCallbacks)
-  ShouldRun &= C(Pass.name(), llvm::Any(&IR));
+  ShouldRun &= C(Pass.name(), Pass.isRequired(), llvm::Any(&IR));
 return ShouldRun;

ychen wrote:
> Could we do this to not changing the callback API?
> `ShouldRun &= C(Pass.name(), llvm::Any(&IR)) || Pass.isRequired();`
Each pass instrumentation should decide whether or not to run the pass based on 
whether or not the pass is required or optional. An optional pass may still be 
run, (which should be the case for the vast majority of instances).

For example, the optnone would only care if a pass is required or not if it 
sees that a function is marked optnone.
Similarly, opt-bisect would only care if a pass is required if it's hit the 
bisect limit.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83519/new/

https://reviews.llvm.org/D83519



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D83519: [NewPM] Support optnone under new pass manager

2020-07-09 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks marked an inline comment as done.
aeubanks added inline comments.



Comment at: llvm/include/llvm/IR/PassInstrumentation.h:150
 for (auto &C : Callbacks->BeforePassCallbacks)
-  ShouldRun &= C(Pass.name(), llvm::Any(&IR));
+  ShouldRun &= C(Pass.name(), Pass.isRequired(), llvm::Any(&IR));
 return ShouldRun;

aeubanks wrote:
> ychen wrote:
> > Could we do this to not changing the callback API?
> > `ShouldRun &= C(Pass.name(), llvm::Any(&IR)) || Pass.isRequired();`
> Each pass instrumentation should decide whether or not to run the pass based 
> on whether or not the pass is required or optional. An optional pass may 
> still be run, (which should be the case for the vast majority of instances).
> 
> For example, the optnone would only care if a pass is required or not if it 
> sees that a function is marked optnone.
> Similarly, opt-bisect would only care if a pass is required if it's hit the 
> bisect limit.
Sorry, now I understand what you mean, the ands and ors confused me.

I don't want to rule out the possibility of some future pass instrumentation 
wanting to skip even a required pass. But I am open to discussion on this point.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83519/new/

https://reviews.llvm.org/D83519



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D83519: [NewPM] Support optnone under new pass manager

2020-07-10 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks marked an inline comment as done.
aeubanks added a comment.

In D83519#2144403 , @ychen wrote:

> High-level request: how about split this patch into two, the first for the 
> `require` pass part; the second for the PassInstrument callback. Then we 
> could discuss the choices of first patch and D82344 
> .


Good idea, will split the patch and take a closer look at your patch.




Comment at: llvm/include/llvm/IR/PassInstrumentation.h:150
 for (auto &C : Callbacks->BeforePassCallbacks)
-  ShouldRun &= C(Pass.name(), llvm::Any(&IR));
+  ShouldRun &= C(Pass.name(), Pass.isRequired(), llvm::Any(&IR));
 return ShouldRun;

ychen wrote:
> aeubanks wrote:
> > aeubanks wrote:
> > > ychen wrote:
> > > > Could we do this to not changing the callback API?
> > > > `ShouldRun &= C(Pass.name(), llvm::Any(&IR)) || Pass.isRequired();`
> > > Each pass instrumentation should decide whether or not to run the pass 
> > > based on whether or not the pass is required or optional. An optional 
> > > pass may still be run, (which should be the case for the vast majority of 
> > > instances).
> > > 
> > > For example, the optnone would only care if a pass is required or not if 
> > > it sees that a function is marked optnone.
> > > Similarly, opt-bisect would only care if a pass is required if it's hit 
> > > the bisect limit.
> > Sorry, now I understand what you mean, the ands and ors confused me.
> > 
> > I don't want to rule out the possibility of some future pass 
> > instrumentation wanting to skip even a required pass. But I am open to 
> > discussion on this point.
> > I don't want to rule out the possibility of some future pass 
> > instrumentation wanting to skip even a required pass. But I am open to 
> > discussion on this point.
> 
> That makes sense. However, since this requires changing the callback 
> API(return value or parameter), and there is no real use of it for the 
> moment. IMHO we should defer it to the use case comes up. If there was no 
> change to the callback API, I wouldn't mind doing this for now.
> 
> The immediate motivation for the `require` is the same as D82344 (the 
> approach is a little bit different). That's we don't want to consider 
> infrastructure passes (pass managers, adaptor passes that have a nested pass 
> manager)
Sounds good, I'll go with your approach for keeping the current API.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83519/new/

https://reviews.llvm.org/D83519



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D83519: [NewPM] Support optnone under new pass manager

2020-07-10 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D83519#2144463 , @aeubanks wrote:

> In D83519#2144403 , @ychen wrote:
>
> > High-level request: how about split this patch into two, the first for the 
> > `require` pass part; the second for the PassInstrument callback. Then we 
> > could discuss the choices of first patch and D82344 
> > .
>
>
> Good idea, will split the patch and take a closer look at your patch.


I split the required passes part into https://reviews.llvm.org/D83575.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83519/new/

https://reviews.llvm.org/D83519



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82231: [NFC] Remove unused pass name parser classes

2020-06-19 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
Herald added subscribers: llvm-commits, cfe-commits, mgorny.
Herald added projects: clang, LLVM.
aeubanks added a reviewer: echristo.
aeubanks updated this revision to Diff 272166.
aeubanks added a comment.

Unintended change


Looks like these were for the most part touched over a decade ago.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82231

Files:
  llvm/include/llvm/IR/LegacyPassNameParser.h


Index: llvm/include/llvm/IR/LegacyPassNameParser.h
===
--- llvm/include/llvm/IR/LegacyPassNameParser.h
+++ llvm/include/llvm/IR/LegacyPassNameParser.h
@@ -92,47 +92,6 @@
   }
 };
 
-///===--===//
-/// FilteredPassNameParser class - Make use of the pass registration
-/// mechanism to automatically add a command line argument to opt for
-/// each pass that satisfies a filter criteria.  Filter should return
-/// true for passes to be registered as command-line options.
-///
-template
-class FilteredPassNameParser : public PassNameParser {
-private:
-  Filter filter;
-
-public:
-  bool ignorablePassImpl(const PassInfo *P) const override {
-return !filter(*P);
-  }
-};
-
-///===--===//
-/// PassArgFilter - A filter for use with PassNameFilterParser that only
-/// accepts a Pass whose Arg matches certain strings.
-///
-/// Use like this:
-///
-/// extern const char AllowedPassArgs[] = "-anders_aa -dse";
-///
-/// static cl::list<
-///   const PassInfo*,
-///   bool,
-///   FilteredPassNameParser > >
-/// PassList(cl::desc("Passes available:"));
-///
-/// Only the -anders_aa and -dse options will be available to the user.
-///
-template
-class PassArgFilter {
-public:
-  bool operator()(const PassInfo &P) const {
-return StringRef(Args).contains(P.getPassArgument());
-  }
-};
-
 } // End llvm namespace
 
 #endif


Index: llvm/include/llvm/IR/LegacyPassNameParser.h
===
--- llvm/include/llvm/IR/LegacyPassNameParser.h
+++ llvm/include/llvm/IR/LegacyPassNameParser.h
@@ -92,47 +92,6 @@
   }
 };
 
-///===--===//
-/// FilteredPassNameParser class - Make use of the pass registration
-/// mechanism to automatically add a command line argument to opt for
-/// each pass that satisfies a filter criteria.  Filter should return
-/// true for passes to be registered as command-line options.
-///
-template
-class FilteredPassNameParser : public PassNameParser {
-private:
-  Filter filter;
-
-public:
-  bool ignorablePassImpl(const PassInfo *P) const override {
-return !filter(*P);
-  }
-};
-
-///===--===//
-/// PassArgFilter - A filter for use with PassNameFilterParser that only
-/// accepts a Pass whose Arg matches certain strings.
-///
-/// Use like this:
-///
-/// extern const char AllowedPassArgs[] = "-anders_aa -dse";
-///
-/// static cl::list<
-///   const PassInfo*,
-///   bool,
-///   FilteredPassNameParser > >
-/// PassList(cl::desc("Passes available:"));
-///
-/// Only the -anders_aa and -dse options will be available to the user.
-///
-template
-class PassArgFilter {
-public:
-  bool operator()(const PassInfo &P) const {
-return StringRef(Args).contains(P.getPassArgument());
-  }
-};
-
 } // End llvm namespace
 
 #endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82231: [NFC] Remove unused pass name parser classes

2020-06-19 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 272166.
aeubanks added a comment.

Unintended change


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82231/new/

https://reviews.llvm.org/D82231

Files:
  llvm/include/llvm/IR/LegacyPassNameParser.h


Index: llvm/include/llvm/IR/LegacyPassNameParser.h
===
--- llvm/include/llvm/IR/LegacyPassNameParser.h
+++ llvm/include/llvm/IR/LegacyPassNameParser.h
@@ -92,47 +92,6 @@
   }
 };
 
-///===--===//
-/// FilteredPassNameParser class - Make use of the pass registration
-/// mechanism to automatically add a command line argument to opt for
-/// each pass that satisfies a filter criteria.  Filter should return
-/// true for passes to be registered as command-line options.
-///
-template
-class FilteredPassNameParser : public PassNameParser {
-private:
-  Filter filter;
-
-public:
-  bool ignorablePassImpl(const PassInfo *P) const override {
-return !filter(*P);
-  }
-};
-
-///===--===//
-/// PassArgFilter - A filter for use with PassNameFilterParser that only
-/// accepts a Pass whose Arg matches certain strings.
-///
-/// Use like this:
-///
-/// extern const char AllowedPassArgs[] = "-anders_aa -dse";
-///
-/// static cl::list<
-///   const PassInfo*,
-///   bool,
-///   FilteredPassNameParser > >
-/// PassList(cl::desc("Passes available:"));
-///
-/// Only the -anders_aa and -dse options will be available to the user.
-///
-template
-class PassArgFilter {
-public:
-  bool operator()(const PassInfo &P) const {
-return StringRef(Args).contains(P.getPassArgument());
-  }
-};
-
 } // End llvm namespace
 
 #endif


Index: llvm/include/llvm/IR/LegacyPassNameParser.h
===
--- llvm/include/llvm/IR/LegacyPassNameParser.h
+++ llvm/include/llvm/IR/LegacyPassNameParser.h
@@ -92,47 +92,6 @@
   }
 };
 
-///===--===//
-/// FilteredPassNameParser class - Make use of the pass registration
-/// mechanism to automatically add a command line argument to opt for
-/// each pass that satisfies a filter criteria.  Filter should return
-/// true for passes to be registered as command-line options.
-///
-template
-class FilteredPassNameParser : public PassNameParser {
-private:
-  Filter filter;
-
-public:
-  bool ignorablePassImpl(const PassInfo *P) const override {
-return !filter(*P);
-  }
-};
-
-///===--===//
-/// PassArgFilter - A filter for use with PassNameFilterParser that only
-/// accepts a Pass whose Arg matches certain strings.
-///
-/// Use like this:
-///
-/// extern const char AllowedPassArgs[] = "-anders_aa -dse";
-///
-/// static cl::list<
-///   const PassInfo*,
-///   bool,
-///   FilteredPassNameParser > >
-/// PassList(cl::desc("Passes available:"));
-///
-/// Only the -anders_aa and -dse options will be available to the user.
-///
-template
-class PassArgFilter {
-public:
-  bool operator()(const PassInfo &P) const {
-return StringRef(Args).contains(P.getPassArgument());
-  }
-};
-
 } // End llvm namespace
 
 #endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82231: [NFC] Remove unused pass name parser classes

2020-06-19 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2565581e3704: [NFC] Remove unused pass name parser classes 
(authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82231/new/

https://reviews.llvm.org/D82231

Files:
  llvm/include/llvm/IR/LegacyPassNameParser.h


Index: llvm/include/llvm/IR/LegacyPassNameParser.h
===
--- llvm/include/llvm/IR/LegacyPassNameParser.h
+++ llvm/include/llvm/IR/LegacyPassNameParser.h
@@ -92,47 +92,6 @@
   }
 };
 
-///===--===//
-/// FilteredPassNameParser class - Make use of the pass registration
-/// mechanism to automatically add a command line argument to opt for
-/// each pass that satisfies a filter criteria.  Filter should return
-/// true for passes to be registered as command-line options.
-///
-template
-class FilteredPassNameParser : public PassNameParser {
-private:
-  Filter filter;
-
-public:
-  bool ignorablePassImpl(const PassInfo *P) const override {
-return !filter(*P);
-  }
-};
-
-///===--===//
-/// PassArgFilter - A filter for use with PassNameFilterParser that only
-/// accepts a Pass whose Arg matches certain strings.
-///
-/// Use like this:
-///
-/// extern const char AllowedPassArgs[] = "-anders_aa -dse";
-///
-/// static cl::list<
-///   const PassInfo*,
-///   bool,
-///   FilteredPassNameParser > >
-/// PassList(cl::desc("Passes available:"));
-///
-/// Only the -anders_aa and -dse options will be available to the user.
-///
-template
-class PassArgFilter {
-public:
-  bool operator()(const PassInfo &P) const {
-return StringRef(Args).contains(P.getPassArgument());
-  }
-};
-
 } // End llvm namespace
 
 #endif


Index: llvm/include/llvm/IR/LegacyPassNameParser.h
===
--- llvm/include/llvm/IR/LegacyPassNameParser.h
+++ llvm/include/llvm/IR/LegacyPassNameParser.h
@@ -92,47 +92,6 @@
   }
 };
 
-///===--===//
-/// FilteredPassNameParser class - Make use of the pass registration
-/// mechanism to automatically add a command line argument to opt for
-/// each pass that satisfies a filter criteria.  Filter should return
-/// true for passes to be registered as command-line options.
-///
-template
-class FilteredPassNameParser : public PassNameParser {
-private:
-  Filter filter;
-
-public:
-  bool ignorablePassImpl(const PassInfo *P) const override {
-return !filter(*P);
-  }
-};
-
-///===--===//
-/// PassArgFilter - A filter for use with PassNameFilterParser that only
-/// accepts a Pass whose Arg matches certain strings.
-///
-/// Use like this:
-///
-/// extern const char AllowedPassArgs[] = "-anders_aa -dse";
-///
-/// static cl::list<
-///   const PassInfo*,
-///   bool,
-///   FilteredPassNameParser > >
-/// PassList(cl::desc("Passes available:"));
-///
-/// Only the -anders_aa and -dse options will be available to the user.
-///
-template
-class PassArgFilter {
-public:
-  bool operator()(const PassInfo &P) const {
-return StringRef(Args).contains(P.getPassArgument());
-  }
-};
-
 } // End llvm namespace
 
 #endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79895: Add a new warning to warn when passing uninitialized variables as const reference parameters to a function

2020-06-22 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D79895#2107796 , @nick wrote:

> > This warning can be turned off by the flag 
> > `-Wno-uninitialized-const-reference`.
>
> Suggesting to turn off the warning should be the last resort. I am pointing 
> to the false positives for large existing code bases from `-Wall` diagnostic.
>
> > I don't think we can just make the diagnostic not fire for empty body 
> > consuming functions, if the function declaration and definition are in 
> > different translation units.
>
> I am talking about the particular situation that is involves only inline 
> functions with empty bodies. `boost::ignore_unused`-like functions are 
> obviously come with definition.


I feel like doing interprocedural analysis for this is overkill. What is the 
benefit of `boost::ignore_unused(foo);` rather than the more common `(void) 
foo;`? Any examples?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79895/new/

https://reviews.llvm.org/D79895



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79895: Add a new warning to warn when passing uninitialized variables as const reference parameters to a function

2020-06-23 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D79895#2110345 , @nick wrote:

> > We didn't see it in the code bases I work with, so is boost a special case, 
> > or an example of a common practice?
>
> I do not have resources to make such statistics, but there are compilers 
> where casting to void is not enough to suppress the warning. 
> https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/#comment-1509
>  https://godbolt.org/z/pS_iQ3
>
> > If it's just boost, fixing the code seems better
>
> Have you tried to push a fix for a warning in Boost? If it was that simple. A 
> part of my warning-fixing PRs are not merged in years. And considering that 
> fixing this warning will reintroduce warnings for other compilers I probably 
> will have a bad luck with this one too.
>
> > (it will compile faster too).
>
> Should I open a PR with replacing `std::forward` with `static_cast` because 
> it compiles faster? :-)


Perhaps asking for more opinions in cfe-dev will be better.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79895/new/

https://reviews.llvm.org/D79895



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78836: [clangd] Strip /showIncludes in clangd compile commandsIn command lines with /showIncludes, clangd would output includes to stdout, breaking clients.

2020-04-24 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
aeubanks added reviewers: sammccall, kadircet.
Herald added subscribers: cfe-commits, usaxena95, arphaman, jkorous, MaskRay, 
ilya-biryukov.
Herald added a project: clang.

Fixes https://github.com/clangd/clangd/issues/322.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78836

Files:
  clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
  clang/lib/Tooling/ArgumentsAdjusters.cpp


Index: clang/lib/Tooling/ArgumentsAdjusters.cpp
===
--- clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -98,7 +98,7 @@
   StringRef Arg = Args[i];
   // All dependency-file options begin with -M. These include -MM,
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M")) {
+  if (!Arg.startswith("-M") && Arg != "/showIncludes") {
 AdjustedArgs.push_back(Args[i]);
 continue;
   }
Index: clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
===
--- clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
+++ clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
@@ -79,6 +79,13 @@
 EXPECT_THAT(Cmd, Not(Contains(Stripped)));
 }
 
+TEST(CommandMangler, StripShowIncludes) {
+  auto Mangler = CommandMangler::forTests();
+  std::vector Cmd = {"clang-cl", "/showIncludes", "foo.cc"};
+  Mangler.adjust(Cmd);
+  EXPECT_THAT(Cmd, Not(Contains("/showIncludes")));
+}
+
 TEST(CommandMangler, ClangPath) {
   auto Mangler = CommandMangler::forTests();
   Mangler.ClangPath = testPath("fake/clang");


Index: clang/lib/Tooling/ArgumentsAdjusters.cpp
===
--- clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -98,7 +98,7 @@
   StringRef Arg = Args[i];
   // All dependency-file options begin with -M. These include -MM,
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M")) {
+  if (!Arg.startswith("-M") && Arg != "/showIncludes") {
 AdjustedArgs.push_back(Args[i]);
 continue;
   }
Index: clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
===
--- clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
+++ clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
@@ -79,6 +79,13 @@
 EXPECT_THAT(Cmd, Not(Contains(Stripped)));
 }
 
+TEST(CommandMangler, StripShowIncludes) {
+  auto Mangler = CommandMangler::forTests();
+  std::vector Cmd = {"clang-cl", "/showIncludes", "foo.cc"};
+  Mangler.adjust(Cmd);
+  EXPECT_THAT(Cmd, Not(Contains("/showIncludes")));
+}
+
 TEST(CommandMangler, ClangPath) {
   auto Mangler = CommandMangler::forTests();
   Mangler.ClangPath = testPath("fake/clang");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78836: [clangd] Strip /showIncludes in clangd compile commands

2020-04-24 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.
Herald added a subscriber: ormris.

I did verify that clangd on vscode now works on Windows on the LLVM codebase.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78836/new/

https://reviews.llvm.org/D78836



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78836: [clangd] Strip /showIncludes in clangd compile commands

2020-04-24 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks marked an inline comment as done.
aeubanks added inline comments.



Comment at: clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp:82
 
+TEST(CommandMangler, StripShowIncludes) {
+  auto Mangler = CommandMangler::forTests();

sammccall wrote:
> It's useful to have this test to verify the behavior at the clangd level, but 
> the arg adjuster is a separate library and also used in other contexts.
> 
> The unit-test for this arg-adjuster lives in 
> clang/unittests/Tooling/ToolingTest.cpp around line 500. Could you add a test 
> for the new behavior there, too?
Done.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78836/new/

https://reviews.llvm.org/D78836



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78836: [clangd] Strip /showIncludes in clangd compile commands

2020-04-24 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 260040.
aeubanks added a comment.

Add test in ToolingTest


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78836/new/

https://reviews.llvm.org/D78836

Files:
  clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
  clang/lib/Tooling/ArgumentsAdjusters.cpp
  clang/unittests/Tooling/ToolingTest.cpp


Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -530,6 +530,34 @@
   EXPECT_TRUE(HasFlag("-w"));
 }
 
+// Check getClangStripDependencyFileAdjuster strips /showIncludes
+TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
+  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+
+  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
+  Tool.mapVirtualFile("/a.cc", "void a() {}");
+
+  std::unique_ptr Action(
+  newFrontendActionFactory());
+
+  CommandLineArguments FinalArgs;
+  ArgumentsAdjuster CheckFlagsAdjuster =
+[&FinalArgs](const CommandLineArguments &Args, StringRef /*unused*/) {
+  FinalArgs = Args;
+  return Args;
+};
+  Tool.clearArgumentsAdjusters();
+  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
+  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
+  Tool.run(Action.get());
+
+  auto HasFlag = [&FinalArgs](const std::string &Flag) {
+return llvm::find(FinalArgs, Flag) != FinalArgs.end();
+  };
+  EXPECT_FALSE(HasFlag("/showIncludes"));
+  EXPECT_TRUE(HasFlag("-c"));
+}
+
 // Check getClangStripPluginsAdjuster strips plugin related args.
 TEST(ClangToolTest, StripPluginsAdjuster) {
   FixedCompilationDatabase Compilations(
Index: clang/lib/Tooling/ArgumentsAdjusters.cpp
===
--- clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -98,7 +98,7 @@
   StringRef Arg = Args[i];
   // All dependency-file options begin with -M. These include -MM,
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M")) {
+  if (!Arg.startswith("-M") && Arg != "/showIncludes") {
 AdjustedArgs.push_back(Args[i]);
 continue;
   }
Index: clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
===
--- clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
+++ clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
@@ -79,6 +79,13 @@
 EXPECT_THAT(Cmd, Not(Contains(Stripped)));
 }
 
+TEST(CommandMangler, StripShowIncludes) {
+  auto Mangler = CommandMangler::forTests();
+  std::vector Cmd = {"clang-cl", "/showIncludes", "foo.cc"};
+  Mangler.adjust(Cmd);
+  EXPECT_THAT(Cmd, Not(Contains("/showIncludes")));
+}
+
 TEST(CommandMangler, ClangPath) {
   auto Mangler = CommandMangler::forTests();
   Mangler.ClangPath = testPath("fake/clang");


Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -530,6 +530,34 @@
   EXPECT_TRUE(HasFlag("-w"));
 }
 
+// Check getClangStripDependencyFileAdjuster strips /showIncludes
+TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
+  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+
+  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
+  Tool.mapVirtualFile("/a.cc", "void a() {}");
+
+  std::unique_ptr Action(
+  newFrontendActionFactory());
+
+  CommandLineArguments FinalArgs;
+  ArgumentsAdjuster CheckFlagsAdjuster =
+[&FinalArgs](const CommandLineArguments &Args, StringRef /*unused*/) {
+  FinalArgs = Args;
+  return Args;
+};
+  Tool.clearArgumentsAdjusters();
+  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
+  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
+  Tool.run(Action.get());
+
+  auto HasFlag = [&FinalArgs](const std::string &Flag) {
+return llvm::find(FinalArgs, Flag) != FinalArgs.end();
+  };
+  EXPECT_FALSE(HasFlag("/showIncludes"));
+  EXPECT_TRUE(HasFlag("-c"));
+}
+
 // Check getClangStripPluginsAdjuster strips plugin related args.
 TEST(ClangToolTest, StripPluginsAdjuster) {
   FixedCompilationDatabase Compilations(
Index: clang/lib/Tooling/ArgumentsAdjusters.cpp
===
--- clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -98,7 +98,7 @@
   StringRef Arg = Args[i];
   // All dependency-file options begin with -M. These include -MM,
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M")) {
+  if (!Arg.startswith("-M") && Arg != "/showIncludes") {
 AdjustedArgs.push_back(Args[i]);
 continue;
   }
Index: clang-tools-extra/clangd/uni

[PATCH] D78836: [clangd] Strip /showIncludes in clangd compile commands

2020-04-25 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 260103.
aeubanks added a comment.

Handle /showIncludes:user


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78836/new/

https://reviews.llvm.org/D78836

Files:
  clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
  clang/lib/Tooling/ArgumentsAdjusters.cpp
  clang/unittests/Tooling/ToolingTest.cpp

Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -530,6 +530,62 @@
   EXPECT_TRUE(HasFlag("-w"));
 }
 
+// Check getClangStripDependencyFileAdjuster strips /showIncludes
+TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
+  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+
+  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
+  Tool.mapVirtualFile("/a.cc", "void a() {}");
+
+  std::unique_ptr Action(
+  newFrontendActionFactory());
+
+  CommandLineArguments FinalArgs;
+  ArgumentsAdjuster CheckFlagsAdjuster =
+  [&FinalArgs](const CommandLineArguments &Args, StringRef /*unused*/) {
+FinalArgs = Args;
+return Args;
+  };
+  Tool.clearArgumentsAdjusters();
+  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
+  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
+  Tool.run(Action.get());
+
+  auto HasFlag = [&FinalArgs](const std::string &Flag) {
+return llvm::find(FinalArgs, Flag) != FinalArgs.end();
+  };
+  EXPECT_FALSE(HasFlag("/showIncludes"));
+  EXPECT_TRUE(HasFlag("-c"));
+}
+
+// Check getClangStripDependencyFileAdjuster strips /showIncludes:user
+TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludesUser) {
+  FixedCompilationDatabase Compilations("/", {"/showIncludes:user", "-c"});
+
+  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
+  Tool.mapVirtualFile("/a.cc", "void a() {}");
+
+  std::unique_ptr Action(
+  newFrontendActionFactory());
+
+  CommandLineArguments FinalArgs;
+  ArgumentsAdjuster CheckFlagsAdjuster =
+  [&FinalArgs](const CommandLineArguments &Args, StringRef /*unused*/) {
+FinalArgs = Args;
+return Args;
+  };
+  Tool.clearArgumentsAdjusters();
+  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
+  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
+  Tool.run(Action.get());
+
+  auto HasFlag = [&FinalArgs](const std::string &Flag) {
+return llvm::find(FinalArgs, Flag) != FinalArgs.end();
+  };
+  EXPECT_FALSE(HasFlag("/showIncludes:user"));
+  EXPECT_TRUE(HasFlag("-c"));
+}
+
 // Check getClangStripPluginsAdjuster strips plugin related args.
 TEST(ClangToolTest, StripPluginsAdjuster) {
   FixedCompilationDatabase Compilations(
Index: clang/lib/Tooling/ArgumentsAdjusters.cpp
===
--- clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -98,7 +98,7 @@
   StringRef Arg = Args[i];
   // All dependency-file options begin with -M. These include -MM,
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M")) {
+  if (!Arg.startswith("-M") && !Arg.startswith("/showIncludes")) {
 AdjustedArgs.push_back(Args[i]);
 continue;
   }
Index: clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
===
--- clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
+++ clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
@@ -79,6 +79,20 @@
 EXPECT_THAT(Cmd, Not(Contains(Stripped)));
 }
 
+TEST(CommandMangler, StripShowIncludes) {
+  auto Mangler = CommandMangler::forTests();
+  std::vector Cmd = {"clang-cl", "/showIncludes", "foo.cc"};
+  Mangler.adjust(Cmd);
+  EXPECT_THAT(Cmd, Not(Contains("/showIncludes")));
+}
+
+TEST(CommandMangler, StripShowIncludesUser) {
+  auto Mangler = CommandMangler::forTests();
+  std::vector Cmd = {"clang-cl", "/showIncludes:user", "foo.cc"};
+  Mangler.adjust(Cmd);
+  EXPECT_THAT(Cmd, Not(Contains("/showIncludes:user")));
+}
+
 TEST(CommandMangler, ClangPath) {
   auto Mangler = CommandMangler::forTests();
   Mangler.ClangPath = testPath("fake/clang");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78836: [clangd] Strip /showIncludes in clangd compile commands

2020-04-25 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks marked an inline comment as done.
aeubanks added inline comments.



Comment at: clang/lib/Tooling/ArgumentsAdjusters.cpp:101
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M")) {
+  if (!Arg.startswith("-M") && Arg != "/showIncludes") {
 AdjustedArgs.push_back(Args[i]);

kadircet wrote:
> kadircet wrote:
> > this can also be --show-includes
> and looks like there's also `/showIncludes:user` :/
Handled `/showIncludes:user`, thanks for catching that. I don't see 
`--show-includes` though, clang-cl and clang both don't like the option?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78836/new/

https://reviews.llvm.org/D78836



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78836: [clangd] Strip /showIncludes in clangd compile commands

2020-04-26 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D78836#2003696 , @kadircet wrote:

> thanks, lgtm. do you have commit access?


Yep :)

Thanks for the reviews!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78836/new/

https://reviews.llvm.org/D78836



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78836: [clangd] Strip /showIncludes in clangd compile commands

2020-04-26 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8000d506afcd: [clangd] Strip /showIncludes in clangd compile 
commands (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78836/new/

https://reviews.llvm.org/D78836

Files:
  clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
  clang/lib/Tooling/ArgumentsAdjusters.cpp
  clang/unittests/Tooling/ToolingTest.cpp

Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -530,6 +530,62 @@
   EXPECT_TRUE(HasFlag("-w"));
 }
 
+// Check getClangStripDependencyFileAdjuster strips /showIncludes
+TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
+  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+
+  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
+  Tool.mapVirtualFile("/a.cc", "void a() {}");
+
+  std::unique_ptr Action(
+  newFrontendActionFactory());
+
+  CommandLineArguments FinalArgs;
+  ArgumentsAdjuster CheckFlagsAdjuster =
+  [&FinalArgs](const CommandLineArguments &Args, StringRef /*unused*/) {
+FinalArgs = Args;
+return Args;
+  };
+  Tool.clearArgumentsAdjusters();
+  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
+  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
+  Tool.run(Action.get());
+
+  auto HasFlag = [&FinalArgs](const std::string &Flag) {
+return llvm::find(FinalArgs, Flag) != FinalArgs.end();
+  };
+  EXPECT_FALSE(HasFlag("/showIncludes"));
+  EXPECT_TRUE(HasFlag("-c"));
+}
+
+// Check getClangStripDependencyFileAdjuster strips /showIncludes:user
+TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludesUser) {
+  FixedCompilationDatabase Compilations("/", {"/showIncludes:user", "-c"});
+
+  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
+  Tool.mapVirtualFile("/a.cc", "void a() {}");
+
+  std::unique_ptr Action(
+  newFrontendActionFactory());
+
+  CommandLineArguments FinalArgs;
+  ArgumentsAdjuster CheckFlagsAdjuster =
+  [&FinalArgs](const CommandLineArguments &Args, StringRef /*unused*/) {
+FinalArgs = Args;
+return Args;
+  };
+  Tool.clearArgumentsAdjusters();
+  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
+  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
+  Tool.run(Action.get());
+
+  auto HasFlag = [&FinalArgs](const std::string &Flag) {
+return llvm::find(FinalArgs, Flag) != FinalArgs.end();
+  };
+  EXPECT_FALSE(HasFlag("/showIncludes:user"));
+  EXPECT_TRUE(HasFlag("-c"));
+}
+
 // Check getClangStripPluginsAdjuster strips plugin related args.
 TEST(ClangToolTest, StripPluginsAdjuster) {
   FixedCompilationDatabase Compilations(
Index: clang/lib/Tooling/ArgumentsAdjusters.cpp
===
--- clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -98,7 +98,7 @@
   StringRef Arg = Args[i];
   // All dependency-file options begin with -M. These include -MM,
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M")) {
+  if (!Arg.startswith("-M") && !Arg.startswith("/showIncludes")) {
 AdjustedArgs.push_back(Args[i]);
 continue;
   }
Index: clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
===
--- clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
+++ clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp
@@ -79,6 +79,20 @@
 EXPECT_THAT(Cmd, Not(Contains(Stripped)));
 }
 
+TEST(CommandMangler, StripShowIncludes) {
+  auto Mangler = CommandMangler::forTests();
+  std::vector Cmd = {"clang-cl", "/showIncludes", "foo.cc"};
+  Mangler.adjust(Cmd);
+  EXPECT_THAT(Cmd, Not(Contains("/showIncludes")));
+}
+
+TEST(CommandMangler, StripShowIncludesUser) {
+  auto Mangler = CommandMangler::forTests();
+  std::vector Cmd = {"clang-cl", "/showIncludes:user", "foo.cc"};
+  Mangler.adjust(Cmd);
+  EXPECT_THAT(Cmd, Not(Contains("/showIncludes:user")));
+}
+
 TEST(CommandMangler, ClangPath) {
   auto Mangler = CommandMangler::forTests();
   Mangler.ClangPath = testPath("fake/clang");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78939: Strip -showIncludes in getClangStripDependencyFileAdjuster()

2020-04-27 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
aeubanks added a reviewer: thakis.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Follow-up to https://reviews.llvm.org/D78836.

Also consolidate some test cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78939

Files:
  clang/lib/Tooling/ArgumentsAdjusters.cpp
  clang/unittests/Tooling/ToolingTest.cpp


Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -530,9 +530,11 @@
   EXPECT_TRUE(HasFlag("-w"));
 }
 
-// Check getClangStripDependencyFileAdjuster strips /showIncludes
+// Check getClangStripDependencyFileAdjuster strips /showIncludes and variants
 TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+  FixedCompilationDatabase Compilations(
+  "/", {"/showIncludes", "/showIncludes:user", "-showIncludes",
+"-showIncludes:user", "-c"});
 
   ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
   Tool.mapVirtualFile("/a.cc", "void a() {}");
@@ -555,34 +557,9 @@
 return llvm::find(FinalArgs, Flag) != FinalArgs.end();
   };
   EXPECT_FALSE(HasFlag("/showIncludes"));
-  EXPECT_TRUE(HasFlag("-c"));
-}
-
-// Check getClangStripDependencyFileAdjuster strips /showIncludes:user
-TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludesUser) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes:user", "-c"});
-
-  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
-  Tool.mapVirtualFile("/a.cc", "void a() {}");
-
-  std::unique_ptr Action(
-  newFrontendActionFactory());
-
-  CommandLineArguments FinalArgs;
-  ArgumentsAdjuster CheckFlagsAdjuster =
-  [&FinalArgs](const CommandLineArguments &Args, StringRef /*unused*/) {
-FinalArgs = Args;
-return Args;
-  };
-  Tool.clearArgumentsAdjusters();
-  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
-  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
-  Tool.run(Action.get());
-
-  auto HasFlag = [&FinalArgs](const std::string &Flag) {
-return llvm::find(FinalArgs, Flag) != FinalArgs.end();
-  };
   EXPECT_FALSE(HasFlag("/showIncludes:user"));
+  EXPECT_FALSE(HasFlag("-showIncludes"));
+  EXPECT_FALSE(HasFlag("-showIncludes:user"));
   EXPECT_TRUE(HasFlag("-c"));
 }
 
Index: clang/lib/Tooling/ArgumentsAdjusters.cpp
===
--- clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -98,7 +98,8 @@
   StringRef Arg = Args[i];
   // All dependency-file options begin with -M. These include -MM,
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M") && !Arg.startswith("/showIncludes")) {
+  if (!Arg.startswith("-M") && !Arg.startswith("/showIncludes") &&
+  !Arg.startswith("-showIncludes")) {
 AdjustedArgs.push_back(Args[i]);
 continue;
   }


Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -530,9 +530,11 @@
   EXPECT_TRUE(HasFlag("-w"));
 }
 
-// Check getClangStripDependencyFileAdjuster strips /showIncludes
+// Check getClangStripDependencyFileAdjuster strips /showIncludes and variants
 TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+  FixedCompilationDatabase Compilations(
+  "/", {"/showIncludes", "/showIncludes:user", "-showIncludes",
+"-showIncludes:user", "-c"});
 
   ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
   Tool.mapVirtualFile("/a.cc", "void a() {}");
@@ -555,34 +557,9 @@
 return llvm::find(FinalArgs, Flag) != FinalArgs.end();
   };
   EXPECT_FALSE(HasFlag("/showIncludes"));
-  EXPECT_TRUE(HasFlag("-c"));
-}
-
-// Check getClangStripDependencyFileAdjuster strips /showIncludes:user
-TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludesUser) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes:user", "-c"});
-
-  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
-  Tool.mapVirtualFile("/a.cc", "void a() {}");
-
-  std::unique_ptr Action(
-  newFrontendActionFactory());
-
-  CommandLineArguments FinalArgs;
-  ArgumentsAdjuster CheckFlagsAdjuster =
-  [&FinalArgs](const CommandLineArguments &Args, StringRef /*unused*/) {
-FinalArgs = Args;
-return Args;
-  };
-  Tool.clearArgumentsAdjusters();
-  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
-  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
-  Tool.run(Action.get());
-
-  auto HasFlag = [&FinalArgs](const std::string &Flag) {
-return llvm::find(FinalArgs, Flag) != FinalArgs.end();
-  };
   EXPECT_FALSE

[PATCH] D78939: Strip -showIncludes in getClangStripDependencyFileAdjuster()

2020-04-27 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdab1326a5ae3: Strip -showIncludes in 
getClangStripDependencyFileAdjuster() (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78939/new/

https://reviews.llvm.org/D78939

Files:
  clang/lib/Tooling/ArgumentsAdjusters.cpp
  clang/unittests/Tooling/ToolingTest.cpp


Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -530,9 +530,11 @@
   EXPECT_TRUE(HasFlag("-w"));
 }
 
-// Check getClangStripDependencyFileAdjuster strips /showIncludes
+// Check getClangStripDependencyFileAdjuster strips /showIncludes and variants
 TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+  FixedCompilationDatabase Compilations(
+  "/", {"/showIncludes", "/showIncludes:user", "-showIncludes",
+"-showIncludes:user", "-c"});
 
   ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
   Tool.mapVirtualFile("/a.cc", "void a() {}");
@@ -555,34 +557,9 @@
 return llvm::find(FinalArgs, Flag) != FinalArgs.end();
   };
   EXPECT_FALSE(HasFlag("/showIncludes"));
-  EXPECT_TRUE(HasFlag("-c"));
-}
-
-// Check getClangStripDependencyFileAdjuster strips /showIncludes:user
-TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludesUser) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes:user", "-c"});
-
-  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
-  Tool.mapVirtualFile("/a.cc", "void a() {}");
-
-  std::unique_ptr Action(
-  newFrontendActionFactory());
-
-  CommandLineArguments FinalArgs;
-  ArgumentsAdjuster CheckFlagsAdjuster =
-  [&FinalArgs](const CommandLineArguments &Args, StringRef /*unused*/) {
-FinalArgs = Args;
-return Args;
-  };
-  Tool.clearArgumentsAdjusters();
-  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
-  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
-  Tool.run(Action.get());
-
-  auto HasFlag = [&FinalArgs](const std::string &Flag) {
-return llvm::find(FinalArgs, Flag) != FinalArgs.end();
-  };
   EXPECT_FALSE(HasFlag("/showIncludes:user"));
+  EXPECT_FALSE(HasFlag("-showIncludes"));
+  EXPECT_FALSE(HasFlag("-showIncludes:user"));
   EXPECT_TRUE(HasFlag("-c"));
 }
 
Index: clang/lib/Tooling/ArgumentsAdjusters.cpp
===
--- clang/lib/Tooling/ArgumentsAdjusters.cpp
+++ clang/lib/Tooling/ArgumentsAdjusters.cpp
@@ -98,7 +98,8 @@
   StringRef Arg = Args[i];
   // All dependency-file options begin with -M. These include -MM,
   // -MF, -MG, -MP, -MT, -MQ, -MD, and -MMD.
-  if (!Arg.startswith("-M") && !Arg.startswith("/showIncludes")) {
+  if (!Arg.startswith("-M") && !Arg.startswith("/showIncludes") &&
+  !Arg.startswith("-showIncludes")) {
 AdjustedArgs.push_back(Args[i]);
 continue;
   }


Index: clang/unittests/Tooling/ToolingTest.cpp
===
--- clang/unittests/Tooling/ToolingTest.cpp
+++ clang/unittests/Tooling/ToolingTest.cpp
@@ -530,9 +530,11 @@
   EXPECT_TRUE(HasFlag("-w"));
 }
 
-// Check getClangStripDependencyFileAdjuster strips /showIncludes
+// Check getClangStripDependencyFileAdjuster strips /showIncludes and variants
 TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludes) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes", "-c"});
+  FixedCompilationDatabase Compilations(
+  "/", {"/showIncludes", "/showIncludes:user", "-showIncludes",
+"-showIncludes:user", "-c"});
 
   ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
   Tool.mapVirtualFile("/a.cc", "void a() {}");
@@ -555,34 +557,9 @@
 return llvm::find(FinalArgs, Flag) != FinalArgs.end();
   };
   EXPECT_FALSE(HasFlag("/showIncludes"));
-  EXPECT_TRUE(HasFlag("-c"));
-}
-
-// Check getClangStripDependencyFileAdjuster strips /showIncludes:user
-TEST(ClangToolTest, StripDependencyFileAdjusterShowIncludesUser) {
-  FixedCompilationDatabase Compilations("/", {"/showIncludes:user", "-c"});
-
-  ClangTool Tool(Compilations, std::vector(1, "/a.cc"));
-  Tool.mapVirtualFile("/a.cc", "void a() {}");
-
-  std::unique_ptr Action(
-  newFrontendActionFactory());
-
-  CommandLineArguments FinalArgs;
-  ArgumentsAdjuster CheckFlagsAdjuster =
-  [&FinalArgs](const CommandLineArguments &Args, StringRef /*unused*/) {
-FinalArgs = Args;
-return Args;
-  };
-  Tool.clearArgumentsAdjusters();
-  Tool.appendArgumentsAdjuster(getClangStripDependencyFileAdjuster());
-  Tool.appendArgumentsAdjuster(CheckFlagsAdjuster);
-  Tool.run(Action.get());
-
-  auto HasFlag = [&FinalArgs](const std::string &Flag) {
-return llvm::find(FinalArgs, Flag) != 

[PATCH] D71687: Fix full loop unrolling initialization in new pass manager

2020-08-03 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

I'm looking at enabling the -enable-npm-optnone flag and FullUnroll.ll fails. I 
understand that loop unrolling should be forced when some metadata is present, 
but the FullUnroll.ll test seems to check for a lot more than that. It checks 
for (roughly) two unconditional branches and no conditional branches. Running 
the test under -debug-pass-manager and --print-after-all, , it looks like 
InstCombine does a lot of work removing instructions, and SimplifyCFG is 
ultimately what removes all the conditional branches. But InstCombine and 
SimplifyCFG shouldn't run on an optnone function, right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71687/new/

https://reviews.llvm.org/D71687

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85252: [Driver] Accept -fno-lto in clang-cl

2020-08-04 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
aeubanks added reviewers: hans, thakis.
Herald added subscribers: cfe-commits, dang, dexonsmith, inglorion.
Herald added a project: clang.
aeubanks requested review of this revision.

Some compiler-rt tests check for the presence of the compiler accepting
-fno-lto to add that flag. Otherwise some tests don't link due to
-flto mismatch between compiling and linking.

$ cmake ... -DLLVM_ENABLE_LTO=Thin ...
$ ninja 
projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test.exe
previously failed, now links.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85252

Files:
  clang/include/clang/Driver/Options.td
  clang/test/Driver/cl-options.c


Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -586,6 +586,9 @@
 // RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s
 // LTO: -flto
 
+// RUN: %clang_cl -### /c -flto -fno-lto -- %s 2>&1 | FileCheck 
-check-prefix=LTO-NO %s
+// LTO-NO-NOT: "-flto"
+
 // RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck 
-check-prefix=LTO-THIN %s
 // LTO-THIN: -flto=thin
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1351,7 +1351,7 @@
   HelpText<"Set LTO mode to either 'full' or 'thin'">, Values<"thin,full">;
 def flto : Flag<["-"], "flto">, Flags<[CoreOption, CC1Option]>, Group,
   HelpText<"Enable LTO in 'full' mode">;
-def fno_lto : Flag<["-"], "fno-lto">, Group,
+def fno_lto : Flag<["-"], "fno-lto">, Flags<[CoreOption, CC1Option]>, 
Group,
   HelpText<"Disable LTO mode (default)">;
 def flto_jobs_EQ : Joined<["-"], "flto-jobs=">,
   Flags<[CC1Option]>, Group,


Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -586,6 +586,9 @@
 // RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s
 // LTO: -flto
 
+// RUN: %clang_cl -### /c -flto -fno-lto -- %s 2>&1 | FileCheck -check-prefix=LTO-NO %s
+// LTO-NO-NOT: "-flto"
+
 // RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck -check-prefix=LTO-THIN %s
 // LTO-THIN: -flto=thin
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1351,7 +1351,7 @@
   HelpText<"Set LTO mode to either 'full' or 'thin'">, Values<"thin,full">;
 def flto : Flag<["-"], "flto">, Flags<[CoreOption, CC1Option]>, Group,
   HelpText<"Enable LTO in 'full' mode">;
-def fno_lto : Flag<["-"], "fno-lto">, Group,
+def fno_lto : Flag<["-"], "fno-lto">, Flags<[CoreOption, CC1Option]>, Group,
   HelpText<"Disable LTO mode (default)">;
 def flto_jobs_EQ : Joined<["-"], "flto-jobs=">,
   Flags<[CC1Option]>, Group,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85252: [Driver] Accept -fno-lto in clang-cl

2020-08-05 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8dc43852e4a8: [Driver] Accept -fno-lto in clang-cl (authored 
by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85252/new/

https://reviews.llvm.org/D85252

Files:
  clang/include/clang/Driver/Options.td
  clang/test/Driver/cl-options.c


Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -586,6 +586,9 @@
 // RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s
 // LTO: -flto
 
+// RUN: %clang_cl -### /c -flto -fno-lto -- %s 2>&1 | FileCheck 
-check-prefix=LTO-NO %s
+// LTO-NO-NOT: "-flto"
+
 // RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck 
-check-prefix=LTO-THIN %s
 // LTO-THIN: -flto=thin
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1351,7 +1351,7 @@
   HelpText<"Set LTO mode to either 'full' or 'thin'">, Values<"thin,full">;
 def flto : Flag<["-"], "flto">, Flags<[CoreOption, CC1Option]>, Group,
   HelpText<"Enable LTO in 'full' mode">;
-def fno_lto : Flag<["-"], "fno-lto">, Group,
+def fno_lto : Flag<["-"], "fno-lto">, Flags<[CoreOption, CC1Option]>, 
Group,
   HelpText<"Disable LTO mode (default)">;
 def flto_jobs_EQ : Joined<["-"], "flto-jobs=">,
   Flags<[CC1Option]>, Group,


Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -586,6 +586,9 @@
 // RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s
 // LTO: -flto
 
+// RUN: %clang_cl -### /c -flto -fno-lto -- %s 2>&1 | FileCheck -check-prefix=LTO-NO %s
+// LTO-NO-NOT: "-flto"
+
 // RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck -check-prefix=LTO-THIN %s
 // LTO-THIN: -flto=thin
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -1351,7 +1351,7 @@
   HelpText<"Set LTO mode to either 'full' or 'thin'">, Values<"thin,full">;
 def flto : Flag<["-"], "flto">, Flags<[CoreOption, CC1Option]>, Group,
   HelpText<"Enable LTO in 'full' mode">;
-def fno_lto : Flag<["-"], "fno-lto">, Group,
+def fno_lto : Flag<["-"], "fno-lto">, Flags<[CoreOption, CC1Option]>, Group,
   HelpText<"Disable LTO mode (default)">;
 def flto_jobs_EQ : Joined<["-"], "flto-jobs=">,
   Flags<[CC1Option]>, Group,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85457: [NewPM][optnone] Mark various passes as required

2020-08-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 284093.
aeubanks added a comment.
Herald added subscribers: cfe-commits, jfb, eraman.
Herald added a project: clang.

Add test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85457/new/

https://reviews.llvm.org/D85457

Files:
  clang/test/CodeGen/O0-no-skipped-passes.c
  llvm/include/llvm/IR/IRPrintingPasses.h
  llvm/include/llvm/IR/PassManager.h
  llvm/include/llvm/IR/Verifier.h
  llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h
  llvm/include/llvm/Transforms/Coroutines/CoroEarly.h
  llvm/include/llvm/Transforms/Coroutines/CoroElide.h
  llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
  llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
  llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
  llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
  llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
  llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
  llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
  llvm/test/Feature/optnone-opt.ll

Index: llvm/test/Feature/optnone-opt.ll
===
--- llvm/test/Feature/optnone-opt.ll
+++ llvm/test/Feature/optnone-opt.ll
@@ -66,8 +66,8 @@
 ; Additional IR passes that opt doesn't turn on by default.
 ; MORE-DAG: Skipping pass 'Dead Code Elimination'
 ; MORE-DAG: Skipping pass 'Dead Instruction Elimination'
+; NPM-MORE-DAG: Skipping pass: DCEPass
 ; NPM-MORE-DAG: Skipping pass: GVNHoistPass
-; NPM-MORE-DAG: Skipping pass: LowerAtomicPass
 
 ; Loop IR passes that opt doesn't turn on by default.
 ; LOOP-DAG: Skipping pass 'Delete dead loops'
Index: llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
===
--- llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
+++ llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
@@ -18,6 +18,7 @@
 namespace llvm {
 struct LowerMatrixIntrinsicsPass : PassInfoMixin {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 } // namespace llvm
 
Index: llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
===
--- llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
+++ llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
@@ -22,6 +22,7 @@
 class LowerAtomicPass : public PassInfoMixin {
 public:
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  static bool isRequired() { return true; }
 };
 }
 
Index: llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
@@ -28,6 +28,7 @@
 struct ThreadSanitizerPass : public PassInfoMixin {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 } // namespace llvm
Index: llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
===
--- llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
+++ llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
@@ -46,6 +46,7 @@
*vfs::getRealFileSystem());
   }
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   SanitizerCoverageOptions Options;
Index: llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
@@ -41,6 +41,7 @@
 
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   MemorySanitizerOptions Options;
Index: llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
@@ -27,6 +27,7 @@
   explicit HWAddressSanitizerPass(bool CompileKernel = false,
   bool Recover = false);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  static bool isRequired() { return true; }
 
 private:
   bool CompileKernel;
Index: llvm/include/llvm

[PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D85545#2208266 , @arthur.j.odwyer 
wrote:

> To decrease the number of false-positives, you could emit the warning only
> if *exactly one* comma was missing.
>
>   const char *likely_a_bug[] = { "a", "b", "c" "d", "e", "f", "g", "h",
>
> "i" };
>
>   const char *likely_not_a_bug[] = { "a", "b" "c", "d" "e", "f" "g" };
>   const char *oops_still_a_bug[] = { "a", "b", "c" "d", "e", "f" "g",
>
> "h", "i" };
>
> However, as `oops_still_a_bug` shows, that tactic would also decrease the
> number of true positives, and it would confuse the end-user, for whom
> predictability is key.
>
> I still think it would be appropriate to *stop issuing the warning for
> structs*, though.
> Here's my struct example from below in Godbolt: https://godbolt.org/z/6jjv6a
> Speaking of predictability, I don't understand why `struct Y` avoids the
> warning whereas `struct X` hits it.
> After removing the warning for structs, neither `X` nor `Y` should hit it,
> and that should fix pretty much all the Firefox hits as I understand them.
>
> –Arthur

+1 to ignoring structs. See https://crbug.com/1114873 and 
https://source.chromium.org/chromium/chromium/src/+/master:third_party/dawn/src/dawn_native/Toggles.cpp;drc=80f927d763211ea8e6a6377f86282809c86dc107;l=32.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85545/new/

https://reviews.llvm.org/D85545

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-10 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

After not warning on structs, this did find a real missing comma in the 
Chromium codebase, so thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85545/new/

https://reviews.llvm.org/D85545

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-11 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

Actually sorry, it does still seem like there are false positives on structs. 
Reduced:

  $ cat /tmp/a.cpp
  
  struct A {
const char* a;
const char* b;
const char* c;
  };
  
  static constexpr A foo2 = A{"",
  ""
  "",
  ""};
  
  $ ~/repos/llvm-project/build_cmake/bin/clang /tmp/a.cpp -o /dev/null -c 
-Wstring-concatenation
  /tmp/a.cpp:10:29: warning: suspicious concatenation of string literals in an 
array initialization; did you mean to separate the elements with a comma? 
[-Wstring-concatenation]
  "",
  ^
  /tmp/a.cpp:9:29: note: place parentheses around the string literal to silence 
warning
  ""
  ^
  1 warning generated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85545/new/

https://reviews.llvm.org/D85545

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-11 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D85545#2211070 , @xbolva00 wrote:

> I check if all elements of init list are strings, so this is not
> exactly true "struct checker" (I have no such info in that part of
> code..) but I consider it good enough. Your test case is based on real
> code? Does not seem so - well sure, we could construct many examples
> where warning fires uselessly but my focus is on real world false
> positive cases :)
>
> ut 11. 8. 2020 o 19:55 Arthur Eubanks via Phabricator
>  napĆ­sal(a):
>
>> aeubanks added a comment.
>>
>> Actually sorry, it does still seem like there are false positives on 
>> structs. Reduced:
>>
>>   $ cat /tmp/a.cpp
>>   
>>   struct A {
>> const char* a;
>> const char* b;
>> const char* c;
>>   };
>>   
>>   static constexpr A foo2 = A{"",
>>   ""
>>   "",
>>   ""};
>>   
>>   $ ~/repos/llvm-project/build_cmake/bin/clang /tmp/a.cpp -o /dev/null -c 
>> -Wstring-concatenation
>>   /tmp/a.cpp:10:29: warning: suspicious concatenation of string literals in 
>> an array initialization; did you mean to separate the elements with a comma? 
>> [-Wstring-concatenation]
>>   "",
>>   ^
>>   /tmp/a.cpp:9:29: note: place parentheses around the string literal to 
>> silence warning
>>   ""
>>   ^
>>   1 warning generated.
>>
>> Repository:
>>
>>   rG LLVM Github Monorepo
>>
>> CHANGES SINCE LAST ACTION
>>
>>   https://reviews.llvm.org/D85545/new/
>>
>> https://reviews.llvm.org/D85545

Yup it's reduced from real world code, same link as before: 
https://source.chromium.org/chromium/chromium/src/+/master:third_party/dawn/src/dawn_native/Toggles.cpp;drc=80f927d763211ea8e6a6377f86282809c86dc107;l=32.
Clearly if there are 3 strings in the struct and the initializer has three 
strings, then the warning shouldn't apply.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85545/new/

https://reviews.llvm.org/D85545

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85457: [NewPM][optnone] Mark various passes as required

2020-08-11 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 284875.
aeubanks added a comment.

Specify target


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85457/new/

https://reviews.llvm.org/D85457

Files:
  clang/test/CodeGen/O0-no-skipped-passes.c
  llvm/include/llvm/IR/IRPrintingPasses.h
  llvm/include/llvm/IR/PassManager.h
  llvm/include/llvm/IR/Verifier.h
  llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h
  llvm/include/llvm/Transforms/Coroutines/CoroEarly.h
  llvm/include/llvm/Transforms/Coroutines/CoroElide.h
  llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
  llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
  llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
  llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
  llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
  llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
  llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
  llvm/test/Feature/optnone-opt.ll

Index: llvm/test/Feature/optnone-opt.ll
===
--- llvm/test/Feature/optnone-opt.ll
+++ llvm/test/Feature/optnone-opt.ll
@@ -66,8 +66,8 @@
 ; Additional IR passes that opt doesn't turn on by default.
 ; MORE-DAG: Skipping pass 'Dead Code Elimination'
 ; MORE-DAG: Skipping pass 'Dead Instruction Elimination'
+; NPM-MORE-DAG: Skipping pass: DCEPass
 ; NPM-MORE-DAG: Skipping pass: GVNHoistPass
-; NPM-MORE-DAG: Skipping pass: LowerAtomicPass
 
 ; Loop IR passes that opt doesn't turn on by default.
 ; LOOP-DAG: Skipping pass 'Delete dead loops'
Index: llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
===
--- llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
+++ llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
@@ -18,6 +18,7 @@
 namespace llvm {
 struct LowerMatrixIntrinsicsPass : PassInfoMixin {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 } // namespace llvm
 
Index: llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
===
--- llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
+++ llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
@@ -22,6 +22,7 @@
 class LowerAtomicPass : public PassInfoMixin {
 public:
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  static bool isRequired() { return true; }
 };
 }
 
Index: llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
@@ -28,6 +28,7 @@
 struct ThreadSanitizerPass : public PassInfoMixin {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 } // namespace llvm
Index: llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
===
--- llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
+++ llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
@@ -46,6 +46,7 @@
*vfs::getRealFileSystem());
   }
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   SanitizerCoverageOptions Options;
Index: llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
@@ -41,6 +41,7 @@
 
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   MemorySanitizerOptions Options;
Index: llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
@@ -27,6 +27,7 @@
   explicit HWAddressSanitizerPass(bool CompileKernel = false,
   bool Recover = false);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  static bool isRequired() { return true; }
 
 private:
   bool CompileKernel;
Index: llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h

[PATCH] D85545: [Diagnostics] Diagnose missing comma in string array initialization

2020-08-12 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

It still seems to trigger on structs at head:

$ cat /tmp/a.cc
struct A {

  const char *a;
  const char *b;
  const char *c;

};

static A a = {"",

  ""
  "",
  ""};

$ ./build/bin/clang++ -Wstring-concatenation -o /dev/null -c /tmp/a.cc
C:/src/tmp/a.cc:10:15: warning: suspicious concatenation of string literals in 
an array initialization; did you mean to separate the elements with a comma? 
[-Wstring-concatenation]

  "",
  ^

C:/src/tmp/a.cc:9:15: note: place parentheses around the string literal to 
silence warning

  ""
  ^

1 warning generated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85545/new/

https://reviews.llvm.org/D85545

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D85457: [NewPM][optnone] Mark various passes as required

2020-08-14 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 285752.
aeubanks added a comment.

-target -> -triple
rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85457/new/

https://reviews.llvm.org/D85457

Files:
  clang/test/CodeGen/O0-no-skipped-passes.c
  llvm/include/llvm/IR/IRPrintingPasses.h
  llvm/include/llvm/IR/PassManager.h
  llvm/include/llvm/IR/Verifier.h
  llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h
  llvm/include/llvm/Transforms/Coroutines/CoroEarly.h
  llvm/include/llvm/Transforms/Coroutines/CoroElide.h
  llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
  llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
  llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
  llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
  llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
  llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
  llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
  llvm/test/Feature/optnone-opt.ll

Index: llvm/test/Feature/optnone-opt.ll
===
--- llvm/test/Feature/optnone-opt.ll
+++ llvm/test/Feature/optnone-opt.ll
@@ -66,8 +66,8 @@
 ; Additional IR passes that opt doesn't turn on by default.
 ; MORE-DAG: Skipping pass 'Dead Code Elimination'
 ; MORE-DAG: Skipping pass 'Dead Instruction Elimination'
+; NPM-MORE-DAG: Skipping pass: DCEPass
 ; NPM-MORE-DAG: Skipping pass: GVNHoistPass
-; NPM-MORE-DAG: Skipping pass: LowerAtomicPass
 
 ; Loop IR passes that opt doesn't turn on by default.
 ; LOOP-DAG: Skipping pass 'Delete dead loops'
Index: llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
===
--- llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
+++ llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
@@ -18,6 +18,7 @@
 namespace llvm {
 struct LowerMatrixIntrinsicsPass : PassInfoMixin {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 } // namespace llvm
 
Index: llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
===
--- llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
+++ llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
@@ -22,6 +22,7 @@
 class LowerAtomicPass : public PassInfoMixin {
 public:
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  static bool isRequired() { return true; }
 };
 }
 
Index: llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
@@ -28,6 +28,7 @@
 struct ThreadSanitizerPass : public PassInfoMixin {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 } // namespace llvm
Index: llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
===
--- llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
+++ llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
@@ -46,6 +46,7 @@
*vfs::getRealFileSystem());
   }
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   SanitizerCoverageOptions Options;
Index: llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
@@ -41,6 +41,7 @@
 
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   MemorySanitizerOptions Options;
Index: llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
@@ -27,6 +27,7 @@
   explicit HWAddressSanitizerPass(bool CompileKernel = false,
   bool Recover = false);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  static bool isRequired() { return true; }
 
 private:
   bool CompileKernel;
Index: llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
=

[PATCH] D85457: [NewPM][optnone] Mark various passes as required

2020-08-14 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe6ea8779c2e0: [NewPM][optnone] Mark various passes as 
required (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85457/new/

https://reviews.llvm.org/D85457

Files:
  clang/test/CodeGen/O0-no-skipped-passes.c
  llvm/include/llvm/IR/IRPrintingPasses.h
  llvm/include/llvm/IR/PassManager.h
  llvm/include/llvm/IR/Verifier.h
  llvm/include/llvm/Transforms/Coroutines/CoroCleanup.h
  llvm/include/llvm/Transforms/Coroutines/CoroEarly.h
  llvm/include/llvm/Transforms/Coroutines/CoroElide.h
  llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
  llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
  llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
  llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
  llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
  llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
  llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
  llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
  llvm/test/Feature/optnone-opt.ll

Index: llvm/test/Feature/optnone-opt.ll
===
--- llvm/test/Feature/optnone-opt.ll
+++ llvm/test/Feature/optnone-opt.ll
@@ -66,8 +66,8 @@
 ; Additional IR passes that opt doesn't turn on by default.
 ; MORE-DAG: Skipping pass 'Dead Code Elimination'
 ; MORE-DAG: Skipping pass 'Dead Instruction Elimination'
+; NPM-MORE-DAG: Skipping pass: DCEPass
 ; NPM-MORE-DAG: Skipping pass: GVNHoistPass
-; NPM-MORE-DAG: Skipping pass: LowerAtomicPass
 
 ; Loop IR passes that opt doesn't turn on by default.
 ; LOOP-DAG: Skipping pass 'Delete dead loops'
Index: llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
===
--- llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
+++ llvm/include/llvm/Transforms/Scalar/LowerMatrixIntrinsics.h
@@ -18,6 +18,7 @@
 namespace llvm {
 struct LowerMatrixIntrinsicsPass : PassInfoMixin {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 } // namespace llvm
 
Index: llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
===
--- llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
+++ llvm/include/llvm/Transforms/Scalar/LowerAtomic.h
@@ -22,6 +22,7 @@
 class LowerAtomicPass : public PassInfoMixin {
 public:
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
+  static bool isRequired() { return true; }
 };
 }
 
Index: llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
@@ -28,6 +28,7 @@
 struct ThreadSanitizerPass : public PassInfoMixin {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 };
 
 } // namespace llvm
Index: llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
===
--- llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
+++ llvm/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h
@@ -46,6 +46,7 @@
*vfs::getRealFileSystem());
   }
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   SanitizerCoverageOptions Options;
Index: llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
@@ -41,6 +41,7 @@
 
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+  static bool isRequired() { return true; }
 
 private:
   MemorySanitizerOptions Options;
Index: llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
===
--- llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
+++ llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
@@ -27,6 +27,7 @@
   explicit HWAddressSanitizerPass(bool CompileKernel = false,
   bool Recover = false);
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
+  static bool isRequired() { return true; }
 
 private:
   bool CompileKernel;
Index: llv

[PATCH] D86008: [NewPM][optnone] Fix clang tests in preparation for -enable-npm-optnone

2020-08-14 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
Herald added subscribers: cfe-commits, dexonsmith, steven_wu, hiraditya.
Herald added a project: clang.
aeubanks requested review of this revision.

These are the last clang tests failing before being able to turn on 
-enable-npm-optnone.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86008

Files:
  clang/test/CodeGen/aggregate-assign-call.c
  clang/test/CodeGen/thinlto-debug-pm.c


Index: clang/test/CodeGen/thinlto-debug-pm.c
===
--- clang/test/CodeGen/thinlto-debug-pm.c
+++ clang/test/CodeGen/thinlto-debug-pm.c
@@ -1,16 +1,22 @@
 // Test to ensure the opt level is passed down to the ThinLTO backend.
 // REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple 
x86_64-unknown-linux-gnu -emit-llvm-bc %s
+
+// RUN: %clang_cc1 -O2 -o %t.o -flto=thin -fexperimental-new-pass-manager 
-triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
 // RUN: llvm-lto -thinlto -o %t %t.o
 
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm 
-debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O2-OLDPM
+// O2-OLDPM: Loop Vectorization
+
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O2-NEWPM
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-NEWPM
 // O2-NEWPM: Running pass: LoopVectorizePass
+
+// RUN: %clang_cc1 -O0 -o %t.o -flto=thin -fexperimental-new-pass-manager 
-triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
+// RUN: llvm-lto -thinlto -o %t %t.o
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-NEWPM
 // O0-NEWPM-NOT: Running pass: LoopVectorizePass
 
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm 
-debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O2-OLDPM
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm 
-debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O0-OLDPM
-// O2-OLDPM: Loop Vectorization
 // O0-OLDPM-NOT: Loop Vectorization
 
 void foo() {
Index: clang/test/CodeGen/aggregate-assign-call.c
===
--- clang/test/CodeGen/aggregate-assign-call.c
+++ clang/test/CodeGen/aggregate-assign-call.c
@@ -1,6 +1,7 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 
-fno-experimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1,O1-LEGACY
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 
-fexperimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1,O1-NEWPM
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s 
| FileCheck %s --check-prefix=O0
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -mllvm -enable-npm-optnone 
-triple x86_64-unknown-linux-gnu -O1 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1
+// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple 
x86_64-unknown-linux-gnu -O1 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -mllvm -enable-npm-optnone 
-triple x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefix=O0
+// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple 
x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefix=O0
 //
 // Ensure that we place appropriate lifetime markers around indirectly returned
 // temporaries, and that the lifetime.ends appear in a timely manner.
@@ -54,29 +55,21 @@
 
   do {
 // O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* nonnull 
%[[P]])
+// O1: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
 //
-// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: %[[TMP3:.*]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
-// O1-NEWPM: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* nonnull 
%[[P]])
+// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
+// O1: call void @llvm.lifetime.end.p

[PATCH] D86008: [NewPM][optnone] Fix clang tests in preparation for -enable-npm-optnone

2020-08-14 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 285797.
aeubanks added a comment.

Split out other test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86008/new/

https://reviews.llvm.org/D86008

Files:
  clang/test/CodeGen/aggregate-assign-call.c


Index: clang/test/CodeGen/aggregate-assign-call.c
===
--- clang/test/CodeGen/aggregate-assign-call.c
+++ clang/test/CodeGen/aggregate-assign-call.c
@@ -1,6 +1,7 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 
-fno-experimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1,O1-LEGACY
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 
-fexperimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1,O1-NEWPM
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s 
| FileCheck %s --check-prefix=O0
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -mllvm -enable-npm-optnone 
-triple x86_64-unknown-linux-gnu -O1 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1
+// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple 
x86_64-unknown-linux-gnu -O1 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -mllvm -enable-npm-optnone 
-triple x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefix=O0
+// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple 
x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefix=O0
 //
 // Ensure that we place appropriate lifetime markers around indirectly returned
 // temporaries, and that the lifetime.ends appear in a timely manner.
@@ -54,29 +55,21 @@
 
   do {
 // O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* nonnull 
%[[P]])
+// O1: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
 //
-// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: %[[TMP3:.*]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
-// O1-NEWPM: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* nonnull 
%[[P]])
+// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
+// O1: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
 //
-// O1-LEGACY: call void @foo_int(%struct.S* sret align 4 %[[TMP1_ALLOCA]],
-// O1-NEWPM: call void @foo_int(%struct.S* nonnull sret align 4 
%[[TMP1_ALLOCA]],
+// O1: call void @foo_int(%struct.S* sret align 4 %[[TMP1_ALLOCA]],
 // O1: call void @llvm.memcpy
-// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* nonnull 
%[[P]])
-// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* nonnull 
%[[TMP3]])
-// O1-LEGACY: call void @foo_int(%struct.S* sret align 4 %[[TMP2_ALLOCA]],
-// O1-NEWPM: call void @foo_int(%struct.S* nonnull sret align 4 
%[[TMP2_ALLOCA]],
+// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
+// O1: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
+// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
+// O1: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
+// O1: call void @foo_int(%struct.S* sret align 4 %[[TMP2_ALLOCA]],
 // O1: call void @llvm.memcpy
-// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* nonnull 
%[[TMP3]])
+// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
+// O1: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
 r = foo_int(({
   if (*j)
 break;


Index: clang/test/CodeGen/aggregate-assign-call.c
===
--- clang/test/CodeGen/aggregate-assign-call.c
+++ clang/test/CodeGen/aggregate-assign-call.c
@@ -1,6 +1,7 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 -fno-experimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=O1,O1-LEGACY
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 -fexperimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=O1,O1-NEWPM
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s | FileCheck %s --check-prefix=O0
+// RUN: %clang_cc1 -fexperimental-new-pass-m

[PATCH] D86011: [test] Fix thinlto-debug-pm.c in preparation for -enable-npm-optnone

2020-08-14 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
aeubanks added reviewers: asbirlea, ychen.
Herald added subscribers: cfe-commits, dexonsmith, steven_wu, hiraditya, 
inglorion.
Herald added a project: clang.
aeubanks requested review of this revision.

This fails due to the clang invocation running at -O0, producing an optnone 
function.
Then even with -O2 in the later invocations, LoopVectorizePass doesn't run on 
the optnone function.
So split this into an -O0 run and an -O2 run.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86011

Files:
  clang/test/CodeGen/thinlto-debug-pm.c


Index: clang/test/CodeGen/thinlto-debug-pm.c
===
--- clang/test/CodeGen/thinlto-debug-pm.c
+++ clang/test/CodeGen/thinlto-debug-pm.c
@@ -1,16 +1,22 @@
 // Test to ensure the opt level is passed down to the ThinLTO backend.
 // REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple 
x86_64-unknown-linux-gnu -emit-llvm-bc %s
+
+// RUN: %clang_cc1 -O2 -o %t.o -flto=thin -fexperimental-new-pass-manager 
-triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
 // RUN: llvm-lto -thinlto -o %t %t.o
 
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm 
-debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O2-OLDPM
+// O2-OLDPM: Loop Vectorization
+
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O2-NEWPM
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-NEWPM
 // O2-NEWPM: Running pass: LoopVectorizePass
+
+// RUN: %clang_cc1 -O0 -o %t.o -flto=thin -fexperimental-new-pass-manager 
-triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
+// RUN: llvm-lto -thinlto -o %t %t.o
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-NEWPM
 // O0-NEWPM-NOT: Running pass: LoopVectorizePass
 
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm 
-debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O2-OLDPM
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm 
-debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O0-OLDPM
-// O2-OLDPM: Loop Vectorization
 // O0-OLDPM-NOT: Loop Vectorization
 
 void foo() {


Index: clang/test/CodeGen/thinlto-debug-pm.c
===
--- clang/test/CodeGen/thinlto-debug-pm.c
+++ clang/test/CodeGen/thinlto-debug-pm.c
@@ -1,16 +1,22 @@
 // Test to ensure the opt level is passed down to the ThinLTO backend.
 // REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
+
+// RUN: %clang_cc1 -O2 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
 // RUN: llvm-lto -thinlto -o %t %t.o
 
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm -debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O2-OLDPM
+// O2-OLDPM: Loop Vectorization
+
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O2-NEWPM
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-NEWPM
 // O2-NEWPM: Running pass: LoopVectorizePass
+
+// RUN: %clang_cc1 -O0 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
+// RUN: llvm-lto -thinlto -o %t %t.o
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-NEWPM
 // O0-NEWPM-NOT: Running pass: LoopVectorizePass
 
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm -debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O2-OLDPM
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t

[PATCH] D86011: [test] Fix thinlto-debug-pm.c in preparation for -enable-npm-optnone

2020-08-17 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa3973195095e: [test] Fix thinlto-debug-pm.c in preparation 
for -enable-npm-optnone (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86011/new/

https://reviews.llvm.org/D86011

Files:
  clang/test/CodeGen/thinlto-debug-pm.c


Index: clang/test/CodeGen/thinlto-debug-pm.c
===
--- clang/test/CodeGen/thinlto-debug-pm.c
+++ clang/test/CodeGen/thinlto-debug-pm.c
@@ -1,16 +1,22 @@
 // Test to ensure the opt level is passed down to the ThinLTO backend.
 // REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple 
x86_64-unknown-linux-gnu -emit-llvm-bc %s
+
+// RUN: %clang_cc1 -O2 -o %t.o -flto=thin -fexperimental-new-pass-manager 
-triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
 // RUN: llvm-lto -thinlto -o %t %t.o
 
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm 
-debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O2-OLDPM
+// O2-OLDPM: Loop Vectorization
+
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O2-NEWPM
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-NEWPM
 // O2-NEWPM: Running pass: LoopVectorizePass
+
+// RUN: %clang_cc1 -O0 -o %t.o -flto=thin -fexperimental-new-pass-manager 
-triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
+// RUN: llvm-lto -thinlto -o %t %t.o
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager 
-fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-NEWPM
 // O0-NEWPM-NOT: Running pass: LoopVectorizePass
 
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm 
-debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O2-OLDPM
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x 
ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm 
-debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O0-OLDPM
-// O2-OLDPM: Loop Vectorization
 // O0-OLDPM-NOT: Loop Vectorization
 
 void foo() {


Index: clang/test/CodeGen/thinlto-debug-pm.c
===
--- clang/test/CodeGen/thinlto-debug-pm.c
+++ clang/test/CodeGen/thinlto-debug-pm.c
@@ -1,16 +1,22 @@
 // Test to ensure the opt level is passed down to the ThinLTO backend.
 // REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
+
+// RUN: %clang_cc1 -O2 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
 // RUN: llvm-lto -thinlto -o %t %t.o
 
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm -debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O2-OLDPM
+// O2-OLDPM: Loop Vectorization
+
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O2-NEWPM
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-NEWPM
 // O2-NEWPM: Running pass: LoopVectorizePass
+
+// RUN: %clang_cc1 -O0 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
+// RUN: llvm-lto -thinlto -o %t %t.o
+
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s --check-prefix=O0-NEWPM
 // O0-NEWPM-NOT: Running pass: LoopVectorizePass
 
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm -debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O2-OLDPM
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O0 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fno-experimental-new-pass-manager -mllvm -debug-pass=Structure 2>&1 | FileCheck %s --check-prefix=O0-OLDPM
-// O2-OLDPM: Loop Vectorization
 // O0-OLDPM-NOT: 

[PATCH] D86008: [test] Fix aggregate-assign-call.c in preparation for -enable-npm-optnone

2020-08-17 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb0ceff94d663: [test] Fix aggregate-assign-call.c in 
preparation for -enable-npm-optnone (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86008/new/

https://reviews.llvm.org/D86008

Files:
  clang/test/CodeGen/aggregate-assign-call.c


Index: clang/test/CodeGen/aggregate-assign-call.c
===
--- clang/test/CodeGen/aggregate-assign-call.c
+++ clang/test/CodeGen/aggregate-assign-call.c
@@ -1,6 +1,7 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 
-fno-experimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1,O1-LEGACY
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 
-fexperimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1,O1-NEWPM
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s 
| FileCheck %s --check-prefix=O0
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -mllvm -enable-npm-optnone 
-triple x86_64-unknown-linux-gnu -O1 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1
+// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple 
x86_64-unknown-linux-gnu -O1 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=O1
+// RUN: %clang_cc1 -fexperimental-new-pass-manager -mllvm -enable-npm-optnone 
-triple x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefix=O0
+// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple 
x86_64-unknown-linux-gnu -O0 -S -emit-llvm -o - %s | FileCheck %s 
--check-prefix=O0
 //
 // Ensure that we place appropriate lifetime markers around indirectly returned
 // temporaries, and that the lifetime.ends appear in a timely manner.
@@ -54,29 +55,21 @@
 
   do {
 // O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* nonnull 
%[[P]])
+// O1: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
 //
-// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: %[[TMP3:.*]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
-// O1-NEWPM: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* nonnull 
%[[P]])
+// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
+// O1: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
 //
-// O1-LEGACY: call void @foo_int(%struct.S* sret align 4 %[[TMP1_ALLOCA]],
-// O1-NEWPM: call void @foo_int(%struct.S* nonnull sret align 4 
%[[TMP1_ALLOCA]],
+// O1: call void @foo_int(%struct.S* sret align 4 %[[TMP1_ALLOCA]],
 // O1: call void @llvm.memcpy
-// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* nonnull 
%[[P]])
-// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* nonnull 
%[[TMP3]])
-// O1-LEGACY: call void @foo_int(%struct.S* sret align 4 %[[TMP2_ALLOCA]],
-// O1-NEWPM: call void @foo_int(%struct.S* nonnull sret align 4 
%[[TMP2_ALLOCA]],
+// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP1_ALLOCA]] to i8*
+// O1: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
+// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
+// O1: call void @llvm.lifetime.start.p0i8({{[^,]*}}, i8* %[[P]])
+// O1: call void @foo_int(%struct.S* sret align 4 %[[TMP2_ALLOCA]],
 // O1: call void @llvm.memcpy
-// O1-LEGACY: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
-// O1-LEGACY: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
-// O1-NEWPM: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* nonnull 
%[[TMP3]])
+// O1: %[[P:[^ ]+]] = bitcast %struct.S* %[[TMP2_ALLOCA]] to i8*
+// O1: call void @llvm.lifetime.end.p0i8({{[^,]*}}, i8* %[[P]])
 r = foo_int(({
   if (*j)
 break;


Index: clang/test/CodeGen/aggregate-assign-call.c
===
--- clang/test/CodeGen/aggregate-assign-call.c
+++ clang/test/CodeGen/aggregate-assign-call.c
@@ -1,6 +1,7 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 -fno-experimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=O1,O1-LEGACY
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -O1 -fexperimental-new-pass-manager -S -emit-llvm -o - %s | FileCheck %s --check-prefixes=O1,O1-NEWPM
-// RUN: %clang_cc1 -triple x86_64-unknown-linu

[PATCH] D80833: [CodeView] Add full repro to LF_BUILDINFO record

2020-08-17 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

This seems to be breaking determinism on Windows builds, see 
https://crbug.com/1117026. Can this be reverted and fixed?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80833/new/

https://reviews.llvm.org/D80833

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79445: [MSan] Pass MSan command line options under new pass manager

2020-05-05 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
aeubanks added reviewers: nemanjai, vitalybuka, leonardchan.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Properly forward TrackOrigins and Recover user options to the MSan pass under 
the new pass manager.
This makes the number of check-msan failures when 
ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER is TRUE go from 52 to 2.

Based on https://reviews.llvm.org/D77249.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79445

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1016,8 +1016,11 @@
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-MPM.addPass(MemorySanitizerPass({}));
-MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({})));
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+MPM.addPass(createModuleToFunctionPassAdaptor(
+MemorySanitizerPass({TrackOrigins, Recover, false})));
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::KernelMemory)) {
@@ -1236,12 +1239,16 @@
   FPM.addPass(BoundsCheckingPass());
 });
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-PB.registerPipelineStartEPCallback([](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({}));
-});
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+PB.registerPipelineStartEPCallback(
+[TrackOrigins, Recover](ModulePassManager &MPM) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+});
 PB.registerOptimizerLastEPCallback(
-[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) 
{
-  FPM.addPass(MemorySanitizerPass({}));
+[TrackOrigins, Recover](FunctionPassManager &FPM,
+PassBuilder::OptimizationLevel Level) {
+  FPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1016,8 +1016,11 @@
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-MPM.addPass(MemorySanitizerPass({}));
-MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({})));
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+MPM.addPass(createModuleToFunctionPassAdaptor(
+MemorySanitizerPass({TrackOrigins, Recover, false})));
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::KernelMemory)) {
@@ -1236,12 +1239,16 @@
   FPM.addPass(BoundsCheckingPass());
 });
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-PB.registerPipelineStartEPCallback([](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({}));
-});
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+PB.registerPipelineStartEPCallback(
+[TrackOrigins, Recover](ModulePassManager &MPM) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+});
 PB.registerOptimizerLastEPCallback(
-[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
-  FPM.addPass(MemorySanitizerPass({}));
+[TrackOrigins, Recover](FunctionPassManager &FPM,
+PassBuilder::OptimizationLevel Level) {
+  FPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79445: [MSan] Pass MSan command line options under new pass manager

2020-05-05 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 262248.
aeubanks added a comment.

Address review comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79445/new/

https://reviews.llvm.org/D79445

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1015,14 +1015,20 @@
 ASanPass(SanitizerKind::KernelAddress, /*CompileKernel=*/true);
   }
 
+  auto MSanPass = [&](SanitizerMask Mask, bool Kernel) {
+bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, Kernel}));
+MPM.addPass(createModuleToFunctionPassAdaptor(
+MemorySanitizerPass({TrackOrigins, Recover, Kernel})));
+  };
+
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-MPM.addPass(MemorySanitizerPass({}));
-MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({})));
+MSanPass(SanitizerKind::Memory, /*Kernel=*/false);
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::KernelMemory)) {
-MPM.addPass(createModuleToFunctionPassAdaptor(
-MemorySanitizerPass({0, false, /*Kernel=*/true})));
+MSanPass(SanitizerKind::KernelMemory, /*Kernel=*/true);
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
@@ -1236,12 +1242,16 @@
   FPM.addPass(BoundsCheckingPass());
 });
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-PB.registerPipelineStartEPCallback([](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({}));
-});
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+PB.registerPipelineStartEPCallback(
+[TrackOrigins, Recover](ModulePassManager &MPM) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+});
 PB.registerOptimizerLastEPCallback(
-[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) 
{
-  FPM.addPass(MemorySanitizerPass({}));
+[TrackOrigins, Recover](FunctionPassManager &FPM,
+PassBuilder::OptimizationLevel Level) {
+  FPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1015,14 +1015,20 @@
 ASanPass(SanitizerKind::KernelAddress, /*CompileKernel=*/true);
   }
 
+  auto MSanPass = [&](SanitizerMask Mask, bool Kernel) {
+bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, Kernel}));
+MPM.addPass(createModuleToFunctionPassAdaptor(
+MemorySanitizerPass({TrackOrigins, Recover, Kernel})));
+  };
+
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-MPM.addPass(MemorySanitizerPass({}));
-MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({})));
+MSanPass(SanitizerKind::Memory, /*Kernel=*/false);
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::KernelMemory)) {
-MPM.addPass(createModuleToFunctionPassAdaptor(
-MemorySanitizerPass({0, false, /*Kernel=*/true})));
+MSanPass(SanitizerKind::KernelMemory, /*Kernel=*/true);
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
@@ -1236,12 +1242,16 @@
   FPM.addPass(BoundsCheckingPass());
 });
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-PB.registerPipelineStartEPCallback([](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({}));
-});
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+PB.registerPipelineStartEPCallback(
+[TrackOrigins, Recover](ModulePassManager &MPM) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+});
 PB.registerOptimizerLastEPCallback(
-[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
-  FPM.addPass(MemorySanitizerPass({}));
+[TrackOrigins, Recover](FunctionPassManager &FPM,
+PassBuilder::OptimizationLevel Level) {
+  FPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
___
cfe-commits maili

[PATCH] D79445: [MSan] Pass MSan command line options under new pass manager

2020-05-05 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D79445#2021311 , @leonardchan wrote:

> In `addSanitizersAtO0`, could you make something similar to the `ASanPass` 
> lambda for the MSan passes and also apply it when adding kernel MSan?


It ends up calling an extra `MPM.addPass(createModuleToFunctionPassAdaptor())` 
in the `KernelMemory` case, is that okay?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79445/new/

https://reviews.llvm.org/D79445



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79445: [MSan] Pass MSan command line options under new pass manager

2020-05-06 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 262426.
aeubanks added a comment.

Revert back to initial patch


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79445/new/

https://reviews.llvm.org/D79445

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1016,8 +1016,11 @@
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-MPM.addPass(MemorySanitizerPass({}));
-MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({})));
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+MPM.addPass(createModuleToFunctionPassAdaptor(
+MemorySanitizerPass({TrackOrigins, Recover, false})));
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::KernelMemory)) {
@@ -1236,12 +1239,16 @@
   FPM.addPass(BoundsCheckingPass());
 });
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-PB.registerPipelineStartEPCallback([](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({}));
-});
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+PB.registerPipelineStartEPCallback(
+[TrackOrigins, Recover](ModulePassManager &MPM) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+});
 PB.registerOptimizerLastEPCallback(
-[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) 
{
-  FPM.addPass(MemorySanitizerPass({}));
+[TrackOrigins, Recover](FunctionPassManager &FPM,
+PassBuilder::OptimizationLevel Level) {
+  FPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1016,8 +1016,11 @@
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-MPM.addPass(MemorySanitizerPass({}));
-MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({})));
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+MPM.addPass(createModuleToFunctionPassAdaptor(
+MemorySanitizerPass({TrackOrigins, Recover, false})));
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::KernelMemory)) {
@@ -1236,12 +1239,16 @@
   FPM.addPass(BoundsCheckingPass());
 });
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-PB.registerPipelineStartEPCallback([](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({}));
-});
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+PB.registerPipelineStartEPCallback(
+[TrackOrigins, Recover](ModulePassManager &MPM) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+});
 PB.registerOptimizerLastEPCallback(
-[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
-  FPM.addPass(MemorySanitizerPass({}));
+[TrackOrigins, Recover](FunctionPassManager &FPM,
+PassBuilder::OptimizationLevel Level) {
+  FPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79445: [MSan] Pass MSan command line options under new pass manager

2020-05-07 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG48451ee6a7ee: [MSan] Pass MSan command line options under 
new pass manager (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79445/new/

https://reviews.llvm.org/D79445

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1016,8 +1016,11 @@
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-MPM.addPass(MemorySanitizerPass({}));
-MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({})));
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+MPM.addPass(createModuleToFunctionPassAdaptor(
+MemorySanitizerPass({TrackOrigins, Recover, false})));
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::KernelMemory)) {
@@ -1236,12 +1239,16 @@
   FPM.addPass(BoundsCheckingPass());
 });
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-PB.registerPipelineStartEPCallback([](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({}));
-});
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+PB.registerPipelineStartEPCallback(
+[TrackOrigins, Recover](ModulePassManager &MPM) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+});
 PB.registerOptimizerLastEPCallback(
-[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) 
{
-  FPM.addPass(MemorySanitizerPass({}));
+[TrackOrigins, Recover](FunctionPassManager &FPM,
+PassBuilder::OptimizationLevel Level) {
+  FPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1016,8 +1016,11 @@
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-MPM.addPass(MemorySanitizerPass({}));
-MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass({})));
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+MPM.addPass(createModuleToFunctionPassAdaptor(
+MemorySanitizerPass({TrackOrigins, Recover, false})));
   }
 
   if (LangOpts.Sanitize.has(SanitizerKind::KernelMemory)) {
@@ -1236,12 +1239,16 @@
   FPM.addPass(BoundsCheckingPass());
 });
   if (LangOpts.Sanitize.has(SanitizerKind::Memory)) {
-PB.registerPipelineStartEPCallback([](ModulePassManager &MPM) {
-  MPM.addPass(MemorySanitizerPass({}));
-});
+int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;
+bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::Memory);
+PB.registerPipelineStartEPCallback(
+[TrackOrigins, Recover](ModulePassManager &MPM) {
+  MPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
+});
 PB.registerOptimizerLastEPCallback(
-[](FunctionPassManager &FPM, PassBuilder::OptimizationLevel Level) {
-  FPM.addPass(MemorySanitizerPass({}));
+[TrackOrigins, Recover](FunctionPassManager &FPM,
+PassBuilder::OptimizationLevel Level) {
+  FPM.addPass(MemorySanitizerPass({TrackOrigins, Recover, false}));
 });
   }
   if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79698: Run Coverage pass before other *San passes under new pass manager

2020-05-10 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
aeubanks added reviewers: vitalybuka, leonardchan.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This fixes compiler-rt/test/msan/coverage-levels.cpp under the new pass manager 
(final check-msan test!).
Under the old pass manager, the coverage pass would run before the MSan pass. 
The opposite happened under the new pass manager. The MSan pass adds extra 
basic blocks, changing the number of coverage callbacks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79698

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1004,6 +1004,15 @@
   const Triple &TargetTriple,
   const LangOptions &LangOpts,
   const CodeGenOptions &CodeGenOpts) {
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+MPM.addPass(ModuleSanitizerCoveragePass(
+SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+CodeGenOpts.SanitizeCoverageBlacklistFiles));
+  }
+
   auto ASanPass = [&](SanitizerMask Mask, bool CompileKernel) {
 MPM.addPass(RequireAnalysisPass());
 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
@@ -1244,6 +1253,17 @@
 EntryExitInstrumenterPass(/*PostInlining=*/false)));
   });
 
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+PB.registerPipelineStartEPCallback([&](ModulePassManager &MPM) {
+  auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+  MPM.addPass(ModuleSanitizerCoveragePass(
+  SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+  CodeGenOpts.SanitizeCoverageBlacklistFiles));
+});
+  }
+
   // Register callbacks to schedule sanitizer passes at the appropriate 
part of
   // the pipeline.
   // FIXME: either handle asan/the remaining sanitizers or error out
@@ -1328,15 +1348,6 @@
   }
 }
 
-if (CodeGenOpts.SanitizeCoverageType ||
-CodeGenOpts.SanitizeCoverageIndirectCalls ||
-CodeGenOpts.SanitizeCoverageTraceCmp) {
-  auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
-  MPM.addPass(ModuleSanitizerCoveragePass(
-  SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
-  CodeGenOpts.SanitizeCoverageBlacklistFiles));
-}
-
 if (LangOpts.Sanitize.has(SanitizerKind::HWAddress)) {
   bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::HWAddress);
   MPM.addPass(HWAddressSanitizerPass(


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1004,6 +1004,15 @@
   const Triple &TargetTriple,
   const LangOptions &LangOpts,
   const CodeGenOptions &CodeGenOpts) {
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+MPM.addPass(ModuleSanitizerCoveragePass(
+SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+CodeGenOpts.SanitizeCoverageBlacklistFiles));
+  }
+
   auto ASanPass = [&](SanitizerMask Mask, bool CompileKernel) {
 MPM.addPass(RequireAnalysisPass());
 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
@@ -1244,6 +1253,17 @@
 EntryExitInstrumenterPass(/*PostInlining=*/false)));
   });
 
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+PB.registerPipelineStartEPCallback([&](ModulePassManager &MPM) {
+  auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+  MPM.addPass(ModuleSanitizerCoveragePass(
+  SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+  CodeGenOpts.SanitizeCoverageBlacklistFiles));
+});
+  }
+
   // Register callbacks to schedule sanitizer passes at the appropriate part of
   // the pipeline.
   // FIXME: either handle asan/the remaining sanitizers or error out
@@ -1328,15 +1348,6 @@
   }
 }
 
-if (CodeGenOpts.SanitizeCoverageType ||
-CodeGenOpts.SanitizeCoverageIndirectCalls ||
-CodeGenOpts.SanitizeCoverageTraceCmp) {
-  auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
-  MPM.addPass(ModuleSanitizerCoveragePass(
-  SancovOpts, CodeGenOpts.San

[PATCH] D79698: Run Coverage pass before other *San passes under new pass manager

2020-05-11 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7d5bb94d7838: Run Coverage pass before other *San passes 
under new pass manager (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79698/new/

https://reviews.llvm.org/D79698

Files:
  clang/lib/CodeGen/BackendUtil.cpp


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1002,6 +1002,15 @@
   const Triple &TargetTriple,
   const LangOptions &LangOpts,
   const CodeGenOptions &CodeGenOpts) {
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+MPM.addPass(ModuleSanitizerCoveragePass(
+SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+CodeGenOpts.SanitizeCoverageBlacklistFiles));
+  }
+
   auto ASanPass = [&](SanitizerMask Mask, bool CompileKernel) {
 MPM.addPass(RequireAnalysisPass());
 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
@@ -1242,6 +1251,17 @@
 EntryExitInstrumenterPass(/*PostInlining=*/false)));
   });
 
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+PB.registerPipelineStartEPCallback([&](ModulePassManager &MPM) {
+  auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+  MPM.addPass(ModuleSanitizerCoveragePass(
+  SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+  CodeGenOpts.SanitizeCoverageBlacklistFiles));
+});
+  }
+
   // Register callbacks to schedule sanitizer passes at the appropriate 
part of
   // the pipeline.
   // FIXME: either handle asan/the remaining sanitizers or error out
@@ -1326,15 +1346,6 @@
   }
 }
 
-if (CodeGenOpts.SanitizeCoverageType ||
-CodeGenOpts.SanitizeCoverageIndirectCalls ||
-CodeGenOpts.SanitizeCoverageTraceCmp) {
-  auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
-  MPM.addPass(ModuleSanitizerCoveragePass(
-  SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
-  CodeGenOpts.SanitizeCoverageBlacklistFiles));
-}
-
 if (LangOpts.Sanitize.has(SanitizerKind::HWAddress)) {
   bool Recover = CodeGenOpts.SanitizeRecover.has(SanitizerKind::HWAddress);
   MPM.addPass(HWAddressSanitizerPass(


Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1002,6 +1002,15 @@
   const Triple &TargetTriple,
   const LangOptions &LangOpts,
   const CodeGenOptions &CodeGenOpts) {
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+MPM.addPass(ModuleSanitizerCoveragePass(
+SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+CodeGenOpts.SanitizeCoverageBlacklistFiles));
+  }
+
   auto ASanPass = [&](SanitizerMask Mask, bool CompileKernel) {
 MPM.addPass(RequireAnalysisPass());
 bool Recover = CodeGenOpts.SanitizeRecover.has(Mask);
@@ -1242,6 +1251,17 @@
 EntryExitInstrumenterPass(/*PostInlining=*/false)));
   });
 
+  if (CodeGenOpts.SanitizeCoverageType ||
+  CodeGenOpts.SanitizeCoverageIndirectCalls ||
+  CodeGenOpts.SanitizeCoverageTraceCmp) {
+PB.registerPipelineStartEPCallback([&](ModulePassManager &MPM) {
+  auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
+  MPM.addPass(ModuleSanitizerCoveragePass(
+  SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
+  CodeGenOpts.SanitizeCoverageBlacklistFiles));
+});
+  }
+
   // Register callbacks to schedule sanitizer passes at the appropriate part of
   // the pipeline.
   // FIXME: either handle asan/the remaining sanitizers or error out
@@ -1326,15 +1346,6 @@
   }
 }
 
-if (CodeGenOpts.SanitizeCoverageType ||
-CodeGenOpts.SanitizeCoverageIndirectCalls ||
-CodeGenOpts.SanitizeCoverageTraceCmp) {
-  auto SancovOpts = getSancovOptsFromCGOpts(CodeGenOpts);
-  MPM.addPass(ModuleSanitizerCoveragePass(
-  SancovOpts, CodeGenOpts.SanitizeCoverageWhitelistFiles,
-  CodeGenOpts.SanitizeCoverageBlacklistFiles));
-}
-
 if (LangOpts.Sanitize.has(SanitizerKind::HWAddress)) {
   bool Recover = CodeGenOpts.SanitizeRecover.has(Sa

[PATCH] D79698: Run Coverage pass before other *San passes under new pass manager

2020-05-14 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D79698#2037305 , @leonardchan wrote:

> Just to followup on this: We believe the root cause of the error we're 
> running into is that some sancov guards in one comdat are being referenced by 
> symbols in another comdat, so due to linking order, the other comdat in 
> question is referencing a sancov guard that was in a discarded comdat group. 
> I posted full details of this on llvm-dev 
> . We believe 
> we're running into this error now because with this patch, inlining occurs 
> after the sanitizers are run.
>
> Based on some discussion in 
> http://lists.llvm.org/pipermail/llvm-dev/2020-May/141558.html, it seems 
> appropriate that the solution for this is to just run sanitizers after 
> inlining, so we would avoid this error that's brought about by inlining after 
> sanitizer runs. Since this has been breaking us for a few days, and unless 
> other folks don't mind, I'm thinking it might be appropriate to temporarily 
> revert this until there's a fix for either


Maybe the fix is to use `registerScalarOptimizerLateEPCallback()` instead of 
`registerPipelineStartEPCallback()`. But I'm not sure how to test that, could 
you try that and lmk if that fixes the issue?

> (1) running sanitizers after inlining or
>  (2) changing which comdat groups the sancov guards get placed in (such that 
> guards in one group aren't referenced by functions defined in another group)
> 
> I'm not sure how long it would take to implement either solution, so I think 
> temporarily reverting might be ok here.

Sure, feel free to revert.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79698/new/

https://reviews.llvm.org/D79698



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79895: Fix warning about using uninitialized variable as function const reference parameter

2020-05-15 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

The summary of this change should be "add warning..." not "fix warning..."

Could you add more detail into the commit description? About newly introduced 
diagnostic groups, etc.

Also, I thought I saw tests in a previous revision but now they seem to be gone?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79895/new/

https://reviews.llvm.org/D79895



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79895: Add a new warning to warn when passing uninitialized variables as const reference parameters to a function

2020-05-18 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:2110
+def warn_uninit_const_reference : Warning<
+  "variable %0 is uninitialized when passes as a const reference parameter "
+  "here">, InGroup, DefaultIgnore;

s/passes/passed



Comment at: clang/test/SemaCXX/warn-uninitialized-const-reference.cpp:23
+int k = const_use(k); // expected-warning {{variable 'k' is uninitialized 
when used within its own initialization}}
+A a2 = const_use_A(a2); // expected-warning {{variable 'a2' is 
uninitialized when used within its own initialization}}
+A a3(const_ref_use_A(a3)); // expected-warning {{variable 'a3' is 
uninitialized when passes as a const reference parameter here}}

For my knowledge, is this to make sure that this other warning takes precedence 
over the one introduced in this change? If it is, a comment would be nice.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79895/new/

https://reviews.llvm.org/D79895



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-09-01 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

I've run into https://github.com/llvm/llvm-project/issues/56503 after this 
patch so I've reverted this for now while I'm fixing that. Sorry for this patch 
exposing so many pre-existing issues.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D133036: [InstCombine] Treat passing undef to noundef params as UB

2022-09-01 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks updated this revision to Diff 457383.
aeubanks added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

fix clang test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133036/new/

https://reviews.llvm.org/D133036

Files:
  clang/test/CodeGenOpenCL/overload.cl
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/test/Transforms/InstCombine/call-undef.ll
  llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll

Index: llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
===
--- llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
+++ llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
@@ -6,7 +6,7 @@
 ; CHECK-LABEL: @test_out_of_bounds(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[AND1:%.*]] = and i32 [[A:%.*]], 3
-; CHECK-NEXT:tail call void @llvm.assume(i1 poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret i32 [[AND1]]
 ;
 entry:
@@ -20,7 +20,7 @@
 define i128 @test_non64bit(i128 %a) {
 ; CHECK-LABEL: @test_non64bit(
 ; CHECK-NEXT:[[AND1:%.*]] = and i128 [[A:%.*]], 3
-; CHECK-NEXT:tail call void @llvm.assume(i1 poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret i128 [[AND1]]
 ;
   %and1 = and i128 %a, 3
Index: llvm/test/Transforms/InstCombine/call-undef.ll
===
--- llvm/test/Transforms/InstCombine/call-undef.ll
+++ llvm/test/Transforms/InstCombine/call-undef.ll
@@ -8,7 +8,7 @@
 
 define void @test1() {
 ; CHECK-LABEL: @test1(
-; CHECK-NEXT:call void @c(i32 undef)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @c(i32 undef)
@@ -17,7 +17,7 @@
 
 define void @test2() {
 ; CHECK-LABEL: @test2(
-; CHECK-NEXT:call void @c(i32 poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @c(i32 poison)
@@ -26,7 +26,7 @@
 
 define void @test3() {
 ; CHECK-LABEL: @test3(
-; CHECK-NEXT:call void @e(i32 noundef undef)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @e(i32 noundef undef)
@@ -35,7 +35,7 @@
 
 define void @test4() {
 ; CHECK-LABEL: @test4(
-; CHECK-NEXT:call void @e(i32 noundef poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @e(i32 noundef poison)
@@ -44,7 +44,7 @@
 
 define void @test5() {
 ; CHECK-LABEL: @test5(
-; CHECK-NEXT:call void @d(ptr undef)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @d(ptr undef)
@@ -53,7 +53,7 @@
 
 define void @test6() {
 ; CHECK-LABEL: @test6(
-; CHECK-NEXT:call void @d(ptr poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @d(ptr poison)
@@ -62,7 +62,7 @@
 
 define void @test7() {
 ; CHECK-LABEL: @test7(
-; CHECK-NEXT:call void @f(ptr dereferenceable(1) undef)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @f(ptr dereferenceable(1) undef)
@@ -71,7 +71,7 @@
 
 define void @test8() {
 ; CHECK-LABEL: @test8(
-; CHECK-NEXT:call void @f(ptr dereferenceable(1) poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @f(ptr dereferenceable(1) poison)
Index: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
===
--- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -2900,6 +2900,15 @@
   return nullptr;
 }
 
+static bool callPassesUndefToPassingUndefUBParam(CallBase &Call) {
+  for (unsigned I = 0; I < Call.arg_size(); ++I) {
+if (isa(Call.getArgOperand(I)) && Call.isPassingUndefUB(I)) {
+  return true;
+}
+  }
+  return false;
+}
+
 bool InstCombinerImpl::annotateAnyAllocSite(CallBase &Call,
 const TargetLibraryInfo *TLI) {
   // Note: We only handle cases which can't be driven from generic attributes
@@ -3026,9 +3035,11 @@
 
   // Calling a null function pointer is undefined if a null address isn't
   // dereferenceable.
+  // Passing undef/poison to any parameter where doing so is UB is undefined (of
+  // course).
   if ((isa(Callee) &&
!NullPointerIsDefined(Call.getFunction())) ||
-  isa(Callee)) {
+  isa(Callee) || callPassesUndefToPassingUndefUBParam(Call)) {
 // If Call does not return void then replaceInstUsesWith poison.
 // This allows ValueHandlers and custom metadata to adjust itself.
 if (!Call.getType()->isVoidTy())
Index: clang/test/CodeGenOpenCL/overload.cl
===
--- clang/test/CodeGenOpenCL/overload.cl
+++ clang/test/CodeGenOpenCL/overload.cl
@@ -1,5 +1,5 @@
-/

[PATCH] D133036: [InstCombine] Treat passing undef to noundef params as UB

2022-09-01 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc911befaec49: [InstCombine] Treat passing undef to noundef 
params as UB (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133036/new/

https://reviews.llvm.org/D133036

Files:
  clang/test/CodeGenOpenCL/overload.cl
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/test/Transforms/InstCombine/call-undef.ll
  llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll

Index: llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
===
--- llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
+++ llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
@@ -6,7 +6,7 @@
 ; CHECK-LABEL: @test_out_of_bounds(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[AND1:%.*]] = and i32 [[A:%.*]], 3
-; CHECK-NEXT:tail call void @llvm.assume(i1 poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret i32 [[AND1]]
 ;
 entry:
@@ -20,7 +20,7 @@
 define i128 @test_non64bit(i128 %a) {
 ; CHECK-LABEL: @test_non64bit(
 ; CHECK-NEXT:[[AND1:%.*]] = and i128 [[A:%.*]], 3
-; CHECK-NEXT:tail call void @llvm.assume(i1 poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret i128 [[AND1]]
 ;
   %and1 = and i128 %a, 3
Index: llvm/test/Transforms/InstCombine/call-undef.ll
===
--- llvm/test/Transforms/InstCombine/call-undef.ll
+++ llvm/test/Transforms/InstCombine/call-undef.ll
@@ -8,7 +8,7 @@
 
 define void @test1() {
 ; CHECK-LABEL: @test1(
-; CHECK-NEXT:call void @c(i32 undef)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @c(i32 undef)
@@ -17,7 +17,7 @@
 
 define void @test2() {
 ; CHECK-LABEL: @test2(
-; CHECK-NEXT:call void @c(i32 poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @c(i32 poison)
@@ -26,7 +26,7 @@
 
 define void @test3() {
 ; CHECK-LABEL: @test3(
-; CHECK-NEXT:call void @e(i32 noundef undef)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @e(i32 noundef undef)
@@ -35,7 +35,7 @@
 
 define void @test4() {
 ; CHECK-LABEL: @test4(
-; CHECK-NEXT:call void @e(i32 noundef poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @e(i32 noundef poison)
@@ -44,7 +44,7 @@
 
 define void @test5() {
 ; CHECK-LABEL: @test5(
-; CHECK-NEXT:call void @d(ptr undef)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @d(ptr undef)
@@ -53,7 +53,7 @@
 
 define void @test6() {
 ; CHECK-LABEL: @test6(
-; CHECK-NEXT:call void @d(ptr poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @d(ptr poison)
@@ -62,7 +62,7 @@
 
 define void @test7() {
 ; CHECK-LABEL: @test7(
-; CHECK-NEXT:call void @f(ptr dereferenceable(1) undef)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @f(ptr dereferenceable(1) undef)
@@ -71,7 +71,7 @@
 
 define void @test8() {
 ; CHECK-LABEL: @test8(
-; CHECK-NEXT:call void @f(ptr dereferenceable(1) poison)
+; CHECK-NEXT:store i1 true, ptr poison, align 1
 ; CHECK-NEXT:ret void
 ;
   call void @f(ptr dereferenceable(1) poison)
Index: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
===
--- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -2900,6 +2900,15 @@
   return nullptr;
 }
 
+static bool callPassesUndefToPassingUndefUBParam(CallBase &Call) {
+  for (unsigned I = 0; I < Call.arg_size(); ++I) {
+if (isa(Call.getArgOperand(I)) && Call.isPassingUndefUB(I)) {
+  return true;
+}
+  }
+  return false;
+}
+
 bool InstCombinerImpl::annotateAnyAllocSite(CallBase &Call,
 const TargetLibraryInfo *TLI) {
   // Note: We only handle cases which can't be driven from generic attributes
@@ -3026,9 +3035,11 @@
 
   // Calling a null function pointer is undefined if a null address isn't
   // dereferenceable.
+  // Passing undef/poison to any parameter where doing so is UB is undefined (of
+  // course).
   if ((isa(Callee) &&
!NullPointerIsDefined(Call.getFunction())) ||
-  isa(Callee)) {
+  isa(Callee) || callPassesUndefToPassingUndefUBParam(Call)) {
 // If Call does not return void then replaceInstUsesWith poison.
 // This allows ValueHandlers and custom metadata to adjust itself.
 if (!Call.getType()->isVoidTy())
Index: clang/test/CodeGenOpenCL/overload.cl
===
--- clang/test/

[PATCH] D133587: Loop names used in reporting can grow very large

2022-09-09 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks accepted this revision.
aeubanks added a comment.
This revision is now accepted and ready to land.

this is something I've wanted to do for a while but never got around to
thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133587/new/

https://reviews.llvm.org/D133587

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D133537: [pipelines] RecomputeGlobalsAAPass after OptimizerEarlyEPCallbacks

2022-09-14 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks accepted this revision.
aeubanks added a comment.
This revision is now accepted and ready to land.

lg with comments addressed

title needs update




Comment at: clang/lib/CodeGen/BackendUtil.cpp:443
   Options.EmulatedTLS = CodeGenOpts.EmulatedTLS;
-  Options.ExplicitEmulatedTLS = true;
+  Options.ExplicitEmulatedTLS = CodeGenOpts.ExplicitEmulatedTLS;
   Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();

unrelated?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133537/new/

https://reviews.llvm.org/D133537

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D144006: [DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)

2023-11-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

Heads up, we're seeing issues from this in Chrome again, will try to post a 
reduced repro (https://crbug.com/1500022)

The reduced repro I found crashed very far back, so I'm guessing this patch 
caused bad debug info which caused an existing issue that doesn't handle bad 
debug info.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144006/new/

https://reviews.llvm.org/D144006

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D144006: [DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)

2023-11-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

`../../llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp:110: void 
llvm::DwarfFile::addScopeVariable(LexicalScope *, DbgVariable *): Assertion 
'Ret.second' failed.`

is the crash btw


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144006/new/

https://reviews.llvm.org/D144006

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D144006: [DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)

2023-11-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

Is there any issue with mixing IR built with 
`LLVMContext::enableDebugTypeODRUniquing()` and without? I'm suspecting that 
ThinLTO is mixing Rust and Clang IR which set that differently.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144006/new/

https://reviews.llvm.org/D144006

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D144006: [DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)

2023-11-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

another observation, `opt` complained about some debug info due to setting 
`LLVMContext::enableDebugTypeODRUniquing()` and stripped it away, but `llc` 
happily accepted the debug info and crashed with the assertion above when 
emitting assembly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144006/new/

https://reviews.llvm.org/D144006

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D144006: [DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)

2023-11-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

F30438826: i.ll 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144006/new/

https://reviews.llvm.org/D144006

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D144006: [DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (4/7)

2023-11-07 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D144006#4656383 , @dzhidzhoev 
wrote:

> In D144006#4656371 , @aeubanks 
> wrote:
>
>> Is there any issue with mixing IR built with 
>> `LLVMContext::enableDebugTypeODRUniquing()` and without? I'm suspecting that 
>> ThinLTO is mixing Rust and Clang IR which set that differently.
>
> Apparently, it's an issue with ThinLTO that might be caused by a change in 
> MetadataLoader https://github.com/llvm/llvm-project/pull/68986.
> Is there a way to get a repro like this one 
> https://bugs.chromium.org/p/chromium/issues/detail?id=1487910#c3 if it's not 
> too complicated?

I've shared the repro tar with your commit email address, sorry it's so big. I 
tried linking again with the revert and now it looks like the debug info 
verifier is firing instead. Do you also need a repro tar with everything built 
with the revert?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144006/new/

https://reviews.llvm.org/D144006

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128955: [WPD] Use new llvm.public.type.test intrinsic for publicly visible classes

2022-06-30 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks created this revision.
Herald added subscribers: ormris, steven_wu, hiraditya.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, jdoerfert.
Herald added projects: clang, LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128955

Files:
  clang/lib/CodeGen/CGClass.cpp
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/Analysis/TypeMetadataUtils.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp

Index: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
===
--- llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
+++ llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
@@ -860,7 +860,7 @@
 const DenseSet &DynamicExportSymbols) {
   if (!hasWholeProgramVisibility(WholeProgramVisibilityEnabledInLTO))
 return;
-  for (GlobalVariable &GV : M.globals())
+  for (GlobalVariable &GV : M.globals()) {
 // Add linkage unit visibility to any variable with type metadata, which are
 // the vtable definitions. We won't have an existing vcall_visibility
 // metadata on vtable definitions with public visibility.
@@ -870,6 +870,34 @@
 // linker, as we have no information on their eventual use.
 !DynamicExportSymbols.count(GV.getGUID()))
   GV.setVCallVisibilityMetadata(GlobalObject::VCallVisibilityLinkageUnit);
+  }
+}
+
+void updatePublicTypeTestCalls(Module &M,
+   bool WholeProgramVisibilityEnabledInLTO) {
+  Function *PublicTypeTestFunc =
+  M.getFunction(Intrinsic::getName(Intrinsic::public_type_test));
+  if (!PublicTypeTestFunc)
+return;
+  if (hasWholeProgramVisibility(WholeProgramVisibilityEnabledInLTO)) {
+Function *TypeTestFunc =
+Intrinsic::getDeclaration(&M, Intrinsic::type_test);
+for (Use &U : make_early_inc_range(PublicTypeTestFunc->uses())) {
+  auto *CI = cast(U.getUser());
+  auto *NewCI = CallInst::Create(
+  TypeTestFunc, {CI->getArgOperand(0), CI->getArgOperand(1)}, None, "",
+  CI);
+  CI->replaceAllUsesWith(NewCI);
+  CI->eraseFromParent();
+}
+  } else {
+auto *True = ConstantInt::getTrue(M.getContext());
+for (Use &U : make_early_inc_range(PublicTypeTestFunc->uses())) {
+  auto *CI = cast(U.getUser());
+  CI->replaceAllUsesWith(True);
+  CI->eraseFromParent();
+}
+  }
 }
 
 /// If whole program visibility asserted, then upgrade all public vcall
Index: llvm/lib/LTO/LTOBackend.cpp
===
--- llvm/lib/LTO/LTOBackend.cpp
+++ llvm/lib/LTO/LTOBackend.cpp
@@ -40,6 +40,7 @@
 #include "llvm/Support/ToolOutputFile.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/IPO/WholeProgramDevirt.h"
 #include "llvm/Transforms/Scalar/LoopPassManager.h"
 #include "llvm/Transforms/Utils/FunctionImportUtils.h"
 #include "llvm/Transforms/Utils/SplitModule.h"
@@ -330,6 +331,7 @@
/*EmbedBitcode*/ true, /*EmbedCmdline*/ true,
/*Cmdline*/ CmdArgs);
   }
+  updatePublicTypeTestCalls(Mod, Conf.HasWholeProgramVisibility);
   // FIXME: Plumb the combined index into the new pass manager.
   runNewPMPasses(Conf, Mod, TM, Conf.OptLevel, IsThinLTO, ExportSummary,
  ImportSummary);
Index: llvm/lib/Analysis/TypeMetadataUtils.cpp
===
--- llvm/lib/Analysis/TypeMetadataUtils.cpp
+++ llvm/lib/Analysis/TypeMetadataUtils.cpp
@@ -75,7 +75,9 @@
 SmallVectorImpl &DevirtCalls,
 SmallVectorImpl &Assumes, const CallInst *CI,
 DominatorTree &DT) {
-  assert(CI->getCalledFunction()->getIntrinsicID() == Intrinsic::type_test);
+  assert(CI->getCalledFunction()->getIntrinsicID() == Intrinsic::type_test ||
+ CI->getCalledFunction()->getIntrinsicID() ==
+ Intrinsic::public_type_test);
 
   const Module *M = CI->getParent()->getParent()->getParent();
 
Index: llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
===
--- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -164,7 +164,8 @@
 SetVector &TypeCheckedLoadConstVCalls,
 DominatorTree &DT) {
   switch (CI->getCalledFunction()->getIntrinsicID()) {
-  case Intrinsic::type_test: {
+  case Intrinsic::type_test:
+  case Intrinsic::public_type_test: {
 auto *TypeMDVal = cast(CI->getArgOperand(1));
 auto *TypeId = dyn_cast(TypeMDVal->getMetadata());
 if (!TypeId)
Index: llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
===
--- llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
+++ llvm/include/llvm/Transfo

[PATCH] D128830: [Pipelines] Introduce DAE after ArgumentPromotion

2022-07-08 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

moving DAE after the function simplification pipeline makes sense

In D128830#3622736 , @psamolysov 
wrote:

> In D128830#3622467 , @fhahn wrote:
>
>> Do we need to retain the run of `DeadArgumentEliminationPass` in the 
>> original position or is a single run at the new position sufficient?
>
> Good point! I tried and also removed the guard that the DAE pass should run 
> with O3  only (currently it run 
> exactly as the pass in the original position did: with any O > 0). I have a 
> chance to run the LLVM :: Transforms tests only, one test failed - `LLVM :: 
> Transforms\InstCombine\unused-nonnull.ll`:
>
>   error: CHECK-SAME: expected string not found in input
>   ; CHECK-SAME: (i32 [[ARGC:%.*]], i8** nocapture readnone [[ARGV:%.*]]) 
> local_unnamed_addr #[[ATTR0:[0-9]+]] {
> ^
>   :7:17: note: scanning from here
>   define i32 @main(i32 %argc, i8** nocapture readonly %argv) 
> local_unnamed_addr #0 {
>
> The difference is that the `%argv` argument has the `readonly` attribute, not 
> `readnone`. I'm not sure whether this makes much sense (I guess this  could 
> because `readnone` can theoretically open a door for some optimizations for 
> which `readonly` cannot).

this would be fixed by running `PostOrderFunctionAttrsPass` after the function 
simplification pipeline which is something I've wanted to do but never got 
around to testing. we should be inferring more precise attributes after fully 
simplifying functions. the only case that might regress is recursive functions 
since when visiting the recursive calls we haven't computed attributes for the 
recursive functions yet

this test is regressing with this patch because previously DAE would replace 
passed arguments with poison if the argument isn't used in the function, 
removing the use of `%argv` in `@main` and func-attrs would mark `%argv` as 
readnone, but with this patch func-attrs runs on `@main` before the use of 
`%argv` is eliminated. the call to `@compute` is eliminated in all cases in the 
function simplification pipeline due to inferring the `returned` attribute on 
`%x`, which is why running func-attrs after the function simplification 
pipeline fixes this issue

  @@ -759,9 +758,6 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
 if (AttributorRun & AttributorRunOption::CGSCC)
   MainCGPipeline.addPass(AttributorCGSCCPass());
   
  -  // Now deduce any function attributes based in the current code.
  -  MainCGPipeline.addPass(PostOrderFunctionAttrsPass());
  -
 // When at O3 add argument promotion to the pass pipeline.
 // FIXME: It isn't at all clear why this should be limited to O3.
 if (Level == OptimizationLevel::O3)
  @@ -781,6 +777,9 @@ PassBuilder::buildInlinerPipeline(OptimizationLevel Level,
 buildFunctionSimplificationPipeline(Level, Phase),
 PTO.EagerlyInvalidateAnalyses, EnableNoRerunSimplificationPipeline));
   
  +  // Now deduce any function attributes based in the current code.
  +  MainCGPipeline.addPass(PostOrderFunctionAttrsPass());
  +
 MainCGPipeline.addPass(CoroSplitPass(Level != OptimizationLevel::O0));


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128830/new/

https://reviews.llvm.org/D128830

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D122275: [PassManager][Coroutine] Run passes under -O0 conditionally and run GlobalDCE

2022-03-23 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9bd66b312c3e: [PassManager][Coroutine] Run passes under -O0 
conditionally and run GlobalDCE (authored by aeubanks).
Herald added subscribers: cfe-commits, ormris, steven_wu.
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D122275?vs=417447&id=417694#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122275/new/

https://reviews.llvm.org/D122275

Files:
  clang/test/CodeGen/lto-newpm-pipeline.c
  llvm/include/llvm/Transforms/Coroutines/CoroConditionalWrapper.h
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/lib/Transforms/Coroutines/CMakeLists.txt
  llvm/lib/Transforms/Coroutines/CoroConditionalWrapper.cpp
  llvm/lib/Transforms/Coroutines/CoroInternal.h
  llvm/lib/Transforms/Coroutines/Coroutines.cpp
  llvm/test/Other/new-pm-O0-defaults.ll
  llvm/test/Transforms/Coroutines/coro-internal-O0.ll
  llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll
  llvm/test/Transforms/Coroutines/smoketest.ll
  llvm/utils/gn/secondary/llvm/lib/Transforms/Coroutines/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/Transforms/Coroutines/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/lib/Transforms/Coroutines/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/lib/Transforms/Coroutines/BUILD.gn
@@ -11,6 +11,7 @@
   ]
   sources = [
 "CoroCleanup.cpp",
+"CoroConditionalWrapper.cpp",
 "CoroEarly.cpp",
 "CoroElide.cpp",
 "CoroFrame.cpp",
Index: llvm/test/Transforms/Coroutines/smoketest.ll
===
--- llvm/test/Transforms/Coroutines/smoketest.ll
+++ llvm/test/Transforms/Coroutines/smoketest.ll
@@ -22,6 +22,8 @@
 ; CHECK-ALL: CoroSplitPass
 ; CHECK-ALL: CoroCleanupPass
 
+declare token @llvm.coro.id(i32, i8*, i8*, i8*)
+
 define void @foo() {
   ret void
 }
Index: llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll
===
--- llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll
+++ llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll
@@ -3,9 +3,7 @@
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.12.0"
 
-; CHECK: define internal { i8*, i32 } @f(i8* %buffer, i32* %array)
-; CHECK-NEXT: entry:
-; CHECK-NEXT:  unreachable
+; CHECK-NOT: define
 
 define internal {i8*, i32} @f(i8* %buffer, i32* %array) {
 entry:
Index: llvm/test/Transforms/Coroutines/coro-internal-O0.ll
===
--- /dev/null
+++ llvm/test/Transforms/Coroutines/coro-internal-O0.ll
@@ -0,0 +1,10 @@
+; RUN: opt -passes='default' -S < %s | FileCheck %s
+
+; CHECK-NOT: call .*llvm.coro.size
+
+declare i64 @llvm.coro.size.i64()
+define internal i64 @f() {
+  %a = call i64 @llvm.coro.size.i64()
+  ret i64 %a
+}
+
Index: llvm/test/Other/new-pm-O0-defaults.ll
===
--- llvm/test/Other/new-pm-O0-defaults.ll
+++ llvm/test/Other/new-pm-O0-defaults.ll
@@ -38,14 +38,7 @@
 ; CHECK-DEFAULT-NEXT: Running analysis: ProfileSummaryAnalysis
 ; CHECK-MATRIX: Running pass: LowerMatrixIntrinsicsPass
 ; CHECK-MATRIX-NEXT: Running analysis: TargetIRAnalysis
-; CHECK-CORO-NEXT: Running pass: CoroEarlyPass
-; CHECK-CORO-NEXT: Running analysis: InnerAnalysisManagerProxy
-; CHECK-CORO-NEXT: Running analysis: LazyCallGraphAnalysis
-; CHECK-CORO-NEXT: Running analysis: TargetLibraryAnalysis
-; CHECK-CORO-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
-; CHECK-CORO-NEXT: Running analysis: OuterAnalysisManagerProxy
-; CHECK-CORO-NEXT: Running pass: CoroSplitPass
-; CHECK-CORO-NEXT: Running pass: CoroCleanupPass
+; CHECK-CORO-NEXT: Running pass: CoroConditionalWrapper
 ; CHECK-PRE-LINK: Running pass: CanonicalizeAliasesPass
 ; CHECK-PRE-LINK-NEXT: Running pass: NameAnonGlobalPass
 ; CHECK-THINLTO: Running pass: Annotation2MetadataPass
@@ -59,6 +52,7 @@
 ; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
 ; CHECK-LTO-NEXT: Running pass: LowerTypeTestsPass
 ; CHECK-CORO-NEXT: Running pass: AnnotationRemarksPass
+; CHECK-CORO-NEXT: Running analysis: TargetLibraryAnalysis
 ; CHECK-LTO-NEXT: Running pass: AnnotationRemarksPass
 ; CHECK-LTO-NEXT: Running analysis: TargetLibraryAnalysis
 ; CHECK-NEXT: Running pass: PrintModulePass
Index: llvm/lib/Transforms/Coroutines/Coroutines.cpp
===
--- llvm/lib/Transforms/Coroutines/Coroutines.cpp
+++ llvm/lib/Transforms/Coroutines/Coroutines.cpp
@@ -119,44 +119,55 @@
   return Bitcast;
 }
 
+// NOTE: Must be sorted!
+static const char *const CoroIntrinsics[] = {
+"llvm.coro.align",
+"llvm.coro.alloc",
+"llvm.coro.async.context.alloc",
+"llvm.coro.async.context

[PATCH] D128955: [WPD] Use new llvm.public.type.test intrinsic for potentially publicly visible classes

2022-07-26 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

thanks for the review!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128955/new/

https://reviews.llvm.org/D128955

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D128955: [WPD] Use new llvm.public.type.test intrinsic for potentially publicly visible classes

2022-07-26 Thread Arthur Eubanks via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2eade1dba4a8: [WPD] Use new llvm.public.type.test intrinsic 
for potentially publicly visible… (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128955/new/

https://reviews.llvm.org/D128955

Files:
  clang/lib/CodeGen/CGClass.cpp
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/test/CodeGenCXX/cfi-mfcall.cpp
  clang/test/CodeGenCXX/thinlto-distributed-type-metadata.cpp
  clang/test/CodeGenCXX/thinlto_public_type_test_distributed.ll
  clang/test/CodeGenCXX/type-metadata.cpp
  lld/test/ELF/lto/update_public_type_test.ll
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/llvm/IR/ModuleSummaryIndex.h
  llvm/include/llvm/LTO/legacy/LTOCodeGenerator.h
  llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/lib/Analysis/TypeMetadataUtils.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/IR/ModuleSummaryIndex.cpp
  llvm/lib/LTO/LTO.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/LTO/LTOCodeGenerator.cpp
  llvm/lib/LTO/ThinLTOCodeGenerator.cpp
  llvm/lib/Transforms/IPO/LowerTypeTests.cpp
  llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
  llvm/test/LTO/X86/public-type-test.ll
  llvm/test/ThinLTO/X86/devirt_vcall_vis_public.ll
  llvm/test/ThinLTO/X86/public-type-test.ll
  llvm/tools/llvm-lto/llvm-lto.cpp

Index: llvm/tools/llvm-lto/llvm-lto.cpp
===
--- llvm/tools/llvm-lto/llvm-lto.cpp
+++ llvm/tools/llvm-lto/llvm-lto.cpp
@@ -261,6 +261,10 @@
  cl::desc("Print pass management debugging information"),
  cl::cat(LTOCategory));
 
+static cl::opt
+LTOSaveBeforeOpt("lto-save-before-opt", cl::init(false),
+ cl::desc("Save the IR before running optimizations"));
+
 namespace {
 
 struct ModuleInfo {
@@ -1069,6 +1073,9 @@
 CodeGen.setFileType(*FT);
 
   if (!OutputFilename.empty()) {
+if (LTOSaveBeforeOpt)
+  CodeGen.setSaveIRBeforeOptPath(OutputFilename + ".0.preopt.bc");
+
 if (SaveLinkedModuleFile) {
   std::string ModuleFilename = OutputFilename;
   ModuleFilename += ".linked.bc";
Index: llvm/test/ThinLTO/X86/public-type-test.ll
===
--- /dev/null
+++ llvm/test/ThinLTO/X86/public-type-test.ll
@@ -0,0 +1,25 @@
+; Test to ensure that the legacy LTO API lowers @llvm.public.type.test.
+
+; RUN: opt -module-summary %s -o %t.bc
+; RUN: llvm-lto --thinlto-action=run -exported-symbol=_main %t.bc --thinlto-save-temps=%t2
+; RUN: llvm-dis -o - %t20.2.internalized.bc | FileCheck %s --check-prefix=PUBLIC
+; RUN: llvm-lto --thinlto-action=run -exported-symbol=_main %t.bc --thinlto-save-temps=%t2 --whole-program-visibility
+; RUN: llvm-dis -o - %t20.2.internalized.bc | FileCheck %s --check-prefix=HIDDEN
+
+; PUBLIC-NOT: call {{.*}}@llvm.public.type.test
+; PUBLIC-NOT: call {{.*}}@llvm.type.test
+; HIDDEN-NOT: call {{.*}}@llvm.public.type.test
+; HIDDEN: call {{.*}}@llvm.type.test
+
+target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.9"
+
+define i32 @main(ptr %vtable) {
+entry:
+  %p = call i1 @llvm.public.type.test(ptr %vtable, metadata !"_ZTS1A")
+  call void @llvm.assume(i1 %p)
+  ret i32 0
+}
+
+declare void @llvm.assume(i1)
+declare i1 @llvm.public.type.test(ptr, metadata)
Index: llvm/test/ThinLTO/X86/devirt_vcall_vis_public.ll
===
--- llvm/test/ThinLTO/X86/devirt_vcall_vis_public.ll
+++ llvm/test/ThinLTO/X86/devirt_vcall_vis_public.ll
@@ -10,6 +10,7 @@
 ; RUN:   -whole-program-visibility \
 ; RUN:   -o %t3 \
 ; RUN:   -r=%t2.o,test,px \
+; RUN:   -r=%t2.o,test_public,px \
 ; RUN:   -r=%t2.o,_ZN1A1nEi,p \
 ; RUN:   -r=%t2.o,_ZN1B1fEi,p \
 ; RUN:   -r=%t2.o,_ZN1C1fEi,p \
@@ -17,6 +18,7 @@
 ; RUN:   -r=%t2.o,_ZTV1B,px \
 ; RUN:   -r=%t2.o,_ZTV1C,px \
 ; RUN:   -r=%t2.o,_ZTV1D,px 2>&1 | FileCheck %s --check-prefix=REMARK
+; RUN: llvm-dis %t3.1.0.preopt.bc -o - | FileCheck %s --check-prefix=CHECK-TT
 ; RUN: llvm-dis %t3.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR
 
 ; Hybrid WPD
@@ -26,6 +28,7 @@
 ; RUN:   -whole-program-visibility \
 ; RUN:   -o %t3 \
 ; RUN:   -r=%t.o,test,px \
+; RUN:   -r=%t.o,test_public,px \
 ; RUN:   -r=%t.o,_ZN1A1nEi,p \
 ; RUN:   -r=%t.o,_ZN1B1fEi,p \
 ; RUN:   -r=%t.o,_ZN1C1fEi,p \
@@ -40,6 +43,7 @@
 ; RUN:   -r=%t.o,_ZTV1B,px \
 ; RUN:   -r=%t.o,_ZTV1C,px \
 ; RUN:   -r=%t.o,_ZTV1D,px 2>&1 | FileCheck %s --check-prefix=REMARK --dump-input=fail
+; RUN: llvm-dis %t3.1.0.preopt.bc -o - | FileCheck %s --check-prefix=CHECK-TT
 ; RUN: llvm-dis %t3.1.4.opt.bc -o - | FileCheck %s --check-prefix=CHECK-IR
 
 ; Regular LTO WPD
@@ -48

[PATCH] D129700: [clang] Don't emit type tests for dllexport/import classes

2022-07-26 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

ping


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129700/new/

https://reviews.llvm.org/D129700

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D124063: [LegacyPM] Rename and deprecate populateModulePassManager

2022-07-26 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

polly and clang-fuzzer both call `populateModulePassManager` just to optimize 
IR, they should be easily migrated to use the new PM

bugpoint is still an issue, I just haven't found time to work on it yet


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124063/new/

https://reviews.llvm.org/D124063

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D122768: [Clang][C++20] Support capturing structured bindings in lambdas

2022-08-04 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

in the commit message

  In addition, capturing an anonymous union member,
  a bitfield, or a structured binding thereof now has a
  better diagnostic.

"better diagnostic" implies there was already a diagnostic, but we're seeing 
new errors pop up. is this just a not precise commit message or are new errors 
related to capturing bitfields by reference unintentional?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122768/new/

https://reviews.llvm.org/D122768

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D122768: [Clang][C++20] Support capturing structured bindings in lambdas

2022-08-04 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

In D122768#3700486 , @cor3ntin wrote:

> In D122768#3700451 , @aeubanks 
> wrote:
>
>> in the commit message
>>
>>   In addition, capturing an anonymous union member,
>>   a bitfield, or a structured binding thereof now has a
>>   better diagnostic.
>>
>> "better diagnostic" implies there was already a diagnostic, but we're seeing 
>> new errors pop up. is this just a not precise commit message or are new 
>> errors related to capturing bitfields by reference unintentional?
>
> New errors when capturing bit fields are probably*not* intentional. You have 
> some of the problematic code i could look at? (not that the patch was 
> reverted and then re-landed to fix a bug there)
> And... the commit message is a bit inaccurate as the change that was 
> supposedly improving diagnostics for reference to bit fields was remove (and 
> i forgot to update the commit message accordingly)

reduced, this does seem wrong

  $ cat /tmp/a.cc
  struct S {
  int s : 4;
  };
  
  void f() {
  S s;
  int l = s.s;
  auto a = [&]() {
  l;
  };
  }
  $ clang++ -fsyntax-only /tmp/a.cc
  /tmp/a.cc:10:3: error: cannot capture a bit-field by reference
  l;
  ^
  /tmp/a.cc:8:6: note: 'l' declared here
  int l = s.s;
  ^
  /tmp/a.cc:3:6: note: bit-field is declared here
  int s : 4;
  ^
  1 error generated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122768/new/

https://reviews.llvm.org/D122768

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D129700: [clang] Don't emit type tests for dllexport/import classes

2022-08-08 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

ping


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129700/new/

https://reviews.llvm.org/D129700

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   3   4   5   6   7   8   >