Home | History | Annotate | Download | only in ADCE
      1 ; RUN: opt < %s -gvn -simplifycfg -adce | llvm-dis
      2 ; RUN: opt < %s -gvn -simplifycfg -adce -verify-dom-info | llvm-dis
      3 
      4 ; This test makes sure that the DominatorTree properly handles
      5 ; deletion of edges that go to forward-unreachable regions.
      6 ; In this case, %land.end is already forward unreachable when
      7 ; the DT gets informed about the deletion of %entry -> %land.end.
      8 
      9 @a = common global i32 0, align 4
     10 
     11 define i32 @main() {
     12 entry:
     13   %retval = alloca i32, align 4
     14   store i32 0, i32* %retval, align 4
     15   %0 = load i32, i32* @a, align 4
     16   %cmp = icmp ne i32 %0, 1
     17   br i1 %cmp, label %land.rhs, label %land.end4
     18 
     19 land.rhs:                                         ; preds = %entry
     20   %1 = load i32, i32* @a, align 4
     21   %tobool = icmp ne i32 %1, 0
     22   br i1 %tobool, label %land.rhs1, label %land.end
     23 
     24 land.rhs1:                                        ; preds = %land.rhs
     25   br label %land.end
     26 
     27 land.end:                                         ; preds = %land.rhs1, %land.rhs
     28   %2 = phi i1 [ false, %land.rhs ], [ true, %land.rhs1 ]
     29   %land.ext = zext i1 %2 to i32
     30   %conv = trunc i32 %land.ext to i16
     31   %conv2 = sext i16 %conv to i32
     32   %tobool3 = icmp ne i32 %conv2, 0
     33   br label %land.end4
     34 
     35 land.end4:                                        ; preds = %land.end, %entry
     36   %3 = phi i1 [ false, %entry ], [ %tobool3, %land.end ]
     37   %land.ext5 = zext i1 %3 to i32
     38   ret i32 0
     39 }
     40