Re: C and Fortran semantics and optimization, was C Fronts

bob@tera.com (Bob Alverson)
Mon, 12 Aug 91 20:57:36 GMT

          From comp.compilers

Related articles
Re: C Fronts kers@hplb.hpl.hp.com (Chris Dollin) (1991-08-08)
Re: C and Fortran semantics and optimization, was C Fronts bob@tera.com (1991-08-12)
| List of all articles for this month |
Newsgroups: comp.compilers
From: bob@tera.com (Bob Alverson)
Summary: relying on rules
Keywords: C, Fortran, optimize
Organization: Compilers Central
References: 91-08-032
Date: Mon, 12 Aug 91 20:57:36 GMT
Return-Path: <news@mammoth.tera.com>

In a previous article, MASLOV@VADIK.srcc.msu.su (Vadim Yu. Maslov) writes:
| Example:
|
| DIMENSION A(0:19,0:9) | double a[20][10]; int i,j, func();
| DO 10 i=0,9 | for(i=0; i<10; i++)
| DO 10 j=0,9 | for(j=0; j<10; j++)
| 10 A(i+10,FUNC(j))=A(i,j) | a[i+10][func(j)]=a[i][j];
|
|(Continuing discussion about whether &a(i, j) = &a(i', j') iff i = i' and
    j = j')
|


How about this:


DOUBLE X(1001), Y(1001)


lw = 994
temp = 0.0;
DO 4 j = 5, n, 5
temp = temp - X(lw)*Y(j)
lw = lw + 1
  4 continue




Can the compiler infer that (n < 45) in this loop? When n is as large as
45, lw will exceed the subscript range of X. Thus, it seems that a smart
compiler could unroll this loop completely, allowing for 0 to 8 iterations
of the j loop. :-)


Bob


P.S. For those who haven't guessed, this is lifted from livermore loop 4.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.