This is an archive of the discontinued LLVM Phabricator instance.

Introduce print-memderefs to test isDereferenceablePointer
ClosedPublic

Authored by artagnon on Jan 20 2015, 3:41 PM.

Details

Summary

Since testing the function indirectly is tricky, introduce a direct
print-memderefs pass, in the same spirit as print-memdeps, which prints
dereferenceability information matched by FileCheck.

Diff Detail

Repository
rL LLVM

Event Timeline

artagnon updated this revision to Diff 18464.Jan 20 2015, 3:41 PM
artagnon retitled this revision from to isDereferenceablePointer: look through gc.relocates + test.
artagnon updated this object.
artagnon edited the test plan for this revision. (Show Details)
artagnon added reviewers: reames, chandlerc, eliben, arsenm.
artagnon added a subscriber: Unknown Object (MLST).
reames edited edge metadata.Jan 23 2015, 11:16 AM

I'd suggest splitting this into two patches: adding the new analysis, adding the new optimization and testing it. If you really didn't want to for some reason, it's not that big a deal, but it would make it easier to review quickly.

include/llvm/IR/InstIterator.h
130 ↗(On Diff #18464)

I might call this inst_range. I'm usually not a fan of extra verbosity, but I see potential confusion resulting from a such short relatively common name being added to the llvm namespace.

lib/Analysis/MemDepPrinter.cpp
147 ↗(On Diff #18464)

Please separate this refactoring into a separate change.

lib/Analysis/MemDerefPrinter.cpp
1 ↗(On Diff #18464)

Please split the introduction of the printer and one or two example tests into it's own change. I'll be happy to LGTM that one quickly.

22 ↗(On Diff #18464)

Why do you need to capture F?

24 ↗(On Diff #18464)

Why is this enum needed?

43 ↗(On Diff #18464)

You should also clear your small vector. (I think)

lib/IR/Value.cpp
575 ↗(On Diff #18464)

I'd suggest using isGCRelocate here.

artagnon retitled this revision from isDereferenceablePointer: look through gc.relocates + test to Introduce print-memderefs to test isDereferenceablePointer.Jan 27 2015, 12:48 PM
artagnon updated this object.
artagnon edited edge metadata.
artagnon updated this revision to Diff 18843.Jan 27 2015, 12:51 PM

Split print-memderefs into its own change. Fix all-round sloppiness.

LGTM.

For future reference, I read your comment "Split print-memderefs into its own change." as meaning that you'd split the MemDerefPrinter into a separate review thread. Since the original semantic change (which I thought was this thread) was blocked on that, I deleted the email without looking further.

lib/Analysis/MemDerefPrinter.cpp
48 ↗(On Diff #18843)

It would be better to get the data layout if available and use it here. You'll get far more precise results.

(This can be separate change if desired.)

This revision was automatically updated to reflect the committed changes.