-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SelectionDAG] Add computeKnownBits support for ISD::STEP_VECTOR #80452
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 all commits
ff14dd1
bb72363
40012cf
d472126
d35a5a2
32daac9
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 |
---|---|---|
|
@@ -3110,6 +3110,33 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts, | |
} | ||
break; | ||
} | ||
case ISD::STEP_VECTOR: { | ||
const APInt &Step = Op.getConstantOperandAPInt(0); | ||
|
||
if (Step.isPowerOf2()) | ||
Known.Zero.setLowBits(Step.logBase2()); | ||
|
||
const Function &F = getMachineFunction().getFunction(); | ||
|
||
if (!isUIntN(BitWidth, Op.getValueType().getVectorMinNumElements())) | ||
break; | ||
const APInt MinNumElts = | ||
APInt(BitWidth, Op.getValueType().getVectorMinNumElements()); | ||
|
||
bool Overflow; | ||
const APInt MaxNumElts = getVScaleRange(&F, BitWidth) | ||
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. Are fixed vector ISD::STEP_VECTOR allowed? 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 don't believe we construct them. SDAGBuilder doesn't, so unless we have something somewhere which combines to them, no. However, good point. Unless we have an assert to that effect somewhere, we should handle them (via a bail out) here. 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. Never mind, we have the assert in SelectionDAG::getNode
|
||
.getUnsignedMax() | ||
.umul_ov(MinNumElts, Overflow); | ||
if (Overflow) | ||
break; | ||
|
||
const APInt MaxValue = (MaxNumElts - 1).umul_ov(Step, Overflow); | ||
lukel97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (Overflow) | ||
break; | ||
|
||
Known.Zero.setHighBits(MaxValue.countl_zero()); | ||
break; | ||
} | ||
case ISD::BUILD_VECTOR: | ||
assert(!Op.getValueType().isScalableVector()); | ||
// Collect the known bits that are shared by every demanded vector element. | ||
|
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 think this might be off by 1. Only
Op.getValueType().getVectorMinNumElements() - 1
needs to fit in the bitwidth.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.
Err. nevermind we need it to fit to load it into the APInt.