Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constant propagation doesn't work through unrolled loops #1604

Closed
llvmbot opened this issue Mar 1, 2007 · 2 comments
Closed

constant propagation doesn't work through unrolled loops #1604

llvmbot opened this issue Mar 1, 2007 · 2 comments
Labels
bugzilla Issues migrated from bugzilla duplicate Resolved as duplicate

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 1, 2007

Bugzilla Link 1232
Resolution DUPLICATE
Resolved on Feb 22, 2010 12:42
Version unspecified
OS Linux
Reporter LLVM Bugzilla Contributor

Extended Description

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

@lattner
Copy link
Collaborator

lattner commented Mar 1, 2007

Yep, known.

*** This bug has been marked as a duplicate of 1179 ***

@lattner
Copy link
Collaborator

lattner commented Mar 4, 2007

This has been implemented, see #1551 for details,

-Chris

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

2 participants