File: 2008-07-22-LoadGlobalConstant.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (42 lines) | stat: -rw-r--r-- 1,354 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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=licm -S | FileCheck %s

@a = external constant ptr

define void @test(i32 %count) {
; CHECK-LABEL: @test(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP3:%.*]] = load ptr, ptr @a, align 8
; CHECK-NEXT:    br label [[FORCOND:%.*]]
; CHECK:       forcond:
; CHECK-NEXT:    [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FORBODY:%.*]] ]
; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[I_0]], [[COUNT:%.*]]
; CHECK-NEXT:    br i1 [[CMP]], label [[FORBODY]], label [[AFTERFOR:%.*]]
; CHECK:       forbody:
; CHECK-NEXT:    [[ARRAYIDX:%.*]] = getelementptr float, ptr [[TMP3]], i32 [[I_0]]
; CHECK-NEXT:    [[TMP7:%.*]] = uitofp i32 [[I_0]] to float
; CHECK-NEXT:    store float [[TMP7]], ptr [[ARRAYIDX]], align 4
; CHECK-NEXT:    [[INC]] = add i32 [[I_0]], 1
; CHECK-NEXT:    br label [[FORCOND]]
; CHECK:       afterfor:
; CHECK-NEXT:    ret void
;
entry:
  br label %forcond

forcond:
  %i.0 = phi i32 [ 0, %entry ], [ %inc, %forbody ]
  %cmp = icmp ult i32 %i.0, %count
  br i1 %cmp, label %forbody, label %afterfor

forbody:
  %tmp3 = load ptr, ptr @a
  %arrayidx = getelementptr float, ptr %tmp3, i32 %i.0
  %tmp7 = uitofp i32 %i.0 to float
  store float %tmp7, ptr %arrayidx
  %inc = add i32 %i.0, 1
  br label %forcond

afterfor:
  ret void
}