aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-12-14 18:34:23 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-12-14 18:34:23 +0000
commitbbfc7219ef121d345784b0c080a268beb051c736 (patch)
treedf2b7b2e6f57615a58d0d86aef7fa03081649176 /llvm/lib/Transforms
parentfeeefb214dfa398df4cec92b1e9f3e3219d3944f (diff)
downloadllvm-bbfc7219ef121d345784b0c080a268beb051c736.zip
llvm-bbfc7219ef121d345784b0c080a268beb051c736.tar.gz
llvm-bbfc7219ef121d345784b0c080a268beb051c736.tar.bz2
[IR] Remove terminatepad
It turns out that terminatepad gives little benefit over a cleanuppad which calls the termination function. This is not sufficient to implement fully generic filters but MSVC doesn't support them which makes terminatepad a little over-designed. Depends on D15478. Differential Revision: http://reviews.llvm.org/D15479 llvm-svn: 255522
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp5
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp15
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp7
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp2
4 files changed, 3 insertions, 26 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 10f5099..5a7bce5 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2695,11 +2695,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
setOrigin(&I, getCleanOrigin());
}
- void visitTerminatePad(TerminatePadInst &I) {
- DEBUG(dbgs() << "TerminatePad: " << I << "\n");
- // Nothing to do here.
- }
-
void visitGetElementPtrInst(GetElementPtrInst &I) {
handleShadowOr(I);
}
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 74ece38..b0d99a8 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -343,15 +343,7 @@ static void HandleInlinedEHPad(InvokeInst *II, BasicBlock *FirstNewBlock,
continue;
Instruction *Replacement = nullptr;
- if (auto *TPI = dyn_cast<TerminatePadInst>(I)) {
- if (TPI->unwindsToCaller()) {
- SmallVector<Value *, 3> TerminatePadArgs;
- for (Value *ArgOperand : TPI->arg_operands())
- TerminatePadArgs.push_back(ArgOperand);
- Replacement = TerminatePadInst::Create(TPI->getParentPad(), UnwindDest,
- TerminatePadArgs, TPI);
- }
- } else if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(I)) {
+ if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(I)) {
if (CatchSwitch->unwindsToCaller()) {
auto *NewCatchSwitch = CatchSwitchInst::Create(
CatchSwitch->getParentPad(), UnwindDest,
@@ -1441,10 +1433,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
if (!I->isEHPad())
continue;
- if (auto *TPI = dyn_cast<TerminatePadInst>(I)) {
- if (isa<ConstantTokenNone>(TPI->getParentPad()))
- TPI->setParentPad(CallSiteEHPad);
- } else if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(I)) {
+ if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(I)) {
if (isa<ConstantTokenNone>(CatchSwitch->getParentPad()))
CatchSwitch->setParentPad(CallSiteEHPad);
} else {
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index cb17b60..24f8817 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1338,13 +1338,6 @@ void llvm::removeUnwindEdge(BasicBlock *BB) {
if (auto *CRI = dyn_cast<CleanupReturnInst>(TI)) {
NewTI = CleanupReturnInst::Create(CRI->getCleanupPad(), nullptr, CRI);
UnwindDest = CRI->getUnwindDest();
- } else if (auto *TPI = dyn_cast<TerminatePadInst>(TI)) {
- SmallVector<Value *, 3> TerminatePadArgs;
- for (Value *Operand : TPI->arg_operands())
- TerminatePadArgs.push_back(Operand);
- NewTI = TerminatePadInst::Create(TPI->getParentPad(), nullptr,
- TerminatePadArgs, TPI);
- UnwindDest = TPI->getUnwindDest();
} else if (auto *CatchSwitch = dyn_cast<CatchSwitchInst>(TI)) {
auto *NewCatchSwitch = CatchSwitchInst::Create(
CatchSwitch->getParentPad(), nullptr, CatchSwitch->getNumHandlers(),
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 78088e7..74b7c06 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -3498,7 +3498,7 @@ bool SimplifyCFGOpt::SimplifyUnreachable(UnreachableInst *UI) {
}
} else if ((isa<InvokeInst>(TI) &&
cast<InvokeInst>(TI)->getUnwindDest() == BB) ||
- isa<TerminatePadInst>(TI) || isa<CatchSwitchInst>(TI)) {
+ isa<CatchSwitchInst>(TI)) {
removeUnwindEdge(TI->getParent());
Changed = true;
} else if (isa<CleanupReturnInst>(TI)) {