-
Notifications
You must be signed in to change notification settings - Fork 237
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
Invalid Phis Generated #320
Comments
Just passing by but this looks unrelated to the linked issue. I'm imagining that brilc isn't taking into account that some of your variables are constant and don't need phi nodes. |
To restate some of an off github conversation, Bril to LLVM compilers have this edge case with phi nodes because the Bril currently imposes very few constraints on their usage unlike LLVM. A different example of this is that LLVM requires that phi nodes be at the top of the block, Bril currently does not. See the following; a direct translation of this valid Bril code would be invalid LLVM code.
|
To add to some more analysis I've done since then, it does appear that It is likely part of the problem in tandem with what you mentioned @Pat-Lafon that is creating this sort of behavior. For example, I can offer a simple patch to insert |
I was under the impression that Edit: re-reading, I understand that it's not a bug in ssa.py but a bug in translation to LLVM. However I'm still not sure in particular what invariant we violated. Something about phi nodes for constants? |
The error above is not actually that a phi node refers to itself. Rather, it is because the definition of |
@Alex-Fischman nice catch, I didn't see that. I do believe that is one of two errors however (which may be why it prints it out twice?).
|
Similar issue at #318 |
We have the following bril program:
Which after running through
brilc
/bril_llvm gives us this IR:Running this through clang sometimes succeeds because it "figures it out" (or sometimes miscompiles?? I don't recommend using clang here) but running said IR through
llc
gives us an error (there are many more with different variable names):Since a phi cannot refer to itself.
Is this similar to this issue? It doesn't appear the SSA'd bril has any
__undefined
in it, so is bril's SSA choosing the value itself as the initial value?The original program (this was what happened after we ran an optimizer on it) did have all values defined before their use (and it appears that this bril program that I've posted also does), this code seems reachable so I'm unsure as to why it would be hitting any of the limitations of phis in bril
The text was updated successfully, but these errors were encountered: