LLVM  7.0.0
Macros | Functions | Variables
InstCombineMulDivRem.cpp File Reference
#include "InstCombineInternal.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.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/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Transforms/InstCombine/InstCombineWorklist.h"
#include "llvm/Transforms/Utils/BuildLibCalls.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <utility>
Include dependency graph for InstCombineMulDivRem.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "instcombine"
 

Functions

static Value * simplifyValueKnownNonZero (Value *V, InstCombiner &IC, Instruction &CxtI)
 The specific integer value is used in a context where it is known to be non-zero. More...
 
static Constant * getLogBase2 (Type *Ty, Constant *C)
 A helper routine of InstCombiner::visitMul(). More...
 
static bool multiplyOverflows (const APInt &C1, const APInt &C2, APInt &Product, bool IsSigned)
 True if the multiply can not be expressed in an int this size. More...
 
static bool isMultiple (const APInt &C1, const APInt &C2, APInt &Quotient, bool IsSigned)
 True if C1 is a multiple of C2. Quotient contains C1/C2. More...
 
static Instruction * foldUDivPow2Cst (Value *Op0, Value *Op1, const BinaryOperator &I, InstCombiner &IC)
 
static Instruction * foldUDivShl (Value *Op0, Value *Op1, const BinaryOperator &I, InstCombiner &IC)
 
static size_t visitUDivOperand (Value *Op0, Value *Op1, const BinaryOperator &I, SmallVectorImpl< UDivFoldAction > &Actions, unsigned Depth=0)
 
static Instruction * narrowUDivURem (BinaryOperator &I, InstCombiner::BuilderTy &Builder)
 If we have zero-extended operands of an unsigned div or rem, we may be able to narrow the operation (sink the zext below the math). More...
 
static Instruction * foldFDivConstantDivisor (BinaryOperator &I)
 Remove negation and try to convert division into multiplication. More...
 
static Instruction * foldFDivConstantDividend (BinaryOperator &I)
 Remove negation and try to reassociate constant math. More...
 

Variables

static const unsigned MaxDepth = 6
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "instcombine"

Definition at line 45 of file InstCombineMulDivRem.cpp.

Function Documentation

◆ foldFDivConstantDividend()

static Instruction* foldFDivConstantDividend ( BinaryOperator &  I)
static

◆ foldFDivConstantDivisor()

static Instruction* foldFDivConstantDivisor ( BinaryOperator &  I)
static

◆ foldUDivPow2Cst()

static Instruction* foldUDivPow2Cst ( Value *  Op0,
Value *  Op1,
const BinaryOperator &  I,
InstCombiner &  IC 
)
static

◆ foldUDivShl()

static Instruction* foldUDivShl ( Value *  Op0,
Value *  Op1,
const BinaryOperator &  I,
InstCombiner &  IC 
)
static

◆ getLogBase2()

static Constant* getLogBase2 ( Type *  Ty,
Constant *  C 
)
static

◆ isMultiple()

static bool isMultiple ( const APInt &  C1,
const APInt &  C2,
APInt &  Quotient,
bool  IsSigned 
)
static

◆ multiplyOverflows()

static bool multiplyOverflows ( const APInt &  C1,
const APInt &  C2,
APInt &  Product,
bool  IsSigned 
)
static

True if the multiply can not be expressed in an int this size.

Definition at line 624 of file InstCombineMulDivRem.cpp.

References llvm::APInt::smul_ov(), and llvm::APInt::umul_ov().

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

◆ narrowUDivURem()

static Instruction* narrowUDivURem ( BinaryOperator &  I,
InstCombiner::BuilderTy &  Builder 
)
static

◆ simplifyValueKnownNonZero()

static Value* simplifyValueKnownNonZero ( Value *  V,
InstCombiner &  IC,
Instruction &  CxtI 
)
static

◆ visitUDivOperand()

static size_t visitUDivOperand ( Value *  Op0,
Value *  Op1,
const BinaryOperator &  I,
SmallVectorImpl< UDivFoldAction > &  Actions,
unsigned  Depth = 0 
)
static

Variable Documentation

◆ MaxDepth

const unsigned MaxDepth = 6
static

Definition at line 789 of file InstCombineMulDivRem.cpp.