Closed
Description
; RUN: opt -S -inline < %s
define void @foo() personality i32 (...)* undef {
entry:
br i1 false, label %join, label %split
split: ; preds = %entry
br label %join
join: ; preds = %split, %entry
%phi = phi i64 [ 1, %split ], [ 0, %entry ]
%cmp = icmp ugt i64 1, %phi
br i1 %cmp, label %invoke1, label %exit
invoke1: ; preds = %join
invoke void undef()
to label %exit unwind label %cleanup1
cleanup1: ; preds = %invoke1
%pad1 = cleanuppad within none []
br label %cleanup1.cont
cleanup1.cont: ; preds = %invoke2, %cleanup1
br i1 undef, label %cleanupret, label %invoke2
invoke2: ; preds = %cleanup1.cont
invoke void undef()
to label %cleanup1.cont unwind label %cleanup2
cleanup2: ; preds = %invoke2
%pad2 = cleanuppad within none []
br label %cleanupret
cleanupret: ; preds = %cleanup2, %cleanup1.cont
cleanupret from %pad1 unwind to caller
exit: ; preds = %invoke1, %join
ret void
}
define void @test() personality i32 (...)* undef {
invoke void @foo()
to label %exit unwind label %cleanup
exit: ; preds = %0
ret void
cleanup: ; preds = %0
%pad = cleanuppad within none []
cleanupret from %pad unwind to caller
}
Asserts:
opt: /home/npopov/repos/llvm-project/llvm/include/llvm/Support/Casting.h:255: std::enable_if_t<(! llvm::is_simple_type<Y>::value), typename llvm::cast_retty<X, const Y>::ret_type> llvm::cast(const Y&) [with X = llvm::CleanupPadInst; Y = llvm::Use; std::enable_if_t<(! llvm::is_simple_type<Y>::value), typename llvm::cast_retty<X, const Y>::ret_type> = llvm::CleanupPadInst*; typename llvm::cast_retty<X, const Y>::ret_type = llvm::CleanupPadInst*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: build/bin/opt -S -inline -debug-only=inline test064.ll
#0 0x000000000316a451 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x0000000003167c2e SignalHandler(int) Signals.cpp:0:0
#2 0x00007ffabebb8750 __restore_rt (/lib64/libc.so.6+0x42750)
#3 0x00007ffabec0584c __pthread_kill_implementation (/lib64/libc.so.6+0x8f84c)
#4 0x00007ffabebb86a6 gsignal (/lib64/libc.so.6+0x426a6)
#5 0x00007ffabeba27d3 abort (/lib64/libc.so.6+0x2c7d3)
#6 0x00007ffabeba26fb _nl_load_domain.cold (/lib64/libc.so.6+0x2c6fb)
#7 0x00007ffabebb1396 (/lib64/libc.so.6+0x3b396)
#8 0x0000000003211cdf HandleInlinedEHPad(llvm::InvokeInst*, llvm::BasicBlock*, llvm::ClonedCodeInfo&) InlineFunction.cpp:0:0
#9 0x0000000003217fd3 llvm::InlineFunction(llvm::CallBase&, llvm::InlineFunctionInfo&, llvm::AAResults*, bool, llvm::Function*) (build/bin/opt+0x3217fd3)
#10 0x0000000002976948 llvm::InlinerPass::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) (build/bin/opt+0x2976948)