[LLVMbugs] [Bug 1309] NEW: store only array is never removed

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Apr 4 15:34:43 PDT 2007


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

           Summary: store only array is never removed
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: alenhar2 at uiuc.edu


The following should be optimized:
int x(int y) {
int f[100];
for (y = 0; y < 100; ++y) 
  f[y] = 0;
return 1;
}

it generates (1.9) this unfortunate dead loop:
int %x(int %y) {
entry:
	%f = alloca [100 x int], align 16		; <[100 x int]*> [#uses=1]
	br label %bb

bb:		; preds = %bb, %entry
	%indvar = phi uint [ 0, %entry ], [ %indvar.next, %bb ]		; <uint> [#uses=2]
	%tmp1 = getelementptr [100 x int]* %f, int 0, uint %indvar		; <int*> [#uses=1]
	store int 0, int* %tmp1
	%indvar.next = add uint %indvar, 1		; <uint> [#uses=2]
	%exitcond = seteq uint %indvar.next, 100		; <bool> [#uses=1]
	br bool %exitcond, label %bb6, label %bb

bb6:		; preds = %bb
	ret int 1
}

Thanks to Duncan and ADA for discovering this :)



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list