[LLVMbugs] [Bug 1232] NEW: constant propagation doesn't work through unrolled loops

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Feb 28 17:46:01 PST 2007


           Summary: constant propagation doesn't work through unrolled loops
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: loufoque at gmail.com

With the following C code, the loop is completely eliminated, thanks to loop
unrolling and constant propagation.
The resulting LLVM code just calls printf with 20.

#include <stdio.h>
#include <stddef.h>

int main()
	int v = 0;

	size_t i;
	for(i=0; i<5; i++)
		v += i*2;

	printf("%d\n", v);

However, if 5 is replaced by 100, loop unrolling doesn't occur, and for some
reason constant propagation doesn't work anymore.
The resulting code just needs to call printf with 9900, there is no need for any

------- 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