LLVM  8.0.1
Macros | Functions | Variables
InstCombineCalls.cpp File Reference
#include "InstCombineInternal.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Statepoint.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/InstCombine/InstCombineWorklist.h"
#include "llvm/Transforms/Utils/SimplifyLibCalls.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <utility>
#include <vector>

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "instcombine"
 

Functions

 STATISTIC (NumSimplified, "Number of library calls simplified")
 
static TypegetPromotedType (Type *Ty)
 Return the specified type promoted as it would be to pass though a va_arg area. More...
 
static ConstantgetNegativeIsTrueBoolVec (ConstantDataVector *V)
 Return a constant boolean vector that has true elements in all positions where the input constant data vector has an element with the sign bit set. More...
 
static ValuesimplifyX86immShift (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyX86varShift (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyX86pack (IntrinsicInst &II, bool IsSigned)
 
static ValuesimplifyX86round (IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyX86movmsk (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyX86insertps (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyX86extrq (IntrinsicInst &II, Value *Op0, ConstantInt *CILength, ConstantInt *CIIndex, InstCombiner::BuilderTy &Builder)
 Attempt to simplify SSE4A EXTRQ/EXTRQI instructions using constant folding or conversion to a shuffle vector. More...
 
static ValuesimplifyX86insertq (IntrinsicInst &II, Value *Op0, Value *Op1, APInt APLength, APInt APIndex, InstCombiner::BuilderTy &Builder)
 Attempt to simplify SSE4A INSERTQ/INSERTQI instructions using constant folding or conversion to a shuffle vector. More...
 
static ValuesimplifyX86pshufb (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert pshufb* to shufflevector if the mask is constant. More...
 
static ValuesimplifyX86vpermilvar (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert vpermilvar* to shufflevector if the mask is constant. More...
 
static ValuesimplifyX86vpermv (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert vpermd/vpermps to shufflevector if the mask is constant. More...
 
static ValuesimplifyX86vpcom (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder, bool IsSigned)
 Decode XOP integer vector comparison intrinsics. More...
 
static bool maskIsAllOneOrUndef (Value *Mask)
 
static ValuesimplifyMaskedLoad (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static InstructionsimplifyMaskedStore (IntrinsicInst &II, InstCombiner &IC)
 
static InstructionsimplifyMaskedGather (IntrinsicInst &II, InstCombiner &IC)
 
static InstructionsimplifyInvariantGroupIntrinsic (IntrinsicInst &II, InstCombiner &IC)
 This function transforms launder.invariant.group and strip.invariant.group like: launder(launder(x)) -> launder(x) (the result is not the argument) launder(strip(x)) -> launder(x) strip(strip(x)) -> strip(x) (the result is not the argument) strip(launder(x)) -> strip(x) This is legal because it preserves the most recent information about the presence or absence of invariant.group. More...
 
static InstructionsimplifyMaskedScatter (IntrinsicInst &II, InstCombiner &IC)
 
static InstructionfoldCttzCtlz (IntrinsicInst &II, InstCombiner &IC)
 
static InstructionfoldCtpop (IntrinsicInst &II, InstCombiner &IC)
 
static InstructionsimplifyX86MaskedLoad (IntrinsicInst &II, InstCombiner &IC)
 
static bool simplifyX86MaskedStore (IntrinsicInst &II, InstCombiner &IC)
 
static APFloat fmed3AMDGCN (const APFloat &Src0, const APFloat &Src1, const APFloat &Src2)
 
static ValuesimplifyNeonTbl1 (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Convert a table lookup to shufflevector if the mask is constant. More...
 
static ValuesimplifyNeonVld1 (const IntrinsicInst &II, unsigned MemAlign, InstCombiner::BuilderTy &Builder)
 Convert a vector load intrinsic into a simple llvm load instruction. More...
 
static bool haveSameOperands (const IntrinsicInst &I, const IntrinsicInst &E, unsigned NumOperands)
 
static bool removeTriviallyEmptyRange (IntrinsicInst &I, unsigned StartID, unsigned EndID, InstCombiner &IC)
 
static InstructionSimplifyNVVMIntrinsic (IntrinsicInst *II, InstCombiner &IC)
 
static InstructioncanonicalizeConstantArg0ToArg1 (CallInst &Call)
 
static bool isSafeToEliminateVarargsCast (const CallSite CS, const DataLayout &DL, const CastInst *const CI, const int ix)
 If this cast does not affect the value passed through the varargs area, we can eliminate the use of the cast. More...
 
static IntrinsicInstfindInitTrampolineFromAlloca (Value *TrampMem)
 
static IntrinsicInstfindInitTrampolineFromBB (IntrinsicInst *AdjustTramp, Value *TrampMem)
 
static IntrinsicInstfindInitTrampoline (Value *Callee)
 

Variables

static cl::opt< unsignedGuardWideningWindow ("instcombine-guard-widening-window", cl::init(3), cl::desc("How wide an instruction window to bypass looking for " "another guard"))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "instcombine"

Definition at line 72 of file InstCombineCalls.cpp.

Function Documentation

◆ canonicalizeConstantArg0ToArg1()

static Instruction* canonicalizeConstantArg0ToArg1 ( CallInst Call)
static

◆ findInitTrampoline()

static IntrinsicInst* findInitTrampoline ( Value Callee)
static

Definition at line 4169 of file InstCombineCalls.cpp.

References llvm::AttributeList::addParamAttribute(), llvm::Intrinsic::adjust_trampoline, llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_begin(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_end(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::arg_size(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::args(), llvm::AMDGPU::HSAMD::Kernel::Key::Args, assert(), llvm::AMDGPU::HSAMD::Kernel::Key::Attrs, llvm::Attribute::ByVal, Callee, llvm::CallInst::Create(), llvm::InvokeInst::Create(), llvm::CastInst::CreateBitOrPointerCast(), llvm::dbgs(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::doesNotThrow(), llvm::dyn_cast(), E, llvm::SmallVectorBase::empty(), llvm::Instruction::extractProfTotalWeight(), findInitTrampolineFromAlloca(), findInitTrampolineFromBB(), llvm::Attribute::get(), llvm::FunctionType::get(), llvm::AttributeSet::get(), llvm::AttributeList::get(), llvm::UndefValue::get(), llvm::CallBase::getArgOperand(), llvm::Function::getAttributes(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getAttributes(), llvm::ConstantExpr::getBitCast(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledValue(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCallingConv(), llvm::CastInst::getCastOpcode(), llvm::Value::getContext(), llvm::Instruction::getDebugLoc(), llvm::PointerType::getElementType(), llvm::AttributeList::getFnAttributes(), llvm::Instruction::getFunction(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), llvm::Type::getInt1PtrTy(), llvm::IntrinsicInst::getIntrinsicID(), llvm::Constant::getNullValue(), llvm::FunctionType::getNumParams(), llvm::User::getOperand(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getOperandBundlesAsDefs(), llvm::AttributeList::getParamAttributes(), llvm::FunctionType::getParamType(), llvm::Type::getPointerElementType(), getPromotedType(), llvm::FunctionType::getReturnType(), llvm::ConstantInt::getTrue(), llvm::Value::getType(), llvm::GlobalValue::getType(), llvm::PointerType::getUnqual(), llvm::GlobalValue::getValueType(), llvm::AttributeSet::hasAttribute(), llvm::AttributeList::hasAttrSomewhere(), llvm::AttributeList::hasParamAttribute(), llvm::Value::hasValueHandle(), I, llvm::Attribute::InAlloca, llvm::isAllocLikeFn(), llvm::CastInst::isBitOrNoopPointerCastable(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::isConvergent(), llvm::AttributeList::isEmpty(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::isInAllocaArgument(), llvm::isKnownNonZero(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::isMustTailCall(), isSafeToEliminateVarargsCast(), llvm::Type::isSized(), llvm::Type::isStructTy(), llvm::FunctionType::isVarArg(), llvm::Type::isVoidTy(), IT, LLVM_DEBUG, NC, llvm::Attribute::Nest, llvm::Attribute::NonNull, llvm::NullPointerIsDefined(), llvm::AttrBuilder::overlaps(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::paramHasAttr(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::AttrBuilder::remove(), llvm::SmallVectorImpl< T >::reserve(), llvm::AttributeList::ReturnIndex, llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::setAttributes(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::setCalledFunction(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::setCallingConv(), llvm::Instruction::setDebugLoc(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::setDoesNotThrow(), llvm::Value::setName(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::setNotConvergent(), llvm::SmallVectorBase::size(), llvm::Value::stripPointerCasts(), llvm::Attribute::StructRet, llvm::AttributeFuncs::typeIncompatible(), llvm::Value::use_empty(), llvm::Value::users(), llvm::ValueHandleBase::ValueIsDeleted(), llvm::ValueHandleBase::ValueIsRAUWd(), and llvm::RISCVFenceField::W.

◆ findInitTrampolineFromAlloca()

static IntrinsicInst* findInitTrampolineFromAlloca ( Value TrampMem)
static

◆ findInitTrampolineFromBB()

static IntrinsicInst* findInitTrampolineFromBB ( IntrinsicInst AdjustTramp,
Value TrampMem 
)
static

◆ fmed3AMDGCN()

static APFloat fmed3AMDGCN ( const APFloat Src0,
const APFloat Src1,
const APFloat Src2 
)
static

◆ foldCtpop()

static Instruction* foldCtpop ( IntrinsicInst II,
InstCombiner IC 
)
static

◆ foldCttzCtlz()

static Instruction* foldCttzCtlz ( IntrinsicInst II,
InstCombiner IC 
)
static

◆ getNegativeIsTrueBoolVec()

static Constant* getNegativeIsTrueBoolVec ( ConstantDataVector V)
static

◆ getPromotedType()

static Type* getPromotedType ( Type Ty)
static

Return the specified type promoted as it would be to pass though a va_arg area.

Definition at line 84 of file InstCombineCalls.cpp.

References llvm::Type::getContext(), and llvm::Type::getInt32Ty().

Referenced by findInitTrampoline().

◆ haveSameOperands()

static bool haveSameOperands ( const IntrinsicInst I,
const IntrinsicInst E,
unsigned  NumOperands 
)
static

◆ isSafeToEliminateVarargsCast()

static bool isSafeToEliminateVarargsCast ( const CallSite  CS,
const DataLayout DL,
const CastInst *const  CI,
const int  ix 
)
static

◆ maskIsAllOneOrUndef()

static bool maskIsAllOneOrUndef ( Value Mask)
static

Definition at line 1176 of file InstCombineCalls.cpp.

References llvm::dyn_cast(), E, I, and llvm::BitmaskEnumDetail::Mask().

Referenced by simplifyMaskedLoad().

◆ removeTriviallyEmptyRange()

static bool removeTriviallyEmptyRange ( IntrinsicInst I,
unsigned  StartID,
unsigned  EndID,
InstCombiner IC 
)
static

◆ simplifyInvariantGroupIntrinsic()

static Instruction* simplifyInvariantGroupIntrinsic ( IntrinsicInst II,
InstCombiner IC 
)
static

This function transforms launder.invariant.group and strip.invariant.group like: launder(launder(x)) -> launder(x) (the result is not the argument) launder(strip(x)) -> launder(x) strip(strip(x)) -> strip(x) (the result is not the argument) strip(launder(x)) -> strip(x) This is legal because it preserves the most recent information about the presence or absence of invariant.group.

Definition at line 1241 of file InstCombineCalls.cpp.

References Arg, llvm::InstCombiner::Builder, llvm::IRBuilder< T, Inserter >::CreateAddrSpaceCast(), llvm::IRBuilder< T, Inserter >::CreateBitCast(), llvm::IRBuilder< T, Inserter >::CreateLaunderInvariantGroup(), llvm::IRBuilder< T, Inserter >::CreateStripInvariantGroup(), llvm::CallBase::getArgOperand(), llvm::IntrinsicInst::getIntrinsicID(), llvm::Type::getPointerAddressSpace(), llvm::Value::getType(), llvm::Intrinsic::launder_invariant_group, llvm_unreachable, llvm::Intrinsic::strip_invariant_group, llvm::Value::stripPointerCasts(), and llvm::Value::stripPointerCastsAndInvariantGroups().

Referenced by llvm::InstCombiner::visitCallInst().

◆ simplifyMaskedGather()

static Instruction* simplifyMaskedGather ( IntrinsicInst II,
InstCombiner IC 
)
static

◆ simplifyMaskedLoad()

static Value* simplifyMaskedLoad ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyMaskedScatter()

static Instruction* simplifyMaskedScatter ( IntrinsicInst II,
InstCombiner IC 
)
static

◆ simplifyMaskedStore()

static Instruction* simplifyMaskedStore ( IntrinsicInst II,
InstCombiner IC 
)
static

◆ simplifyNeonTbl1()

static Value* simplifyNeonTbl1 ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

Convert a table lookup to shufflevector if the mask is constant.

This could benefit tbl1 if the mask is { 7,6,5,4,3,2,1,0 }, in which case we could lower the shufflevector with rev64 instructions as it's actually a byte reverse.

Definition at line 1461 of file InstCombineCalls.cpp.

References C, llvm::IRBuilder< T, Inserter >::CreateShuffleVector(), llvm::dyn_cast(), llvm::ConstantDataVector::get(), llvm::CallBase::getArgOperand(), llvm::Value::getContext(), llvm::Constant::getNullValue(), llvm::Value::getType(), I, llvm::makeArrayRef(), and llvm::NVPTX::PTXLdStInstCode::V2.

Referenced by llvm::InstCombiner::visitCallInst().

◆ simplifyNeonVld1()

static Value* simplifyNeonVld1 ( const IntrinsicInst II,
unsigned  MemAlign,
InstCombiner::BuilderTy Builder 
)
static

Convert a vector load intrinsic into a simple llvm load instruction.

This is beneficial when the underlying object being addressed comes from a constant, since we get constant-folding for free.

Definition at line 1500 of file InstCombineCalls.cpp.

References llvm::IRBuilder< T, Inserter >::CreateAlignedLoad(), llvm::IRBuilder< T, Inserter >::CreateBitCast(), llvm::dyn_cast(), llvm::PointerType::get(), llvm::CallBase::getArgOperand(), llvm::ConstantInt::getLimitedValue(), llvm::Value::getType(), and llvm::isPowerOf2_32().

Referenced by llvm::InstCombiner::visitCallInst().

◆ SimplifyNVVMIntrinsic()

static Instruction* SimplifyNVVMIntrinsic ( IntrinsicInst II,
InstCombiner IC 
)
static

Definition at line 1563 of file InstCombineCalls.cpp.

References llvm::CallBase::arg_operands(), llvm::AMDGPU::HSAMD::Kernel::Key::Args, llvm::Intrinsic::ceil, llvm::BinaryOperator::Create(), llvm::CastInst::Create(), llvm::CallInst::Create(), llvm::Intrinsic::fabs, llvm::Intrinsic::floor, llvm::Intrinsic::fma, FtzEnabled, llvm::ConstantFP::get(), llvm::CallBase::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::Function::getFnAttribute(), llvm::Instruction::getFunction(), llvm::IntrinsicInst::getIntrinsicID(), llvm::Instruction::getModule(), llvm::Value::getName(), llvm::Value::getType(), llvm::Attribute::getValueAsString(), llvm_unreachable, llvm::Intrinsic::maxnum, llvm::Intrinsic::minnum, llvm::Intrinsic::nvvm_add_rn_d, llvm::Intrinsic::nvvm_add_rn_f, llvm::Intrinsic::nvvm_add_rn_ftz_f, llvm::Intrinsic::nvvm_ceil_d, llvm::Intrinsic::nvvm_ceil_f, llvm::Intrinsic::nvvm_ceil_ftz_f, llvm::Intrinsic::nvvm_d2i_rz, llvm::Intrinsic::nvvm_d2ll_rz, llvm::Intrinsic::nvvm_d2ui_rz, llvm::Intrinsic::nvvm_d2ull_rz, llvm::Intrinsic::nvvm_div_rn_d, llvm::Intrinsic::nvvm_div_rn_f, llvm::Intrinsic::nvvm_div_rn_ftz_f, llvm::Intrinsic::nvvm_f2i_rz, llvm::Intrinsic::nvvm_f2ll_rz, llvm::Intrinsic::nvvm_f2ui_rz, llvm::Intrinsic::nvvm_f2ull_rz, llvm::Intrinsic::nvvm_fabs_d, llvm::Intrinsic::nvvm_fabs_f, llvm::Intrinsic::nvvm_fabs_ftz_f, llvm::Intrinsic::nvvm_floor_d, llvm::Intrinsic::nvvm_floor_f, llvm::Intrinsic::nvvm_floor_ftz_f, llvm::Intrinsic::nvvm_fma_rn_d, llvm::Intrinsic::nvvm_fma_rn_f, llvm::Intrinsic::nvvm_fma_rn_ftz_f, llvm::Intrinsic::nvvm_fmax_d, llvm::Intrinsic::nvvm_fmax_f, llvm::Intrinsic::nvvm_fmax_ftz_f, llvm::Intrinsic::nvvm_fmin_d, llvm::Intrinsic::nvvm_fmin_f, llvm::Intrinsic::nvvm_fmin_ftz_f, llvm::Intrinsic::nvvm_i2d_rz, llvm::Intrinsic::nvvm_i2f_rz, llvm::Intrinsic::nvvm_ll2d_rz, llvm::Intrinsic::nvvm_ll2f_rz, llvm::Intrinsic::nvvm_mul_rn_d, llvm::Intrinsic::nvvm_mul_rn_f, llvm::Intrinsic::nvvm_mul_rn_ftz_f, llvm::Intrinsic::nvvm_rcp_rn_d, llvm::Intrinsic::nvvm_rcp_rn_f, llvm::Intrinsic::nvvm_rcp_rn_ftz_f, llvm::Intrinsic::nvvm_round_d, llvm::Intrinsic::nvvm_round_f, llvm::Intrinsic::nvvm_round_ftz_f, llvm::Intrinsic::nvvm_sqrt_f, llvm::Intrinsic::nvvm_sqrt_rn_d, llvm::Intrinsic::nvvm_sqrt_rn_f, llvm::Intrinsic::nvvm_sqrt_rn_ftz_f, llvm::Intrinsic::nvvm_trunc_d, llvm::Intrinsic::nvvm_trunc_f, llvm::Intrinsic::nvvm_trunc_ftz_f, llvm::Intrinsic::nvvm_ui2d_rz, llvm::Intrinsic::nvvm_ui2f_rz, llvm::Intrinsic::nvvm_ull2d_rz, llvm::Intrinsic::nvvm_ull2f_rz, llvm::Intrinsic::round, llvm::Intrinsic::sqrt, and llvm::Intrinsic::trunc.

Referenced by llvm::InstCombiner::visitCallInst().

◆ simplifyX86extrq()

static Value* simplifyX86extrq ( IntrinsicInst II,
Value Op0,
ConstantInt CILength,
ConstantInt CIIndex,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86immShift()

static Value* simplifyX86immShift ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

Definition at line 268 of file InstCombineCalls.cpp.

References assert(), llvm::IRBuilder< T, Inserter >::CreateAShr(), llvm::IRBuilder< T, Inserter >::CreateLShr(), llvm::IRBuilder< T, Inserter >::CreateShl(), llvm::IRBuilder< T, Inserter >::CreateVectorSplat(), llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::ConstantAggregateZero::get(), llvm::CallBase::getArgOperand(), llvm::IntrinsicInst::getIntrinsicID(), llvm::APInt::isNullValue(), llvm_unreachable, llvm::APInt::uge(), llvm::Intrinsic::x86_avx2_psll_d, llvm::Intrinsic::x86_avx2_psll_q, llvm::Intrinsic::x86_avx2_psll_w, llvm::Intrinsic::x86_avx2_pslli_d, llvm::Intrinsic::x86_avx2_pslli_q, llvm::Intrinsic::x86_avx2_pslli_w, llvm::Intrinsic::x86_avx2_psra_d, llvm::Intrinsic::x86_avx2_psra_w, llvm::Intrinsic::x86_avx2_psrai_d, llvm::Intrinsic::x86_avx2_psrai_w, llvm::Intrinsic::x86_avx2_psrl_d, llvm::Intrinsic::x86_avx2_psrl_q, llvm::Intrinsic::x86_avx2_psrl_w, llvm::Intrinsic::x86_avx2_psrli_d, llvm::Intrinsic::x86_avx2_psrli_q, llvm::Intrinsic::x86_avx2_psrli_w, llvm::Intrinsic::x86_avx512_psll_d_512, llvm::Intrinsic::x86_avx512_psll_q_512, llvm::Intrinsic::x86_avx512_psll_w_512, llvm::Intrinsic::x86_avx512_pslli_d_512, llvm::Intrinsic::x86_avx512_pslli_q_512, llvm::Intrinsic::x86_avx512_pslli_w_512, llvm::Intrinsic::x86_avx512_psra_d_512, llvm::Intrinsic::x86_avx512_psra_q_128, llvm::Intrinsic::x86_avx512_psra_q_256, llvm::Intrinsic::x86_avx512_psra_q_512, llvm::Intrinsic::x86_avx512_psra_w_512, llvm::Intrinsic::x86_avx512_psrai_d_512, llvm::Intrinsic::x86_avx512_psrai_q_128, llvm::Intrinsic::x86_avx512_psrai_q_256, llvm::Intrinsic::x86_avx512_psrai_q_512, llvm::Intrinsic::x86_avx512_psrai_w_512, llvm::Intrinsic::x86_avx512_psrl_d_512, llvm::Intrinsic::x86_avx512_psrl_q_512, llvm::Intrinsic::x86_avx512_psrl_w_512, llvm::Intrinsic::x86_avx512_psrli_d_512, llvm::Intrinsic::x86_avx512_psrli_q_512, llvm::Intrinsic::x86_avx512_psrli_w_512, llvm::Intrinsic::x86_sse2_psll_d, llvm::Intrinsic::x86_sse2_psll_q, llvm::Intrinsic::x86_sse2_psll_w, llvm::Intrinsic::x86_sse2_pslli_d, llvm::Intrinsic::x86_sse2_pslli_q, llvm::Intrinsic::x86_sse2_pslli_w, llvm::Intrinsic::x86_sse2_psra_d, llvm::Intrinsic::x86_sse2_psra_w, llvm::Intrinsic::x86_sse2_psrai_d, llvm::Intrinsic::x86_sse2_psrai_w, llvm::Intrinsic::x86_sse2_psrl_d, llvm::Intrinsic::x86_sse2_psrl_q, llvm::Intrinsic::x86_sse2_psrl_w, llvm::Intrinsic::x86_sse2_psrli_d, llvm::Intrinsic::x86_sse2_psrli_q, llvm::Intrinsic::x86_sse2_psrli_w, and llvm::APInt::zextOrTrunc().

Referenced by llvm::InstCombiner::visitCallInst().

◆ simplifyX86insertps()

static Value* simplifyX86insertps ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86insertq()

static Value* simplifyX86insertq ( IntrinsicInst II,
Value Op0,
Value Op1,
APInt  APLength,
APInt  APIndex,
InstCombiner::BuilderTy Builder 
)
static

Attempt to simplify SSE4A INSERTQ/INSERTQI instructions using constant folding or conversion to a shuffle vector.

Definition at line 909 of file InstCombineCalls.cpp.

References llvm::APInt::getZExtValue(), and llvm::APInt::zextOrTrunc().

Referenced by llvm::InstCombiner::visitCallInst().

◆ simplifyX86MaskedLoad()

static Instruction* simplifyX86MaskedLoad ( IntrinsicInst II,
InstCombiner IC 
)
static

◆ simplifyX86MaskedStore()

static bool simplifyX86MaskedStore ( IntrinsicInst II,
InstCombiner IC 
)
static

◆ simplifyX86movmsk()

static Value* simplifyX86movmsk ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86pack()

static Value* simplifyX86pack ( IntrinsicInst II,
bool  IsSigned 
)
static

◆ simplifyX86pshufb()

static Value* simplifyX86pshufb ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86round()

static Value* simplifyX86round ( IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86varShift()

static Value* simplifyX86varShift ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

Definition at line 402 of file InstCombineCalls.cpp.

References llvm::all_of(), assert(), llvm::IRBuilder< T, Inserter >::CreateAShr(), llvm::IRBuilder< T, Inserter >::CreateLShr(), llvm::IRBuilder< T, Inserter >::CreateShl(), llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::ConstantVector::get(), llvm::UndefValue::get(), llvm::CallBase::getArgOperand(), llvm::IntrinsicInst::getIntrinsicID(), llvm::Constant::getNullValue(), llvm::Value::getType(), llvm::APInt::getZExtValue(), I, llvm_unreachable, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::APInt::uge(), llvm::Intrinsic::x86_avx2_psllv_d, llvm::Intrinsic::x86_avx2_psllv_d_256, llvm::Intrinsic::x86_avx2_psllv_q, llvm::Intrinsic::x86_avx2_psllv_q_256, llvm::Intrinsic::x86_avx2_psrav_d, llvm::Intrinsic::x86_avx2_psrav_d_256, llvm::Intrinsic::x86_avx2_psrlv_d, llvm::Intrinsic::x86_avx2_psrlv_d_256, llvm::Intrinsic::x86_avx2_psrlv_q, llvm::Intrinsic::x86_avx2_psrlv_q_256, llvm::Intrinsic::x86_avx512_psllv_d_512, llvm::Intrinsic::x86_avx512_psllv_q_512, llvm::Intrinsic::x86_avx512_psllv_w_128, llvm::Intrinsic::x86_avx512_psllv_w_256, llvm::Intrinsic::x86_avx512_psllv_w_512, llvm::Intrinsic::x86_avx512_psrav_d_512, llvm::Intrinsic::x86_avx512_psrav_q_128, llvm::Intrinsic::x86_avx512_psrav_q_256, llvm::Intrinsic::x86_avx512_psrav_q_512, llvm::Intrinsic::x86_avx512_psrav_w_128, llvm::Intrinsic::x86_avx512_psrav_w_256, llvm::Intrinsic::x86_avx512_psrav_w_512, llvm::Intrinsic::x86_avx512_psrlv_d_512, llvm::Intrinsic::x86_avx512_psrlv_q_512, llvm::Intrinsic::x86_avx512_psrlv_w_128, llvm::Intrinsic::x86_avx512_psrlv_w_256, and llvm::Intrinsic::x86_avx512_psrlv_w_512.

Referenced by llvm::InstCombiner::visitCallInst().

◆ simplifyX86vpcom()

static Value* simplifyX86vpcom ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder,
bool  IsSigned 
)
static

◆ simplifyX86vpermilvar()

static Value* simplifyX86vpermilvar ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ simplifyX86vpermv()

static Value* simplifyX86vpermv ( const IntrinsicInst II,
InstCombiner::BuilderTy Builder 
)
static

◆ STATISTIC()

STATISTIC ( NumSimplified  ,
"Number of library calls simplified"   
)

Variable Documentation

◆ GuardWideningWindow

cl::opt<unsigned> GuardWideningWindow("instcombine-guard-widening-window", cl::init(3), cl::desc("How wide an instruction window to bypass looking for " "another guard"))
static