Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spirv-opt: Fix stacked CompositeExtract constant folds #4932

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

sjfricke
Copy link
Contributor

This was spotted in the Validation Layers where OpSpecConstantOp %x CompositeExtract %y 0 was being folded to a constant, but anything that was using it wasn't recognizing it as a constant, the simple fix was to add a const_mgr->MapInst(new_const_inst); so the next instruction knew it was a const

"OpFunctionEnd",
// clang-format on
};
SinglePassRunAndCheck<FoldSpecConstantOpAndCompositePass>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is fine for this PR, but, for any future PRs, we prefer the SinglePassRunAndMatch tests. Having the "Check" instructions using regex makes the tests less likely to need updating, and it make the important part of the change more obvious.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, so SinglePassRunAndCheck is being used in fold_spec_const_op_composite_test.cpp instead of SinglePassRunAndMatch and new to test/opt so wasn't aware, looks way nicer to use

@s-perron s-perron self-assigned this Sep 13, 2022
@sjfricke
Copy link
Contributor Author

@s-perron friendly ping if this is still waiting on anything

@s-perron
Copy link
Collaborator

@dnovillo

@dnovillo dnovillo assigned dnovillo and unassigned s-perron Sep 23, 2022
@dnovillo dnovillo self-requested a review September 23, 2022 12:43
@dnovillo dnovillo merged commit ddbee48 into KhronosGroup:master Sep 23, 2022
@sjfricke sjfricke deleted the sjfricke-stackedop branch October 20, 2022 16:32
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.

None yet

4 participants