1; RUN: opt -codegenprepare -S < %s | FileCheck %s 2 3@exit_addr = constant i8* blockaddress(@gep_unmerging, %exit) 4@op1_addr = constant i8* blockaddress(@gep_unmerging, %op1) 5@op2_addr = constant i8* blockaddress(@gep_unmerging, %op2) 6@op3_addr = constant i8* blockaddress(@gep_unmerging, %op3) 7@dummy = global i8 0 8 9define void @gep_unmerging(i1 %pred, i8* %p0) { 10entry: 11 %table = alloca [256 x i8*] 12 %table_0 = getelementptr [256 x i8*], [256 x i8*]* %table, i64 0, i64 0 13 %table_1 = getelementptr [256 x i8*], [256 x i8*]* %table, i64 0, i64 1 14 %table_2 = getelementptr [256 x i8*], [256 x i8*]* %table, i64 0, i64 2 15 %table_3 = getelementptr [256 x i8*], [256 x i8*]* %table, i64 0, i64 3 16 %exit_a = load i8*, i8** @exit_addr 17 %op1_a = load i8*, i8** @op1_addr 18 %op2_a = load i8*, i8** @op2_addr 19 %op3_a = load i8*, i8** @op3_addr 20 store i8* %exit_a, i8** %table_0 21 store i8* %op1_a, i8** %table_1 22 store i8* %op2_a, i8** %table_2 23 store i8* %op3_a, i8** %table_3 24 br label %indirectbr 25 26op1: 27; CHECK-LABEL: op1: 28; CHECK-NEXT: %p1_inc2 = getelementptr i8, i8* %p_postinc, i64 2 29; CHECK-NEXT: %p1_inc1 = getelementptr i8, i8* %p_postinc, i64 1 30 %p1_inc2 = getelementptr i8, i8* %p_preinc, i64 3 31 %p1_inc1 = getelementptr i8, i8* %p_preinc, i64 2 32 %a10 = load i8, i8* %p_postinc 33 %a11 = load i8, i8* %p1_inc1 34 %a12 = add i8 %a10, %a11 35 store i8 %a12, i8* @dummy 36 br i1 %pred, label %indirectbr, label %exit 37 38op2: 39; CHECK-LABEL: op2: 40; CHECK-NEXT: %p2_inc = getelementptr i8, i8* %p_postinc, i64 1 41 %p2_inc = getelementptr i8, i8* %p_preinc, i64 2 42 %a2 = load i8, i8* %p_postinc 43 store i8 %a2, i8* @dummy 44 br i1 %pred, label %indirectbr, label %exit 45 46op3: 47 br i1 %pred, label %indirectbr, label %exit 48 49indirectbr: 50 %p_preinc = phi i8* [%p0, %entry], [%p1_inc2, %op1], [%p2_inc, %op2], [%p_postinc, %op3] 51 %p_postinc = getelementptr i8, i8* %p_preinc, i64 1 52 %next_op = load i8, i8* %p_preinc 53 %p_zext = zext i8 %next_op to i64 54 %slot = getelementptr [256 x i8*], [256 x i8*]* %table, i64 0, i64 %p_zext 55 %target = load i8*, i8** %slot 56 indirectbr i8* %target, [label %exit, label %op1, label %op2] 57 58exit: 59 ret void 60} 61