Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/IR/IntrinsicInst.cpp
Show First 20 Lines • Show All 273 Lines • ▼ Show 20 Lines | |||||
Value *VPIntrinsic::getMaskParam() const { | Value *VPIntrinsic::getMaskParam() const { | ||||
auto maskPos = GetMaskParamPos(getIntrinsicID()); | auto maskPos = GetMaskParamPos(getIntrinsicID()); | ||||
if (maskPos) | if (maskPos) | ||||
return getArgOperand(maskPos.getValue()); | return getArgOperand(maskPos.getValue()); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
void VPIntrinsic::setMaskParam(Value *NewMask) { | |||||
auto MaskPos = GetMaskParamPos(getIntrinsicID()); | |||||
setArgOperand(*MaskPos, NewMask); | |||||
craig.topper: getValue() will assert itself won't it? | |||||
} | |||||
Value *VPIntrinsic::getVectorLengthParam() const { | Value *VPIntrinsic::getVectorLengthParam() const { | ||||
auto vlenPos = GetVectorLengthParamPos(getIntrinsicID()); | auto vlenPos = GetVectorLengthParamPos(getIntrinsicID()); | ||||
if (vlenPos) | if (vlenPos) | ||||
return getArgOperand(vlenPos.getValue()); | return getArgOperand(vlenPos.getValue()); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
void VPIntrinsic::setVectorLengthParam(Value *NewEVL) { | |||||
auto EVLPos = GetVectorLengthParamPos(getIntrinsicID()); | |||||
setArgOperand(*EVLPos, NewEVL); | |||||
Same craig.topper: Same | |||||
} | |||||
Optional<int> VPIntrinsic::GetMaskParamPos(Intrinsic::ID IntrinsicID) { | Optional<int> VPIntrinsic::GetMaskParamPos(Intrinsic::ID IntrinsicID) { | ||||
switch (IntrinsicID) { | switch (IntrinsicID) { | ||||
default: | default: | ||||
return None; | return None; | ||||
#define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \ | #define BEGIN_REGISTER_VP_INTRINSIC(VPID, MASKPOS, VLENPOS) \ | ||||
case Intrinsic::VPID: \ | case Intrinsic::VPID: \ | ||||
return MASKPOS; | return MASKPOS; | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | bool VPIntrinsic::canIgnoreVectorLengthParam() const { | ||||
if (EC.isScalable()) { | if (EC.isScalable()) { | ||||
// Undig the DL | // Undig the DL | ||||
auto ParMod = this->getModule(); | auto ParMod = this->getModule(); | ||||
if (!ParMod) | if (!ParMod) | ||||
return false; | return false; | ||||
const auto &DL = ParMod->getDataLayout(); | const auto &DL = ParMod->getDataLayout(); | ||||
// Compare vscale patterns | // Compare vscale patterns | ||||
uint64_t VScaleFactor; | uint64_t VScaleFactor; | ||||
if (match(VLParam, m_c_Mul(m_ConstantInt(VScaleFactor), m_VScale(DL)))) | if (match(VLParam, m_c_Mul(m_ConstantInt(VScaleFactor), m_VScale(DL)))) | ||||
return VScaleFactor >= EC.getKnownMinValue(); | return VScaleFactor >= EC.getKnownMinValue(); | ||||
return (EC.getKnownMinValue() == 1) && match(VLParam, m_VScale(DL)); | return (EC.getKnownMinValue() == 1) && match(VLParam, m_VScale(DL)); | ||||
This unrelated change fixes a bug (ParamFactor does not make sense as a return value here and is not initialized!). I'll push a fix in a separate commit along with a test for this case. simoll: This unrelated change fixes a bug (`ParamFactor` does not make sense as a return value here and… | |||||
} | } | ||||
// standard SIMD operation | // standard SIMD operation | ||||
auto VLConst = dyn_cast<ConstantInt>(VLParam); | auto VLConst = dyn_cast<ConstantInt>(VLParam); | ||||
if (!VLConst) | if (!VLConst) | ||||
return false; | return false; | ||||
uint64_t VLNum = VLConst->getZExtValue(); | uint64_t VLNum = VLConst->getZExtValue(); | ||||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |
getValue() will assert itself won't it?