[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / llvm / tools / llvm-reduce / deltas / ReduceInvokes.cpp
blobc6425a753df54a839d57f15e11f921e06eaad477
1 //===- ReduceInvokes.cpp - Specialized Delta Pass -------------------------===//
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 //===----------------------------------------------------------------------===//
8 //
9 // Try to replace invokes with calls.
11 //===----------------------------------------------------------------------===//
13 #include "ReduceInvokes.h"
14 #include "Delta.h"
15 #include "llvm/IR/Instructions.h"
16 #include "llvm/Transforms/Utils/Local.h"
18 using namespace llvm;
20 static void reduceInvokesInFunction(Oracle &O, Function &F) {
21 for (BasicBlock &BB : F) {
22 InvokeInst *Invoke = dyn_cast<InvokeInst>(BB.getTerminator());
23 if (Invoke && !O.shouldKeep())
24 changeToCall(Invoke);
27 // TODO: We most likely are leaving behind dead landingpad blocks. Should we
28 // delete unreachable blocks now, or leave that for the unreachable block
29 // reduction.
32 static void reduceInvokesInModule(Oracle &O, ReducerWorkItem &WorkItem) {
33 for (Function &F : WorkItem.getModule()) {
34 if (F.hasPersonalityFn())
35 reduceInvokesInFunction(O, F);
39 void llvm::reduceInvokesDeltaPass(TestRunner &Test) {
40 runDeltaPass(Test, reduceInvokesInModule, "Reducing Invokes");