Home | History | Annotate | Download | only in DeadArgElim
      1 ; RUN: opt -deadargelim -S < %s | FileCheck %s
      2 
      3 define void @test(i32) {
      4   ret void
      5 }
      6 
      7 define void @foo() {
      8   call void @test(i32 0)
      9   ret void
     10 ; CHECK-LABEL: @foo(
     11 ; CHECK: i32 undef
     12 }
     13 
     14 define void @f(i32 %X) {
     15 entry:
     16   tail call void @sideeffect() nounwind
     17   ret void
     18 }
     19 
     20 declare void @sideeffect()
     21 
     22 define void @g(i32 %n) {
     23 entry:
     24   %add = add nsw i32 %n, 1
     25 ; CHECK: tail call void @f(i32 undef)
     26   tail call void @f(i32 %add)
     27   ret void
     28 }
     29 
     30 define void @h() {
     31 entry:
     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)
     38   ret void
     39 }
     40 
     41 ; Check that callers are not transformed for weak definitions.
     42 define weak i32 @weak_f(i32 %x) nounwind {
     43 entry:
     44   ret i32 0
     45 }
     46 define void @weak_f_caller() nounwind {
     47 entry:
     48 ; CHECK: call i32 @weak_f(i32 10)
     49   %call = tail call i32 @weak_f(i32 10)
     50   ret void
     51 }
     52 
     53