File: avoid-loop-align.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 (39 lines) | stat: -rw-r--r-- 1,163 bytes parent folder | download | duplicates (17)
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
; RUN: llc < %s -mtriple=i386-apple-darwin | FileCheck %s

; CodeGen should align the top of the loop, which differs from the loop
; header in this case.

; CHECK: jmp LBB0_2
; CHECK: .p2align
; CHECK: LBB0_1:

@A = common global [100 x i32] zeroinitializer, align 32		; <[100 x i32]*> [#uses=1]

define i8* @test(i8* %Q, i32* %L) nounwind {
entry:
	%tmp = tail call i32 (...) @foo() nounwind		; <i32> [#uses=2]
	%tmp1 = inttoptr i32 %tmp to i8*		; <i8*> [#uses=1]
	br label %bb1

bb:		; preds = %bb1, %bb1
	%indvar.next = add i32 %P.0.rec, 1		; <i32> [#uses=1]
	br label %bb1

bb1:		; preds = %bb, %entry
	%P.0.rec = phi i32 [ 0, %entry ], [ %indvar.next, %bb ]		; <i32> [#uses=2]
	%P.0 = getelementptr i8, i8* %tmp1, i32 %P.0.rec		; <i8*> [#uses=3]
	%tmp2 = load i8, i8* %P.0, align 1		; <i8> [#uses=1]
	switch i8 %tmp2, label %bb4 [
		i8 12, label %bb
		i8 42, label %bb
	]

bb4:		; preds = %bb1
	%tmp3 = ptrtoint i8* %P.0 to i32		; <i32> [#uses=1]
	%tmp4 = sub i32 %tmp3, %tmp		; <i32> [#uses=1]
	%tmp5 = getelementptr [100 x i32], [100 x i32]* @A, i32 0, i32 %tmp4		; <i32*> [#uses=1]
	store i32 4, i32* %tmp5, align 4
	ret i8* %P.0
}

declare i32 @foo(...)