LLVM  5.0.0
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/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constant.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/Value.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/SimplifyLibCalls.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <cstring>
#include <vector>
Include dependency graph for InstCombineCalls.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "instcombine"
 

Functions

 STATISTIC (NumSimplified,"Number of library calls simplified")
 
static Type * getPromotedType (Type *Ty)
 Return the specified type promoted as it would be to pass though a va_arg area. More...
 
static Constant * getNegativeIsTrueBoolVec (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 Value * simplifyX86immShift (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static Value * simplifyX86varShift (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static Value * simplifyX86muldq (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static Value * simplifyX86pack (IntrinsicInst &II, bool IsSigned)
 
static Value * simplifyX86movmsk (const IntrinsicInst &II)
 
static Value * simplifyX86insertps (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static Value * simplifyX86extrq (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 Value * simplifyX86insertq (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 Value * simplifyX86pshufb (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert pshufb* to shufflevector if the mask is constant. More...
 
static Value * simplifyX86vpermilvar (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert vpermilvar* to shufflevector if the mask is constant. More...
 
static Value * simplifyX86vpermv (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 Attempt to convert vpermd/vpermps to shufflevector if the mask is constant. More...
 
static Value * simplifyX86vperm2 (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 The shuffle mask for a perm2*128 selects any two halves of two 256-bit source vectors, unless a zero bit is set. More...
 
static Value * simplifyX86vpcom (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder, bool IsSigned)
 Decode XOP integer vector comparison intrinsics. More...
 
static Value * emitX86MaskSelect (Value *Mask, Value *Op0, Value *Op1, InstCombiner::BuilderTy &Builder)
 
static Value * simplifyMinnumMaxnum (const IntrinsicInst &II)
 
static bool maskIsAllOneOrUndef (Value *Mask)
 
static Value * simplifyMaskedLoad (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder)
 
static Instruction * simplifyMaskedStore (IntrinsicInst &II, InstCombiner &IC)
 
static Instruction * simplifyMaskedGather (IntrinsicInst &II, InstCombiner &IC)
 
static Instruction * simplifyMaskedScatter (IntrinsicInst &II, InstCombiner &IC)
 
static Instruction * foldCttzCtlz (IntrinsicInst &II, InstCombiner &IC)
 
static Instruction * foldCtpop (IntrinsicInst &II, InstCombiner &IC)
 
static Instruction * simplifyX86MaskedLoad (IntrinsicInst &II, InstCombiner &IC)
 
static bool simplifyX86MaskedStore (IntrinsicInst &II, InstCombiner &IC)
 
static APFloat fmed3AMDGCN (const APFloat &Src0, const APFloat &Src1, const APFloat &Src2)
 
static bool haveSameOperands (const IntrinsicInst &I, const IntrinsicInst &E, unsigned NumOperands)
 
static bool removeTriviallyEmptyRange (IntrinsicInst &I, unsigned StartID, unsigned EndID, InstCombiner &IC)
 
static Instruction * SimplifyNVVMIntrinsic (IntrinsicInst *II, InstCombiner &IC)
 
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 IntrinsicInst * findInitTrampolineFromAlloca (Value *TrampMem)
 
static IntrinsicInst * findInitTrampolineFromBB (IntrinsicInst *AdjustTramp, Value *TrampMem)
 
static IntrinsicInst * findInitTrampoline (Value *Callee)
 

Variables

static cl::opt< unsigned > UnfoldElementAtomicMemcpyMaxElements ("unfold-element-atomic-memcpy-max-elements", cl::init(16), cl::desc("Maximum number of elements in atomic memcpy the optimizer is ""allowed to unfold"))
 

Macro Definition Documentation

#define DEBUG_TYPE   "instcombine"

Definition at line 60 of file InstCombineCalls.cpp.

Function Documentation

static Value* emitX86MaskSelect ( Value *  Mask,
Value *  Op0,
Value *  Op1,
InstCombiner::BuilderTy &  Builder 
)
static
static IntrinsicInst* findInitTrampoline ( Value *  Callee)
static
static IntrinsicInst* findInitTrampolineFromAlloca ( Value *  TrampMem)
static
static IntrinsicInst* findInitTrampolineFromBB ( IntrinsicInst *  AdjustTramp,
Value *  TrampMem 
)
static
static APFloat fmed3AMDGCN ( const APFloat &  Src0,
const APFloat &  Src1,
const APFloat &  Src2 
)
static
static Instruction* foldCtpop ( IntrinsicInst &  II,
InstCombiner &  IC 
)
static
static Instruction* foldCttzCtlz ( IntrinsicInst &  II,
InstCombiner &  IC 
)
static
static Constant* getNegativeIsTrueBoolVec ( ConstantDataVector *  V)
static
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 72 of file InstCombineCalls.cpp.

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

static bool haveSameOperands ( const IntrinsicInst &  I,
const IntrinsicInst &  E,
unsigned  NumOperands 
)
static
static bool isSafeToEliminateVarargsCast ( const CallSite  CS,
const DataLayout &  DL,
const CastInst *const  CI,
const int  ix 
)
static
static bool maskIsAllOneOrUndef ( Value *  Mask)
static

Definition at line 1308 of file InstCombineCalls.cpp.

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

Referenced by simplifyMaskedLoad().

static bool removeTriviallyEmptyRange ( IntrinsicInst &  I,
unsigned  StartID,
unsigned  EndID,
InstCombiner &  IC 
)
static
static Instruction* simplifyMaskedGather ( IntrinsicInst &  II,
InstCombiner &  IC 
)
static
static Value* simplifyMaskedLoad ( const IntrinsicInst &  II,
InstCombiner::BuilderTy &  Builder 
)
static
static Instruction* simplifyMaskedScatter ( IntrinsicInst &  II,
InstCombiner &  IC 
)
static
static Instruction* simplifyMaskedStore ( IntrinsicInst &  II,
InstCombiner &  IC 
)
static
static Value* simplifyMinnumMaxnum ( const IntrinsicInst &  II)
static
static Instruction* SimplifyNVVMIntrinsic ( IntrinsicInst *  II,
InstCombiner &  IC 
)
static
static Value* simplifyX86extrq ( IntrinsicInst &  II,
Value *  Op0,
ConstantInt *  CILength,
ConstantInt *  CIIndex,
InstCombiner::BuilderTy &  Builder 
)
static
static Value* simplifyX86immShift ( const IntrinsicInst &  II,
InstCombiner::BuilderTy &  Builder 
)
static
static Value* simplifyX86insertps ( const IntrinsicInst &  II,
InstCombiner::BuilderTy &  Builder 
)
static
static Value* simplifyX86insertq ( IntrinsicInst &  II,
Value *  Op0,
Value *  Op1,
APInt  APLength,
APInt  APIndex,
InstCombiner::BuilderTy &  Builder 
)
static
static Instruction* simplifyX86MaskedLoad ( IntrinsicInst &  II,
InstCombiner &  IC 
)
static
static bool simplifyX86MaskedStore ( IntrinsicInst &  II,
InstCombiner &  IC 
)
static
static Value* simplifyX86movmsk ( const IntrinsicInst &  II)
static
static Value* simplifyX86muldq ( const IntrinsicInst &  II,
InstCombiner::BuilderTy &  Builder 
)
static
static Value* simplifyX86pack ( IntrinsicInst &  II,
bool  IsSigned 
)
static
static Value* simplifyX86pshufb ( const IntrinsicInst &  II,
InstCombiner::BuilderTy &  Builder 
)
static
static Value* simplifyX86varShift ( const IntrinsicInst &  II,
InstCombiner::BuilderTy &  Builder 
)
static
static Value* simplifyX86vpcom ( const IntrinsicInst &  II,
InstCombiner::BuilderTy &  Builder,
bool  IsSigned 
)
static
static Value* simplifyX86vperm2 ( const IntrinsicInst &  II,
InstCombiner::BuilderTy &  Builder 
)
static

The shuffle mask for a perm2*128 selects any two halves of two 256-bit source vectors, unless a zero bit is set.

If a zero bit is set, then ignore that half of the mask and clear that half of the vector.

Definition at line 1100 of file InstCombineCalls.cpp.

References llvm::IRBuilder< T, Inserter >::CreateShuffleVector(), llvm::dyn_cast(), llvm::ConstantAggregateZero::get(), llvm::CallInst::getArgOperand(), llvm::SequentialType::getNumElements(), and llvm::Value::getType().

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

static Value* simplifyX86vpermilvar ( const IntrinsicInst &  II,
InstCombiner::BuilderTy &  Builder 
)
static
static Value* simplifyX86vpermv ( const IntrinsicInst &  II,
InstCombiner::BuilderTy &  Builder 
)
static
STATISTIC ( NumSimplified  ,
"Number of library calls simplified"   
)

Variable Documentation

cl::opt<unsigned> UnfoldElementAtomicMemcpyMaxElements("unfold-element-atomic-memcpy-max-elements", cl::init(16), cl::desc("Maximum number of elements in atomic memcpy the optimizer is ""allowed to unfold"))
static