https://bugs.llvm.org/show_bug.cgi?id=40757

            Bug ID: 40757
           Summary: Compilation does not end when -O3 or more is set.
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: ueno.masak...@jp.fujitsu.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org

When compiling the following program(bug498.c) with -O3 or more, compilation
does not end.

I think there is something wrong with Loop Strength Reduction Pass.
This problem can be avoided by the -mllvm -disable-lsr option.

* source program(bug498.c)
#include <stdio.h>
int main () {
  int i,j,l=0,m=3,n=40;
  unsigned long v1=1,v2=2,v3=3;
  int a[50][50],b[50][50];

  for (i=0; i<50; i++) {
    for (j=0; j<50; j++) {
      a[i][j]=0;
      b[i][j]=1;
    }
  }

  for(i=0;i<10;i++) {
    for (l=0; l<4; l++) {
      for(m=0; m<30; m++) {
        for(j=0;j<2;j++) {
          v3=v2 * v2;
        }
        v1=v3 - v1;
        v2=v1 - i;
        b[i][j]=a[i][j]+b[i][j];
      }
    }
  }

  printf("%lu %lu %lu %d\n",v1,v2,v3, b[0][0]);
  return 0;
}


* compile/exec log using -mllvm -disable-lsr option
$ clang -O3 bug498.c -mllvm -disable-lsr
$ ./a.out
12145924650467887591 12145924650467887582 3040934746218291456 1

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to