[LLVMbugs] [Bug 5794] New: not getting trip count of nested loop

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Dec 15 18:19:45 PST 2009


http://llvm.org/bugs/show_bug.cgi?id=5794

           Summary: not getting trip count of nested loop
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Global Analyses
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu, regehr at cs.utah.edu


This code:
int pmat (int m, int n, double *y __attribute__ ((__unused__)))
  __attribute__ ((__unused__));
int pmat (int m, int n, double *y __attribute__ ((__unused__)))
  __attribute__ ((__unused__));
int
pmat (int m, int n, double *y __attribute__ ((__unused__)))
{
  int i;
  int j;
  int k;

  {
    k = 0;
    i = 0;
    while (i < m)
      {
        j = 0;
        while (j < n)
          {
            k++;
            j++;
          }
        i++;
      }
    return (0);
  }
}

/* Checksum = FCADC848 */

is compiling to:

define i32 @pmat(i32 %m, i32 %n, double* nocapture %y) nounwind readnone {
entry:
  %0 = icmp sgt i32 %m, 0                         ; <i1> [#uses=1]
  %.not = xor i1 %0, true                         ; <i1> [#uses=1]
  %1 = icmp sgt i32 %n, 0                         ; <i1> [#uses=1]
  %or.cond = or i1 %.not, %1                      ; <i1> [#uses=1]
  br i1 %or.cond, label %bb5, label %bb3

bb3:                                              ; preds = %bb3, %entry
  %i.010 = phi i32 [ %2, %bb3 ], [ 0, %entry ]    ; <i32> [#uses=1]
  %2 = add nsw i32 %i.010, 1                      ; <i32> [#uses=2]
  %3 = icmp slt i32 %2, %m                        ; <i1> [#uses=1]
  br i1 %3, label %bb3, label %bb5

bb5:                                              ; preds = %bb3, %entry
  ret i32 0
}

We should realize that the loop is output free and dead and remove it.  This
comes from John Regehr testsuite


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list