LLVM  4.0.0
Macros | Functions
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/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.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/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 TypegetPromotedType (Type *Ty)
 Return the specified type promoted as it would be to pass though a va_arg area. More...
 
static TypereduceToSingleValueType (Type *T)
 Given an aggregate type which ultimately holds a single scalar element, like {{{type}}} or [1 x type], return type. 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 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 ValuesimplifyX86vperm2 (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 ValuesimplifyX86vpcom (const IntrinsicInst &II, InstCombiner::BuilderTy &Builder, bool IsSigned)
 Decode XOP integer vector comparison intrinsics. More...
 
static ValueemitX86MaskSelect (Value *Mask, Value *Op0, Value *Op1, InstCombiner::BuilderTy &Builder)
 
static ValuesimplifyMinnumMaxnum (const IntrinsicInst &II)
 
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 InstructionsimplifyMaskedScatter (IntrinsicInst &II, InstCombiner &IC)
 
static InstructionfoldCttzCtlz (IntrinsicInst &II, InstCombiner &IC)
 
static InstructionsimplifyX86MaskedLoad (IntrinsicInst &II, InstCombiner &IC)
 
static bool simplifyX86MaskedStore (IntrinsicInst &II, InstCombiner &IC)
 
static bool haveSameOperands (const IntrinsicInst &I, const IntrinsicInst &E, unsigned NumOperands)
 
static bool removeTriviallyEmptyRange (IntrinsicInst &I, unsigned StartID, unsigned EndID, 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 IntrinsicInstfindInitTrampolineFromAlloca (Value *TrampMem)
 
static IntrinsicInstfindInitTrampolineFromBB (IntrinsicInst *AdjustTramp, Value *TrampMem)
 
static IntrinsicInstfindInitTrampoline (Value *Callee)
 

Macro Definition Documentation

#define DEBUG_TYPE   "instcombine"

Definition at line 59 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 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 65 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 1143 of file InstCombineCalls.cpp.

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

Referenced by simplifyMaskedLoad().

static Type* reduceToSingleValueType ( Type T)
static

Given an aggregate type which ultimately holds a single scalar element, like {{{type}}} or [1 x type], return type.

Definition at line 75 of file InstCombineCalls.cpp.

References llvm::Type::isSingleValueType(), and T.

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 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,
InstCombiner::BuilderTy Builder 
)
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 935 of file InstCombineCalls.cpp.

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

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"   
)