1; RUN: opt -mergereturn -enable-new-pm=0 -S < %s | FileCheck %s 2; RUN: opt -passes='break-crit-edges,lowerswitch,mergereturn' -S < %s | FileCheck %s 3 4; The pass did previously not report the correct Modified status in the case 5; where a function had at most one return block, and an unified unreachable 6; block was created. This was caught by the pass return status check that is 7; hidden under EXPENSIVE_CHECKS. 8 9; CHECK: for.foo.body2: 10; CHECK-NEXT: br label %UnifiedUnreachableBlock 11 12; CHECK: for.foo.end: 13; CHECK-NEXT: br label %UnifiedUnreachableBlock 14 15; CHECK: UnifiedUnreachableBlock: 16; CHECK-NEXT: unreachable 17 18define i32 @foo() { 19entry: 20 br label %for.foo.cond 21 22for.foo.cond: ; preds = %entry 23 br i1 false, label %for.foo.body, label %for.foo.end3 24 25for.foo.body: ; preds = %for.foo.cond 26 br label %for.foo.cond1 27 28for.foo.cond1: ; preds = %for.foo.body 29 br i1 false, label %for.foo.body2, label %for.foo.end 30 31for.foo.body2: ; preds = %for.foo.cond1 32 unreachable 33 34for.foo.end: ; preds = %for.foo.cond1 35 unreachable 36 37for.foo.end3: ; preds = %for.foo.cond 38 ret i32 undef 39} 40 41; CHECK: for.bar.body2: 42; CHECK-NEXT: br label %UnifiedUnreachableBlock 43 44; CHECK: for.bar.end: 45; CHECK-NEXT: br label %UnifiedUnreachableBlock 46 47; CHECK: UnifiedUnreachableBlock: 48; CHECK-NEXT: unreachable 49 50define void @bar() { 51entry: 52 br label %for.bar.cond 53 54for.bar.cond: ; preds = %entry 55 br i1 false, label %for.bar.body, label %for.bar.end 56 57for.bar.body: ; preds = %for.bar.cond 58 br label %for.bar.cond1 59 60for.bar.cond1: ; preds = %for.bar.body 61 br i1 false, label %for.bar.body2, label %for.bar.end 62 63for.bar.body2: ; preds = %for.bar.cond1 64 unreachable 65 66for.bar.end: ; preds = %for.bar.cond1 67 unreachable 68} 69