This is an archive of the discontinued LLVM Phabricator instance.

[Refactor] Have getNonLocalPointerDependency take the query instruction
ClosedPublic

Authored by reames on Jan 8 2015, 3:20 PM.

Details

Reviewers
sanjoy
Summary

Previously, MemoryDependenceAnalysis::getNonLocalPointerDependency was taking a list of properties about the instruction being queried. Since I'm about to need one more property to be passed down through the infrastructure - I need to know a query instruction is non-volatile in an inner helper - fix the interface once and for all.

I also added some assertions and behaviour clarifications around volatile and ordered field accesses. At the moment, this is mostly to document expected behaviour. The only non-standard instructions which can current reach this are atomic, but unordered, loads and stores. Neither ordered or volatile accesses can reach here.

The call in GVN is protected by an isSimple check when it first considers the load. The calls in MemDepPrinter are protected by isUnordered checks. Both utilities also check isVolatile for loads and stores.

Review wise, I'm just looking for style comments and a second look to make sure I didn't typo something and accidentally change behaviour.

Diff Detail

Event Timeline

reames updated this revision to Diff 17915.Jan 8 2015, 3:20 PM
reames retitled this revision from to [Refactor] Have getNonLocalPointerDependency take the query instruction.
reames updated this object.
reames edited the test plan for this revision. (Show Details)
reames added a reviewer: sanjoy.
reames added a subscriber: Unknown Object (MLST).
sanjoy accepted this revision.Jan 8 2015, 3:40 PM
sanjoy edited edge metadata.

The only thing that concerns me is the new alternate return path on if (is_ordered(QueryInst)) {. With that addressed, LGTM.

include/llvm/Analysis/MemoryDependenceAnalysis.h
373

What is BB here?

lib/Analysis/MemoryDependenceAnalysis.cpp
866

Minor & optional: I'd just assert(isa<LoadInst>(I) || isa<StoreInst>(I) ...) and then return AA->getLocation(I); because that makes it obvious that the result is always AA->getLocation(I).

899

Shouldn't this be isOrdered? Or does llvm allow non camelcase for lambdas?

908

Where did this come from? Is this a semantic difference?

This revision is now accepted and ready to land.Jan 8 2015, 3:40 PM
reames added a comment.Jan 8 2015, 3:59 PM

Thanks for the comments. I'll fix and submit.

include/llvm/Analysis/MemoryDependenceAnalysis.h
373

Fixed.

lib/Analysis/MemoryDependenceAnalysis.cpp
866

AA::getLocation(Instruction *I) doesn't exists. I may move this lambda to be that function, but that would be a separate change.

899

Not sure actually, but I took your suggestion.

908

Technically, yes. I'll replace it with the assert - which is not a change - before submitting. My next change is to pull in some of the logic from MemDepPrinter into this function.

reames closed this revision.Jan 8 2015, 4:31 PM

This was closed with 225481; I forgot to include the link.