[NFC][2/n] Remove PrunePH pass

Second patch in the series to remove legacy PM and
associated -enable-new-pm=0 flag targets pass that
has not been ported to new PM - PruneEH.
Discussion about this can be found in D44415.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D134686
This commit is contained in:
Sebastian Peryt 2022-09-26 18:31:32 -07:00 committed by Arthur Eubanks
parent e15b2da42f
commit 46fc75ab28
31 changed files with 0 additions and 2209 deletions

View File

@ -31,7 +31,6 @@ func (pm PassManager) AddFunctionAttrsPass() { C.LLVMAddFunctionAttrsPas
func (pm PassManager) AddFunctionInliningPass() { C.LLVMAddFunctionInliningPass(pm.C) }
func (pm PassManager) AddGlobalDCEPass() { C.LLVMAddGlobalDCEPass(pm.C) }
func (pm PassManager) AddGlobalOptimizerPass() { C.LLVMAddGlobalOptimizerPass(pm.C) }
func (pm PassManager) AddPruneEHPass() { C.LLVMAddPruneEHPass(pm.C) }
func (pm PassManager) AddIPSCCPPass() { C.LLVMAddIPSCCPPass(pm.C) }
func (pm PassManager) AddInternalizePass(allButMain bool) {
C.LLVMAddInternalizePass(pm.C, boolToUnsigned(allButMain))

View File

@ -67,12 +67,6 @@ value llvm_add_global_optimizer(LLVMPassManagerRef PM) {
return Val_unit;
}
/* [`Module] Llvm.PassManager.t -> unit */
value llvm_add_prune_eh(LLVMPassManagerRef PM) {
LLVMAddPruneEHPass(PM);
return Val_unit;
}
/* [`Module] Llvm.PassManager.t -> unit */
value llvm_add_ipsccp(LLVMPassManagerRef PM) {
LLVMAddIPSCCPPass(PM);

View File

@ -30,9 +30,6 @@ external add_global_dce
external add_global_optimizer
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_global_optimizer"
external add_prune_eh
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_prune_eh"
external add_ipsccp
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_ipsccp"

View File

@ -51,11 +51,6 @@ external add_global_optimizer
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_global_optimizer"
(** See the [llvm::createPruneEHPass] function. *)
external add_prune_eh
: [ `Module ] Llvm.PassManager.t -> unit
= "llvm_add_prune_eh"
(** See the [llvm::createIPSCCPPass] function. *)
external add_ipsccp
: [ `Module ] Llvm.PassManager.t -> unit

View File

@ -54,9 +54,6 @@ void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM);
/** See llvm::createGlobalOptimizerPass function. */
void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM);
/** See llvm::createPruneEHPass function. */
void LLVMAddPruneEHPass(LLVMPassManagerRef PM);
/** See llvm::createIPSCCPPass function. */
void LLVMAddIPSCCPPass(LLVMPassManagerRef PM);

View File

@ -352,7 +352,6 @@ void initializePrintModulePassWrapperPass(PassRegistry&);
void initializeProcessImplicitDefsPass(PassRegistry&);
void initializeProfileSummaryInfoWrapperPassPass(PassRegistry&);
void initializePromoteLegacyPassPass(PassRegistry&);
void initializePruneEHPass(PassRegistry&);
void initializeRABasicPass(PassRegistry&);
void initializePseudoProbeInserterPass(PassRegistry &);
void initializeRAGreedyPass(PassRegistry&);

View File

@ -146,7 +146,6 @@ namespace {
(void) llvm::createPAEvalPass();
(void) llvm::createPromoteMemoryToRegisterPass();
(void) llvm::createDemoteRegisterToMemoryPass();
(void) llvm::createPruneEHPass();
(void)llvm::createPostDomOnlyPrinterWrapperPassPass();
(void)llvm::createPostDomPrinterWrapperPassPass();
(void)llvm::createPostDomOnlyViewerWrapperPassPass();

View File

@ -110,12 +110,6 @@ Pass *createFunctionInliningPass(unsigned OptLevel, unsigned SizeOptLevel,
bool DisableInlineHotCallSite);
Pass *createFunctionInliningPass(InlineParams &Params);
//===----------------------------------------------------------------------===//
/// createPruneEHPass - Return a new pass object which transforms invoke
/// instructions into calls, if the callee can _not_ unwind the stack.
///
Pass *createPruneEHPass();
//===----------------------------------------------------------------------===//
/// createInternalizePass - This pass loops over all of the functions in the
/// input module, internalizing all globals (functions and variables) it can.

View File

@ -33,7 +33,6 @@ add_llvm_component_library(LLVMipo
OpenMPOpt.cpp
PartialInlining.cpp
PassManagerBuilder.cpp
PruneEH.cpp
SampleContextTracker.cpp
SampleProfile.cpp
SampleProfileProbe.cpp

View File

@ -50,7 +50,6 @@ void llvm::initializeIPO(PassRegistry &Registry) {
initializeAttributorCGSCCLegacyPassPass(Registry);
initializePostOrderFunctionAttrsLegacyPassPass(Registry);
initializeReversePostOrderFunctionAttrsLegacyPassPass(Registry);
initializePruneEHPass(Registry);
initializeIPSCCPLegacyPassPass(Registry);
initializeStripDeadPrototypesLegacyPassPass(Registry);
initializeStripSymbolsPass(Registry);
@ -97,10 +96,6 @@ void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createGlobalOptimizerPass());
}
void LLVMAddPruneEHPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createPruneEHPass());
}
void LLVMAddIPSCCPPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createIPSCCPPass());
}

View File

