bgergely0 wrote:

## How to test this?

I have a few concern on testing:
- the patch adds several "helper functions", which would all ideally be 
unittested, but as they are private functions of the pass, I cannot "export" 
them to be visible for tests.
- High-level lit testing is also not feasible. The change tries to cover many 
low-probability edge-cases, all in the scope of "newly generated instructions", 
 that is instructions generated by other BOLT passes. This makes creating lit 
tests difficult, as I would have to create an input assembly on which the other 
passes would do the exact transformations that would trigger/exercise these 
newly added functions. Future changes to any other pass (running before 
InsertNegateRAStates) could also break these tests.

### Proposal
I think the following plan is more reasonable:
- create "single-pass" unittests in gtest, similar to the MCPlusBuilder 
unittests. This way I can manually create the exact BinaryFunctions with the 
exact RAState annotations that exercise additions to this patch. Then, printing 
the BinaryFunction after the pass runs would be enough to check the locations 
of newly inserted CFIs.

I also think this single-pass gtest way of testing would be useful in other 
future additions to BOLT.

https://github.com/llvm/llvm-project/pull/163381
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to