File: 2005-06-30-ReadBeforeWrite.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (47 lines) | stat: -rw-r--r-- 1,672 bytes parent folder | download | duplicates (12)
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
; RUN: opt < %s -passes='mem2reg,instcombine' -S | grep store
; PR590


define void @zero(ptr %p, i32 %n) {
entry:
	%p_addr = alloca ptr		; <ptr> [#uses=2]
	%n_addr = alloca i32		; <ptr> [#uses=2]
	%i = alloca i32		; <ptr> [#uses=6]
	%out = alloca i32		; <ptr> [#uses=2]
	%undef = alloca i32		; <ptr> [#uses=2]
	store ptr %p, ptr %p_addr
	store i32 %n, ptr %n_addr
	store i32 0, ptr %i
	br label %loopentry
loopentry:		; preds = %endif, %entry
	%tmp.0 = load i32, ptr %n_addr		; <i32> [#uses=1]
	%tmp.1 = add i32 %tmp.0, 1		; <i32> [#uses=1]
	%tmp.2 = load i32, ptr %i		; <i32> [#uses=1]
	%tmp.3 = icmp sgt i32 %tmp.1, %tmp.2		; <i1> [#uses=2]
	%tmp.4 = zext i1 %tmp.3 to i32		; <i32> [#uses=0]
	br i1 %tmp.3, label %no_exit, label %return
no_exit:		; preds = %loopentry
	%tmp.5 = load i32, ptr %undef		; <i32> [#uses=1]
	store i32 %tmp.5, ptr %out
	store i32 0, ptr %undef
	%tmp.6 = load i32, ptr %i		; <i32> [#uses=1]
	%tmp.7 = icmp sgt i32 %tmp.6, 0		; <i1> [#uses=2]
	%tmp.8 = zext i1 %tmp.7 to i32		; <i32> [#uses=0]
	br i1 %tmp.7, label %then, label %endif
then:		; preds = %no_exit
	%tmp.9 = load ptr, ptr %p_addr		; <ptr> [#uses=1]
	%tmp.10 = load i32, ptr %i		; <i32> [#uses=1]
	%tmp.11 = sub i32 %tmp.10, 1		; <i32> [#uses=1]
	%tmp.12 = getelementptr i8, ptr %tmp.9, i32 %tmp.11		; <ptr> [#uses=1]
	%tmp.13 = load i32, ptr %out		; <i32> [#uses=1]
	%tmp.14 = trunc i32 %tmp.13 to i8		; <i8> [#uses=1]
	store i8 %tmp.14, ptr %tmp.12
	br label %endif
endif:		; preds = %then, %no_exit
	%tmp.15 = load i32, ptr %i		; <i32> [#uses=1]
	%inc = add i32 %tmp.15, 1		; <i32> [#uses=1]
	store i32 %inc, ptr %i
	br label %loopentry
return:		; preds = %loopentry
	ret void
}