20 using namespace PatternMatch;
32 bool MadeChange =
false;
36 Value *
A = 0, *B = 0, *PowerOf2 = 0;
56 if (
I->getOpcode() == Instruction::LShr && !
I->isExact()) {
61 if (
I->getOpcode() == Instruction::Shl && !
I->hasNoUnsignedWrap()) {
62 I->setHasNoUnsignedWrap();
71 return MadeChange ? V : 0;
81 LHSExt = LHSExt.
sext(W * 2);
82 RHSExt = RHSExt.
sext(W * 2);
84 LHSExt = LHSExt.
zext(W * 2);
85 RHSExt = RHSExt.
zext(W * 2);
88 APInt MulExt = LHSExt * RHSExt;
95 return MulExt.
slt(Min) || MulExt.
sgt(Max);
118 bool Changed = SimplifyAssociativeOrCommutative(I);
122 return ReplaceInstUsesWith(I, V);
124 if (
Value *V = SimplifyUsingDistributiveLaws(I))
125 return ReplaceInstUsesWith(I, V);
160 if (
ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
165 Value *Add = Builder->CreateMul(X, CI);
166 return BinaryOperator::CreateAdd(Add, Builder->CreateMul(C1, CI));
174 const APInt & Val = CI->getValue();
182 Sub = Builder->CreateSub(X,
Y,
"suba");
184 Sub = Builder->CreateSub(Builder->CreateNeg(C1),
Y,
"subc");
187 BinaryOperator::CreateMul(Sub,
195 if (isa<Constant>(Op1)) {
197 if (
SelectInst *SI = dyn_cast<SelectInst>(Op0))
201 if (isa<PHINode>(Op0))
206 if (
Value *Op0v = dyn_castNegVal(Op0))
207 if (
Value *Op1v = dyn_castNegVal(Op1))
208 return BinaryOperator::CreateMul(Op0v, Op1v);
221 Value *Neg = dyn_castNegVal(Op1C);
230 if (SDiv->isExact()) {
232 return ReplaceInstUsesWith(I, Op0BO);
237 if (BO->
getOpcode() == Instruction::UDiv)
238 Rem = Builder->CreateURem(Op0BO, Op1BO);
240 Rem = Builder->CreateSRem(Op0BO, Op1BO);
244 return BinaryOperator::CreateSub(Op0BO, Rem);
245 return BinaryOperator::CreateSub(Rem, Op0BO);
251 return BinaryOperator::CreateAnd(Op0, Op1);
258 return BinaryOperator::CreateShl(Op1, Y);
260 return BinaryOperator::CreateShl(Op0, Y);
270 Value *BoolCast = 0, *OtherOp = 0;
272 BoolCast = Op0, OtherOp = Op1;
274 BoolCast = Op1, OtherOp = Op0;
279 return BinaryOperator::CreateAnd(V, OtherOp);
283 return Changed ? &I : 0;
331 if (!I || (I->
getOpcode() != Instruction::FMul &&
342 (C1 && C1->getValueAPF().isFiniteNonZero());
370 if (FMulOrDiv->
getOpcode() == Instruction::FMul) {
373 R = BinaryOperator::CreateFMul(C1 ? Opnd0 : Opnd1, F);
381 R = BinaryOperator::CreateFDiv(F, Opnd1);
387 R = BinaryOperator::CreateFMul(Opnd0, F);
392 R = BinaryOperator::CreateFDiv(Opnd0, F);
398 R->setHasUnsafeAlgebra(
true);
399 InsertNewInstWith(R, *InsertBefore);
406 bool Changed = SimplifyAssociativeOrCommutative(I);
409 if (isa<Constant>(Op0))
413 return ReplaceInstUsesWith(I, V);
418 if (isa<Constant>(Op1)) {
420 if (
SelectInst *SI = dyn_cast<SelectInst>(Op0))
424 if (isa<PHINode>(Op0))
435 Value *V = foldFMulConst(cast<Instruction>(Op0), C, &I);
437 return ReplaceInstUsesWith(I, V);
443 (FAddSub->
getOpcode() == Instruction::FAdd ||
444 FAddSub->
getOpcode() == Instruction::FSub)) {
456 if (C1 && C1->getValueAPF().isFiniteNonZero() &&
460 foldFMulConst(cast<Instruction>(Opnd0), C, &I) :
463 if (Swap && FAddSub->
getOpcode() == Instruction::FSub)
467 ? BinaryOperator::CreateFAdd(M0, M1)
468 : BinaryOperator::CreateFSub(M0, M1);
498 Value *FMulVal = Builder->CreateFMul(OpX, Log2);
499 Value *FSub = Builder->CreateFSub(FMulVal, OpX);
501 return ReplaceInstUsesWith(I, FSub);
508 for (
int i = 0; i < 2; i++) {
514 Value *N0 = dyn_castFNegVal(Opnd0, IgnoreZeroSign);
515 Value *N1 = dyn_castFNegVal(Opnd1, IgnoreZeroSign);
519 return BinaryOperator::CreateFMul(N0, N1);
523 Value *
T = Builder->CreateFMul(N0, Opnd1);
524 Value *Neg = Builder->CreateFNeg(T);
526 return ReplaceInstUsesWith(I, Neg);
538 if (AllowReassociate) {
539 Value *Opnd0_0, *Opnd0_1;
543 if (Opnd0_0 == Opnd1 && Opnd0_1 != Opnd1)
545 else if (Opnd0_1 == Opnd1 && Opnd0_0 != Opnd1)
551 Value *
T = Builder->CreateFMul(Opnd1, Opnd1);
553 Value *R = Builder->CreateFMul(T, Y);
555 return ReplaceInstUsesWith(I, R);
562 Value *LHS = Op0, *RHS = Op1;
576 Value *LHS = Op0, *RHS = Op1;
589 if (!isa<Constant>(Op1))
595 return Changed ? &I : 0;
604 int NonNullOperand = -1;
606 if (
ST->isNullValue())
610 if (
ST->isNullValue())
613 if (NonNullOperand == -1)
635 while (BBI != BBFront) {
639 if (isa<CallInst>(BBI) && !isa<IntrinsicInst>(BBI))
648 }
else if (*I == SelectCond) {
649 *I = Builder->getInt1(NonNullOperand == 1);
657 if (&*BBI == SelectCond)
661 if (SelectCond == 0 && SI == 0)
684 if (isa<SelectInst>(Op1) && SimplifyDivRemOfSelect(I))
687 if (
ConstantInt *RHS = dyn_cast<ConstantInt>(Op1)) {
691 if (
ConstantInt *LHSRHS = dyn_cast<ConstantInt>(LHS->getOperand(1))) {
699 if (!RHS->isZero()) {
700 if (
SelectInst *SI = dyn_cast<SelectInst>(Op0))
703 if (isa<PHINode>(Op0))
710 if (SimplifyDemandedInstructionBits(I))
716 bool isSigned = I.
getOpcode() == Instruction::SDiv;
728 if (
ZExtInst *Z = dyn_cast<ZExtInst>(V)) {
729 if (Z->getSrcTy() == Ty)
730 return Z->getOperand(0);
732 if (
C->getValue().getActiveBits() <= cast<IntegerType>(Ty)->
getBitWidth())
745 struct UDivFoldAction {
746 FoldUDivOperandCb FoldAction;
750 Value *OperandToFold;
759 UDivFoldAction(FoldUDivOperandCb FA,
Value *InputOperand)
760 : FoldAction(FA), OperandToFold(InputOperand), FoldResult(0) {}
761 UDivFoldAction(FoldUDivOperandCb FA,
Value *InputOperand,
size_t SLHS)
762 : FoldAction(FA), OperandToFold(InputOperand), SelectLHSIdx(SLHS) {}
769 const APInt &
C = cast<Constant>(Op1)->getUniqueInteger();
789 if (isa<ZExtInst>(ShiftLeft))
790 ShiftLeft = cast<Instruction>(ShiftLeft->
getOperand(0));
793 cast<Constant>(ShiftLeft->
getOperand(0))->getUniqueInteger();
797 if (
ZExtInst *Z = dyn_cast<ZExtInst>(Op1))
810 unsigned Depth = 0) {
815 return Actions.
size();
820 if (
C->getValue().isNegative()) {
822 return Actions.
size();
829 return Actions.
size();
836 if (
SelectInst *SI = dyn_cast<SelectInst>(Op1))
839 Actions.
push_back(UDivFoldAction((FoldUDivOperandCb)0, Op1, LHSIdx-1));
840 return Actions.
size();
850 return ReplaceInstUsesWith(I, V);
857 if (
ConstantInt *C2 = dyn_cast<ConstantInt>(Op1)) {
862 return BinaryOperator::CreateUDiv(X, Builder->getInt(NC));
867 if (
ZExtInst *ZOp0 = dyn_cast<ZExtInst>(Op0))
869 return new ZExtInst(Builder->CreateUDiv(ZOp0->getOperand(0), ZOp1,
"div",
876 for (
unsigned i = 0, e = UDivActions.size(); i != e; ++i) {
877 FoldUDivOperandCb Action = UDivActions[i].FoldAction;
878 Value *ActionOp1 = UDivActions[i].OperandToFold;
881 Inst = Action(Op0, ActionOp1, I, *
this);
886 size_t SelectRHSIdx = i - 1;
887 Value *SelectRHS = UDivActions[SelectRHSIdx].FoldResult;
888 size_t SelectLHSIdx = UDivActions[i].SelectLHSIdx;
889 Value *SelectLHS = UDivActions[SelectLHSIdx].FoldResult;
891 SelectLHS, SelectRHS);
899 UDivActions[i].FoldResult = Inst;
911 return ReplaceInstUsesWith(I, V);
917 if (
ConstantInt *RHS = dyn_cast<ConstantInt>(Op1)) {
919 if (RHS->isAllOnesValue())
923 if (I.
isExact() && RHS->getValue().isNonNegative() &&
924 RHS->getValue().isPowerOf2()) {
926 RHS->getValue().exactLogBase2());
927 return BinaryOperator::CreateExactAShr(Op0, ShAmt, I.
getName());
932 if (
match(Sub->getOperand(0),
m_Zero()) && Sub->hasNoSignedWrap())
933 return BinaryOperator::CreateSDiv(Sub->getOperand(1),
944 return BinaryOperator::CreateUDiv(Op0, Op1, I.
getName());
952 return BinaryOperator::CreateUDiv(Op0, Op1, I.
getName());
969 bool AllowReciprocal) {
977 Cvt = !Reciprocal.isDenormal();
985 return BinaryOperator::CreateFMul(Dividend, R);
992 return ReplaceInstUsesWith(I, V);
994 if (isa<Constant>(Op0))
995 if (
SelectInst *SI = dyn_cast<SelectInst>(Op1))
1002 if (
ConstantFP *Op1C = dyn_cast<ConstantFP>(Op1)) {
1003 if (
SelectInst *SI = dyn_cast<SelectInst>(Op0))
1007 if (AllowReassociate) {
1017 const APFloat &
F = cast<ConstantFP>(
C)->getValueAPF();
1019 Res = BinaryOperator::CreateFMul(X, C);
1024 const APFloat &
F = cast<ConstantFP>(
C)->getValueAPF();
1029 Res = BinaryOperator::CreateFDiv(X, C);
1046 if (AllowReassociate && isa<ConstantFP>(Op0)) {
1050 bool CreateDiv =
true;
1065 const APFloat &FoldC = cast<ConstantFP>(Fold)->getValueAPF();
1068 BinaryOperator::CreateFDiv(Fold, X) :
1069 BinaryOperator::CreateFMul(X, Fold);
1077 if (AllowReassociate) {
1085 if (!isa<ConstantFP>(Y) || !isa<ConstantFP>(Op1)) {
1086 NewInst = Builder->CreateFMul(Y, Op1);
1087 SimpR = BinaryOperator::CreateFDiv(X, NewInst);
1092 if (!isa<ConstantFP>(Y) || !isa<ConstantFP>(Op0)) {
1093 NewInst = Builder->CreateFMul(Op0, Y);
1094 SimpR = BinaryOperator::CreateFDiv(NewInst, X);
1123 if (isa<SelectInst>(Op1) && SimplifyDivRemOfSelect(I))
1126 if (isa<ConstantInt>(Op1)) {
1127 if (
Instruction *Op0I = dyn_cast<Instruction>(Op0)) {
1128 if (
SelectInst *SI = dyn_cast<SelectInst>(Op0I)) {
1131 }
else if (isa<PHINode>(Op0I)) {
1137 if (SimplifyDemandedInstructionBits(I))
1149 return ReplaceInstUsesWith(I, V);
1151 if (
Instruction *common = commonIRemTransforms(I))
1155 if (
ZExtInst *ZOp0 = dyn_cast<ZExtInst>(Op0))
1157 return new ZExtInst(Builder->CreateURem(ZOp0->getOperand(0), ZOp1),
1163 Value *Add = Builder->CreateAdd(Op1, N1);
1164 return BinaryOperator::CreateAnd(Op0, Add);
1169 Value *Cmp = Builder->CreateICmpNE(Op1, Op0);
1171 return ReplaceInstUsesWith(I, Ext);
1181 return ReplaceInstUsesWith(I, V);
1184 if (
Instruction *Common = commonIRemTransforms(I))
1187 if (
Value *RHSNeg = dyn_castNegVal(Op1))
1188 if (!isa<Constant>(RHSNeg) ||
1189 (isa<ConstantInt>(RHSNeg) &&
1190 cast<ConstantInt>(RHSNeg)->getValue().isStrictlyPositive())) {
1203 return BinaryOperator::CreateURem(Op0, Op1, I.
getName());
1208 if (isa<ConstantVector>(Op1) || isa<ConstantDataVector>(Op1)) {
1212 bool hasNegative =
false;
1213 bool hasMissing =
false;
1214 for (
unsigned i = 0; i != VWidth; ++i) {
1221 if (
ConstantInt *RHS = dyn_cast<ConstantInt>(Elt))
1222 if (RHS->isNegative())
1226 if (hasNegative && !hasMissing) {
1228 for (
unsigned i = 0; i != VWidth; ++i) {
1230 if (
ConstantInt *RHS = dyn_cast<ConstantInt>(Elts[i])) {
1231 if (RHS->isNegative())
1252 return ReplaceInstUsesWith(I, V);
1255 if (isa<SelectInst>(Op1) && SimplifyDivRemOfSelect(I))
static Instruction * foldUDivShl(Value *Op0, Value *Op1, const BinaryOperator &I, InstCombiner &IC)
Instruction * visitSDiv(BinaryOperator &I)
void push_back(const T &Elt)
class_match< Value > m_Value()
m_Value() - Match an arbitrary value and ignore it.
void setHasNoSignedWrap(bool b=true)
static APInt getSignBit(unsigned BitWidth)
Get the SignBit for a specific bit width.
void setFastMathFlags(FastMathFlags FMF)
APInt LLVM_ATTRIBUTE_UNUSED_RESULT abs() const
Get the absolute value;.
BinaryOp_match< LHS, RHS, Instruction::Sub > m_Sub(const LHS &L, const RHS &R)
bool SimplifyDivRemOfSelect(BinaryOperator &I)
BinaryOp_match< LHS, RHS, Instruction::FDiv > m_FDiv(const LHS &L, const RHS &R)
Intrinsic::ID getIntrinsicID() const
BinaryOp_match< LHS, RHS, Instruction::SRem > m_SRem(const LHS &L, const RHS &R)
static SelectInst * Create(Value *C, Value *S1, Value *S2, const Twine &NameStr="", Instruction *InsertBefore=0)
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getBitWidth() const
getBitWidth - Return the bitwidth of this constant.
This class represents zero extension of integer types.
Instruction * visitFRem(BinaryOperator &I)
bool MaskedValueIsZero(Value *V, const APInt &Mask, const DataLayout *TD=0, unsigned Depth=0)
static Constant * getLogBase2Vector(ConstantDataVector *CV)
A helper routine of InstCombiner::visitMul().
BinaryOp_match< LHS, RHS, Instruction::Mul > m_Mul(const LHS &L, const RHS &R)
Constant * getElementAsConstant(unsigned i) const
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
class_match< Constant > m_Constant()
Value * CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name="")
FastMathFlags getFastMathFlags() const
BinaryOp_match< LHS, RHS, Instruction::FSub > m_FSub(const LHS &L, const RHS &R)
bool isFiniteNonZero() const
Value * SimplifyUDivInst(Value *LHS, Value *RHS, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0, const DominatorTree *DT=0)
static APInt getSignedMaxValue(unsigned numBits)
Gets maximum signed value of APInt for a specific bit width.
static Value * simplifyValueKnownNonZero(Value *V, InstCombiner &IC)
Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
Value * SimplifySDivInst(Value *LHS, Value *RHS, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0, const DominatorTree *DT=0)
Instruction * visitFMul(BinaryOperator &I)
Instruction * visitFDiv(BinaryOperator &I)
static Constant * getNullValue(Type *Ty)
StringRef getName() const
Instruction * visitMul(BinaryOperator &I)
static Constant * getFMul(Constant *C1, Constant *C2)
Instruction * commonIRemTransforms(BinaryOperator &I)
Common integer remainder transforms.
bool isNegative() const
Determine sign of this APInt.
bool match(Val *V, const Pattern &P)
bool hasNoNaNs() const
Determine whether the no-NaNs flag is set.
static unsigned getBitWidth(Type *Ty, const DataLayout *TD)
const APInt & getValue() const
Return the constant's value.
void setHasNoUnsignedWrap(bool b=true)
static Constant * get(ArrayRef< Constant * > V)
InstCombiner - The -instcombine pass.
bool hasAllowReciprocal() const
Determine whether the allow-reciprocal flag is set.
Instruction * commonIDivTransforms(BinaryOperator &I)
Common integer divide transforms.
BinaryOp_match< LHS, RHS, Instruction::Add > m_Add(const LHS &L, const RHS &R)
bind_ty< ConstantFP > m_ConstantFP(ConstantFP *&C)
m_ConstantFP - Match a ConstantFP, capturing the value if we match.
Instruction * visitSRem(BinaryOperator &I)
LLVMContext & getContext() const
getContext - Return the LLVMContext in which this type was uniqued.
CastClass_match< OpTy, Instruction::ZExt > m_ZExt(const OpTy &Op)
m_ZExt
Value * SimplifyFMulInst(Value *LHS, Value *RHS, FastMathFlags FMF, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0, const DominatorTree *DT=0)
uint64_t getLimitedValue(uint64_t Limit=~0ULL) const
Get the constant's value with a saturation limit.
bool sgt(const APInt &RHS) const
Signed greather than comparison.
bool hasUnsafeAlgebra() const
Determine whether the unsafe-algebra flag is set.
class_match< ConstantInt > m_ConstantInt()
m_ConstantInt() - Match an arbitrary ConstantInt and ignore it.
cst_pred_ty< is_power2 > m_Power2()
m_Power2() - Match an integer or vector power of 2.
static Constant * getFDiv(Constant *C1, Constant *C2)
static bool isNormalFp(const ConstantFP *C)
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
Instruction * visitUDiv(BinaryOperator &I)
OneUse_match< T > m_OneUse(const T &SubPattern)
BinaryOp_match< LHS, RHS, Instruction::LShr > m_LShr(const LHS &L, const RHS &R)
apint_match m_APInt(const APInt *&Res)
void insertBefore(Instruction *InsertPos)
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
LLVM Constant Representation.
cst_pred_ty< is_all_ones > m_AllOnes()
m_AllOnes() - Match an integer or vector with all bits set to true.
specificval_ty m_Specific(const Value *V)
m_Specific - Match if we have a specific specified value.
const DebugLoc & getDebugLoc() const
getDebugLoc - Return the debug location for this node as a DebugLoc.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sext(unsigned width) const
Sign extend to a new width.
BinaryOp_match< LHS, RHS, Instruction::Shl > m_Shl(const LHS &L, const RHS &R)
NUW NUW NUW NUW Exact static Exact BinaryOperator * CreateNeg(Value *Op, const Twine &Name="", Instruction *InsertBefore=0)
Value * getOperand(unsigned i) const
static Instruction * foldUDivNegCst(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)
Constant * getAggregateElement(unsigned Elt) const
static Constant * getAllOnesValue(Type *Ty)
Get the all ones value.
bool hasNoSignedWrap() const
hasNoSignedWrap - Determine whether the no signed wrap flag is set.
bool isPowerOf2() const
Check if this APInt's value is a power of two greater than zero.
void setIsExact(bool b=true)
bool ugt(const APInt &RHS) const
Unsigned greather than comparison.
static bool isFMulOrFDivWithConstant(Value *V)
BinaryOps getOpcode() const
Class for constant integers.
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
bool slt(const APInt &RHS) const
Signed less than comparison.
unsigned getVectorNumElements() const
unsigned logBase2() const
BinaryOp_match< LHS, RHS, Instruction::URem > m_URem(const LHS &L, const RHS &R)
bool isKnownToBeAPowerOfTwo(Value *V, bool OrZero=false, unsigned Depth=0)
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
static Constant * getTrunc(Constant *C, Type *Ty)
CastClass_match< OpTy, Instruction::UIToFP > m_UIToFP(const OpTy &Op)
m_UIToFP
void copyFastMathFlags(const Instruction *I)
Copy I's fast-math flags.
static Constant * get(Type *Ty, double V)
BinaryOp_match< LHS, RHS, Instruction::FMul > m_FMul(const LHS &L, const RHS &R)
bool isExact() const
isExact - Determine whether the exact flag is set.
void setOperand(unsigned i, Value *Val)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Value * getArgOperand(unsigned i) const
Class for arbitrary precision integers.
Value * foldFMulConst(Instruction *FMulOrDiv, ConstantFP *C, Instruction *InsertBefore)
static ConstantFP * getNegativeZero(Type *Ty)
static Instruction * foldUDivPow2Cst(Value *Op0, Value *Op1, const BinaryOperator &I, InstCombiner &IC)
static Instruction * CvtFDivConstToReciprocal(Value *Dividend, ConstantFP *Divisor, bool AllowReciprocal)
Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
static Constant * getNeg(Constant *C, bool HasNUW=false, bool HasNSW=false)
specific_fpval m_FPOne()
Match a float 1.0 or vector with all elements equal to 1.0.
Value * SimplifySRemInst(Value *LHS, Value *RHS, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0, const DominatorTree *DT=0)
Instruction * visitURem(BinaryOperator &I)
static bool isFNeg(const Value *V, bool IgnoreZeroSign=false)
bool hasNoInfs() const
Determine whether the no-infs flag is set.
void setArgOperand(unsigned i, Value *v)
unsigned getNumElements() const
getNumElements - Return the number of elements in the array or vector.
static Constant * getShl(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
bool hasNoSignedZeros() const
Determine whether the no-signed-zeros flag is set.
static BinaryOperator * Create(BinaryOps Op, Value *S1, Value *S2, const Twine &Name=Twine(), Instruction *InsertBefore=0)
unsigned getPrimitiveSizeInBits() const
Value * SimplifyFDivInst(Value *LHS, Value *RHS, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0, const DominatorTree *DT=0)
const APFloat & getValueAPF() const
bool isExactlyValue(const APFloat &V) const
static APInt getSignedMinValue(unsigned numBits)
Gets minimum signed value of APInt for a specific bit width.
Value * SimplifyURemInst(Value *LHS, Value *RHS, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0, const DominatorTree *DT=0)
LLVM Value Representation.
bool hasNoUnsignedWrap() const
hasNoUnsignedWrap - Determine whether the no unsigned wrap flag is set.
unsigned getOpcode() const
getOpcode() returns a member of one of the enums like Instruction::Add.
cst_pred_ty< is_one > m_One()
m_One() - Match an integer 1 or a vector with all elements equal to 1.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zext(unsigned width) const
Zero extend to a new width.
Value * SimplifyFRemInst(Value *LHS, Value *RHS, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0, const DominatorTree *DT=0)
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
static bool MultiplyOverflows(ConstantInt *C1, ConstantInt *C2, bool sign)
static Value * dyn_castZExtVal(Value *V, Type *Ty)
static Constant * getMul(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
bool getExactInverse(APFloat *inv) const
static void detectLog2OfHalf(Value *&Op, Value *&Y, IntrinsicInst *&Log2)
const fltSemantics & getSemantics() const
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
const BasicBlock * getParent() const
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD
Value * SimplifyMulInst(Value *LHS, Value *RHS, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0, const DominatorTree *DT=0)