vect: Prepare promotion/demotion for BB SLP with predicated tails #191

Open
chris.bazley wants to merge 1 commit from chris.bazley/gcc:promotion into trunk
Member

vect_create_vectorized_promotion_stmts no longer pushes
more stmts than implied by vect_get_num_copies because it could
previously overrun the number of slots allocated for an SLP node
(based on its number of lanes and type). e.g., four defs were
pushed for a promotion of V8HI to V2DI (8/2=4) even if only two
lanes of the V8HI were active. Allowing it later caused ICE in
vectorizable_operation for a parent node, because binary ops
require both operands to be the same length.

Since promotion no longer produces redundant definitions,
vectorizable_conversion also had to be modified so that demotion no
longer relies on an even number of defs being produced. If
necessary, it now pushes a single constant zero def.

gcc/ChangeLog:

* tree-vect-stmts.cc (vect_create_vectorized_promotion_stmts):
Require an SLP tree node to be passed by the caller, for use
by vect_get_num_copies.  Stop pushing more stmts than implied
by vect_get_num_copies.
(vectorizable_conversion): Pass SLP tree node to
vect_create_vectorized_promotion_stmts.  Demotion no longer
relies on an even number of definitions being produced by
promotion. If necessary, push a single constant zero
definition.

cc: richard.guenther@gmail.com, Tamar.Christina@arm.com

vect_create_vectorized_promotion_stmts no longer pushes more stmts than implied by vect_get_num_copies because it could previously overrun the number of slots allocated for an SLP node (based on its number of lanes and type). e.g., four defs were pushed for a promotion of V8HI to V2DI (8/2=4) even if only two lanes of the V8HI were active. Allowing it later caused ICE in vectorizable_operation for a parent node, because binary ops require both operands to be the same length. Since promotion no longer produces redundant definitions, vectorizable_conversion also had to be modified so that demotion no longer relies on an even number of defs being produced. If necessary, it now pushes a single constant zero def. gcc/ChangeLog: * tree-vect-stmts.cc (vect_create_vectorized_promotion_stmts): Require an SLP tree node to be passed by the caller, for use by vect_get_num_copies. Stop pushing more stmts than implied by vect_get_num_copies. (vectorizable_conversion): Pass SLP tree node to vect_create_vectorized_promotion_stmts. Demotion no longer relies on an even number of definitions being produced by promotion. If necessary, push a single constant zero definition. cc: richard.guenther@gmail.com, Tamar.Christina@arm.com
vect: Prepare promotion/demotion for BB SLP with predicated tails
All checks were successful
/ format-checks (pull_request) Successful in 1m34s
8e37fb681d
vect_create_vectorized_promotion_stmts no longer pushes
more stmts than implied by vect_get_num_copies because it could
previously overrun the number of slots allocated for an SLP node
(based on its number of lanes and type). e.g., four defs were
pushed for a promotion of V8HI to V2DI (8/2=4) even if only two
lanes of the V8HI were active. Allowing it later caused ICE in
vectorizable_operation for a parent node, because binary ops
require both operands to be the same length.

Since promotion no longer produces redundant definitions,
vectorizable_conversion also had to be modified so that demotion no
longer relies on an even number of defs being produced. If
necessary, it now pushes a single constant zero def.

gcc/ChangeLog:

	* tree-vect-stmts.cc (vect_create_vectorized_promotion_stmts):
	Require an SLP tree node to be passed by the caller, for use
	by vect_get_num_copies.  Stop pushing more stmts than implied
	by vect_get_num_copies.
	(vectorizable_conversion): Pass SLP tree node to
	vect_create_vectorized_promotion_stmts.  Demotion no longer
	relies on an even number of definitions being produced by
	promotion. If necessary, push a single constant zero
	definition.
Member

Hi @chris.bazley. This bot helps send your PR as a patch series to the mailing list.

Next steps

  1. Write a clear PR description. It will be used as the cover letter.
  2. To CC extra people, add lines like this at the end of the PR description: CC: Reviewer1 <revi.ewer@example.com>, Reviewer2 <an.other@example.com>.
  3. To preview the emails, comment with /preview.
  4. When ready, request review in the Reviewers section. Or, if you just want to send the series, comment with /submit.
  5. Use the cover-letter links below to follow replies.
  6. For a new patch series, push your changes, update the PR description with a Changes since vX section, and comment with /submit again.

See Submitting Patches and UsingForge.

Consider joining the gcc and gcc-patches mailing lists..
For real time communication, check the gcc irc channels.

Or join #overseers on Libera Chat, particularly if this automation is not working (stay online to get replies, IRC does not save messages if people are not online).

