This is an archive of the discontinued LLVM Phabricator instance.

[Polly] [ScopInfo] Avoid use of getStmtFor(BB). NFC.
ClosedPublic

Authored by nandini12396 on Jul 20 2017, 10:47 AM.

Details

Summary

Since there will be no more a 1:1 correspondence between statements and basic blocks, we would like to get rid of the method getStmtFor(BB)
and its uses. Here we remove one of its uses in ScopInfo by fetching the statement in which the call instruction lies.

Diff Detail

Repository
rL LLVM

Event Timeline

nandini12396 created this revision.Jul 20 2017, 10:47 AM

@Meinersbur :

Hello Sir,

I know you said to fetch the domain of the BB (CI->getParent()) without needing to pass a statement for it in getDomainConditions. But I was wondering why this solution is wrong?

Meinersbur edited edge metadata.Jul 20 2017, 1:21 PM

Intrinsic::assume (the CI) is an ignored intrinsic, it will not be contained in any ScopStmt. getStmtFor(CI) therefore will necessarily return nullptr once getStmtFor(Instruction*) is implemented properly.

grosser edited edge metadata.Jul 25 2017, 2:22 AM

Nandini, any updates on this patch?

@Meinersbur : I got the basic block of the call instruction, if it belongs to the scop and the region's entry block if not. Im really not sure what is the reason of the failure of these 5 tests.

@grosser : Sorry for the long delay here. The server has to be manually reset after the slightest power fluctuation.

Could you upload the patch with context please (git diff -U999999)?

Use .copy() instead of .get().

Oh, I overlooked. Since we will be freeing the domain (take), we need a reference counted copy! Thank you.

Meinersbur added inline comments.Jul 25 2017, 11:38 AM
lib/Analysis/ScopInfo.cpp
2267 ↗(On Diff #108109)

We must ensure that DomainMap[BB] is a valid entry, it is possibly not assigned.

In particular, if BB is in the middle of a non-affine subregion, it could be empty.

I think those assumptions should be ignored. Can you add a bail-out for that (not call buildConditionSets/continue) or add an assert()?

(I think this wasn't handled correctly before anyway, so an assert would be fine)

Add assertion.

Meinersbur accepted this revision.Jul 26 2017, 6:24 AM

LGTM, going to commit...

This revision is now accepted and ready to land.Jul 26 2017, 6:24 AM
This revision was automatically updated to reflect the committed changes.