@ -647,7 +647,6 @@ void PassManagerBuilder::populateModulePassManager(
MPM.add(createGlobalsAAWrapperPass());
// Start of CallGraph SCC passes.
MPM.add(createPruneEHPass()); // Remove dead EH info
bool RunInliner = false;
if (Inliner) {
MPM.add(Inliner);

View File

@ -1,261 +0,0 @@
//===- PruneEH.cpp - Pass which deletes unused exception handlers ---------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements a simple interprocedural pass which walks the
// call-graph, turning invoke instructions into calls, iff the callee cannot
// throw an exception, and marking functions 'nounwind' if they cannot throw.
// It implements this as a bottom-up traversal of the call-graph.
//
//===----------------------------------------------------------------------===//
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/InitializePasses.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Utils/CallGraphUpdater.h"
#include "llvm/Transforms/Utils/Local.h"
#include <algorithm>
using namespace llvm;
#define DEBUG_TYPE "prune-eh"
STATISTIC(NumRemoved, "Number of invokes removed");
STATISTIC(NumUnreach, "Number of noreturn calls optimized");
namespace {
struct PruneEH : public CallGraphSCCPass {
static char ID; // Pass identification, replacement for typeid
PruneEH() : CallGraphSCCPass(ID) {
initializePruneEHPass(*PassRegistry::getPassRegistry());
}
// runOnSCC - Analyze the SCC, performing the transformation if possible.
bool runOnSCC(CallGraphSCC &SCC) override;
};
}
static bool SimplifyFunction(Function *F, CallGraphUpdater &CGU);
static void DeleteBasicBlock(BasicBlock *BB, CallGraphUpdater &CGU);
char PruneEH::ID = 0;
INITIALIZE_PASS_BEGIN(PruneEH, "prune-eh",
"Remove unused exception handling info", false, false)
INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
INITIALIZE_PASS_END(PruneEH, "prune-eh",
"Remove unused exception handling info", false, false)
Pass *llvm::createPruneEHPass() { return new PruneEH(); }
static bool runImpl(CallGraphUpdater &CGU, SetVector<Function *> &Functions) {
#ifndef NDEBUG
for (auto *F : Functions)
assert(F && "null Function");
#endif
bool MadeChange = false;
// First pass, scan all of the functions in the SCC, simplifying them
// according to what we know.
for (Function *F : Functions)
MadeChange |= SimplifyFunction(F, CGU);
// Next, check to see if any callees might throw or if there are any external
// functions in this SCC: if so, we cannot prune any functions in this SCC.
// Definitions that are weak and not declared non-throwing might be
// overridden at linktime with something that throws, so assume that.
// If this SCC includes the unwind instruction, we KNOW it throws, so
// obviously the SCC might throw.
//
bool SCCMightUnwind = false, SCCMightReturn = false;
for (Function *F : Functions) {
if (!F->hasExactDefinition()) {
SCCMightUnwind |= !F->doesNotThrow();
SCCMightReturn |= !F->doesNotReturn();
} else {
bool CheckUnwind = !SCCMightUnwind && !F->doesNotThrow();
bool CheckReturn = !SCCMightReturn && !F->doesNotReturn();
// Determine if we should scan for InlineAsm in a naked function as it
// is the only way to return without a ReturnInst. Only do this for
// no-inline functions as functions which may be inlined cannot
// meaningfully return via assembly.
bool CheckReturnViaAsm = CheckReturn &&
F->hasFnAttribute(Attribute::Naked) &&
F->hasFnAttribute(Attribute::NoInline);
if (!CheckUnwind && !CheckReturn)
continue;
for (const BasicBlock &BB : *F) {
const Instruction *TI = BB.getTerminator();
if (CheckUnwind && TI->mayThrow()) {
SCCMightUnwind = true;
} else if (CheckReturn && isa<ReturnInst>(TI)) {
SCCMightReturn = true;
}
for (const Instruction &I : BB) {
if ((!CheckUnwind || SCCMightUnwind) &&
(!CheckReturnViaAsm || SCCMightReturn))
break;
// Check to see if this function performs an unwind or calls an
// unwinding function.
if (CheckUnwind && !SCCMightUnwind && I.mayThrow()) {
bool InstMightUnwind = true;
if (const auto *CI = dyn_cast<CallInst>(&I)) {
if (Function *Callee = CI->getCalledFunction()) {
// If the callee is outside our current SCC then we may throw
// because it might. If it is inside, do nothing.
if (Functions.contains(Callee))
InstMightUnwind = false;
}
}
SCCMightUnwind |= InstMightUnwind;
}
if (CheckReturnViaAsm && !SCCMightReturn)
if (const auto *CB = dyn_cast<CallBase>(&I))
if (const auto *IA = dyn_cast<InlineAsm>(CB->getCalledOperand()))
if (IA->hasSideEffects())
SCCMightReturn = true;
}
}
if (SCCMightUnwind && SCCMightReturn)
break;
}
}
// If the SCC doesn't unwind or doesn't throw, note this fact.
if (!SCCMightUnwind || !SCCMightReturn)
for (Function *F : Functions) {
if (!SCCMightUnwind && !F->hasFnAttribute(Attribute::NoUnwind)) {
F->addFnAttr(Attribute::NoUnwind);
MadeChange = true;
}
if (!SCCMightReturn && !F->hasFnAttribute(Attribute::NoReturn)) {
F->addFnAttr(Attribute::NoReturn);
MadeChange = true;
}
}
for (Function *F : Functions) {
// Convert any invoke instructions to non-throwing functions in this node
// into call instructions with a branch. This makes the exception blocks
// dead.
MadeChange |= SimplifyFunction(F, CGU);
}
return MadeChange;
}
bool PruneEH::runOnSCC(CallGraphSCC &SCC) {
if (skipSCC(SCC))
return false;
SetVector<Function *> Functions;
for (const auto &N : SCC) {
if (auto *F = N->getFunction())
Functions.insert(F);
}
CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
CallGraphUpdater CGU;
CGU.initialize(CG, SCC);
return runImpl(CGU, Functions);
}
// SimplifyFunction - Given information about callees, simplify the specified
// function if we have invokes to non-unwinding functions or code after calls to
// no-return functions.
static bool SimplifyFunction(Function *F, CallGraphUpdater &CGU) {
bool MadeChange = false;
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
if (II->doesNotThrow() && canSimplifyInvokeNoUnwind(F)) {
BasicBlock *UnwindBlock = II->getUnwindDest();
removeUnwindEdge(&*BB);
// If the unwind block is now dead, nuke it.
if (pred_empty(UnwindBlock))
DeleteBasicBlock(UnwindBlock, CGU); // Delete the new BB.
++NumRemoved;
MadeChange = true;
}
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; )
if (CallInst *CI = dyn_cast<CallInst>(I++))
if (CI->doesNotReturn() && !CI->isMustTailCall() &&
!isa<UnreachableInst>(I)) {
// This call calls a function that cannot return. Insert an
// unreachable instruction after it and simplify the code. Do this
// by splitting the BB, adding the unreachable, then deleting the
// new BB.
BasicBlock *New = BB->splitBasicBlock(I);
// Remove the uncond branch and add an unreachable.
BB->getInstList().pop_back();
new UnreachableInst(BB->getContext(), &*BB);
DeleteBasicBlock(New, CGU); // Delete the new BB.
MadeChange = true;
++NumUnreach;
break;
}
}
return MadeChange;
}
/// DeleteBasicBlock - remove the specified basic block from the program,
/// updating the callgraph to reflect any now-obsolete edges due to calls that
/// exist in the BB.
static void DeleteBasicBlock(BasicBlock *BB, CallGraphUpdater &CGU) {
assert(pred_empty(BB) && "BB is not dead!");
Instruction *TokenInst = nullptr;
for (BasicBlock::iterator I = BB->end(), E = BB->begin(); I != E; ) {
--I;
if (I->getType()->isTokenTy()) {
TokenInst = &*I;
break;
}
if (auto *Call = dyn_cast<CallBase>(&*I)) {
const Function *Callee = Call->getCalledFunction();
if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID()))
CGU.removeCallSite(*Call);
else if (!Callee->isIntrinsic())
CGU.removeCallSite(*Call);
}
if (!I->use_empty())
I->replaceAllUsesWith(PoisonValue::get(I->getType()));
}
if (TokenInst) {
if (!TokenInst->isTerminator())
changeToUnreachable(TokenInst->getNextNode());
} else {
// Get the list of successors of this block.
std::vector<BasicBlock *> Succs(succ_begin(BB), succ_end(BB));
for (unsigned i = 0, e = Succs.size(); i != e; ++i)
Succs[i]->removePredecessor(BB);
BB->eraseFromParent();
}
}

View File

@ -54,7 +54,6 @@ let test_transforms () =
++ add_always_inliner
++ add_global_dce
++ add_global_optimizer
++ add_prune_eh
++ add_ipsccp
++ add_internalize ~all_but_main:true
++ add_strip_dead_prototypes

View File

@ -1,11 +0,0 @@
; RUN: opt < %s -inline -prune-eh -disable-output -enable-new-pm=0
define linkonce void @caller() {
call void @callee( )
ret void
}
define linkonce void @callee() {
ret void
}

View File

