1 ; RUN: opt -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 undef)
26 tail call void @f(i32 %add)
32 %i = alloca i32, align 4
33 store volatile i32 10, i32* %i, align 4
34 ; CHECK: %tmp = load volatile i32, i32* %i, align 4
35 ; CHECK-NEXT: call void @f(i32 undef)
36 %tmp = load volatile i32, i32* %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(%swift_error** swifterror %dead_arg) {
56 tail call void @sideeffect() nounwind
60 ; CHECK-LABEL: @dont_replace_by_undef
61 ; CHECK-NOT: call void @unused_swifterror_arg({{.*}}undef)
62 define void @dont_replace_by_undef() {
63 %error_ptr_ref = alloca swifterror %swift_error*
64 store %swift_error* null, %swift_error** %error_ptr_ref
65 call void @unused_swifterror_arg(%swift_error** %error_ptr_ref)