LLVM  8.0.1
Functions
AutoUpgrade.cpp File Reference
#include "llvm/IR/AutoUpgrade.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Regex.h"
#include <cstring>
Include dependency graph for AutoUpgrade.cpp:

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 ShouldUpgradeX86Intrinsic (Function *F, StringRef Name)
 
static bool UpgradeX86IntrinsicFunction (Function *F, StringRef Name, Function *&NewFn)
 
static bool UpgradeIntrinsicFunction1 (Function *F, Function *&NewFn)
 
static ValueUpgradeX86PSLLDQIntrinsics (IRBuilder<> &Builder, Value *Op, unsigned Shift)
 
static ValueUpgradeX86PSRLDQIntrinsics (IRBuilder<> &Builder, Value *Op, unsigned Shift)
 
static ValuegetX86MaskVec (IRBuilder<> &Builder, Value *Mask, unsigned NumElts)
 
static ValueEmitX86Select (IRBuilder<> &Builder, Value *Mask, Value *Op0, Value *Op1)
 
static ValueEmitX86ScalarSelect (IRBuilder<> &Builder, Value *Mask, Value *Op0, Value *Op1)
 
static ValueUpgradeX86ALIGNIntrinsics (IRBuilder<> &Builder, Value *Op0, Value *Op1, Value *Shift, Value *Passthru, Value *Mask, bool IsVALIGN)
 
static ValueUpgradeX86VPERMT2Intrinsics (IRBuilder<> &Builder, CallInst &CI, bool ZeroMask, bool IndexForm)
 
static ValueUpgradeX86AddSubSatIntrinsics (IRBuilder<> &Builder, CallInst &CI, bool IsSigned, bool IsAddition)
 
static ValueupgradeX86Rotate (IRBuilder<> &Builder, CallInst &CI, bool IsRotateRight)
 
static ValueupgradeX86ConcatShift (IRBuilder<> &Builder, CallInst &CI, bool IsShiftRight, bool ZeroMask)
 
static ValueUpgradeMaskedStore (IRBuilder<> &Builder, Value *Ptr, Value *Data, Value *Mask, bool Aligned)
 
static ValueUpgradeMaskedLoad (IRBuilder<> &Builder, Value *Ptr, Value *Passthru, Value *Mask, bool Aligned)
 
static ValueupgradeAbs (IRBuilder<> &Builder, CallInst &CI)
 
static ValueupgradeIntMinMax (IRBuilder<> &Builder, CallInst &CI, ICmpInst::Predicate Pred)
 
static ValueupgradePMULDQ (IRBuilder<> &Builder, CallInst &CI, bool IsSigned)
 
static ValueApplyX86MaskOn1BitsVec (IRBuilder<> &Builder, Value *Vec, Value *Mask)
 
static ValueupgradeMaskedCompare (IRBuilder<> &Builder, CallInst &CI, unsigned CC, bool Signed)
 
static ValueUpgradeX86MaskedShift (IRBuilder<> &Builder, CallInst &CI, Intrinsic::ID IID)
 
static ValueupgradeMaskedMove (IRBuilder<> &Builder, CallInst &CI)
 
static ValueUpgradeMaskToInt (IRBuilder<> &Builder, CallInst &CI)
 
static bool upgradeAVX512MaskToSelect (StringRef Name, IRBuilder<> &Builder, CallInst &CI, Value *&Rep)
 
static bool isOldLoopArgument (Metadata *MD)
 
static MDStringupgradeLoopTag (LLVMContext &C, StringRef OldTag)
 
static MetadataupgradeLoopArgument (Metadata *MD)
 

Function Documentation

◆ ApplyX86MaskOn1BitsVec()

static Value* ApplyX86MaskOn1BitsVec ( IRBuilder<> &  Builder,
Value Vec,
Value Mask 
)
static

◆ EmitX86ScalarSelect()

static Value* EmitX86ScalarSelect ( IRBuilder<> &  Builder,
Value Mask,
Value Op0,
Value Op1 
)
static

◆ EmitX86Select()

static Value* EmitX86Select ( IRBuilder<> &  Builder,
Value Mask,
Value Op0,
Value Op1 
)
static

◆ getX86MaskVec()

static Value* getX86MaskVec ( IRBuilder<> &  Builder,
Value Mask,
unsigned  NumElts 
)
static

◆ isOldLoopArgument()

static bool isOldLoopArgument ( Metadata MD)
static

Definition at line 3771 of file AutoUpgrade.cpp.

Referenced by llvm::upgradeInstructionLoopAttachment().

◆ rename()

static void rename ( GlobalValue GV)
static

◆ ShouldUpgradeX86Intrinsic()

static bool ShouldUpgradeX86Intrinsic ( Function F,
StringRef  Name 
)
static

◆ upgradeAbs()

static Value* upgradeAbs ( IRBuilder<> &  Builder,
CallInst CI 
)
static

◆ upgradeAVX512MaskToSelect()

static bool upgradeAVX512MaskToSelect ( StringRef  Name,
IRBuilder<> &  Builder,
CallInst CI,
Value *&  Rep 
)
static

Definition at line 1272 of file AutoUpgrade.cpp.

References llvm::CallBase::arg_operands(), llvm::AMDGPU::HSAMD::Kernel::Key::Args, llvm::IRBuilder< T, Inserter >::CreateCall(), EmitX86Select(), llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::Instruction::getModule(), llvm::CallBase::getNumArgOperands(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::isFPOrFPVectorTy(), llvm_unreachable, llvm::StringRef::startswith(), llvm::StringRef::substr(), llvm::Intrinsic::x86_avx2_packssdw, llvm::Intrinsic::x86_avx2_packsswb, llvm::Intrinsic::x86_avx2_packusdw, llvm::Intrinsic::x86_avx2_packuswb, llvm::Intrinsic::x86_avx2_permd, llvm::Intrinsic::x86_avx2_permps, llvm::Intrinsic::x86_avx2_pmadd_ub_sw, llvm::Intrinsic::x86_avx2_pmadd_wd, llvm::Intrinsic::x86_avx2_pmul_hr_sw, llvm::Intrinsic::x86_avx2_pmulh_w, llvm::Intrinsic::x86_avx2_pmulhu_w, llvm::Intrinsic::x86_avx2_pshuf_b, llvm::Intrinsic::x86_avx512_dbpsadbw_128, llvm::Intrinsic::x86_avx512_dbpsadbw_256, llvm::Intrinsic::x86_avx512_dbpsadbw_512, llvm::Intrinsic::x86_avx512_packssdw_512, llvm::Intrinsic::x86_avx512_packsswb_512, llvm::Intrinsic::x86_avx512_packusdw_512, llvm::Intrinsic::x86_avx512_packuswb_512, llvm::Intrinsic::x86_avx512_permvar_df_256, llvm::Intrinsic::x86_avx512_permvar_df_512, llvm::Intrinsic::x86_avx512_permvar_di_256, llvm::Intrinsic::x86_avx512_permvar_di_512, llvm::Intrinsic::x86_avx512_permvar_hi_128, llvm::Intrinsic::x86_avx512_permvar_hi_256, llvm::Intrinsic::x86_avx512_permvar_hi_512, llvm::Intrinsic::x86_avx512_permvar_qi_128, llvm::Intrinsic::x86_avx512_permvar_qi_256, llvm::Intrinsic::x86_avx512_permvar_qi_512, llvm::Intrinsic::x86_avx512_permvar_sf_512, llvm::Intrinsic::x86_avx512_permvar_si_512, llvm::Intrinsic::x86_avx512_pmaddubs_w_512, llvm::Intrinsic::x86_avx512_pmaddw_d_512, llvm::Intrinsic::x86_avx512_pmul_hr_sw_512, llvm::Intrinsic::x86_avx512_pmulh_w_512, llvm::Intrinsic::x86_avx512_pmulhu_w_512, llvm::Intrinsic::x86_avx512_pmultishift_qb_128, llvm::Intrinsic::x86_avx512_pmultishift_qb_256, llvm::Intrinsic::x86_avx512_pmultishift_qb_512, llvm::Intrinsic::x86_avx512_pshuf_b_512, llvm::Intrinsic::x86_avx512_vpermilvar_pd_512, llvm::Intrinsic::x86_avx512_vpermilvar_ps_512, llvm::Intrinsic::x86_avx_cvt_pd2_ps_256, llvm::Intrinsic::x86_avx_cvt_pd2dq_256, llvm::Intrinsic::x86_avx_cvtt_pd2dq_256, llvm::Intrinsic::x86_avx_cvtt_ps2dq_256, llvm::Intrinsic::x86_avx_max_pd_256, llvm::Intrinsic::x86_avx_max_ps_256, llvm::Intrinsic::x86_avx_min_pd_256, llvm::Intrinsic::x86_avx_min_ps_256, llvm::Intrinsic::x86_avx_vpermilvar_pd, llvm::Intrinsic::x86_avx_vpermilvar_pd_256, llvm::Intrinsic::x86_avx_vpermilvar_ps, llvm::Intrinsic::x86_avx_vpermilvar_ps_256, llvm::Intrinsic::x86_sse2_cvttps2dq, llvm::Intrinsic::x86_sse2_max_pd, llvm::Intrinsic::x86_sse2_min_pd, llvm::Intrinsic::x86_sse2_packssdw_128, llvm::Intrinsic::x86_sse2_packsswb_128, llvm::Intrinsic::x86_sse2_packuswb_128, llvm::Intrinsic::x86_sse2_pmadd_wd, llvm::Intrinsic::x86_sse2_pmulh_w, llvm::Intrinsic::x86_sse2_pmulhu_w, llvm::Intrinsic::x86_sse41_packusdw, llvm::Intrinsic::x86_sse_max_ps, llvm::Intrinsic::x86_sse_min_ps, llvm::Intrinsic::x86_ssse3_pmadd_ub_sw_128, llvm::Intrinsic::x86_ssse3_pmul_hr_sw_128, and llvm::Intrinsic::x86_ssse3_pshuf_b_128.

◆ upgradeIntMinMax()

static Value* upgradeIntMinMax ( IRBuilder<> &  Builder,
CallInst CI,
ICmpInst::Predicate  Pred 
)
static

◆ UpgradeIntrinsicFunction1()

static bool UpgradeIntrinsicFunction1 ( Function F,
Function *&  NewFn 
)
static

Definition at line 480 of file AutoUpgrade.cpp.

References llvm::Function::arg_begin(), llvm::Function::arg_size(), llvm::AMDGPU::HSAMD::Kernel::Key::Args, llvm::Intrinsic::arm_neon_vst1, llvm::Intrinsic::arm_neon_vst2, llvm::Intrinsic::arm_neon_vst2lane, llvm::Intrinsic::arm_neon_vst3, llvm::Intrinsic::arm_neon_vst3lane, llvm::Intrinsic::arm_neon_vst4, llvm::Intrinsic::arm_neon_vst4lane, assert(), llvm::Intrinsic::bitreverse, llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Cases(), llvm::Function::Create(), llvm::Intrinsic::ctlz, llvm::Intrinsic::ctpop, llvm::Intrinsic::cttz, llvm::Intrinsic::dbg_value, llvm::StringSwitch< T, R >::Default(), llvm::StringRef::find(), llvm::FunctionType::get(), llvm::GlobalValue::getAddressSpace(), llvm::Function::getContext(), llvm::Intrinsic::getDeclaration(), llvm::Function::getFunctionType(), llvm::Type::getInt1Ty(), llvm::GlobalValue::getLinkage(), llvm::Intrinsic::getName(), llvm::Value::getName(), llvm::GlobalValue::getParent(), llvm::Function::getReturnType(), llvm::Value::getType(), llvm::Intrinsic::invariant_end, llvm::Intrinsic::invariant_start, llvm::Intrinsic::launder_invariant_group, llvm::Intrinsic::lifetime_end, llvm::Intrinsic::lifetime_start, llvm::Intrinsic::masked_gather, llvm::Intrinsic::masked_load, llvm::Intrinsic::masked_scatter, llvm::Intrinsic::masked_store, llvm::Regex::match(), llvm::Intrinsic::memcpy, llvm::Intrinsic::memmove, llvm::Intrinsic::memset, Name, llvm::None, llvm::Intrinsic::not_intrinsic, llvm::StringRef::npos, llvm::Intrinsic::objectsize, llvm::FunctionType::params(), llvm::Intrinsic::remangleIntrinsicFunction(), rename(), llvm::StringRef::size(), llvm::StringRef::startswith(), llvm::StringRef::substr(), llvm::Intrinsic::thread_pointer, and UpgradeX86IntrinsicFunction().

Referenced by llvm::UpgradeIntrinsicFunction().

◆ upgradeLoopArgument()

static Metadata* upgradeLoopArgument ( Metadata MD)
static

◆ upgradeLoopTag()

static MDString* upgradeLoopTag ( LLVMContext C,
StringRef  OldTag 
)
static

◆ upgradeMaskedCompare()

static Value* upgradeMaskedCompare ( IRBuilder<> &  Builder,
CallInst CI,
unsigned  CC,
bool  Signed 
)
static

◆ UpgradeMaskedLoad()

static Value* UpgradeMaskedLoad ( IRBuilder<> &  Builder,
Value Ptr,
Value Passthru,
Value Mask,
bool  Aligned 
)
static

◆ upgradeMaskedMove()

static Value* upgradeMaskedMove ( IRBuilder<> &  Builder,
CallInst CI 
)
static

◆ UpgradeMaskedStore()

static Value* UpgradeMaskedStore ( IRBuilder<> &  Builder,
Value Ptr,
Value Data,
Value Mask,
bool  Aligned 
)
static

◆ UpgradeMaskToInt()

static Value* UpgradeMaskToInt ( IRBuilder<> &  Builder,
CallInst CI 
)
static

◆ upgradePMULDQ()

static Value* upgradePMULDQ ( IRBuilder<> &  Builder,
CallInst CI,
bool  IsSigned 
)
static

◆ UpgradePTESTIntrinsic()

static bool UpgradePTESTIntrinsic ( Function F,
Intrinsic::ID  IID,
Function *&  NewFn 
)
static

◆ UpgradeX86AddSubSatIntrinsics()

static Value* UpgradeX86AddSubSatIntrinsics ( IRBuilder<> &  Builder,
CallInst CI,
bool  IsSigned,
bool  IsAddition 
)
static

◆ UpgradeX86ALIGNIntrinsics()

static Value* UpgradeX86ALIGNIntrinsics ( IRBuilder<> &  Builder,
Value Op0,
Value Op1,
Value Shift,
Value Passthru,
Value Mask,
bool  IsVALIGN 
)
static

◆ upgradeX86ConcatShift()

static Value* upgradeX86ConcatShift ( IRBuilder<> &  Builder,
CallInst CI,
bool  IsShiftRight,
bool  ZeroMask 
)
static

◆ UpgradeX86IntrinsicFunction()

static bool UpgradeX86IntrinsicFunction ( Function F,
StringRef  Name,
Function *&  NewFn 
)
static

◆ UpgradeX86IntrinsicsWith8BitMask()

static bool UpgradeX86IntrinsicsWith8BitMask ( Function F,
Intrinsic::ID  IID,
Function *&  NewFn 
)
static

◆ UpgradeX86MaskedShift()

static Value* UpgradeX86MaskedShift ( IRBuilder<> &  Builder,
CallInst CI,
Intrinsic::ID  IID 
)
static

◆ UpgradeX86PSLLDQIntrinsics()

static Value* UpgradeX86PSLLDQIntrinsics ( IRBuilder<> &  Builder,
Value Op,
unsigned  Shift 
)
static

◆ UpgradeX86PSRLDQIntrinsics()

static Value* UpgradeX86PSRLDQIntrinsics ( IRBuilder<> &  Builder,
Value Op,
unsigned  Shift 
)
static

◆ upgradeX86Rotate()

static Value* upgradeX86Rotate ( IRBuilder<> &  Builder,
CallInst CI,
bool  IsRotateRight 
)
static

◆ UpgradeX86VPERMT2Intrinsics()

static Value* UpgradeX86VPERMT2Intrinsics ( IRBuilder<> &  Builder,
CallInst CI,
bool  ZeroMask,
bool  IndexForm 
)
static