@ -1,25 +0,0 @@
; RUN: opt < %s -inline -prune-eh -disable-output -enable-new-pm=0
%"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>" = type { %"struct.std::locale::facet" }
%"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >" = type { i32 (...)**, i32*, i32*, i32*, i32*, i32*, i32*, %"struct.std::locale" }
%"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, %"struct.std::ios_base::_Words"*, %"struct.std::locale" }
%"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
%"struct.std::ios_base::_Words" = type { i8*, i32 }
%"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
%"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
%"struct.std::locale::facet" = type { i32 (...)**, i32 }
%"struct.std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >"*, i32 }
define void @_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewl(%"struct.std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t> >"* %agg.result, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"* %this, %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >"* %__s.0__, i32 %__s.1__, %"struct.std::ios_base"* %__io, i32 %__fill, i32 %__v) {
entry:
tail call fastcc void @_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES3_S3_RSt8ios_basewT_( )
ret void
}
define fastcc void @_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE13_M_insert_intIlEES3_S3_RSt8ios_basewT_() {
entry:
%tmp.38 = shl i32 0, 3 ; <i32> [#uses=1]
%tmp.39 = alloca i8, i32 %tmp.38 ; <i8*> [#uses=0]
ret void
}

View File

@ -1,840 +0,0 @@
; RUN: opt < %s -inline -prune-eh -disable-output -enable-new-pm=0
; PR827
@_ZTV8CRjii = internal global [1 x i32 (...)*] [ i32 (...)* @_ZN8CRjii12NlFeeEPN5Jr7sE ] ; <[1 x i32 (...)*]*> [#uses=0]
define internal i32 @_ZN8CRjii12NlFeeEPN5Jr7sE(...) {
entry:
br i1 false, label %cond_true, label %cond_false179
cond_true: ; preds = %entry
br label %bb9
bb: ; preds = %cond_true14
br label %bb9
bb9: ; preds = %bb, %cond_true
br i1 false, label %cond_true14, label %cond_false
cond_true14: ; preds = %bb9
br label %bb
cond_false: ; preds = %bb9
br label %bb15
cond_next: ; No predecessors!
br label %bb15
bb15: ; preds = %cond_next, %cond_false
br label %bb24
bb17: ; preds = %cond_true29
br label %bb24
bb24: ; preds = %bb17, %bb15
br i1 false, label %cond_true29, label %cond_false30
cond_true29: ; preds = %bb24
br label %bb17
cond_false30: ; preds = %bb24
br label %bb32
cond_next31: ; No predecessors!
br label %bb32
bb32: ; preds = %cond_next31, %cond_false30
br label %bb41
bb34: ; preds = %cond_true46
br label %bb41
bb41: ; preds = %bb34, %bb32
br i1 false, label %cond_true46, label %cond_false47
cond_true46: ; preds = %bb41
br label %bb34
cond_false47: ; preds = %bb41
br label %bb49
cond_next48: ; No predecessors!
br label %bb49
bb49: ; preds = %cond_next48, %cond_false47
br label %bb58
bb51: ; preds = %cond_true63
br label %bb58
bb58: ; preds = %bb51, %bb49
br i1 false, label %cond_true63, label %cond_false64
cond_true63: ; preds = %bb58
br label %bb51
cond_false64: ; preds = %bb58
br label %bb66
cond_next65: ; No predecessors!
br label %bb66
bb66: ; preds = %cond_next65, %cond_false64
br label %bb76
bb68: ; preds = %cond_true81
br label %bb76
bb76: ; preds = %bb68, %bb66
br i1 false, label %cond_true81, label %cond_false82
cond_true81: ; preds = %bb76
br label %bb68
cond_false82: ; preds = %bb76
br label %bb84
cond_next83: ; No predecessors!
br label %bb84
bb84: ; preds = %cond_next83, %cond_false82
br label %bb94
bb86: ; preds = %cond_true99
br label %bb94
bb94: ; preds = %bb86, %bb84
br i1 false, label %cond_true99, label %cond_false100
cond_true99: ; preds = %bb94
br label %bb86
cond_false100: ; preds = %bb94
br label %bb102
cond_next101: ; No predecessors!
br label %bb102
bb102: ; preds = %cond_next101, %cond_false100
br label %bb112
bb104: ; preds = %cond_true117
br label %bb112
bb112: ; preds = %bb104, %bb102
br i1 false, label %cond_true117, label %cond_false118
cond_true117: ; preds = %bb112
br label %bb104
cond_false118: ; preds = %bb112
br label %bb120
cond_next119: ; No predecessors!
br label %bb120
bb120: ; preds = %cond_next119, %cond_false118
br label %bb130
bb122: ; preds = %cond_true135
br label %bb130
bb130: ; preds = %bb122, %bb120
br i1 false, label %cond_true135, label %cond_false136
cond_true135: ; preds = %bb130
br label %bb122
cond_false136: ; preds = %bb130
br label %bb138
cond_next137: ; No predecessors!
br label %bb138
bb138: ; preds = %cond_next137, %cond_false136
br label %bb148
bb140: ; preds = %cond_true153
call fastcc void @_Zjrf1( )
br label %bb148
bb148: ; preds = %bb140, %bb138
br i1 false, label %cond_true153, label %cond_false154
cond_true153: ; preds = %bb148
br label %bb140
cond_false154: ; preds = %bb148
br label %bb156
cond_next155: ; No predecessors!
br label %bb156
bb156: ; preds = %cond_next155, %cond_false154
br label %bb166
bb158: ; preds = %cond_true171
br label %bb166
bb166: ; preds = %bb158, %bb156
br i1 false, label %cond_true171, label %cond_false172
cond_true171: ; preds = %bb166
br label %bb158
cond_false172: ; preds = %bb166
br label %bb174
cond_next173: ; No predecessors!
br label %bb174
bb174: ; preds = %cond_next173, %cond_false172
br label %cleanup
cleanup: ; preds = %bb174
br label %finally
finally: ; preds = %cleanup
br label %cond_next180
cond_false179: ; preds = %entry
br label %cond_next180
cond_next180: ; preds = %cond_false179, %finally
br label %return
return: ; preds = %cond_next180
ret i32 0
}
define internal fastcc void @_Zjrf2() {
entry:
br label %bb3
bb: ; preds = %cond_true
br label %bb3
bb3: ; preds = %bb, %entry
%tmp5 = load i8*, i8** null ; <i8*> [#uses=1]
%tmp = icmp ne i8* null, %tmp5 ; <i1> [#uses=1]
br i1 %tmp, label %cond_true, label %cond_false
cond_true: ; preds = %bb3
br label %bb
cond_false: ; preds = %bb3
br label %bb6
cond_next: ; No predecessors!
br label %bb6
bb6: ; preds = %cond_next, %cond_false
br label %return
return: ; preds = %bb6
ret void
}
define internal fastcc void @_Zjrf3() {
entry:
call fastcc void @_Zjrf2( )
br label %return
return: ; preds = %entry
ret void
}
define internal fastcc void @_Zjrf4() {
entry:
br label %bb6
bb: ; preds = %cond_true
br label %bb6
bb6: ; preds = %bb, %entry
br i1 false, label %cond_true, label %cond_false
cond_true: ; preds = %bb6
br label %bb
cond_false: ; preds = %bb6
br label %bb8
cond_next: ; No predecessors!
br label %bb8
bb8: ; preds = %cond_next, %cond_false
br i1 false, label %cond_true9, label %cond_false12
cond_true9: ; preds = %bb8
call fastcc void @_Zjrf3( )
br label %cond_next13
cond_false12: ; preds = %bb8
br label %cond_next13
cond_next13: ; preds = %cond_false12, %cond_true9
br label %return
return: ; preds = %cond_next13
ret void
}
define internal fastcc void @_Zjrf5() {
entry:
call fastcc void @_Zjrf4( )
br label %return
return: ; preds = %entry
ret void
}
define internal fastcc void @_Zjrf6() {
entry:
call fastcc void @_Zjrf5( )
br label %return
return: ; preds = %entry
ret void
}
define internal fastcc void @_Zjrf7() {
entry:
br label %cleanup
cleanup: ; preds = %entry
br label %finally
finally: ; preds = %cleanup
call fastcc void @_Zjrf6( )
br label %cleanup9
cleanup9: ; preds = %finally
br label %finally8
finally8: ; preds = %cleanup9
br label %cleanup11
cleanup11: ; preds = %finally8
br label %finally10
finally10: ; preds = %cleanup11
br label %finally23
finally23: ; preds = %finally10
br label %return
return: ; preds = %finally23
ret void
}
define internal fastcc void @_Zjrf11() {
entry:
br label %bb7
bb: ; preds = %cond_true
br label %bb7
bb7: ; preds = %bb, %entry
br i1 false, label %cond_true, label %cond_false
cond_true: ; preds = %bb7
br label %bb
cond_false: ; preds = %bb7
br label %bb9
cond_next: ; No predecessors!
br label %bb9
bb9: ; preds = %cond_next, %cond_false
br label %return
; No predecessors!
br i1 false, label %cond_true12, label %cond_false15
cond_true12: ; preds = %0
call fastcc void @_Zjrf3( )
br label %cond_next16
cond_false15: ; preds = %0
br label %cond_next16
cond_next16: ; preds = %cond_false15, %cond_true12
br label %return
return: ; preds = %cond_next16, %bb9
ret void
}
define internal fastcc void @_Zjrf9() {
entry:
call fastcc void @_Zjrf11( )
br label %return
return: ; preds = %entry
ret void
}
define internal fastcc void @_Zjrf10() {
entry:
call fastcc void @_Zjrf9( )
br label %return
return: ; preds = %entry
ret void
}
define internal fastcc void @_Zjrf8() {
entry:
br i1 false, label %cond_true, label %cond_false201
cond_true: ; preds = %entry
br i1 false, label %cond_true36, label %cond_false
cond_true36: ; preds = %cond_true
br label %cleanup
cleanup: ; preds = %cond_true36
br label %finally
finally: ; preds = %cleanup
br label %cond_next189
cond_false: ; preds = %cond_true
br i1 false, label %cond_true99, label %cond_false137
cond_true99: ; preds = %cond_false
br label %cleanup136
cleanup136: ; preds = %cond_true99
br label %finally135
finally135: ; preds = %cleanup136
br label %cond_next
cond_false137: ; preds = %cond_false
call fastcc void @_Zjrf10( )
br label %cleanup188
cleanup188: ; preds = %cond_false137
br label %finally187
finally187: ; preds = %cleanup188
br label %cond_next
cond_next: ; preds = %finally187, %finally135
br label %cond_next189
cond_next189: ; preds = %cond_next, %finally
br label %cond_next202
cond_false201: ; preds = %entry
br label %cond_next202
cond_next202: ; preds = %cond_false201, %cond_next189
br label %return
return: ; preds = %cond_next202
ret void
}
define internal fastcc void @_Zjrf1() {
entry:
br label %bb492
bb: ; preds = %cond_true499
br label %cleanup
cleanup: ; preds = %bb
br label %finally
finally: ; preds = %cleanup
br label %cleanup11
cleanup11: ; preds = %finally
br label %finally10
finally10: ; preds = %cleanup11
br i1 false, label %cond_true, label %cond_false286
cond_true: ; preds = %finally10
br label %cleanup26
cleanup26: ; preds = %cond_true
br label %finally25
finally25: ; preds = %cleanup26
br label %bb30
bb27: ; preds = %cond_true37
br label %bb30
bb30: ; preds = %bb27, %finally25
br i1 false, label %cond_true37, label %cond_false
cond_true37: ; preds = %bb30
br label %bb27
cond_false: ; preds = %bb30
br label %bb38
cond_next: ; No predecessors!
br label %bb38
bb38: ; preds = %cond_next, %cond_false
br label %bb148
bb40: ; preds = %cond_true156
br label %bb139
bb41: ; preds = %cond_true142
call fastcc void @_Zjrf7( )
br label %bb105
bb44: ; preds = %cond_true112
br label %bb74
bb66: ; preds = %cond_true80
br label %bb74
bb74: ; preds = %bb66, %bb44
br i1 false, label %cond_true80, label %cond_false81
cond_true80: ; preds = %bb74
br label %bb66
cond_false81: ; preds = %bb74
br label %bb83
cond_next82: ; No predecessors!
br label %bb83
bb83: ; preds = %cond_next82, %cond_false81
br label %cleanup97
cleanup97: ; preds = %bb83
br label %finally96
finally96: ; preds = %cleanup97
br label %cleanup99
cleanup99: ; preds = %finally96
br label %finally98
finally98: ; preds = %cleanup99
br label %bb105
bb105: ; preds = %finally98, %bb41
br i1 false, label %cond_true112, label %cond_false113
cond_true112: ; preds = %bb105
br label %bb44
cond_false113: ; preds = %bb105
br label %bb115
cond_next114: ; No predecessors!
br label %bb115
bb115: ; preds = %cond_next114, %cond_false113
br i1 false, label %cond_true119, label %cond_false123
cond_true119: ; preds = %bb115
call fastcc void @_Zjrf8( )
br label %cond_next124
cond_false123: ; preds = %bb115
br label %cond_next124
cond_next124: ; preds = %cond_false123, %cond_true119
br i1 false, label %cond_true131, label %cond_false132
cond_true131: ; preds = %cond_next124
br label %cleanup135
cond_false132: ; preds = %cond_next124
br label %cond_next133
cond_next133: ; preds = %cond_false132
br label %cleanup136
cleanup135: ; preds = %cond_true131
br label %done
cleanup136: ; preds = %cond_next133
br label %finally134
finally134: ; preds = %cleanup136
br label %bb139
bb139: ; preds = %finally134, %bb40
br i1 false, label %cond_true142, label %cond_false143
cond_true142: ; preds = %bb139
br label %bb41
cond_false143: ; preds = %bb139
br label %bb145
cond_next144: ; No predecessors!
br label %bb145
bb145: ; preds = %cond_next144, %cond_false143
br label %bb148
bb148: ; preds = %bb145, %bb38
br i1 false, label %cond_true156, label %cond_false157
cond_true156: ; preds = %bb148
br label %bb40
cond_false157: ; preds = %bb148
br label %bb159
cond_next158: ; No predecessors!
br label %bb159
bb159: ; preds = %cond_next158, %cond_false157
br label %done
done: ; preds = %bb159, %cleanup135
br label %bb214
bb185: ; preds = %cond_true218
br i1 false, label %cond_true193, label %cond_false206
cond_true193: ; preds = %bb185
br label %cond_next211
cond_false206: ; preds = %bb185
br label %cond_next211
cond_next211: ; preds = %cond_false206, %cond_true193
br label %bb214
bb214: ; preds = %cond_next211, %done
br i1 false, label %cond_true218, label %cond_false219
cond_true218: ; preds = %bb214
br label %bb185
cond_false219: ; preds = %bb214
br label %bb221
cond_next220: ; No predecessors!
br label %bb221
bb221: ; preds = %cond_next220, %cond_false219
br i1 false, label %cond_true236, label %cond_false245
cond_true236: ; preds = %bb221
br label %cond_next249
cond_false245: ; preds = %bb221
br label %cond_next249
cond_next249: ; preds = %cond_false245, %cond_true236
br i1 false, label %cond_true272, label %cond_false277
cond_true272: ; preds = %cond_next249
br label %cond_next278
cond_false277: ; preds = %cond_next249
br label %cond_next278
cond_next278: ; preds = %cond_false277, %cond_true272
br label %cleanup285
cleanup285: ; preds = %cond_next278
br label %finally284
finally284: ; preds = %cleanup285
br label %cond_next287
cond_false286: ; preds = %finally10
br label %cond_next287
cond_next287: ; preds = %cond_false286, %finally284
br i1 false, label %cond_true317, label %cond_false319
cond_true317: ; preds = %cond_next287
br label %cond_next321
cond_false319: ; preds = %cond_next287
br label %cond_next321
cond_next321: ; preds = %cond_false319, %cond_true317
br label %bb348
bb335: ; preds = %cond_true355
br label %bb348
bb348: ; preds = %bb335, %cond_next321
br i1 false, label %cond_true355, label %cond_false356
cond_true355: ; preds = %bb348
br label %bb335
cond_false356: ; preds = %bb348
br label %bb358
cond_next357: ; No predecessors!
br label %bb358
bb358: ; preds = %cond_next357, %cond_false356
br i1 false, label %cond_true363, label %cond_false364
cond_true363: ; preds = %bb358
br label %bb388
cond_false364: ; preds = %bb358
br label %cond_next365
cond_next365: ; preds = %cond_false364
br i1 false, label %cond_true370, label %cond_false371
cond_true370: ; preds = %cond_next365
br label %bb388
cond_false371: ; preds = %cond_next365
br label %cond_next372
cond_next372: ; preds = %cond_false371
br i1 false, label %cond_true385, label %cond_false386
cond_true385: ; preds = %cond_next372
br label %bb388
cond_false386: ; preds = %cond_next372
br label %cond_next387
cond_next387: ; preds = %cond_false386
br label %bb389
bb388: ; preds = %cond_true385, %cond_true370, %cond_true363
br label %bb389
bb389: ; preds = %bb388, %cond_next387
br i1 false, label %cond_true392, label %cond_false443
cond_true392: ; preds = %bb389
br label %bb419
bb402: ; preds = %cond_true425
br i1 false, label %cond_true406, label %cond_false412
cond_true406: ; preds = %bb402
br label %cond_next416
cond_false412: ; preds = %bb402
br label %cond_next416
cond_next416: ; preds = %cond_false412, %cond_true406
br label %bb419
bb419: ; preds = %cond_next416, %cond_true392
br i1 false, label %cond_true425, label %cond_false426
cond_true425: ; preds = %bb419
br label %bb402
cond_false426: ; preds = %bb419
br label %bb428
cond_next427: ; No predecessors!
br label %bb428
bb428: ; preds = %cond_next427, %cond_false426
br label %cond_next478
cond_false443: ; preds = %bb389
br label %bb460
bb450: ; preds = %cond_true466
br label %bb460
bb460: ; preds = %bb450, %cond_false443
br i1 false, label %cond_true466, label %cond_false467
cond_true466: ; preds = %bb460
br label %bb450
cond_false467: ; preds = %bb460
br label %bb469
cond_next468: ; No predecessors!
br label %bb469
bb469: ; preds = %cond_next468, %cond_false467
br label %cond_next478
cond_next478: ; preds = %bb469, %bb428
br label %cleanup485
cleanup485: ; preds = %cond_next478
br label %finally484
finally484: ; preds = %cleanup485
br label %cleanup487
cleanup487: ; preds = %finally484
br label %finally486
finally486: ; preds = %cleanup487
br label %cleanup489
cleanup489: ; preds = %finally486
br label %finally488
finally488: ; preds = %cleanup489
br label %bb492
bb492: ; preds = %finally488, %entry
br i1 false, label %cond_true499, label %cond_false500
cond_true499: ; preds = %bb492
br label %bb
cond_false500: ; preds = %bb492
br label %bb502
cond_next501: ; No predecessors!
br label %bb502
bb502: ; preds = %cond_next501, %cond_false500
br label %return
return: ; preds = %bb502
ret void
}
define internal fastcc void @_ZSt26__unguarded_insertion_sortIN9__gnu_cxx17__normal_iteratorIPSsSt6vectorISsSaISsEEEEEvT_S7_() {
entry:
br label %bb12
bb: ; preds = %cond_true
br label %cleanup
cleanup: ; preds = %bb
br label %finally
finally: ; preds = %cleanup
br label %bb12
bb12: ; preds = %finally, %entry
br i1 false, label %cond_true, label %cond_false
cond_true: ; preds = %bb12
br label %bb
cond_false: ; preds = %bb12
br label %bb14
cond_next: ; No predecessors!
br label %bb14
bb14: ; preds = %cond_next, %cond_false
br label %return
return: ; preds = %bb14
ret void
}

View File

@ -1,252 +0,0 @@
; RUN: opt < %s -inline -prune-eh -disable-output -enable-new-pm=0
; PR993
target datalayout = "e-p:32:32"
target triple = "i386-unknown-openbsd3.9"
%"struct.__gnu_cxx::__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" = type { i8* }
%"struct.__gnu_cxx::char_producer<char>" = type { i32 (...)** }
%struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
%struct.__sbuf = type { i8*, i32 }
%"struct.std::__basic_file<char>" = type { %struct.__sFILE*, i1 }
%"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>" = type { %"struct.std::locale::facet" }
%"struct.std::bad_alloc" = type { %"struct.__gnu_cxx::char_producer<char>" }
%"struct.std::basic_filebuf<char,std::char_traits<char> >" = type { %"struct.std::basic_streambuf<char,std::char_traits<char> >", i32, %"struct.std::__basic_file<char>", i32, %union.__mbstate_t, %union.__mbstate_t, i8*, i32, i1, i1, i1, i1, i8, i8*, i8*, i1, %"struct.std::codecvt<char,char,__mbstate_t>"*, i8*, i32, i8*, i8* }
%"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8, i1, %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, %"struct.std::ctype<char>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"* }
%"struct.std::basic_iostream<char,std::char_traits<char> >" = type { %"struct.std::locale::facet", %"struct.__gnu_cxx::char_producer<char>", %"struct.std::basic_ios<char,std::char_traits<char> >" }
%"struct.std::basic_ofstream<char,std::char_traits<char> >" = type { %"struct.__gnu_cxx::char_producer<char>", %"struct.std::basic_filebuf<char,std::char_traits<char> >", %"struct.std::basic_ios<char,std::char_traits<char> >" }
%"struct.std::basic_ostream<char,std::char_traits<char> >" = type { i32 (...)**, %"struct.std::basic_ios<char,std::char_traits<char> >" }
%"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"struct.std::locale" }
%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" = type { %"struct.__gnu_cxx::__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" }
%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" }
%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" = type { i32, i32, i32 }
%"struct.std::codecvt<char,char,__mbstate_t>" = type { %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>", i32* }
%"struct.std::ctype<char>" = type { %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>", i32*, i1, i32*, i32*, i32* }
%"struct.std::domain_error" = type { %"struct.std::logic_error" }
%"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %struct.__sbuf, [8 x %struct.__sbuf], i32, %struct.__sbuf*, %"struct.std::locale" }
%"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
%"struct.std::ios_base::_Words" = type { i8*, i32 }
%"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
%"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
%"struct.std::locale::facet" = type { i32 (...)**, i32 }
%"struct.std::logic_error" = type { %"struct.__gnu_cxx::char_producer<char>", %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" }
%union.__mbstate_t = type { i64, [120 x i8] }
@.str_1 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
@.str_9 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
define void @main() {
entry:
call fastcc void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode( )
ret void
}
define fastcc void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode() {
entry:
%tmp.6 = icmp eq %"struct.std::basic_filebuf<char,std::char_traits<char> >"* null, null ; <i1> [#uses=1]
br i1 %tmp.6, label %then, label %UnifiedReturnBlock
then: ; preds = %entry
tail call fastcc void @_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate( )
ret void
UnifiedReturnBlock: ; preds = %entry
ret void
}
define fastcc void @_ZN10__cxxabiv111__terminateEPFvvE() {
entry:
unreachable
}
define void @_ZNSdD0Ev() {
entry:
unreachable
}
define void @_ZThn8_NSdD1Ev() {
entry:
ret void
}
define void @_ZNSt13basic_filebufIcSt11char_traitsIcEED0Ev() {
entry:
ret void
}
define void @_ZNSt13basic_filebufIcSt11char_traitsIcEE9pbackfailEi() {
entry:
unreachable
}
define fastcc void @_ZNSoD2Ev() {
entry:
unreachable
}
define fastcc void @_ZNSt9basic_iosIcSt11char_traitsIcEED2Ev() {
entry:
unreachable
}
define fastcc void @_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate() {
entry:
tail call fastcc void @_ZSt19__throw_ios_failurePKc( )
ret void
}
declare fastcc void @_ZNSaIcED1Ev()
define fastcc void @_ZNSsC1EPKcRKSaIcE() {
entry:
tail call fastcc void @_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type( )
unreachable
}
define fastcc void @_ZSt14__convert_to_vIyEvPKcRT_RSt12_Ios_IostateRKPii() {
entry:
ret void
}
define fastcc void @_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEEC1Ej() {
entry:
ret void
}
define fastcc void @_ZSt19__throw_ios_failurePKc() {
entry:
call fastcc void @_ZNSsC1EPKcRKSaIcE( )
unreachable
}
define void @_GLOBAL__D__ZSt23lexicographical_compareIPKaS1_EbT_S2_T0_S3_() {
entry:
ret void
}
define void @_ZNSt9bad_allocD1Ev() {
entry:
unreachable
}
define fastcc void @_ZSt19__throw_logic_errorPKc() personality i32 (...)* @__gxx_personality_v0 {
entry:
invoke fastcc void @_ZNSt11logic_errorC1ERKSs( )
to label %try_exit.0 unwind label %try_catch.0
try_catch.0: ; preds = %entry
%exn = landingpad {i8*, i32}
catch i8* null
resume { i8*, i32 } %exn
try_exit.0: ; preds = %entry
unreachable
}
define fastcc void @_ZNSt11logic_errorC1ERKSs() {
entry:
call fastcc void @_ZNSsC1ERKSs( )
ret void
}
define void @_ZNSt12domain_errorD1Ev() {
entry:
unreachable
}
define fastcc void @_ZSt20__throw_length_errorPKc() {
entry:
call fastcc void @_ZNSt12length_errorC1ERKSs( )
unreachable
}
define fastcc void @_ZNSt12length_errorC1ERKSs() personality i32 (...)* @__gxx_personality_v0 {
entry:
invoke fastcc void @_ZNSsC1ERKSs( )
to label %_ZNSt11logic_errorC2ERKSs.exit unwind label %invoke_catch.i
invoke_catch.i: ; preds = %entry
%exn = landingpad {i8*, i32}
catch i8* null
resume { i8*, i32 } %exn
_ZNSt11logic_errorC2ERKSs.exit: ; preds = %entry
ret void
}
define fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE() {
entry:
call fastcc void @_ZSt20__throw_length_errorPKc( )
unreachable
}
define fastcc void @_ZNSs12_S_constructIN9__gnu_cxx17__normal_iteratorIPcSsEEEES2_T_S4_RKSaIcESt20forward_iterator_tag() {
entry:
unreachable
}
define fastcc void @_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type() {
entry:
br i1 false, label %then.1.i, label %endif.1.i
then.1.i: ; preds = %entry
call fastcc void @_ZSt19__throw_logic_errorPKc( )
br label %endif.1.i
endif.1.i: ; preds = %then.1.i, %entry
call fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE( )
unreachable
}
define fastcc void @_ZNSsC1ERKSs() personality i32 (...)* @__gxx_personality_v0 {
entry:
call fastcc void @_ZNSs4_Rep7_M_grabERKSaIcES2_( )
invoke fastcc void @_ZNSaIcEC1ERKS_( )
to label %invoke_cont.1 unwind label %invoke_catch.1
invoke_catch.1: ; preds = %entry
%exn = landingpad {i8*, i32}
catch i8* null
call fastcc void @_ZNSaIcED1Ev( )
resume { i8*, i32 } %exn
invoke_cont.1: ; preds = %entry
call fastcc void @_ZNSaIcEC2ERKS_( )
ret void
}
define fastcc void @_ZNSaIcEC1ERKS_() {
entry:
ret void
}
define fastcc void @_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_jc() {
entry:
ret void
}
define fastcc void @_ZNSs4_Rep7_M_grabERKSaIcES2_() {
entry:
br i1 false, label %else.i, label %cond_true
cond_true: ; preds = %entry
ret void
else.i: ; preds = %entry
tail call fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE( )
unreachable
}
define fastcc void @_ZNSaIcEC2ERKS_() {
entry:
ret void
}
define fastcc void @_ZN9__gnu_cxx12__pool_allocILb1ELi0EE8allocateEj() {
entry:
ret void
}
define fastcc void @_ZN9__gnu_cxx12__pool_allocILb1ELi0EE9_S_refillEj() {
entry:
unreachable
}
declare i32 @__gxx_personality_v0(...)

View File

@ -1,343 +0,0 @@
; RUN: opt < %s -inline -prune-eh -disable-output -enable-new-pm=0
; PR992
target datalayout = "e-p:32:32"
target triple = "i686-pc-linux-gnu"
%struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i32, [52 x i8] }
%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
%"struct.__cxxabiv1::__array_type_info" = type { %"struct.std::type_info" }
%"struct.__cxxabiv1::__si_class_type_info" = type { %"struct.__cxxabiv1::__array_type_info", %"struct.__cxxabiv1::__array_type_info"* }
%"struct.__gnu_cxx::_Rope_rep_alloc_base<char,std::allocator<char>, true>" = type { i32 }
%"struct.__gnu_cxx::__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" = type { i8* }
%"struct.__gnu_cxx::__normal_iterator<const wchar_t*,std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >" = type { i32* }
%"struct.__gnu_cxx::char_producer<char>" = type { i32 (...)** }
%"struct.__gnu_cxx::stdio_sync_filebuf<char,std::char_traits<char> >" = type { %"struct.std::basic_streambuf<char,std::char_traits<char> >", %struct._IO_FILE*, i32 }
%"struct.__gnu_cxx::stdio_sync_filebuf<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >", %struct._IO_FILE*, i32 }
%struct.__locale_struct = type { [13 x %struct.locale_data*], i16*, i32*, i32*, [13 x i8*] }
%struct.__mbstate_t = type { i32, %"struct.__gnu_cxx::_Rope_rep_alloc_base<char,std::allocator<char>, true>" }
%struct.locale_data = type opaque
%"struct.std::__basic_file<char>" = type { %struct._IO_FILE*, i1 }
%"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>" = type { %"struct.std::locale::facet" }
%"struct.std::basic_filebuf<char,std::char_traits<char> >" = type { %"struct.std::basic_streambuf<char,std::char_traits<char> >", i32, %"struct.std::__basic_file<char>", i32, %struct.__mbstate_t, %struct.__mbstate_t, i8*, i32, i1, i1, i1, i1, i8, i8*, i8*, i1, %"struct.std::codecvt<char,char,__mbstate_t>"*, i8*, i32, i8*, i8* }
%"struct.std::basic_filebuf<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >", i32, %"struct.std::__basic_file<char>", i32, %struct.__mbstate_t, %struct.__mbstate_t, i32*, i32, i1, i1, i1, i1, i32, i32*, i32*, i1, %"struct.std::codecvt<char,char,__mbstate_t>"*, i8*, i32, i8*, i8* }
%"struct.std::basic_fstream<char,std::char_traits<char> >" = type { { %"struct.std::locale::facet", %"struct.__gnu_cxx::char_producer<char>" }, %"struct.std::basic_filebuf<char,std::char_traits<char> >", %"struct.std::basic_ios<char,std::char_traits<char> >" }
%"struct.std::basic_fstream<wchar_t,std::char_traits<wchar_t> >" = type { { %"struct.std::locale::facet", %"struct.__gnu_cxx::char_producer<char>" }, %"struct.std::basic_filebuf<wchar_t,std::char_traits<wchar_t> >", %"struct.std::basic_ios<wchar_t,std::char_traits<wchar_t> >" }
%"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8, i1, %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, %"struct.std::ctype<char>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"* }
%"struct.std::basic_ios<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<wchar_t,std::char_traits<wchar_t> >"*, i32, i1, %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >"*, %"struct.std::codecvt<char,char,__mbstate_t>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"*, %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>"* }
%"struct.std::basic_iostream<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::locale::facet", %"struct.__gnu_cxx::char_producer<char>", %"struct.std::basic_ios<wchar_t,std::char_traits<wchar_t> >" }
%"struct.std::basic_ostream<char,std::char_traits<char> >" = type { i32 (...)**, %"struct.std::basic_ios<char,std::char_traits<char> >" }
%"struct.std::basic_ostream<wchar_t,std::char_traits<wchar_t> >" = type { i32 (...)**, %"struct.std::basic_ios<wchar_t,std::char_traits<wchar_t> >" }
%"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"struct.std::locale" }
%"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >" = type { i32 (...)**, i32*, i32*, i32*, i32*, i32*, i32*, %"struct.std::locale" }
%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" = type { %"struct.__gnu_cxx::__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" }
%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" }
%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" = type { i32, i32, i32 }
%"struct.std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >" = type { %"struct.__gnu_cxx::__normal_iterator<const wchar_t*,std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >" }
%"struct.std::codecvt<char,char,__mbstate_t>" = type { %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>", %struct.__locale_struct* }
%"struct.std::collate<char>" = type { %"struct.std::locale::facet", %struct.__locale_struct* }
%"struct.std::collate_byname<char>" = type { %"struct.std::collate<char>" }
%"struct.std::ctype<char>" = type { %"struct.std::__codecvt_abstract_base<char,char,__mbstate_t>", %struct.__locale_struct*, i1, i32*, i32*, i16* }
%"struct.std::ctype_byname<char>" = type { %"struct.std::ctype<char>" }
%"struct.std::domain_error" = type { %"struct.std::logic_error" }
%"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, %"struct.std::ios_base::_Words"*, %"struct.std::locale" }
%"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
%"struct.std::ios_base::_Words" = type { i8*, i32 }
%"struct.std::istreambuf_iterator<char,std::char_traits<char> >" = type { %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, i32 }
%"struct.std::istreambuf_iterator<wchar_t,std::char_traits<wchar_t> >" = type { %"struct.std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >"*, i32 }
%"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
%"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
%"struct.std::locale::facet" = type { i32 (...)**, i32 }
%"struct.std::logic_error" = type { %"struct.__gnu_cxx::char_producer<char>", %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" }
%"struct.std::type_info" = type { i32 (...)**, i8* }
@.str_11 = external global [42 x i8] ; <[42 x i8]*> [#uses=0]
@.str_9 = external global [24 x i8] ; <[24 x i8]*> [#uses=0]
@.str_1 = external global [17 x i8] ; <[17 x i8]*> [#uses=0]
define void @main() {
entry:
tail call fastcc void @_ZNSolsEi( )
ret void
}
define fastcc void @_ZNSolsEi() {
entry:
%tmp.22 = icmp eq i32 0, 0 ; <i1> [#uses=1]
br i1 %tmp.22, label %else, label %then
then: ; preds = %entry
ret void
else: ; preds = %entry
tail call fastcc void @_ZNSolsEl( )
ret void
}
define void @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_() {
entry:
ret void
}
define fastcc void @_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate() {
entry:
tail call fastcc void @_ZSt19__throw_ios_failurePKc( )
ret void
}
define fastcc void @_ZNSo3putEc() {
entry:
ret void
}
define fastcc void @_ZNSolsEl() {
entry:
%tmp.21.i = icmp eq %"struct.std::basic_ostream<char,std::char_traits<char> >"* null, null ; <i1> [#uses=1]
br i1 %tmp.21.i, label %endif.0.i, label %shortcirc_next.i
shortcirc_next.i: ; preds = %entry
ret void
endif.0.i: ; preds = %entry
call fastcc void @_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate( )
ret void
}
define fastcc void @_ZSt19__throw_ios_failurePKc() {
entry:
call fastcc void @_ZNSsC1EPKcRKSaIcE( )
ret void
}
define fastcc void @_ZNSt8ios_baseD2Ev() {
entry:
unreachable
}
define void @_ZN9__gnu_cxx18stdio_sync_filebufIwSt11char_traitsIwEE5uflowEv() {
entry:
unreachable
}
define void @_ZN9__gnu_cxx18stdio_sync_filebufIcSt11char_traitsIcEED1Ev() {
entry:
unreachable
}
define void @_ZNSt15basic_streambufIcSt11char_traitsIcEE6setbufEPci() {
entry:
ret void
}
define fastcc void @_ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale() {
entry:
ret void
}
declare fastcc void @_ZNSaIcED1Ev()
define fastcc void @_ZSt19__throw_logic_errorPKc() {
entry:
call fastcc void @_ZNSt11logic_errorC1ERKSs( )
ret void
}
define fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE() {
entry:
br i1 false, label %then.0, label %endif.0
then.0: ; preds = %entry
call fastcc void @_ZSt20__throw_length_errorPKc( )
ret void
endif.0: ; preds = %entry
ret void
}
define fastcc void @_ZSt20__throw_length_errorPKc() {
entry:
call fastcc void @_ZNSt12length_errorC1ERKSs( )
ret void
}
define fastcc void @_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type() {
entry:
br i1 false, label %then.1.i, label %endif.1.i
then.1.i: ; preds = %entry
call fastcc void @_ZSt19__throw_logic_errorPKc( )
ret void
endif.1.i: ; preds = %entry
call fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE( )
unreachable
}
define fastcc void @_ZNSsC1ERKSs() personality i32 (...)* @__gxx_personality_v0 {
entry:
call fastcc void @_ZNSs4_Rep7_M_grabERKSaIcES2_( )
invoke fastcc void @_ZNSaIcEC1ERKS_( )
to label %invoke_cont.1 unwind label %invoke_catch.1
invoke_catch.1: ; preds = %entry
%exn = landingpad {i8*, i32}
catch i8* null
call fastcc void @_ZNSaIcED1Ev( )
resume { i8*, i32 } %exn
invoke_cont.1: ; preds = %entry
call fastcc void @_ZNSaIcEC2ERKS_( )
ret void
}
define fastcc void @_ZNSs7reserveEj() {
entry:
ret void
}
define fastcc void @_ZNSaIcEC1ERKS_() {
entry:
ret void
}
define fastcc void @_ZNSs4_Rep7_M_grabERKSaIcES2_() {
entry:
br i1 false, label %else.i, label %cond_true
cond_true: ; preds = %entry
ret void
else.i: ; preds = %entry
tail call fastcc void @_ZNSs4_Rep9_S_createEjRKSaIcE( )
ret void
}
define fastcc void @_ZNSsC1EPKcRKSaIcE() {
entry:
tail call fastcc void @_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type( )
unreachable
}
define fastcc void @_ZNSaIcEC2ERKS_() {
entry:
ret void
}
define void @_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev() {
entry:
unreachable
}
define void @_ZNSt14collate_bynameIcED1Ev() {
entry:
unreachable
}
define void @_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRSt12_Ios_IostateRy() {
entry:
ret void
}
define void @_ZNSt23__codecvt_abstract_baseIcc11__mbstate_tED1Ev() {
entry:
unreachable
}
define void @_ZNSt12ctype_bynameIcED0Ev() {
entry:
unreachable
}
define fastcc void @_ZNSt8messagesIwEC1Ej() {
entry:
ret void
}
define fastcc void @_ZSt14__convert_to_vIlEvPKcRT_RSt12_Ios_IostateRKP15__locale_structi() {
entry:
ret void
}
define fastcc void @_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEEC1Ej() {
entry:
ret void
}
define fastcc void @_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEEC1Ej() {
entry:
ret void
}
define fastcc void @_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE16_M_extract_floatES3_S3_RSt8ios_baseRSt12_Ios_IostateRSs() {
entry:
unreachable
}
define fastcc void @_ZNSbIwSt11char_traitsIwESaIwEE4swapERS2_() {
entry:
ret void
}
define void @_ZNSt14basic_iostreamIwSt11char_traitsIwEED0Ev() {
entry:
unreachable
}
define void @_ZNSt15basic_streambufIcSt11char_traitsIcEE9showmanycEv() {
entry:
ret void
}
define void @_ZNSt9exceptionD0Ev() {
entry:
unreachable
}
define fastcc void @_ZNSt11logic_errorC1ERKSs() {
entry:
call fastcc void @_ZNSsC1ERKSs( )
ret void
}
define fastcc void @_ZNSt11logic_errorD2Ev() {
entry:
unreachable
}
define fastcc void @_ZNSt12length_errorC1ERKSs() personality i32 (...)* @__gxx_personality_v0 {
entry:
invoke fastcc void @_ZNSsC1ERKSs( )
to label %_ZNSt11logic_errorC2ERKSs.exit unwind label %invoke_catch.i
invoke_catch.i: ; preds = %entry
%exn = landingpad {i8*, i32}
catch i8* null
resume { i8*, i32 } %exn
_ZNSt11logic_errorC2ERKSs.exit: ; preds = %entry
ret void
}
define void @_ZNK10__cxxabiv120__si_class_type_info20__do_find_public_srcEiPKvPKNS_17__class_type_infoES2_() {
entry:
ret void
}
define fastcc void @_ZNSbIwSt11char_traitsIwESaIwEE16_S_construct_auxIPKwEEPwT_S7_RKS1_12__false_type() {
entry:
ret void
}
define void @_ZTv0_n12_NSt13basic_fstreamIwSt11char_traitsIwEED1Ev() {
entry:
ret void
}
define void @_ZNSt13basic_fstreamIcSt11char_traitsIcEED1Ev() {
entry:
unreachable
}
define fastcc void @_ZNSt5ctypeIcEC1EPKtbj() {
entry:
ret void
}
declare i32 @__gxx_personality_v0(...)

View File

@ -1,73 +0,0 @@
; RUN: opt -prune-eh -inline -jump-threading -S -enable-new-pm=0 < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@d = external global i32*, align 8
define void @fn3(i1 %B) {
entry:
br i1 %B, label %if.end, label %if.then
if.then: ; preds = %entry
call void @fn2(i1 %B)
ret void
if.end: ; preds = %entry
call void @fn2(i1 %B)
ret void
}
define internal void @fn2(i1 %B) unnamed_addr {
entry:
call void @fn1()
call void @fn1()
call void @fn1()
br i1 %B, label %if.end, label %if.then
if.then:
unreachable
if.end:
unreachable
}
; CHECK-LABEL: define internal void @fn2(
; CHECK: %[[LOAD:.*]] = load i32*, i32** @d, align 8
; CHECK: %tobool1.i = icmp eq i32* %[[LOAD]], null
define internal void @fn1() unnamed_addr {
entry:
br label %for.body
for.body: ; preds = %entry
%0 = load i32*, i32** @d, align 8
%tobool1 = icmp eq i32* %0, null
br i1 %tobool1, label %cond.false, label %cond.end
cond.false: ; preds = %for.body
call void @__assert_fail(i8* null)
unreachable
cond.end: ; preds = %for.body
%1 = load i32*, i32** @d, align 8
%cmp = icmp eq i32* %1, null
br i1 %cmp, label %cond.end4, label %cond.false3
cond.false3: ; preds = %cond.end
call void @__assert_fail(i8* null)
unreachable
cond.end4: ; preds = %cond.end
call void @__assert_fail(i8* null)
unreachable
for.end: ; No predecessors!
ret void
}
declare void @__assert_fail(i8*)
; Function Attrs: noreturn nounwind
declare void @llvm.trap() #0
attributes #0 = { noreturn nounwind }

View File

@ -1,20 +0,0 @@
; RUN: opt < %s -prune-eh -enable-new-pm=0 -S | FileCheck %s
; RUN: opt < %s -passes='function-attrs,function(simplifycfg)' -S | FileCheck %s
; We should not infer 'nounwind' for/from a weak function,
; since it can be overriden by throwing implementation.
;
; CHECK-LABEL: define weak void @f()
define weak void @f() {
entry:
ret void
}
; CHECK-LABEL: define void @g()
define void @g() {
entry:
call void @f()
ret void
}
; CHECK-NOT: {{^}}attributes #{{[0-9].*}} nounwind

View File

@ -1,67 +0,0 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -prune-eh -enable-new-pm=0 < %s | FileCheck --check-prefixes=ALL,OLDPM %s
; RUN: opt -S -passes='function-attrs,function(simplifycfg)' < %s | FileCheck --check-prefixes=ALL,NEWPM %s
declare void @may_throw()
; @callee below may be an optimized form of this function, which can
; throw at runtime (see r265762 for more details):
;
; define linkonce_odr void @callee(i32* %ptr) noinline {
; entry:
; %val0 = load atomic i32, i32* %ptr unordered, align 4
; %val1 = load atomic i32, i32* %ptr unordered, align 4
; %cmp = icmp eq i32 %val0, %val1
; br i1 %cmp, label %left, label %right
; left:
; ret void
; right:
; call void @may_throw()
; ret void
; }
define linkonce_odr void @callee(i32* %ptr) noinline {
; ALL-LABEL: @callee(
; ALL-NEXT: ret void
;
ret void
}
define i32 @caller(i32* %ptr) personality i32 3 {
; OLDPM-LABEL: @caller(
; OLDPM-NEXT: entry:
; OLDPM-NEXT: invoke void @callee(i32* [[PTR:%.*]])
; OLDPM-NEXT: to label [[NORMAL:%.*]] unwind label [[UNWIND:%.*]]
; OLDPM: normal:
; OLDPM-NEXT: ret i32 1
; OLDPM: unwind:
; OLDPM-NEXT: [[RES:%.*]] = landingpad { i8*, i32 }
; OLDPM-NEXT: cleanup
; OLDPM-NEXT: ret i32 2
;
; NEWPM-LABEL: @caller(
; NEWPM-NEXT: entry:
; NEWPM-NEXT: invoke void @callee(i32* [[PTR:%.*]])
; NEWPM-NEXT: to label [[COMMON_RET:%.*]] unwind label [[UNWIND:%.*]]
; NEWPM: common.ret:
; NEWPM-NEXT: [[COMMON_RET_OP:%.*]] = phi i32 [ 2, [[UNWIND]] ], [ 1, [[ENTRY:%.*]] ]
; NEWPM-NEXT: ret i32 [[COMMON_RET_OP]]
; NEWPM: unwind:
; NEWPM-NEXT: [[RES:%.*]] = landingpad { i8*, i32 }
; NEWPM-NEXT: cleanup
; NEWPM-NEXT: br label [[COMMON_RET]]
;
entry:
invoke void @callee(i32* %ptr)
to label %normal unwind label %unwind
normal:
ret i32 1
unwind:
%res = landingpad { i8*, i32 }
cleanup
ret i32 2
}

View File

@ -1,45 +0,0 @@
; RUN: opt < %s -prune-eh -S -enable-new-pm=0 | FileCheck %s
; RUN: opt < %s -passes='function-attrs,function(simplifycfg)' -S | FileCheck %s
declare void @nounwind() nounwind
define internal void @foo() {
call void @nounwind()
ret void
}
; CHECK-LABEL: @caller
define i32 @caller(i32 %n) personality i32 (...)* @__gxx_personality_v0 {
entry:
br label %for
for:
%j = phi i32 [0, %entry], [%j.inc, %inc]
%j.cmp = icmp slt i32 %j, %n
br i1 %j.cmp, label %body, label %exit, !llvm.loop !0
body:
; CHECK: call void @foo(), !llvm.mem.parallel_loop_access !0
invoke void @foo( )
to label %Normal unwind label %Except, !llvm.mem.parallel_loop_access !0
br label %inc
inc:
%j.inc = add nuw nsw i32 %j, 1
br label %for, !llvm.loop !0
exit:
br label %Normal
Normal:
ret i32 0
Except:
landingpad { i8*, i32 }
catch i8* null
ret i32 1
}
declare i32 @__gxx_personality_v0(...)
!0 = distinct !{!0}

View File

@ -1,16 +0,0 @@
; RUN: opt -prune-eh -enable-new-pm=0 -S < %s | FileCheck %s
; RUN: opt < %s -passes='function-attrs,function(simplifycfg)' -S | FileCheck %s
declare void @noreturn()
define void @testfn() {
; A musttail call must be followed by (optional bitcast then) ret,
; so make sure we don't insert an unreachable
; CHECK: musttail call void @noreturn
; CHECK-NOT: unreachable
; CHECK-NEXT: ret void
musttail call void @noreturn() #0
ret void
}
attributes #0 = { noreturn }

View File

@ -1,27 +0,0 @@
; RUN: opt < %s -prune-eh -enable-new-pm=0 -S | FileCheck %s
; RUN: opt < %s -passes='function-attrs,function(simplifycfg)' -S | FileCheck %s
declare void @nounwind() nounwind
define internal void @foo() {
call void @nounwind()
ret void
}
define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-LABEL: @caller(
; CHECK-NOT: invoke
; CHECK: call void @foo() [ "foo"(i32 0, i8 1) ]
invoke void @foo() [ "foo"(i32 0, i8 1) ]
to label %Normal unwind label %Except
Normal: ; preds = %0
ret i32 0
Except: ; preds = %0
landingpad { i8*, i32 }
catch i8* null
ret i32 1
}
declare i32 @__gxx_personality_v0(...)

View File

@ -1,22 +0,0 @@
; RUN: opt -S -prune-eh -enable-new-pm=0 < %s | FileCheck %s
; RUN: opt -S -passes='function-attrs,function(simplifycfg)' < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @f() #0 {
entry:
call void asm sideeffect "ret\0A\09", "~{dirflag},~{fpsr},~{flags}"()
unreachable
}
define i32 @g() {
entry:
call void @f()
ret i32 42
}
; CHECK-LABEL: define i32 @g()
; CHECK: ret i32 42
attributes #0 = { naked noinline }

View File

@ -1,70 +0,0 @@
; PruneEH is less powerful than simplifycfg in terms of cfg simplification,
; so it leaves some of the unreachable stuff hanging around.
; Checking it with CHECK-OLD.
;
; RUN: opt -prune-eh -enable-new-pm=0 -S < %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-OLD
; RUN: opt -passes='function-attrs,function(simplifycfg)' -S < %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NEW
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i386-pc-windows-msvc"
declare void @neverthrows() nounwind
define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
invoke void @neverthrows()
to label %try.cont unwind label %cleanuppad
try.cont:
ret void
cleanuppad:
%cp = cleanuppad within none []
br label %cleanupret
cleanupret:
cleanupret from %cp unwind to caller
}
; CHECK-LABEL: define void @test1(
; CHECK: call void @neverthrows()
; CHECK-NEW-NEXT: ret void
; CHECK-NEW-NEXT: }
; CHECK-OLD: ret void
; CHECK-OLD: %[[cp:.*]] = cleanuppad within none []
; CHECK-OLD-NEXT: unreachable
; CHECK-OLD: cleanupret from %[[cp]] unwind to caller
define void @test2() personality i32 (...)* @__CxxFrameHandler3 {
invoke void @neverthrows()
to label %try.cont unwind label %catchswitch
try.cont:
ret void
catchswitch:
%cs = catchswitch within none [label %catchpad] unwind to caller
catchpad:
%cp = catchpad within %cs []
unreachable
ret:
ret void
}
; CHECK-LABEL: define void @test2(
; CHECK: call void @neverthrows()
; CHECK-NEW-NEXT: ret void
; CHECK-NEW-NEXT: }
; CHECK-OLD: ret void
; CHECK-OLD: %[[cs:.*]] = catchswitch within none [label
; CHECK-OLD: catchpad within %[[cs]] []
; CHECK-OLD-NEXT: unreachable
; CHECK-OLD:ret void
declare i32 @__CxxFrameHandler3(...)

View File

@ -1,30 +0,0 @@
; RUN: opt < %s -prune-eh -enable-new-pm=0 -S | FileCheck %s
; RUN: opt < %s -passes='function-attrs,function(simplifycfg)' -S | FileCheck %s
; CHECK-LABEL: define internal i32 @foo()
define internal i32 @foo() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-NOT: invoke i32 @foo()
invoke i32 @foo( )
to label %Normal unwind label %Except ; <i32>:1 [#uses=0]
Normal: ; preds = %0
ret i32 12
Except: ; preds = %0
landingpad { i8*, i32 }
catch i8* null
ret i32 123
}
; CHECK-LABEL: define i32 @caller()
define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-NOT: invoke i32 @foo()
invoke i32 @foo( )
to label %Normal unwind label %Except ; <i32>:1 [#uses=0]
Normal: ; preds = %0
ret i32 0
Except: ; preds = %0
landingpad { i8*, i32 }
catch i8* null
ret i32 1
}
declare i32 @__gxx_personality_v0(...)

View File

@ -1,32 +0,0 @@
; RUN: opt -S -prune-eh -enable-new-pm=0 < %s | FileCheck %s
; RUN: opt -S -passes='function-attrs,function(simplifycfg)' < %s | FileCheck %s
; Don't remove invokes of nounwind functions if the personality handles async
; exceptions. The @div function in this test can fault, even though it can't
; throw a synchronous exception.
define i32 @div(i32 %n, i32 %d) nounwind {
entry:
%div = sdiv i32 %n, %d
ret i32 %div
}
define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
entry:
%call = invoke i32 @div(i32 10, i32 0)
to label %__try.cont unwind label %lpad
lpad:
%0 = landingpad { i8*, i32 }
catch i8* null
br label %__try.cont
__try.cont:
%retval.0 = phi i32 [ %call, %entry ], [ 0, %lpad ]
ret i32 %retval.0
}
; CHECK-LABEL: define i32 @main()
; CHECK: invoke i32 @div(i32 10, i32 0)
declare i32 @__C_specific_handler(...)

View File

@ -1,14 +0,0 @@
; RUN: opt < %s -prune-eh -S -enable-new-pm=0 | not grep "ret i32"
; RUN: opt < %s -passes='function-attrs,function(simplifycfg)' -S | not grep "ret i32"
declare void @noreturn() noreturn
define i32 @caller() {
call void @noreturn()
ret i32 17
}
define i32 @caller2() {
%T = call i32 @caller()
ret i32 %T
}

View File

@ -1,26 +0,0 @@
; RUN: opt < %s -prune-eh -enable-new-pm=0 -S | FileCheck %s
; RUN: opt < %s -passes='function-attrs,function(simplifycfg)' -S | FileCheck %s
declare void @nounwind() nounwind
define internal void @foo() {
call void @nounwind()
ret void
}
; CHECK-LABEL: define i32 @caller()
define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-NOT: invoke void @foo
invoke void @foo( )
to label %Normal unwind label %Except
Normal: ; preds = %0
ret i32 0
Except: ; preds = %0
landingpad { i8*, i32 }
catch i8* null
ret i32 1
}
declare i32 @__gxx_personality_v0(...)

View File

@ -53,7 +53,6 @@ static_library("IPO") {
"OpenMPOpt.cpp",
"PartialInlining.cpp",
"PassManagerBuilder.cpp",
"PruneEH.cpp",
"SCCP.cpp",
"SampleContextTracker.cpp",
"SampleProfile.cpp",