Skip to content

Fix merge blocks opportunity to check if still enabled#2370

Merged
dneto0 merged 2 commits intoKhronosGroup:masterfrom
paulthomson:merge_blocks_fix
Feb 11, 2019
Merged

Fix merge blocks opportunity to check if still enabled#2370
dneto0 merged 2 commits intoKhronosGroup:masterfrom
paulthomson:merge_blocks_fix

Conversation

@paulthomson
Copy link
Copy Markdown
Contributor

Fixes #2369. Added tests.

@paulthomson paulthomson requested a review from afd February 11, 2019 13:51
Copy link
Copy Markdown
Contributor

@afd afd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; just a request for a comment.

bool MergeBlocksReductionOpportunity::PreconditionHolds() {
// By construction, it is not possible for the merging of A->B to disable the
// merging of C->D, even when B and C are the same block.
return true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a comment explaining that there do exist scenarios where one merge can disable another merge. Giving one example would help.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Done.

CheckEqual(env, after, context.get());
}

void MergeBlocksReductionPassTest_LoopReturn_Helper(bool reverse) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great that we have this example in the tests. Still, a comment in the precondition checking code would be good.

Copy link
Copy Markdown
Contributor

@afd afd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@dneto0 dneto0 merged commit 40a7940 into KhronosGroup:master Feb 11, 2019
afd pushed a commit to afd/SPIRV-Tools that referenced this pull request Feb 13, 2019
…2370)

Fix MergeBlocksReductionOpportunity so it checks whether it is still enabled

Fixes KhronosGroup#2369. Added tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants