1 ; RUN: opt -passes=deadargelim -S < %s | FileCheck %s
3 define void @test(i32) {
14 define void @f(i32 %X) {
16 tail call void @sideeffect() nounwind
20 declare void @sideeffect()
22 define void @g(i32 %n) {
24 %add = add nsw i32 %n, 1
25 ; CHECK: tail call void @f(i32 poison)
26 tail call void @f(i32 %add)
32 %i = alloca i32, align 4
33 store volatile i32 10, ptr %i, align 4
34 ; CHECK: %tmp = load volatile i32, ptr %i, align 4
35 ; CHECK-NEXT: call void @f(i32 poison)
36 %tmp = load volatile i32, ptr %i, align 4
37 call void @f(i32 %tmp)
41 ; Check that callers are not transformed for weak definitions.
42 define weak i32 @weak_f(i32 %x) nounwind {
46 define void @weak_f_caller() nounwind {
48 ; CHECK: call i32 @weak_f(i32 10)
49 %call = tail call i32 @weak_f(i32 10)
53 %swift_error = type opaque
55 define void @unused_swifterror_arg(ptr swifterror %dead_arg) {
56 tail call void @sideeffect() nounwind
60 ; CHECK-LABEL: @dont_replace_by_poison
61 ; CHECK-NOT: call void @unused_swifterror_arg({{.*}}poison)
62 define void @dont_replace_by_poison() {
63 %error_ptr_ref = alloca swifterror ptr
64 store ptr null, ptr %error_ptr_ref
65 call void @unused_swifterror_arg(ptr %error_ptr_ref)