This is an archive of the discontinued LLVM Phabricator instance.

MIR-Canon tests and helper function additions.
AbandonedPublic

Authored by plotfi on Mar 8 2018, 8:49 AM.

Details

Reviewers
bogner
Summary

Need to add a simple test for the canonizer. Also adding some helper functions that a couple new features that another patch will use.

Diff Detail

Repository
rL LLVM

Event Timeline

plotfi created this revision.Mar 8 2018, 8:49 AM
bogner added a comment.Mar 8 2018, 4:19 PM

I've commented on both parts, but please keep each review to a single topic. Adding the test is one thing, and adding the helpers should be another review (or better yet, just add them when you use them).

lib/CodeGen/MIRCanonicalizerPass.cpp
102–106

These macros don't expand to expressions - adding semicolons doesn't make much sense.

134

Should this be static?

145–146

I think we usually put raw_string_ostream stuff in its own block to ensure it flushes or something. Please check other uses to see if this is right.

150

Spelling out the type is clearer than auto here, though it might be simpler still to use StringRef::split or StringRef::take_until instead.

152

I'm pretty sure we can do StringInstrMap.insert({Str, II}) and avoid the StringMapEntry typedef here. If not, std::make_pair is probably what we want.

173

Range-for probably cleans this up a bit.

test/CodeGen/MIR/AArch64/mirCanonTest1.mir
14–35

You should be able to remove the whole IR block here, it isn't really relevant to the test. You'll need to add -mtriple to the llc command.

38–67

I think you can get away with removing all of this metadata.

69

You'll need to drop the names from these to get rid of the IR.

99

Without IR this will presumably read STRXui %0, %stack.1, 0 :: (store 8)

plotfi marked 6 inline comments as done.Mar 10 2018, 11:07 PM
plotfi added inline comments.
lib/CodeGen/MIRCanonicalizerPass.cpp
145–146

.str() appears to call flush():

raw_ostream.h:478:

std::string& str() {
  flush();
  return OS;
}
173

Going to leave this one out in first commit.

plotfi marked 6 inline comments as done.Mar 11 2018, 10:35 AM
plotfi abandoned this revision.Apr 9 2018, 11:58 AM