|
22 | 22 | #include "LegalizeTypes.h"
|
23 | 23 | #include "llvm/ADT/SmallBitVector.h"
|
24 | 24 | #include "llvm/Analysis/MemoryLocation.h"
|
25 |
| -#include "llvm/Analysis/ValueTracking.h" |
26 | 25 | #include "llvm/Analysis/VectorUtils.h"
|
27 | 26 | #include "llvm/IR/DataLayout.h"
|
28 | 27 | #include "llvm/Support/ErrorHandling.h"
|
@@ -6957,32 +6956,14 @@ SDValue DAGTypeLegalizer::WidenVecOp_VSELECT(SDNode *N) {
|
6957 | 6956 | }
|
6958 | 6957 |
|
6959 | 6958 | SDValue DAGTypeLegalizer::WidenVecOp_VP_CttzElements(SDNode *N) {
|
6960 |
| - // Widen the result bit width if needed. |
6961 | 6959 | SDLoc DL(N);
|
6962 |
| - EVT OrigResVT = N->getValueType(0); |
6963 |
| - const Function &F = DAG.getMachineFunction().getFunction(); |
6964 |
| - |
6965 | 6960 | SDValue Source = GetWidenedVector(N->getOperand(0));
|
6966 | 6961 | EVT SrcVT = Source.getValueType();
|
6967 | 6962 | SDValue Mask =
|
6968 | 6963 | GetWidenedMask(N->getOperand(1), SrcVT.getVectorElementCount());
|
6969 | 6964 |
|
6970 |
| - // Compute the number of bits that can fit the result. |
6971 |
| - ConstantRange CR(APInt(64, SrcVT.getVectorMinNumElements())); |
6972 |
| - if (SrcVT.isScalableVT()) |
6973 |
| - CR = CR.umul_sat(getVScaleRange(&F, 64)); |
6974 |
| - // If the zero-is-poison flag is set in the original intrinsic, we can |
6975 |
| - // assume the upper limit of the result is EVL - 1. |
6976 |
| - if (N->getOpcode() == ISD::VP_CTTZ_ELTS_ZERO_UNDEF) |
6977 |
| - CR = CR.subtract(APInt(64, 1)); |
6978 |
| - |
6979 |
| - unsigned NewResWidth = OrigResVT.getScalarSizeInBits(); |
6980 |
| - NewResWidth = std::min(NewResWidth, unsigned(CR.getActiveBits())); |
6981 |
| - NewResWidth = std::max(llvm::bit_ceil(NewResWidth), 8U); |
6982 |
| - |
6983 |
| - EVT NewResVT = EVT::getIntegerVT(*DAG.getContext(), NewResWidth); |
6984 |
| - return DAG.getNode(N->getOpcode(), DL, NewResVT, Source, Mask, |
6985 |
| - N->getOperand(2)); |
| 6965 | + return DAG.getNode(N->getOpcode(), DL, N->getValueType(0), |
| 6966 | + {Source, Mask, N->getOperand(2)}, N->getFlags()); |
6986 | 6967 | }
|
6987 | 6968 |
|
6988 | 6969 | //===----------------------------------------------------------------------===//
|
|
0 commit comments