1*9880d681SAndroid Build Coastguard Worker; RUN: opt -simplifycfg -S -o - < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; This test case was written to trigger an incorrect assert statement in 4*9880d681SAndroid Build Coastguard Worker; -simplifycfg. Thus we don't actually want to check the output, just that 5*9880d681SAndroid Build Coastguard Worker; -simplifycfg ran successfully. Thus we only check that the function still 6*9880d681SAndroid Build Coastguard Worker; exists, and that it still calls foo(). 7*9880d681SAndroid Build Coastguard Worker; 8*9880d681SAndroid Build Coastguard Worker; NOTE: There are some obviously dead blocks and missing branch weight 9*9880d681SAndroid Build Coastguard Worker; metadata. Both of these features were key to triggering the assert. 10*9880d681SAndroid Build Coastguard Worker; Additionally, the not-taken weight of the branch with a weight had to 11*9880d681SAndroid Build Coastguard Worker; be 0 to trigger the assert. 12*9880d681SAndroid Build Coastguard Worker 13*9880d681SAndroid Build Coastguard Workerdeclare void @foo() nounwind uwtable 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Workerdefine void @func(i32 %A) nounwind uwtable { 16*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @func( 17*9880d681SAndroid Build Coastguard Workerentry: 18*9880d681SAndroid Build Coastguard Worker %cmp11 = icmp eq i32 %A, 1 19*9880d681SAndroid Build Coastguard Worker br i1 %cmp11, label %if.then, label %if.else, !prof !0 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Workerif.then: 22*9880d681SAndroid Build Coastguard Worker call void @foo() 23*9880d681SAndroid Build Coastguard Worker; CHECK: call void @foo() 24*9880d681SAndroid Build Coastguard Worker br label %if.else 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Workerif.else: 27*9880d681SAndroid Build Coastguard Worker %cmp17 = icmp eq i32 %A, 2 28*9880d681SAndroid Build Coastguard Worker br i1 %cmp17, label %if.then2, label %if.end 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Workerif.then2: 31*9880d681SAndroid Build Coastguard Worker br label %if.end 32*9880d681SAndroid Build Coastguard Worker 33*9880d681SAndroid Build Coastguard Workerif.end: 34*9880d681SAndroid Build Coastguard Worker ret void 35*9880d681SAndroid Build Coastguard Worker} 36*9880d681SAndroid Build Coastguard Worker 37*9880d681SAndroid Build Coastguard Worker!0 = !{!"branch_weights", i32 1, i32 0} 38