-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[DAG] Update canCreateUndefOrPoison to handle ISD::VECTOR_COMPRESS #168010
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
Merged
RKSimon
merged 6 commits into
llvm:main
from
Michael-Chen-NJU:fix-167710-vector-compress
Nov 19, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
97988f6
[SelectionDAG] Update canCreateUndefOrPoison to handle VECTOR_COMPRES…
Michael-Chen-NJU a4e0574
[DAG] Enhance canCreateUndefOrPoison for VECTOR_COMPRESS and add test…
Michael-Chen-NJU 1e3bc70
[DAG] Removing undef
Michael-Chen-NJU d67fee9
[DAG] Add negative test case for freeze elimination in vector.compress
Michael-Chen-NJU b4d8f82
[DAG] Refactor canCreateUndefOrPoison for VECTOR_COMPRESS and update …
Michael-Chen-NJU fb4cee2
Merge branch 'main' into fix-167710-vector-compress
RKSimon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
| ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f,+avx512vl | FileCheck %s | ||
|
|
||
| declare <16 x i32> @llvm.experimental.vector.compress.v16i32(<16 x i32>, <16 x i1>, <16 x i32>) | ||
|
|
||
| define <16 x i32> @test_compress_freeze_elimination(<16 x i32> %a0, <16 x i32> %a1, <16 x i8> %a3) { | ||
| ; CHECK-LABEL: test_compress_freeze_elimination: | ||
| ; CHECK: # %bb.0: | ||
| ; CHECK-NEXT: vpcmpgtd %zmm1, %zmm0, %k1 | ||
| ; CHECK-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm2[0],zero,zero,zero,xmm2[1],zero,zero,zero,xmm2[2],zero,zero,zero,xmm2[3],zero,zero,zero,xmm2[4],zero,zero,zero,xmm2[5],zero,zero,zero,xmm2[6],zero,zero,zero,xmm2[7],zero,zero,zero,xmm2[8],zero,zero,zero,xmm2[9],zero,zero,zero,xmm2[10],zero,zero,zero,xmm2[11],zero,zero,zero,xmm2[12],zero,zero,zero,xmm2[13],zero,zero,zero,xmm2[14],zero,zero,zero,xmm2[15],zero,zero,zero | ||
| ; CHECK-NEXT: vpbroadcastd {{.*#+}} zmm0 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15] | ||
| ; CHECK-NEXT: vpcompressd %zmm1, %zmm0 {%k1} | ||
| ; CHECK-NEXT: retq | ||
| %cmp = icmp sgt <16 x i32> %a0, %a1 | ||
| %ext = zext <16 x i8> %a3 to <16 x i32> | ||
| %cpr = call <16 x i32> @llvm.experimental.vector.compress.v16i32(<16 x i32> %ext, <16 x i1> %cmp, <16 x i32> splat(i32 15)) | ||
| %fr = freeze <16 x i32> %cpr | ||
| %and = and <16 x i32> %fr, splat(i32 255) | ||
| ret <16 x i32> %and | ||
| } | ||
|
|
||
| define <16 x i32> @test_compress_freeze(<16 x i32> %a0, <16 x i32> %a1, <16 x i8> %a3) { | ||
| ; CHECK-LABEL: test_compress_freeze: | ||
| ; CHECK: # %bb.0: | ||
| ; CHECK-NEXT: vpcmpgtd %zmm1, %zmm0, %k1 | ||
| ; CHECK-NEXT: vpmovzxbd {{.*#+}} zmm0 = xmm2[0],zero,zero,zero,xmm2[1],zero,zero,zero,xmm2[2],zero,zero,zero,xmm2[3],zero,zero,zero,xmm2[4],zero,zero,zero,xmm2[5],zero,zero,zero,xmm2[6],zero,zero,zero,xmm2[7],zero,zero,zero,xmm2[8],zero,zero,zero,xmm2[9],zero,zero,zero,xmm2[10],zero,zero,zero,xmm2[11],zero,zero,zero,xmm2[12],zero,zero,zero,xmm2[13],zero,zero,zero,xmm2[14],zero,zero,zero,xmm2[15],zero,zero,zero | ||
| ; CHECK-NEXT: vpcompressd %zmm0, %zmm0 {%k1} | ||
| ; CHECK-NEXT: vpandd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0 | ||
| ; CHECK-NEXT: retq | ||
| %cmp = icmp sgt <16 x i32> %a0, %a1 | ||
| %ext = zext <16 x i8> %a3 to <16 x i32> | ||
| %cpr = call <16 x i32> @llvm.experimental.vector.compress.v16i32(<16 x i32> %ext, <16 x i1> %cmp, <16 x i32> poison) | ||
| %fr = freeze <16 x i32> %cpr | ||
| %and = and <16 x i32> %fr, splat(i32 255) | ||
| ret <16 x i32> %and | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.