-
Notifications
You must be signed in to change notification settings - Fork 448
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
p4test: x: declaration not found #2435
Comments
@mbudiu-vmw and @ChrisDodd In our prior discussion, we seem to be converging on removing exit statements inside action if the action includes any This issue uses an exit inside the control apply block and global action. I thought we could leave this exit for the bmv2 backend to deal with. If we do, the midend screws up the IR. action do_action(inout ethernet_t val) {
val.eth_type = 0xDEAD;
}
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) {
apply {
exit;
do_action(h.eth_hdr);
}
} |
@ChrisDodd : here the LocalCopyProp removes a variable used in a table key. So the dead code elimination is not conservative enough. |
localCopyProp removes the key because the table is never applied, so it doesn't actually use the key. Unfortunately, as it doesn't remove the dead table, it leaves in the reference to the key in the table. For global_after_exited, the same applies, except it is the action that is dead, so the reference to the control local Easiest fix is probably to have a pass that removes unused tables and actions before local copyprop. |
Actually I believe that our pass to remove unused references should do this, but we explicitly prevent it from doing that, because this would change the P4Runtime API generated. I think dead tables should be removed. |
This is why I developed the rmExits pass to remove dead tables and call rmExits just before unused references in frontend.cpp in my recent PR . The PR has fixed this issue. |
So I added a PR #2446 that avoids the problem in LocalCopyProp
|
Running
p4test
there seem to be a problem with the way variables are propagated in the mid end. This only happens in combination with exit statements. There are two examples. One happens after inlining a global action, the other happens after a constant key is simplified. In both casesMidEnd_25_LocalCopyPropagation
removes variables that it should not.key_after_exit.p4.txt
global_action_after_exit.p4.txt
The text was updated successfully, but these errors were encountered: