-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
undef through phi doesn't collapse to undef when it ought #1089
Comments
Verified. This is a missed optimization. |
I've looked into this, and it doesn't seem possible to fix in a straight-forward way, and doesn't seem int %f() { Because we haven't built SSA form yet, the dead code elimination stuff doesn't see the block is dead When building SSA in mem2reg, it notices it's about to create a phi(undef,0), and simplifies it to 0. This -Chris |
Why not allow mem2reg to produce the phi(undef,x) then add another pass after It might make other passes in between mem2reg and DCE slower as the tree would |
I moved this minor optzn into the README.txt file: |
Extended Description
Expressions involving undef get collapsed into undef properly, except for PHI
nodes. The following code should compile into "ret int undef". Instead, LLVM
produces "ret int 0":
int f()
{
int x = 4;
int y;
if (x == 3) y = 0;
return y;
}
The text was updated successfully, but these errors were encountered: