LLVM: lib/IR/AutoUpgrade.cpp File Reference (original) (raw)

Go to the source code of this file.

Functions
static void rename (GlobalValue *GV)
static bool upgradePTESTIntrinsic (Function *F, Intrinsic::ID IID, Function *&NewFn)
static bool upgradeX86IntrinsicsWith8BitMask (Function *F, Intrinsic::ID IID, Function *&NewFn)
static bool upgradeX86MaskedFPCompare (Function *F, Intrinsic::ID IID, Function *&NewFn)
static bool upgradeX86MultiplyAddBytes (Function *F, Intrinsic::ID IID, Function *&NewFn)
static bool upgradeX86BF16Intrinsic (Function *F, Intrinsic::ID IID, Function *&NewFn)
static bool upgradeX86BF16DPIntrinsic (Function *F, Intrinsic::ID IID, Function *&NewFn)
static bool shouldUpgradeX86Intrinsic (Function *F, StringRef Name)
static bool upgradeX86IntrinsicFunction (Function *F, StringRef Name, Function *&NewFn)
static bool upgradeArmOrAarch64IntrinsicFunction (bool IsArm, Function *F, StringRef Name, Function *&NewFn)
static Intrinsic::ID shouldUpgradeNVPTXTMAG2SIntrinsics (Function *F, StringRef Name)
static Intrinsic::ID shouldUpgradeNVPTXSharedClusterIntrinsic (Function *F, StringRef Name)
static Intrinsic::ID shouldUpgradeNVPTXBF16Intrinsic (StringRef Name)
static bool consumeNVVMPtrAddrSpace (StringRef &Name)
static bool upgradeIntrinsicFunction1 (Function *F, Function *&NewFn, bool CanUpgradeDebugIntrinsicsToRecords)
static Value * upgradeX86PSLLDQIntrinsics (IRBuilder<> &Builder, Value *Op, unsigned Shift)
static Value * upgradeX86PSRLDQIntrinsics (IRBuilder<> &Builder, Value *Op, unsigned Shift)
static Value * getX86MaskVec (IRBuilder<> &Builder, Value *Mask, unsigned NumElts)
static Value * emitX86Select (IRBuilder<> &Builder, Value *Mask, Value *Op0, Value *Op1)
static Value * emitX86ScalarSelect (IRBuilder<> &Builder, Value *Mask, Value *Op0, Value *Op1)
static Value * upgradeX86ALIGNIntrinsics (IRBuilder<> &Builder, Value *Op0, Value *Op1, Value *Shift, Value *Passthru, Value *Mask, bool IsVALIGN)
static Value * upgradeX86VPERMT2Intrinsics (IRBuilder<> &Builder, CallBase &CI, bool ZeroMask, bool IndexForm)
static Value * upgradeX86BinaryIntrinsics (IRBuilder<> &Builder, CallBase &CI, Intrinsic::ID IID)
static Value * upgradeX86Rotate (IRBuilder<> &Builder, CallBase &CI, bool IsRotateRight)
static Value * upgradeX86vpcom (IRBuilder<> &Builder, CallBase &CI, unsigned Imm, bool IsSigned)
static Value * upgradeX86ConcatShift (IRBuilder<> &Builder, CallBase &CI, bool IsShiftRight, bool ZeroMask)
static Value * upgradeMaskedStore (IRBuilder<> &Builder, Value *Ptr, Value *Data, Value *Mask, bool Aligned)
static Value * upgradeMaskedLoad (IRBuilder<> &Builder, Value *Ptr, Value *Passthru, Value *Mask, bool Aligned)
static Value * upgradeAbs (IRBuilder<> &Builder, CallBase &CI)
static Value * upgradePMULDQ (IRBuilder<> &Builder, CallBase &CI, bool IsSigned)
static Value * applyX86MaskOn1BitsVec (IRBuilder<> &Builder, Value *Vec, Value *Mask)
static Value * upgradeMaskedCompare (IRBuilder<> &Builder, CallBase &CI, unsigned CC, bool Signed)
static Value * upgradeX86MaskedShift (IRBuilder<> &Builder, CallBase &CI, Intrinsic::ID IID)
static Value * upgradeMaskedMove (IRBuilder<> &Builder, CallBase &CI)
static Value * upgradeMaskToInt (IRBuilder<> &Builder, CallBase &CI)
static bool upgradeAVX512MaskToSelect (StringRef Name, IRBuilder<> &Builder, CallBase &CI, Value *&Rep)
static Value * upgradeNVVMIntrinsicCall (StringRef Name, CallBase *CI, Function *F, IRBuilder<> &Builder)
static Value * upgradeX86IntrinsicCall (StringRef Name, CallBase *CI, Function *F, IRBuilder<> &Builder)
static Value * upgradeAArch64IntrinsicCall (StringRef Name, CallBase *CI, Function *F, IRBuilder<> &Builder)
static Value * upgradeARMIntrinsicCall (StringRef Name, CallBase *CI, Function *F, IRBuilder<> &Builder)
static Value * upgradeAMDGCNIntrinsicCall (StringRef Name, CallBase *CI, Function *F, IRBuilder<> &Builder)
static MDNode * unwrapMAVOp (CallBase *CI, unsigned Op)
Helper to unwrap intrinsic call MetadataAsValue operands.
static Metadata * unwrapMAVMetadataOp (CallBase *CI, unsigned Op)
Helper to unwrap Metadata MetadataAsValue operands, such as the Value field.
static MDNode * getDebugLocSafe (const Instruction *I)
static void upgradeDbgIntrinsicToDbgRecord (StringRef Name, CallBase *CI)
Convert debug intrinsic calls to non-instruction debug records.
static void upgradeNVVMFnVectorAttr (const StringRef Attr, const char DimC, GlobalValue *GV, const Metadata *V)
static bool isXYZ (StringRef S)
static bool upgradeSingleNVVMAnnotation (GlobalValue *GV, StringRef K, const Metadata *V)
static bool upgradeRetainReleaseMarker (Module &M)
This checks for objc retain release marker which should be upgraded.
static void setFunctionAttrIfNotSet (Function &F, StringRef FnAttrName, StringRef Value)
static void ConvertFunctionAttr (Function &F, bool Set, StringRef FnAttrName)
static bool isOldLoopArgument (Metadata *MD)
static MDString * upgradeLoopTag (LLVMContext &C, StringRef OldTag)
static Metadata * upgradeLoopArgument (Metadata *MD)

applyX86MaskOn1BitsVec()

consumeNVVMPtrAddrSpace()

ConvertFunctionAttr()

emitX86ScalarSelect()

emitX86Select()

Definition at line 1886 of file AutoUpgrade.cpp.

References llvm::CallingConv::C, llvm::cast(), llvm::dyn_cast(), llvm::Value::getType(), and getX86MaskVec().

Referenced by upgradeAbs(), upgradeAVX512MaskToSelect(), upgradePMULDQ(), upgradeX86ALIGNIntrinsics(), upgradeX86BinaryIntrinsics(), upgradeX86ConcatShift(), upgradeX86IntrinsicCall(), upgradeX86MaskedShift(), upgradeX86Rotate(), and upgradeX86VPERMT2Intrinsics().

getDebugLocSafe()

getX86MaskVec()

Definition at line 1866 of file AutoUpgrade.cpp.

References llvm::ArrayRef(), assert(), llvm::cast(), llvm::FixedVectorType::get(), and llvm::isPowerOf2_32().

Referenced by applyX86MaskOn1BitsVec(), emitX86Select(), llvm::UpgradeIntrinsicCall(), upgradeMaskedLoad(), upgradeMaskedStore(), upgradeMaskToInt(), and upgradeX86IntrinsicCall().

isOldLoopArgument()

isXYZ()

rename()

Definition at line 63 of file AutoUpgrade.cpp.

References llvm::Value::getName(), and llvm::Value::setName().

Referenced by upgradeArmOrAarch64IntrinsicFunction(), upgradeIntrinsicFunction1(), upgradeNVVMIntrinsicCall(), upgradePTESTIntrinsic(), upgradeX86BF16DPIntrinsic(), upgradeX86BF16Intrinsic(), upgradeX86IntrinsicFunction(), upgradeX86IntrinsicsWith8BitMask(), upgradeX86MaskedFPCompare(), and upgradeX86MultiplyAddBytes().

setFunctionAttrIfNotSet()

shouldUpgradeNVPTXBF16Intrinsic()

shouldUpgradeNVPTXSharedClusterIntrinsic()

shouldUpgradeNVPTXTMAG2SIntrinsics()

shouldUpgradeX86Intrinsic()

unwrapMAVMetadataOp()

unwrapMAVOp()

upgradeAArch64IntrinsicCall()

Definition at line 4358 of file AutoUpgrade.cpp.

References llvm::CallBase::args(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::StringSwitch< T, R >::Case(), llvm::dbgs(), llvm::StringSwitch< T, R >::Default(), llvm::SmallVectorTemplateCommon< T, typename >::end(), F, llvm::ConstantAggregateZero::get(), llvm::FixedVectorType::get(), llvm::ScalableVectorType::get(), llvm::Type::getBFloatTy(), llvm::Value::getName(), llvm::User::getOperand(), getType(), llvm::Value::getType(), llvm_unreachable, and llvm::Intrinsic::not_intrinsic.

Referenced by llvm::UpgradeIntrinsicCall().

upgradeAbs()

upgradeAMDGCNIntrinsicCall()

Definition at line 4505 of file AutoUpgrade.cpp.

References llvm::MDBuilder::createRange(), llvm::dyn_cast(), F, llvm::AtomicRMWInst::FAdd, llvm::AMDGPUAS::FLAT_ADDRESS, llvm::AtomicRMWInst::FMax, llvm::AtomicRMWInst::FMin, llvm::MDNode::get(), llvm::VectorType::get(), llvm::CallBase::getArgOperand(), llvm::Type::getBFloatTy(), llvm::User::getNumOperands(), llvm::Value::getType(), llvm::ConstantInt::getZExtValue(), llvm::Type::isFloatTy(), llvm::isValidAtomicOrdering(), llvm::ConstantInt::isZero(), llvm::AMDGPUAS::LOCAL_ADDRESS, llvm::NotAtomic, llvm::AMDGPUAS::PRIVATE_ADDRESS, llvm::SequentiallyConsistent, llvm::Instruction::setMetadata(), llvm::AtomicRMWInst::setVolatile(), llvm::StringSwitch< T, R >::StartsWith(), llvm::AtomicRMWInst::UDecWrap, llvm::AtomicRMWInst::UIncWrap, and llvm::Unordered.

Referenced by llvm::UpgradeIntrinsicCall().

upgradeARMIntrinsicCall()

Definition at line 4415 of file AutoUpgrade.cpp.

References AbstractManglingParser< Derived, Alloc >::Ops, llvm::CallBase::args(), F, llvm::FixedVectorType::get(), llvm::VectorType::get(), llvm::CallBase::getArgOperand(), llvm::CallBase::getIntrinsicID(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Value::getType(), and llvm_unreachable.

Referenced by llvm::UpgradeIntrinsicCall().

upgradeArmOrAarch64IntrinsicFunction()

Definition at line 707 of file AutoUpgrade.cpp.

References assert(), llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Cases(), llvm::cast(), llvm::Default, llvm::StringSwitch< T, R >::Default(), llvm::dyn_cast(), F, llvm::FixedVectorType::get(), llvm::VectorType::get(), llvm::Type::getBFloatTy(), llvm::Intrinsic::getOrInsertDeclaration(), Groups, llvm::Regex::match(), llvm::Intrinsic::not_intrinsic, rename(), llvm::size(), and llvm::StringSwitch< T, R >::StartsWith().

Referenced by upgradeIntrinsicFunction1().

upgradeAVX512MaskToSelect()

upgradeDbgIntrinsicToDbgRecord()

Convert debug intrinsic calls to non-instruction debug records.

Name - Final part of the intrinsic name, e.g. 'value' in llvm.dbg.value. CI - The debug intrinsic call.

Definition at line 4626 of file AutoUpgrade.cpp.

References llvm::DIExpression::append(), llvm::CallBase::arg_size(), assert(), llvm::DbgVariableRecord::Assign, llvm::DbgLabelRecord::createUnresolvedDbgLabelRecord(), llvm::DbgVariableRecord::createUnresolvedDbgVariableRecord(), llvm::DbgVariableRecord::Declare, llvm::dyn_cast(), llvm::dyn_cast_or_null(), llvm::CallBase::getArgOperand(), llvm::Instruction::getDebugLoc(), getDebugLocSafe(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::Offset, unwrapMAVMetadataOp(), unwrapMAVOp(), and llvm::DbgVariableRecord::Value.

Referenced by llvm::UpgradeIntrinsicCall().

upgradeIntrinsicFunction1()

Definition at line 1184 of file AutoUpgrade.cpp.

References assert(), llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Cases(), consumeNVVMPtrAddrSpace(), llvm::Default, llvm::StringSwitch< T, R >::Default(), F, llvm::Intrinsic::getOrInsertDeclaration(), Groups, llvm::Intrinsic::not_intrinsic, llvm::SmallVectorTemplateBase< T, bool >::push_back(), R2, rename(), shouldUpgradeNVPTXBF16Intrinsic(), shouldUpgradeNVPTXSharedClusterIntrinsic(), shouldUpgradeNVPTXTMAG2SIntrinsics(), llvm::StringSwitch< T, R >::StartsWith(), upgradeArmOrAarch64IntrinsicFunction(), and upgradeX86IntrinsicFunction().

Referenced by llvm::UpgradeIntrinsicFunction().

upgradeLoopArgument()

upgradeLoopTag()

upgradeMaskedCompare()

Definition at line 2234 of file AutoUpgrade.cpp.

References applyX86MaskOn1BitsVec(), llvm::CallBase::arg_size(), llvm::cast(), llvm::FixedVectorType::get(), llvm::Constant::getAllOnesValue(), llvm::CallBase::getArgOperand(), llvm::Constant::getNullValue(), llvm::Value::getType(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm_unreachable, and Signed.

Referenced by upgradeX86IntrinsicCall().

upgradeMaskedLoad()

upgradeMaskedMove()

upgradeMaskedStore()

upgradeMaskToInt()

upgradeNVVMFnVectorAttr()

Definition at line 5536 of file AutoUpgrade.cpp.

References llvm::ArrayRef(), assert(), llvm::cast(), llvm::StringRef::empty(), llvm::mdconst::extract(), F, llvm::join(), llvm::Length, llvm::StringRef::split(), llvm::StringRef::trim(), and llvm::utostr().

Referenced by upgradeSingleNVVMAnnotation().

upgradeNVVMIntrinsicCall()

Definition at line 2544 of file AutoUpgrade.cpp.

References llvm::Function::arg_size(), llvm::cast(), consumeNVVMPtrAddrSpace(), F, llvm::AtomicRMWInst::FAdd, llvm::FixedVectorType::get(), llvm::MDNode::get(), llvm::Function::getArg(), llvm::CallBase::getArgOperand(), llvm::Type::getBFloatTy(), llvm::Type::getInt64Ty(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::Intrinsic::getOrInsertDeclaration(), llvm::Type::getScalarType(), llvm::Value::getType(), I, llvm::Type::isBFloatTy(), llvm::Type::isIntegerTy(), llvm::Intrinsic::not_intrinsic, rename(), llvm::SequentiallyConsistent, llvm::FastMathFlags::setApproxFunc(), shouldUpgradeNVPTXBF16Intrinsic(), llvm::AtomicRMWInst::UDecWrap, and llvm::AtomicRMWInst::UIncWrap.

Referenced by llvm::UpgradeIntrinsicCall().

upgradePMULDQ()

upgradePTESTIntrinsic()

upgradeRetainReleaseMarker()

bool upgradeRetainReleaseMarker ( Module & M) static

upgradeSingleNVVMAnnotation()

upgradeX86ALIGNIntrinsics()

upgradeX86BF16DPIntrinsic()

upgradeX86BF16Intrinsic()

upgradeX86BinaryIntrinsics()

upgradeX86ConcatShift()

upgradeX86IntrinsicCall()

Definition at line 2706 of file AutoUpgrade.cpp.

References A(), AbstractManglingParser< Derived, Alloc >::Ops, llvm::Aligned, applyX86MaskOn1BitsVec(), llvm::CallBase::arg_size(), llvm::CallBase::args(), llvm::ArrayRef(), assert(), B(), llvm::CallingConv::C, llvm::cast(), llvm::Data, emitX86ScalarSelect(), emitX86Select(), F, llvm::ConstantAggregateZero::get(), llvm::ConstantAsMetadata::get(), llvm::FixedVectorType::get(), llvm::MDNode::get(), llvm::PoisonValue::get(), llvm::VectorType::get(), llvm::Constant::getAllOnesValue(), llvm::CallBase::getArgOperand(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getFixedValue(), llvm::Type::getHalfTy(), llvm::Type::getInt32Ty(), llvm::Type::getInt64Ty(), llvm::VectorType::getInteger(), llvm::Instruction::getModule(), llvm::Constant::getNullValue(), getNumElements(), llvm::User::getOperand(), llvm::Intrinsic::getOrInsertDeclaration(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::ShuffleVectorInst::getShuffleMask(), getType(), llvm::Value::getType(), getX86MaskVec(), High, I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::isa(), llvm::Type::isIntegerTy(), LHS, llvm_unreachable, llvm::Offset, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::Value::replaceAllUsesWith(), RHS, llvm::Instruction::setMetadata(), Size, std::swap(), upgradeAbs(), upgradeAVX512MaskToSelect(), upgradeMaskedCompare(), upgradeMaskedLoad(), upgradeMaskedMove(), upgradeMaskedStore(), upgradeMaskToInt(), upgradePMULDQ(), upgradeX86ALIGNIntrinsics(), upgradeX86BinaryIntrinsics(), upgradeX86ConcatShift(), upgradeX86MaskedShift(), upgradeX86PSLLDQIntrinsics(), upgradeX86PSRLDQIntrinsics(), upgradeX86Rotate(), upgradeX86vpcom(), and upgradeX86VPERMT2Intrinsics().

Referenced by llvm::UpgradeIntrinsicCall().

upgradeX86IntrinsicFunction()

Definition at line 515 of file AutoUpgrade.cpp.

References llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), F, llvm::Intrinsic::getOrInsertDeclaration(), llvm::Intrinsic::not_intrinsic, rename(), shouldUpgradeX86Intrinsic(), upgradePTESTIntrinsic(), upgradeX86BF16DPIntrinsic(), upgradeX86BF16Intrinsic(), upgradeX86IntrinsicsWith8BitMask(), upgradeX86MaskedFPCompare(), and upgradeX86MultiplyAddBytes().

Referenced by upgradeIntrinsicFunction1().

upgradeX86IntrinsicsWith8BitMask()

upgradeX86MaskedFPCompare()

upgradeX86MaskedShift()

upgradeX86MultiplyAddBytes()

upgradeX86PSLLDQIntrinsics()

upgradeX86PSRLDQIntrinsics()

upgradeX86Rotate()

upgradeX86vpcom()

Definition at line 2061 of file AutoUpgrade.cpp.

References llvm::Constant::getAllOnesValue(), llvm::CallBase::getArgOperand(), llvm::Constant::getNullValue(), llvm::Value::getType(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, LHS, llvm_unreachable, and RHS.

Referenced by upgradeX86IntrinsicCall().

upgradeX86VPERMT2Intrinsics()

DisableAutoUpgradeDebugInfo