Skip to content

[loopopt] Need index set analysis/splitting #1086

@lattner

Description

@lattner
Bugzilla Link 714
Resolution FIXED
Resolved on Sep 25, 2007 13:25
Version 1.0
OS All

Extended Description

Consider this:


#include <math.h>

void test(float *x, long ndat, float **y, float xcen,
long xmin, long xmax, float sigmal,
float contribution) {
long i,k;
float diff;

    for (i=xmin,k=0; i<=xmax; i++, k++) {
      if(i >= 0 && i < ndat) {
          diff = fabs(xcen - x[i])/sigmal;
          y[0][k] += contribution * 0.5*exp(-diff)/sigmal;

      }
    }

}

Through index set analysis, the two if statements inside the loop (comparing i to 0/ndat) can be
hoisted out.

-Chris

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillacode-qualityenhancementImproving things as opposed to bug fixing, e.g. new or missing featureloopoptim

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions