1 ; RUN: opt -passes='require<profile-summary>,function(codegenprepare)' -S -mtriple=x86_64 < %s | FileCheck %s
3 @exit_addr = constant ptr blockaddress(@gep_unmerging, %exit)
4 @op1_addr = constant ptr blockaddress(@gep_unmerging, %op1)
5 @op2_addr = constant ptr blockaddress(@gep_unmerging, %op2)
6 @op3_addr = constant ptr blockaddress(@gep_unmerging, %op3)
9 define void @gep_unmerging(i1 %pred, ptr %p0) {
11 %table = alloca [256 x ptr]
12 %table_1 = getelementptr [256 x ptr], ptr %table, i64 0, i64 1
13 %table_2 = getelementptr [256 x ptr], ptr %table, i64 0, i64 2
14 %table_3 = getelementptr [256 x ptr], ptr %table, i64 0, i64 3
15 %exit_a = load ptr, ptr @exit_addr
16 %op1_a = load ptr, ptr @op1_addr
17 %op2_a = load ptr, ptr @op2_addr
18 %op3_a = load ptr, ptr @op3_addr
19 store ptr %exit_a, ptr %table
20 store ptr %op1_a, ptr %table_1
21 store ptr %op2_a, ptr %table_2
22 store ptr %op3_a, ptr %table_3
27 ; CHECK-NEXT: %p1_inc2 = getelementptr i8, ptr %p_preinc, i64 3
28 ; CHECK-NEXT: %p1_inc1 = getelementptr i8, ptr %p_preinc, i64 2
29 %p1_inc2 = getelementptr i8, ptr %p_preinc, i64 3
30 %p1_inc1 = getelementptr i8, ptr %p_preinc, i64 2
31 %a10 = load i8, ptr %p_postinc
32 %a11 = load i8, ptr %p1_inc1
33 %a12 = add i8 %a10, %a11
34 store i8 %a12, ptr @dummy
35 br i1 %pred, label %indirectbr, label %exit
39 ; CHECK-NEXT: %p2_inc = getelementptr i8, ptr %p_preinc, i64 2
40 %p2_inc = getelementptr i8, ptr %p_preinc, i64 2
41 %a2 = load i8, ptr %p_postinc
42 store i8 %a2, ptr @dummy
43 br i1 %pred, label %indirectbr, label %exit
46 br i1 %pred, label %indirectbr, label %exit
49 %p_preinc = phi ptr [%p0, %entry], [%p1_inc2, %op1], [%p2_inc, %op2], [%p_postinc, %op3]
50 %p_postinc = getelementptr i8, ptr %p_preinc, i64 1
51 %next_op = load i8, ptr %p_preinc
52 %p_zext = zext i8 %next_op to i64
53 %slot = getelementptr [256 x ptr], ptr %table, i64 0, i64 %p_zext
54 %target = load ptr, ptr %slot
55 indirectbr ptr %target, [label %exit, label %op1, label %op2]