Home | History | Annotate | Download | only in SimplifyCFG
      1 ; RUN: opt < %s -simplifycfg -S | FileCheck %s
      2 
      3 ; Checks that the SimplifyCFG pass won't duplicate a call to a function marked
      4 ; convergent.
      5 ;
      6 ; CHECK: call void @barrier
      7 ; CHECK-NOT: call void @barrier
      8 define void @check(i1 %cond, i32* %out) {
      9 entry:
     10   br i1 %cond, label %if.then, label %if.end
     11 
     12 if.then:
     13   store i32 5, i32* %out
     14   br label %if.end
     15 
     16 if.end:
     17   %x = phi i1 [ true, %entry ], [ false, %if.then ]
     18   call void @barrier()
     19   br i1 %x, label %cond.end, label %cond.false
     20 
     21 cond.false:
     22   br label %cond.end
     23 
     24 cond.end:
     25   ret void
     26 }
     27 
     28 declare void @barrier() convergent
     29