Skip to content

opt: Fold OpCompositeExtract feeding from OpCopyLogical or OpLoad#6614

Open
s-perron wants to merge 1 commit intoKhronosGroup:mainfrom
s-perron:users/s-perron/i6611
Open

opt: Fold OpCompositeExtract feeding from OpCopyLogical or OpLoad#6614
s-perron wants to merge 1 commit intoKhronosGroup:mainfrom
s-perron:users/s-perron/i6611

Conversation

@s-perron
Copy link
Copy Markdown
Collaborator

  • CopyLogicalFeedingExtract: Hoist OpCompositeExtract before OpCopyLogical.
    If the input to an OpCompositeExtract is an OpCopyLogical, we can
    extract from the original composite and then copy the result.
  • LoadFeedingExtract: Change OpLoad + OpCompositeExtract to OpAccessChain + OpLoad.
    If the input to an OpCompositeExtract is an OpLoad, we can load the
    specific element instead of the entire composite. This is restricted
    to non-Function/Private storage classes to avoid interfering with
    local-access-chain-convert.

Updated fold_test.cpp with 8 new test cases and updated existing tests
to use SPV_ENV_UNIVERSAL_1_5.

Fixes #6611

- CopyLogicalFeedingExtract: Hoist OpCompositeExtract before OpCopyLogical.
  If the input to an OpCompositeExtract is an OpCopyLogical, we can
  extract from the original composite and then copy the result.
- LoadFeedingExtract: Change OpLoad + OpCompositeExtract to OpAccessChain + OpLoad.
  If the input to an OpCompositeExtract is an OpLoad, we can load the
  specific element instead of the entire composite. This is restricted
  to non-Function/Private storage classes to avoid interfering with
  local-access-chain-convert.

Updated fold_test.cpp with 8 new test cases and updated existing tests
to use SPV_ENV_UNIVERSAL_1_5.

Fixes KhronosGroup#6611
@s-perron s-perron requested a review from luciechoi March 26, 2026 20:28
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.

Pass to load-store eliminate OpLoad OpLogicalCopy OpCompositeExtract code generated due to explicit layout

1 participant