[clang] Propagate -ftime-report to offload lto (#122143)
[llvm-project.git] / llvm / tools / llvm-reduce / deltas / ReduceGlobalObjects.cpp
blob1d1463a055bd8138d3a15bb05a1991921e1b5a72
1 //===- ReduceGlobalObjects.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 "ReduceGlobalObjects.h"
10 #include "llvm/IR/GlobalObject.h"
12 using namespace llvm;
14 static bool shouldReduceSection(GlobalObject &GO) { return GO.hasSection(); }
16 static bool shouldReduceAlign(GlobalObject &GO) {
17 return GO.getAlign().has_value();
20 static bool shouldReduceComdat(GlobalObject &GO) { return GO.hasComdat(); }
22 static void reduceGOs(Oracle &O, ReducerWorkItem &Program) {
23 for (auto &GO : Program.getModule().global_objects()) {
24 if (shouldReduceSection(GO) && !O.shouldKeep())
25 GO.setSection("");
26 if (shouldReduceAlign(GO) && !O.shouldKeep())
27 GO.setAlignment(MaybeAlign());
28 if (shouldReduceComdat(GO) && !O.shouldKeep())
29 GO.setComdat(nullptr);
33 void llvm::reduceGlobalObjectsDeltaPass(TestRunner &Test) {
34 runDeltaPass(Test, reduceGOs, "Reducing GlobalObjects");