<!-- pr-welcome --> Hi @chris.bazley. This bot helps send your PR as a patch series to the mailing list. ## Next steps 1. Write a clear PR description. It will be used as the cover letter. 2. To CC extra people, add lines like this **at the end** of the PR description: `CC: Reviewer1 <revi.ewer@example.com>, Reviewer2 <an.other@example.com>`. 3. To preview the emails, comment with `/preview`. 4. When ready, request review in the Reviewers section. Or, if you just want to send the series, comment with `/submit`. 5. Use the cover-letter links below to follow replies. 6. For a new patch series, push your changes, update the PR description with a `Changes since vX` section, and comment with `/submit` again. See [Submitting Patches](https://gcc.gnu.org/contribute.html#patches) and [UsingForge](https://gcc.gnu.org/wiki/UsingForge). Consider joining the [gcc and gcc-patches mailing lists.](https://gcc.gnu.org/lists.html). For real time communication, check the [gcc irc channels](https://gcc.gnu.org/wiki/GCConIRC). Or join [`#overseers`](https://web.libera.chat/#overseers) on Libera Chat, particularly if this automation is not working (stay online to get replies, IRC does not save messages if people are not online).
Author
Member
This was split from https://inbox.sourceware.org/gcc-patches/CAFiYyc3v-if02mYN6DFN+i2Eu90gnDeXdPoLRxacpY_WUoFv4Q@mail.gmail.com/ by request.
Author
Member

/submit

/submit
Member

Version 1 of this pull request has been stored. It includes the following commits:

  • vect: Prepare promotion/demotion for BB SLP with predicated tails - 8e37fb681d
<!-- pr-new-version --> Version 1 of this pull request has been stored. It includes the following commits: - vect: Prepare promotion/demotion for BB SLP with predicated tails - 8e37fb681d65c862e2c006bcf1b1ac0ed205c78a
Member

Pull Request versions:

# Base Head
1 4c85f7cf58 8e37fb681d (diff)

In order to compare , clone this repository and run

PR=191
git fetch origin "refs/versioned_pull/${PR}/*:refs/versioned_pull/${PR}/*"
PRV1=1
PRV2=2
git range-diff "refs/versioned_pull/${PR}/${PRV1}/base..refs/versioned_pull/${PR}/${PRV1}/head"  "refs/versioned_pull/${PR}/${PRV2}/base..refs/versioned_pull/${PR}/${PRV2}/head"
<!-- pr-versions --> Pull Request versions: | # | Base | Head | | | - | ---- | ---- | - | | 1 | 4c85f7cf587f0f62a5eb1884998d4ed30a39552a | 8e37fb681d65c862e2c006bcf1b1ac0ed205c78a | [(diff)](https://forge.sourceware.org/gcc/gcc.git/compare/4c85f7cf587f0f62a5eb1884998d4ed30a39552a...8e37fb681d65c862e2c006bcf1b1ac0ed205c78a) | In order to compare , clone this repository and run ``` PR=191 git fetch origin "refs/versioned_pull/${PR}/*:refs/versioned_pull/${PR}/*" PRV1=1 PRV2=2 git range-diff "refs/versioned_pull/${PR}/${PRV1}/base..refs/versioned_pull/${PR}/${PRV1}/head" "refs/versioned_pull/${PR}/${PRV2}/base..refs/versioned_pull/${PR}/${PRV2}/head" ```
Member

Sent patch series version 1 containing 1 patches to gcc-patches mailing list gcc-patches@gcc.gnu.org and cc'd richard.guenther@gmail.com, Tamar.Christina@arm.com.
Cover letter

Sent patch series version 1 containing 1 patches to gcc-patches mailing list <gcc-patches@gcc.gnu.org> and cc'd richard.guenther@gmail.com, Tamar.Christina@arm.com. [Cover letter](https://inbox.sourceware.org/gcc-patches/bmm.hkh9u5nbgg.gcc.gcc.chris.bazley.191.1.0@forge-stage.sourceware.org)
chris.bazley force-pushed promotion from 8e37fb681d
All checks were successful
/ format-checks (pull_request) Successful in 1m34s
to f2112f153d
All checks were successful
/ format-checks (pull_request) Successful in 1m34s
2026-07-28 13:23:31 +00:00
Compare
chris.bazley force-pushed promotion from f2112f153d
All checks were successful
/ format-checks (pull_request) Successful in 1m34s
to 2999cb6cc3
All checks were successful
/ format-checks (pull_request) Successful in 1m31s
2026-07-30 13:05:15 +00:00
Compare
All checks were successful
/ format-checks (pull_request) Successful in 1m31s
This pull request has changes conflicting with the target branch.
  • gcc/tree-vect-stmts.cc
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u promotion:chris.bazley-promotion
git switch chris.bazley-promotion

Merge

Merge the changes and update on Forgejo.
git switch trunk
git merge --no-ff chris.bazley-promotion
git switch chris.bazley-promotion
git rebase trunk
git switch trunk
git merge --ff-only chris.bazley-promotion
git switch chris.bazley-promotion
git rebase trunk
git switch trunk
git merge --no-ff chris.bazley-promotion
git switch trunk
git merge --squash chris.bazley-promotion
git switch trunk
git merge --ff-only chris.bazley-promotion
git switch trunk
git merge chris.bazley-promotion
git push origin trunk
Sign in to join this conversation.
No reviewers
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gcc/gcc!191
No description provided.