-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[DAG] Add ISD::VECTOR_COMPRESS handling in computeKnownBits/ComputeNumSignBits #159692
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
Changes from 1 commit
0173be8
3ad285b
d322cb2
e0c330d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,6 +58,7 @@ | |||||||||||||||||||
| #include "llvm/IR/GlobalValue.h" | ||||||||||||||||||||
| #include "llvm/IR/Metadata.h" | ||||||||||||||||||||
| #include "llvm/IR/Type.h" | ||||||||||||||||||||
| #include "llvm/Pass.h" | ||||||||||||||||||||
| #include "llvm/Support/Casting.h" | ||||||||||||||||||||
| #include "llvm/Support/CodeGen.h" | ||||||||||||||||||||
| #include "llvm/Support/Compiler.h" | ||||||||||||||||||||
|
|
@@ -3480,6 +3481,26 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts, | |||||||||||||||||||
| break; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| break; | ||||||||||||||||||||
| case ISD::VECTOR_COMPRESS: { | ||||||||||||||||||||
| assert(!Op.getValueType().isScalableVector()); | ||||||||||||||||||||
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| SDValue Vec = Op.getOperand(0); | ||||||||||||||||||||
| SDValue PassThru = Op.getOperand(2); | ||||||||||||||||||||
| // If PassThru is undefined, early out | ||||||||||||||||||||
| if (PassThru.isUndef()) | ||||||||||||||||||||
| break; | ||||||||||||||||||||
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| Known.Zero.setAllBits(); | ||||||||||||||||||||
| Known.One.setAllBits(); | ||||||||||||||||||||
|
||||||||||||||||||||
| Known2 = computeKnownBits(PassThru, Depth + 1); | ||||||||||||||||||||
| Known = Known.intersectWith(Known2); | ||||||||||||||||||||
|
||||||||||||||||||||
| // If we don't know any bits, early out. | ||||||||||||||||||||
| if (Known.isUnknown()) | ||||||||||||||||||||
| break; | ||||||||||||||||||||
| Known2 = computeKnownBits(Vec, Depth + 1); | ||||||||||||||||||||
| Known = Known.intersectWith(Known2); | ||||||||||||||||||||
| break; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| case ISD::VECTOR_SHUFFLE: { | ||||||||||||||||||||
| assert(!Op.getValueType().isScalableVector()); | ||||||||||||||||||||
| // Collect the known bits that are shared by every vector element referenced | ||||||||||||||||||||
|
|
@@ -4792,6 +4813,19 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts, | |||||||||||||||||||
| } | ||||||||||||||||||||
| return Tmp; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| case ISD::VECTOR_COMPRESS: { | ||||||||||||||||||||
| SDValue Vec = Op.getOperand(0); | ||||||||||||||||||||
| SDValue Mask = Op.getOperand(1); | ||||||||||||||||||||
| SDValue PassThru = Op.getOperand(2); | ||||||||||||||||||||
| // If PassThru is undefined, early out. | ||||||||||||||||||||
| if (PassThru.isUndef()) | ||||||||||||||||||||
| return 1; | ||||||||||||||||||||
| Tmp = ComputeNumSignBits(Vec, Depth + 1); | ||||||||||||||||||||
| Tmp2 = ComputeNumSignBits(PassThru, Depth + 1); | ||||||||||||||||||||
|
||||||||||||||||||||
| // If PassThru is undefined, early out. | |
| if (PassThru.isUndef()) | |
| return 1; | |
| Tmp = ComputeNumSignBits(Vec, Depth + 1); | |
| Tmp2 = ComputeNumSignBits(PassThru, Depth + 1); | |
| Tmp = ComputeNumSignBits(PassThru, Depth + 1); | |
| if (Tmp == 1) | |
| return 1; | |
| Tmp2 = ComputeNumSignBits(Vec, Depth + 1); |
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.
Again - we might be able to use DemandedElts for the PassThru signbits calc
Uh oh!
There was an error while loading. Please reload this page.