This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] Make unit tests easier to write; NFC
ClosedPublic

Authored by nikic on Nov 30 2018, 12:07 PM.

Details

Summary

This makes unit tests for ValueTracking and in particular computeKnownBits easier to write, by generalizing the existing MatchSelectPatternTest class to also work with other types of tests. It inherits the convention that the function must be @test and the tested instruction %A.

Diff Detail

Event Timeline

nikic created this revision.Nov 30 2018, 12:07 PM
spatel added inline comments.Nov 30 2018, 1:30 PM
unittests/Analysis/ValueTrackingTest.cpp
61

This shouldn't be duplicated in the base class?

nikic updated this revision to Diff 176193.Nov 30 2018, 1:37 PM

Remove duplicate method.

nikic marked 2 inline comments as done.Nov 30 2018, 1:38 PM
nikic added inline comments.
unittests/Analysis/ValueTrackingTest.cpp
61

Uh, yes, it certainly shouldn't!

spatel accepted this revision.Nov 30 2018, 1:42 PM

LGTM - thanks!

This revision is now accepted and ready to land.Nov 30 2018, 1:42 PM
This revision was automatically updated to reflect the committed changes.
nikic marked an inline comment as done.