File: lftr_simple.llx

package info (click to toggle)
llvm 2.2-12
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 38,648 kB
  • ctags: 28,258
  • sloc: cpp: 215,479; sh: 12,132; ansic: 10,002; yacc: 5,525; perl: 2,352; ml: 1,580; makefile: 956; pascal: 718; lex: 602; exp: 320; ada: 193; lisp: 160; csh: 116; objc: 59; python: 59; tcl: 20
file content (23 lines) | stat: -rw-r--r-- 593 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
; LFTR should eliminate the need for the computation of i*i completely.  It 
; is only used to compute the exit value.
; RUN: llvm-upgrade < %s | llvm-as | opt -indvars -dce | llvm-dis | not grep mul

%A = external global int

implementation

int %quadratic_setlt() {   ;; for (i = 7; i*i < 1000; ++i)
entry:
        br label %loop
loop:
        %i = phi int [ 7, %entry ], [ %i.next, %loop ]
        %i.next = add int %i, 1
	store int %i, int* %A
	
        %i2 = mul int %i, %i
        %c = setlt int %i2, 1000
        br bool %c, label %loop, label %loopexit
loopexit:
        ret int %i
}