[clang] Propagate -ftime-report to offload lto (#122143)
[llvm-project.git] / llvm / tools / llvm-reduce / deltas / StripDebugInfo.cpp
blobc9e1261c366a732c566a0e2cb469208ef9826750
1 //===- StripDebugInfo.cpp -------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "StripDebugInfo.h"
10 #include "Delta.h"
11 #include "llvm/IR/DebugInfo.h"
12 #include "llvm/IR/Metadata.h"
14 using namespace llvm;
16 /// Removes all aliases aren't inside any of the
17 /// desired Chunks.
18 static void stripDebugInfoImpl(Oracle &O, ReducerWorkItem &WorkItem) {
19 Module &Program = WorkItem.getModule();
20 bool HasDebugInfo = any_of(Program.named_metadata(), [](NamedMDNode &NMD) {
21 return NMD.getName().starts_with("llvm.dbg.");
22 });
23 if (HasDebugInfo && !O.shouldKeep())
24 StripDebugInfo(Program);
27 void llvm::stripDebugInfoDeltaPass(TestRunner &Test) {
28 runDeltaPass(Test, stripDebugInfoImpl, "Stripping Debug Info");