-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[IA] Fix crash when dealing with deinterleave(interleave) #150713
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
Closed
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -256,7 +256,7 @@ static bool isReInterleaveMask(ShuffleVectorInst *SVI, unsigned &Factor, | |
| static Value *getMaskOperand(IntrinsicInst *II) { | ||
| switch (II->getIntrinsicID()) { | ||
| default: | ||
| llvm_unreachable("Unexpected intrinsic"); | ||
| return nullptr; | ||
| case Intrinsic::vp_load: | ||
| return II->getOperand(1); | ||
| case Intrinsic::masked_load: | ||
|
|
@@ -382,8 +382,11 @@ bool InterleavedAccessImpl::lowerInterleavedLoad( | |
| if (LI) { | ||
| LLVM_DEBUG(dbgs() << "IA: Found an interleaved load: " << *Load << "\n"); | ||
| } else { | ||
| Value *MaskOperand = getMaskOperand(II); | ||
| if (!MaskOperand) | ||
| llvm_unreachable("unsupported intrinsic"); | ||
| // Check mask operand. Handle both all-true/false and interleaved mask. | ||
| Mask = getMask(getMaskOperand(II), Factor, VecTy); | ||
| Mask = getMask(MaskOperand, Factor, VecTy); | ||
| if (!Mask) | ||
| return false; | ||
|
|
||
|
|
@@ -534,10 +537,12 @@ bool InterleavedAccessImpl::lowerInterleavedStore( | |
| if (SI) { | ||
| LLVM_DEBUG(dbgs() << "IA: Found an interleaved store: " << *Store << "\n"); | ||
| } else { | ||
| Value *MaskOperand = getMaskOperand(II); | ||
| if (!MaskOperand) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I we do it this way, I would use an |
||
| llvm_unreachable("unsupported intrinsic"); | ||
| // Check mask operand. Handle both all-true/false and interleaved mask. | ||
| unsigned LaneMaskLen = NumStoredElements / Factor; | ||
| Mask = getMask(getMaskOperand(II), Factor, | ||
| ElementCount::getFixed(LaneMaskLen)); | ||
| Mask = getMask(MaskOperand, Factor, ElementCount::getFixed(LaneMaskLen)); | ||
| if (!Mask) | ||
| return false; | ||
|
|
||
|
|
@@ -634,9 +639,12 @@ bool InterleavedAccessImpl::lowerDeinterleaveIntrinsic( | |
| << " and factor = " << Factor << "\n"); | ||
| } else { | ||
| assert(II); | ||
| Value *MaskOperand = getMaskOperand(II); | ||
| if (!MaskOperand) | ||
| return false; | ||
|
|
||
| // Check mask operand. Handle both all-true/false and interleaved mask. | ||
| Mask = getMask(getMaskOperand(II), Factor, getDeinterleavedVectorType(DI)); | ||
| Mask = getMask(MaskOperand, Factor, getDeinterleavedVectorType(DI)); | ||
| if (!Mask) | ||
| return false; | ||
|
|
||
|
|
@@ -673,8 +681,11 @@ bool InterleavedAccessImpl::lowerInterleaveIntrinsic( | |
|
|
||
| Value *Mask = nullptr; | ||
| if (II) { | ||
| Value *MaskOperand = getMaskOperand(II); | ||
| if (!MaskOperand) | ||
| return false; | ||
| // Check mask operand. Handle both all-true/false and interleaved mask. | ||
| Mask = getMask(getMaskOperand(II), Factor, | ||
| Mask = getMask(MaskOperand, Factor, | ||
| cast<VectorType>(InterleaveValues[0]->getType())); | ||
| if (!Mask) | ||
| return false; | ||
|
|
||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I we do it this way, I would use an
asserthere.