This is an archive of the discontinued LLVM Phabricator instance.

[PatternMatch] Add m_Store pattern match helper
ClosedPublic

Authored by SjoerdMeijer on Jun 18 2018, 6:43 AM.

Details

Diff Detail

Repository
rL LLVM

Event Timeline

SjoerdMeijer created this revision.Jun 18 2018, 6:43 AM

The tests can go into unittests/IR/PatternMatch.cpp.

dmgreen added inline comments.
include/llvm/IR/PatternMatch.h
1206 ↗(On Diff #151704)

Are you sure you want the pointer operand, and not the value being stored? (Or maybe both?)

Ah, thanks! Will add tests there, and check if I want the pointer operand.

Thanks for the suggestions:

  • added unittests,
  • now storing both the pointer and value operand (looks most convenient to me).
SjoerdMeijer marked an inline comment as done.Jun 18 2018, 9:17 AM
dmgreen added inline comments.Jun 19 2018, 4:55 AM
unittests/IR/PatternMatch.cpp
403 ↗(On Diff #151728)

Can you remove these, just using m_Value() as the above tests? Or maybe better to test that they are the correct values (i.e EXPECT_EQ(Alloca, MatchStorePointer);)

Tweaked the unittests a bit more.

SjoerdMeijer marked an inline comment as done.Jun 19 2018, 5:56 AM
dmgreen accepted this revision.Jun 19 2018, 7:42 AM

LGTM. This looks simple enough. Perhaps wait enough for anyone on a different time zone to object.

This revision is now accepted and ready to land.Jun 19 2018, 7:42 AM
lebedev.ri added inline comments.Jun 19 2018, 7:46 AM
unittests/IR/PatternMatch.cpp
411–417 ↗(On Diff #151902)

Can you add a basic sanity test to show that it works with m_Specific(), too?

Thanks, more tests added.

SjoerdMeijer marked an inline comment as done.Jun 19 2018, 8:29 AM

Thanks a lot for the reviews. I will wait a day before committing.

This revision was automatically updated to reflect the committed changes.