40 lines · plain
1; RUN: opt < %s -passes=gvn,simplifycfg,adce -simplifycfg-require-and-preserve-domtree=1 | llvm-dis2; RUN: opt < %s -passes=gvn,simplifycfg,adce -simplifycfg-require-and-preserve-domtree=1 -verify-dom-info | llvm-dis3 4; This test makes sure that the DominatorTree properly handles5; deletion of edges that go to forward-unreachable regions.6; In this case, %land.end is already forward unreachable when7; the DT gets informed about the deletion of %entry -> %land.end.8 9@a = common global i32 0, align 410 11define i32 @main() {12entry:13 %retval = alloca i32, align 414 store i32 0, ptr %retval, align 415 %0 = load i32, ptr @a, align 416 %cmp = icmp ne i32 %0, 117 br i1 %cmp, label %land.rhs, label %land.end418 19land.rhs: ; preds = %entry20 %1 = load i32, ptr @a, align 421 %tobool = icmp ne i32 %1, 022 br i1 %tobool, label %land.rhs1, label %land.end23 24land.rhs1: ; preds = %land.rhs25 br label %land.end26 27land.end: ; preds = %land.rhs1, %land.rhs28 %2 = phi i1 [ false, %land.rhs ], [ true, %land.rhs1 ]29 %land.ext = zext i1 %2 to i3230 %conv = trunc i32 %land.ext to i1631 %conv2 = sext i16 %conv to i3232 %tobool3 = icmp ne i32 %conv2, 033 br label %land.end434 35land.end4: ; preds = %land.end, %entry36 %3 = phi i1 [ false, %entry ], [ %tobool3, %land.end ]37 %land.ext5 = zext i1 %3 to i3238 ret i32 039}40