1; RUN: opt -bdce -S < %s | FileCheck %s
2; RUN: opt -passes=bdce -S < %s | FileCheck %s
3
4declare i32 @strlen(i8*) readonly nounwind
5
6define void @test1() {
7  call i32 @strlen( i8* null )
8  ret void
9
10; CHECK-LABEL: @test1
11; CHECK-NOT: call
12; CHECK: ret void
13}
14
15define i32 @test2() personality i32 (...)* @__gxx_personality_v0 {
16  ; invoke of pure function should not be deleted!
17  invoke i32 @strlen( i8* null ) readnone
18                  to label %Cont unwind label %Other
19
20Cont:           ; preds = %0
21  ret i32 0
22
23Other:          ; preds = %0
24   %exn = landingpad {i8*, i32}
25            cleanup
26  ret i32 1
27
28; CHECK-LABEL: @test2
29; CHECK: invoke
30; CHECK: ret i32 1
31}
32
33declare i32 @__gxx_personality_v0(...)
34
35