-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Make a tablegen test match-table.td more robust. #106508
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
Make a tablegen test match-table.td more robust. #106508
Conversation
|
I'm not sure I like this approach because it makes the test a lot more annoying to update, and it's easy to drop these patterns by just copy-pasting the new output. There are no checks upstream to ensure these patterns remain, and I broke them once in the past because of that. Also if all tests end up like this then a small change to the match table will be 10 min of work and 50 min to update tests. I think the best solution would be to have some Python script to update these tests easily. |
|
Thanks Pierre for the quick review the patch.
Could you please show me an existing example? I could look at it and try to use the python script for the test? Thanks, |
|
There is no pre-existing script unfortunately, I'm not sure what the best approach would be to get this done. I understand if it's out of scope here. I guess we can land this and open an issue directly to come up with a more sustainable approach. One easy approach would be to just read the file for the relevant function signatures, then read lines until we find the matching } and put all of that in a CHECK line. I don't think we'd need to base it off of an existing script like update_llc_test_checks |
|
Hi @Pierre-vh, Very sorry to reply you late. I am on holiday until 23rd Sep. I will work on this PR once I am back from my holiday. Thanks, |
|
Hi @Pierre-vh,
After studying/reading the existing python scripts for updating the tests, I agree that we could write a new python script to update all TableGen related tests as you suggested. We could not only check the output lines, but also make test more robust. Just like the changes made in this PR. Main changes in this PR for each target opcode using
to: The number of "GIMT_Encode4(0)" is decided by the difference of instruction values between two intructions (e.g. Some organizations have added opcodes downstream, therefore the number of
In the generated "MatchTable0[]", Labels are emitted as a label commnet (e.g. /*Label 1*/) following by the current size (or position) of MatchTableRecord::NumElements as the table is built (e.g. Again, since some organizations have added operators downstream in TargetOpcodes.def, the label value might be different from the upstream with off-by-n errors (with n being the number of added operators). The test is more robust by checking the labels match instead of checking the exact value of label. The impact of merge process will be reduced based on the two aboved changes. Could we firstly land this change and then improve the whole TableGen test by using test update python script? Thanks, |
|
Sure, this patch needs to be rebased first (there is a conflict) and I'll approve it |
Some organizations have added operators downstream, and the test match-table.td tends to fail with off-by-n errors (with n being the number of `added operators`) periodically. This patch will increase the test robust and reduce the impact of merge process.
1498cfe to
15a4274
Compare
|
Hi @Pierre-vh, Many thanks again for the quick review. The patch has been rebased. Regards, |
|
Thanks Pierre. The change is merged back to main branch. |
Some organizations have added operators downstream, and the test match-table.td tends to fail with off-by-n errors (with n being the number of
added operators) periodically. This patch will increase the test robust and reduce the impact of merge process.