#include "InstCombineInternal.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/ValueTracking.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/Transforms/InstCombine/InstCombiner.h"
#include "llvm/Transforms/Utils/BuildLibCalls.h"
#include <cassert>
#define DEBUG_TYPE …
#include "llvm/Transforms/Utils/InstructionWorklist.h"
usingnamespacellvm;
usingnamespacePatternMatch;
static Value *simplifyValueKnownNonZero(Value *V, InstCombinerImpl &IC,
Instruction &CxtI) { … }
static Value *foldMulSelectToNegate(BinaryOperator &I,
InstCombiner::BuilderTy &Builder) { … }
static Value *foldMulShl1(BinaryOperator &Mul, bool CommuteOperands,
InstCombiner::BuilderTy &Builder) { … }
static Value *takeLog2(IRBuilderBase &Builder, Value *Op, unsigned Depth,
bool AssumeNonZero, bool DoFold);
Instruction *InstCombinerImpl::visitMul(BinaryOperator &I) { … }
Instruction *InstCombinerImpl::foldFPSignBitOps(BinaryOperator &I) { … }
Instruction *InstCombinerImpl::foldPowiReassoc(BinaryOperator &I) { … }
Instruction *InstCombinerImpl::foldFMulReassoc(BinaryOperator &I) { … }
Instruction *InstCombinerImpl::visitFMul(BinaryOperator &I) { … }
bool InstCombinerImpl::simplifyDivRemOfSelectWithZeroOp(BinaryOperator &I) { … }
static bool multiplyOverflows(const APInt &C1, const APInt &C2, APInt &Product,
bool IsSigned) { … }
static bool isMultiple(const APInt &C1, const APInt &C2, APInt &Quotient,
bool IsSigned) { … }
static Value *foldIDivShl(BinaryOperator &I, InstCombiner::BuilderTy &Builder) { … }
Instruction *InstCombinerImpl::commonIDivTransforms(BinaryOperator &I) { … }
static const unsigned MaxDepth = …;
static Value *takeLog2(IRBuilderBase &Builder, Value *Op, unsigned Depth,
bool AssumeNonZero, bool DoFold) { … }
static Instruction *narrowUDivURem(BinaryOperator &I,
InstCombinerImpl &IC) { … }
Instruction *InstCombinerImpl::visitUDiv(BinaryOperator &I) { … }
Instruction *InstCombinerImpl::visitSDiv(BinaryOperator &I) { … }
Instruction *InstCombinerImpl::foldFDivConstantDivisor(BinaryOperator &I) { … }
static Instruction *foldFDivConstantDividend(BinaryOperator &I) { … }
static Instruction *foldFDivPowDivisor(BinaryOperator &I,
InstCombiner::BuilderTy &Builder) { … }
static Instruction *foldFDivSqrtDivisor(BinaryOperator &I,
InstCombiner::BuilderTy &Builder) { … }
Instruction *InstCombinerImpl::visitFDiv(BinaryOperator &I) { … }
static Instruction *simplifyIRemMulShl(BinaryOperator &I,
InstCombinerImpl &IC) { … }
Instruction *InstCombinerImpl::commonIRemTransforms(BinaryOperator &I) { … }
Instruction *InstCombinerImpl::visitURem(BinaryOperator &I) { … }
Instruction *InstCombinerImpl::visitSRem(BinaryOperator &I) { … }
Instruction *InstCombinerImpl::visitFRem(BinaryOperator &I) { … }