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

[VP] Update uses of select instructions used as masks. #68

Merged
merged 2 commits into from
May 17, 2024

Conversation

AinsleySnow
Copy link

If we run llvm-lit on if-elif-else_not-uniform.ll repeatedly, we'll find that this test case has ~50% probability of failing.

The vector-predication pass will mark out the ready-to-be-removed instructions, and then replace all of its uses.
However, some of these instructions, that is, some select instructions, are marked as mask at the beginning of the pass, and these mask will be used as parameters of newly-generated vp-instrinsic.

In the original version these copies are not updated as well when the instruction is marked as ready-to-be-removed, therefore there still exist uses of ready-to-be-removed instructions. All the instructions are indexed by their addresses. If the replace happens after vp-instrinsic generation, because old uses have appear in LLVM IR, they can be easily handled by replaceAllUsesWith method. But if the replace comes first, the vp-instrinsic generation process has to use yet-stored-in-list old masks, resulting in undesired uses and cause should-be-removed instructions remain in blocks.

By adding a for loop to iterate through VecOpsToTransform, we can update the masks along with replaceAllUsesWith method.

The tests is updated as well. The updated version has same semantic with the former version, but obviously the author hopes the %9 = select ... line to be removed.

@ChunyuLiao ChunyuLiao merged commit 669a5a3 into plctlab:auto-vector-upstream-next May 17, 2024
3 checks passed
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.

2 participants