File: gep-unmerging.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (60 lines) | stat: -rw-r--r-- 2,163 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
; RUN: opt -codegenprepare -S -mtriple=x86_64 < %s | FileCheck %s

@exit_addr = constant i8* blockaddress(@gep_unmerging, %exit)
@op1_addr = constant i8* blockaddress(@gep_unmerging, %op1)
@op2_addr = constant i8* blockaddress(@gep_unmerging, %op2)
@op3_addr = constant i8* blockaddress(@gep_unmerging, %op3)
@dummy = global i8 0

define void @gep_unmerging(i1 %pred, i8* %p0) {
entry:
  %table = alloca [256 x i8*]
  %table_0 = getelementptr [256 x i8*], [256 x i8*]* %table, i64 0, i64 0
  %table_1 = getelementptr [256 x i8*], [256 x i8*]* %table, i64 0, i64 1
  %table_2 = getelementptr [256 x i8*], [256 x i8*]* %table, i64 0, i64 2
  %table_3 = getelementptr [256 x i8*], [256 x i8*]* %table, i64 0, i64 3
  %exit_a = load i8*, i8** @exit_addr
  %op1_a = load i8*, i8** @op1_addr
  %op2_a = load i8*, i8** @op2_addr
  %op3_a = load i8*, i8** @op3_addr
  store i8* %exit_a, i8** %table_0
  store i8* %op1_a, i8** %table_1
  store i8* %op2_a, i8** %table_2
  store i8* %op3_a, i8** %table_3
  br label %indirectbr

op1:
; CHECK-LABEL: op1:
; CHECK-NEXT: %p1_inc2 = getelementptr i8, i8* %p_preinc, i64 3
; CHECK-NEXT: %p1_inc1 = getelementptr i8, i8* %p_preinc, i64 2
  %p1_inc2 = getelementptr i8, i8* %p_preinc, i64 3
  %p1_inc1 = getelementptr i8, i8* %p_preinc, i64 2
  %a10 = load i8, i8* %p_postinc
  %a11 = load i8, i8* %p1_inc1
  %a12 = add i8 %a10, %a11
  store i8 %a12, i8* @dummy
  br i1 %pred, label %indirectbr, label %exit

op2:
; CHECK-LABEL: op2:
; CHECK-NEXT: %p2_inc = getelementptr i8, i8* %p_preinc, i64 2
  %p2_inc = getelementptr i8, i8* %p_preinc, i64 2
  %a2 = load i8, i8* %p_postinc
  store i8 %a2, i8* @dummy
  br i1 %pred, label %indirectbr, label %exit

op3:
  br i1 %pred, label %indirectbr, label %exit

indirectbr:
  %p_preinc = phi i8* [%p0, %entry], [%p1_inc2, %op1], [%p2_inc, %op2], [%p_postinc, %op3]
  %p_postinc = getelementptr i8, i8* %p_preinc, i64 1
  %next_op = load i8, i8* %p_preinc
  %p_zext = zext i8 %next_op to i64
  %slot = getelementptr [256 x i8*], [256 x i8*]* %table, i64 0, i64 %p_zext 
  %target = load i8*, i8** %slot
  indirectbr i8* %target, [label %exit, label %op1, label %op2]

exit:
  ret void
}