Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Reassociation messes up SLPVectorizer reduction #35829

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

Closed
llvmbot opened this issue Feb 22, 2018 · 4 comments
Closed

Reassociation messes up SLPVectorizer reduction #35829

llvmbot opened this issue Feb 22, 2018 · 4 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla confirmed Verified by a second party llvm:SLPVectorizer

Comments

@llvmbot
Copy link
Member

llvmbot commented Feb 22, 2018

Bugzilla Link 36481
Version trunk
OS Linux
Attachments Test
Reporter LLVM Bugzilla Contributor
CC @alexey-bataev,@echristo,@MaskRay,@RKSimon,@rotateright

Extended Description

Running opt -S -slp-vectorizer $TEST_FILE, the function gets SLP-vectorized; Running opt -S -reassociate -slp-vectorizer $TEST_FILE, the function doesn't get SLP-vectorized.

This is because the reassociation pass re-associates instructions like acc = add ith_element, acc to acc = add acc, ith_element, but didn't re-assocate the first instruction acc = add first_element, second_element to acc = add second_element, first_element.

However, as add is associative, a smarter SLP vectorizer could have ignored the associations and vectorize the unordered adds anyway.

I'm not sure where to put the fix on.

@llvmbot
Copy link
Member Author

llvmbot commented Feb 22, 2018

assigned to @alexey-bataev

@llvmbot
Copy link
Member Author

llvmbot commented Feb 22, 2018

CC Arnold because he authored HorizontalReduction::matchAssociativeReduction().

@llvmbot
Copy link
Member Author

llvmbot commented Feb 22, 2018

but didn't
re-assocate the first instruction acc = add first_element, second_element
to acc = add second_element, first_element.

It should be phrased the other way around: but didn't re-assocate the first instruction acc = add second_elemnet, first_element to acc = add first_element, second_element.

As a result, the add sequence is v[1] + v[0] + v[2] + ... + v[31], which doesn't get vectorized.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@llvmbot llvmbot added the confirmed Verified by a second party label Jan 26, 2022
@alexey-bataev
Copy link
Member

Fixed, cannot be reproduced in trunk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla confirmed Verified by a second party llvm:SLPVectorizer
Projects
None yet
Development

No branches or pull requests

3 participants