Summary: When recursively extracting a function from a bit code file, include functions mentioned in InvokeInst as well as CallInst
Reviewers: loladiro, espindola, volkan
Reviewed By: loladiro
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60231
llvm-svn: 357735
; RUN: llvm-extract -func=a --recursive %s -S | FileCheck --check-prefix=CHECK-AB %s
; RUN: llvm-extract -func=a --recursive --delete %s -S | FileCheck --check-prefix=CHECK-CD %s
; RUN: llvm-extract -func=d --recursive %s -S | FileCheck --check-prefix=CHECK-CD %s
+; RUN: llvm-extract -func=e --recursive %s -S | FileCheck --check-prefix=CHECK-CD %s
; CHECK-AB: define void @a
; CHECK-AB: define void @b
call void @c()
ret void
}
+
+define void @e() {
+ invoke void @c()
+ to label %L unwind label %L
+L:
+ ret void
+}
\ No newline at end of file
ExitOnErr(F->materialize());
for (auto &BB : *F) {
for (auto &I : BB) {
- auto *CI = dyn_cast<CallInst>(&I);
- if (!CI)
+ CallBase *CB = dyn_cast<CallBase>(&I);
+ if (!CB)
continue;
- Function *CF = CI->getCalledFunction();
+ Function *CF = CB->getCalledFunction();
if (!CF)
continue;
if (CF->isDeclaration() || GVs.count(CF))