LLVM API Documentation

InstCombine.h
Go to the documentation of this file.
00001 //===- InstCombine.h - Main InstCombine pass definition ---------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef LLVM_LIB_TRANSFORMS_INSTCOMBINE_INSTCOMBINE_H
00011 #define LLVM_LIB_TRANSFORMS_INSTCOMBINE_INSTCOMBINE_H
00012 
00013 #include "InstCombineWorklist.h"
00014 #include "llvm/Analysis/AssumptionTracker.h"
00015 #include "llvm/Analysis/TargetFolder.h"
00016 #include "llvm/Analysis/ValueTracking.h"
00017 #include "llvm/IR/Dominators.h"
00018 #include "llvm/IR/IRBuilder.h"
00019 #include "llvm/IR/InstVisitor.h"
00020 #include "llvm/IR/IntrinsicInst.h"
00021 #include "llvm/IR/Operator.h"
00022 #include "llvm/IR/PatternMatch.h"
00023 #include "llvm/Pass.h"
00024 #include "llvm/Transforms/Utils/SimplifyLibCalls.h"
00025 
00026 #define DEBUG_TYPE "instcombine"
00027 
00028 namespace llvm {
00029 class CallSite;
00030 class DataLayout;
00031 class DominatorTree;
00032 class TargetLibraryInfo;
00033 class DbgDeclareInst;
00034 class MemIntrinsic;
00035 class MemSetInst;
00036 
00037 /// SelectPatternFlavor - We can match a variety of different patterns for
00038 /// select operations.
00039 enum SelectPatternFlavor {
00040   SPF_UNKNOWN = 0,
00041   SPF_SMIN,
00042   SPF_UMIN,
00043   SPF_SMAX,
00044   SPF_UMAX,
00045   SPF_ABS,
00046   SPF_NABS
00047 };
00048 
00049 /// getComplexity:  Assign a complexity or rank value to LLVM Values...
00050 ///   0 -> undef, 1 -> Const, 2 -> Other, 3 -> Arg, 3 -> Unary, 4 -> OtherInst
00051 static inline unsigned getComplexity(Value *V) {
00052   if (isa<Instruction>(V)) {
00053     if (BinaryOperator::isNeg(V) || BinaryOperator::isFNeg(V) ||
00054         BinaryOperator::isNot(V))
00055       return 3;
00056     return 4;
00057   }
00058   if (isa<Argument>(V))
00059     return 3;
00060   return isa<Constant>(V) ? (isa<UndefValue>(V) ? 0 : 1) : 2;
00061 }
00062 
00063 /// AddOne - Add one to a Constant
00064 static inline Constant *AddOne(Constant *C) {
00065   return ConstantExpr::getAdd(C, ConstantInt::get(C->getType(), 1));
00066 }
00067 /// SubOne - Subtract one from a Constant
00068 static inline Constant *SubOne(Constant *C) {
00069   return ConstantExpr::getSub(C, ConstantInt::get(C->getType(), 1));
00070 }
00071 
00072 /// InstCombineIRInserter - This is an IRBuilder insertion helper that works
00073 /// just like the normal insertion helper, but also adds any new instructions
00074 /// to the instcombine worklist.
00075 class LLVM_LIBRARY_VISIBILITY InstCombineIRInserter
00076     : public IRBuilderDefaultInserter<true> {
00077   InstCombineWorklist &Worklist;
00078   AssumptionTracker *AT;
00079 
00080 public:
00081   InstCombineIRInserter(InstCombineWorklist &WL, AssumptionTracker *AT)
00082     : Worklist(WL), AT(AT) {}
00083 
00084   void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB,
00085                     BasicBlock::iterator InsertPt) const {
00086     IRBuilderDefaultInserter<true>::InsertHelper(I, Name, BB, InsertPt);
00087     Worklist.Add(I);
00088 
00089     using namespace llvm::PatternMatch;
00090     if (match(I, m_Intrinsic<Intrinsic::assume>()))
00091       AT->registerAssumption(cast<CallInst>(I));
00092   }
00093 };
00094 
00095 /// InstCombiner - The -instcombine pass.
00096 class LLVM_LIBRARY_VISIBILITY InstCombiner
00097     : public FunctionPass,
00098       public InstVisitor<InstCombiner, Instruction *> {
00099   AssumptionTracker *AT;
00100   const DataLayout *DL;
00101   TargetLibraryInfo *TLI;
00102   DominatorTree *DT;
00103   bool MadeIRChange;
00104   LibCallSimplifier *Simplifier;
00105   bool MinimizeSize;
00106 
00107 public:
00108   /// Worklist - All of the instructions that need to be simplified.
00109   InstCombineWorklist Worklist;
00110 
00111   /// Builder - This is an IRBuilder that automatically inserts new
00112   /// instructions into the worklist when they are created.
00113   typedef IRBuilder<true, TargetFolder, InstCombineIRInserter> BuilderTy;
00114   BuilderTy *Builder;
00115 
00116   static char ID; // Pass identification, replacement for typeid
00117   InstCombiner()
00118       : FunctionPass(ID), DL(nullptr), DT(nullptr), Builder(nullptr) {
00119     MinimizeSize = false;
00120     initializeInstCombinerPass(*PassRegistry::getPassRegistry());
00121   }
00122 
00123 public:
00124   bool runOnFunction(Function &F) override;
00125 
00126   bool DoOneIteration(Function &F, unsigned ItNum);
00127 
00128   void getAnalysisUsage(AnalysisUsage &AU) const override;
00129 
00130   AssumptionTracker *getAssumptionTracker() const { return AT; }
00131 
00132   const DataLayout *getDataLayout() const { return DL; }
00133   
00134   DominatorTree *getDominatorTree() const { return DT; }
00135 
00136   TargetLibraryInfo *getTargetLibraryInfo() const { return TLI; }
00137 
00138   // Visitation implementation - Implement instruction combining for different
00139   // instruction types.  The semantics are as follows:
00140   // Return Value:
00141   //    null        - No change was made
00142   //     I          - Change was made, I is still valid, I may be dead though
00143   //   otherwise    - Change was made, replace I with returned instruction
00144   //
00145   Instruction *visitAdd(BinaryOperator &I);
00146   Instruction *visitFAdd(BinaryOperator &I);
00147   Value *OptimizePointerDifference(Value *LHS, Value *RHS, Type *Ty);
00148   Instruction *visitSub(BinaryOperator &I);
00149   Instruction *visitFSub(BinaryOperator &I);
00150   Instruction *visitMul(BinaryOperator &I);
00151   Value *foldFMulConst(Instruction *FMulOrDiv, Constant *C,
00152                        Instruction *InsertBefore);
00153   Instruction *visitFMul(BinaryOperator &I);
00154   Instruction *visitURem(BinaryOperator &I);
00155   Instruction *visitSRem(BinaryOperator &I);
00156   Instruction *visitFRem(BinaryOperator &I);
00157   bool SimplifyDivRemOfSelect(BinaryOperator &I);
00158   Instruction *commonRemTransforms(BinaryOperator &I);
00159   Instruction *commonIRemTransforms(BinaryOperator &I);
00160   Instruction *commonDivTransforms(BinaryOperator &I);
00161   Instruction *commonIDivTransforms(BinaryOperator &I);
00162   Instruction *visitUDiv(BinaryOperator &I);
00163   Instruction *visitSDiv(BinaryOperator &I);
00164   Instruction *visitFDiv(BinaryOperator &I);
00165   Value *simplifyRangeCheck(ICmpInst *Cmp0, ICmpInst *Cmp1, bool Inverted);
00166   Value *FoldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS);
00167   Value *FoldAndOfFCmps(FCmpInst *LHS, FCmpInst *RHS);
00168   Instruction *visitAnd(BinaryOperator &I);
00169   Value *FoldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS, Instruction *CxtI);
00170   Value *FoldOrOfFCmps(FCmpInst *LHS, FCmpInst *RHS);
00171   Instruction *FoldOrWithConstants(BinaryOperator &I, Value *Op, Value *A,
00172                                    Value *B, Value *C);
00173   Instruction *FoldXorWithConstants(BinaryOperator &I, Value *Op, Value *A,
00174                                     Value *B, Value *C);
00175   Instruction *visitOr(BinaryOperator &I);
00176   Instruction *visitXor(BinaryOperator &I);
00177   Instruction *visitShl(BinaryOperator &I);
00178   Instruction *visitAShr(BinaryOperator &I);
00179   Instruction *visitLShr(BinaryOperator &I);
00180   Instruction *commonShiftTransforms(BinaryOperator &I);
00181   Instruction *FoldFCmp_IntToFP_Cst(FCmpInst &I, Instruction *LHSI,
00182                                     Constant *RHSC);
00183   Instruction *FoldCmpLoadFromIndexedGlobal(GetElementPtrInst *GEP,
00184                                             GlobalVariable *GV, CmpInst &ICI,
00185                                             ConstantInt *AndCst = nullptr);
00186   Instruction *visitFCmpInst(FCmpInst &I);
00187   Instruction *visitICmpInst(ICmpInst &I);
00188   Instruction *visitICmpInstWithCastAndCast(ICmpInst &ICI);
00189   Instruction *visitICmpInstWithInstAndIntCst(ICmpInst &ICI, Instruction *LHS,
00190                                               ConstantInt *RHS);
00191   Instruction *FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI,
00192                               ConstantInt *DivRHS);
00193   Instruction *FoldICmpShrCst(ICmpInst &ICI, BinaryOperator *DivI,
00194                               ConstantInt *DivRHS);
00195   Instruction *FoldICmpCstShrCst(ICmpInst &I, Value *Op, Value *A,
00196                                  ConstantInt *CI1, ConstantInt *CI2);
00197   Instruction *FoldICmpCstShlCst(ICmpInst &I, Value *Op, Value *A,
00198                                  ConstantInt *CI1, ConstantInt *CI2);
00199   Instruction *FoldICmpAddOpCst(Instruction &ICI, Value *X, ConstantInt *CI,
00200                                 ICmpInst::Predicate Pred);
00201   Instruction *FoldGEPICmp(GEPOperator *GEPLHS, Value *RHS,
00202                            ICmpInst::Predicate Cond, Instruction &I);
00203   Instruction *FoldShiftByConstant(Value *Op0, Constant *Op1,
00204                                    BinaryOperator &I);
00205   Instruction *commonCastTransforms(CastInst &CI);
00206   Instruction *commonPointerCastTransforms(CastInst &CI);
00207   Instruction *visitTrunc(TruncInst &CI);
00208   Instruction *visitZExt(ZExtInst &CI);
00209   Instruction *visitSExt(SExtInst &CI);
00210   Instruction *visitFPTrunc(FPTruncInst &CI);
00211   Instruction *visitFPExt(CastInst &CI);
00212   Instruction *visitFPToUI(FPToUIInst &FI);
00213   Instruction *visitFPToSI(FPToSIInst &FI);
00214   Instruction *visitUIToFP(CastInst &CI);
00215   Instruction *visitSIToFP(CastInst &CI);
00216   Instruction *visitPtrToInt(PtrToIntInst &CI);
00217   Instruction *visitIntToPtr(IntToPtrInst &CI);
00218   Instruction *visitBitCast(BitCastInst &CI);
00219   Instruction *visitAddrSpaceCast(AddrSpaceCastInst &CI);
00220   Instruction *FoldSelectOpOp(SelectInst &SI, Instruction *TI, Instruction *FI);
00221   Instruction *FoldSelectIntoOp(SelectInst &SI, Value *, Value *);
00222   Instruction *FoldSPFofSPF(Instruction *Inner, SelectPatternFlavor SPF1,
00223                             Value *A, Value *B, Instruction &Outer,
00224                             SelectPatternFlavor SPF2, Value *C);
00225   Instruction *visitSelectInst(SelectInst &SI);
00226   Instruction *visitSelectInstWithICmp(SelectInst &SI, ICmpInst *ICI);
00227   Instruction *visitCallInst(CallInst &CI);
00228   Instruction *visitInvokeInst(InvokeInst &II);
00229 
00230   Instruction *SliceUpIllegalIntegerPHI(PHINode &PN);
00231   Instruction *visitPHINode(PHINode &PN);
00232   Instruction *visitGetElementPtrInst(GetElementPtrInst &GEP);
00233   Instruction *visitAllocaInst(AllocaInst &AI);
00234   Instruction *visitAllocSite(Instruction &FI);
00235   Instruction *visitFree(CallInst &FI);
00236   Instruction *visitLoadInst(LoadInst &LI);
00237   Instruction *visitStoreInst(StoreInst &SI);
00238   Instruction *visitBranchInst(BranchInst &BI);
00239   Instruction *visitSwitchInst(SwitchInst &SI);
00240   Instruction *visitReturnInst(ReturnInst &RI);
00241   Instruction *visitInsertValueInst(InsertValueInst &IV);
00242   Instruction *visitInsertElementInst(InsertElementInst &IE);
00243   Instruction *visitExtractElementInst(ExtractElementInst &EI);
00244   Instruction *visitShuffleVectorInst(ShuffleVectorInst &SVI);
00245   Instruction *visitExtractValueInst(ExtractValueInst &EV);
00246   Instruction *visitLandingPadInst(LandingPadInst &LI);
00247 
00248   // visitInstruction - Specify what to return for unhandled instructions...
00249   Instruction *visitInstruction(Instruction &I) { return nullptr; }
00250 
00251   // True when DB dominates all uses of DI execpt UI.
00252   // UI must be in the same block as DI.
00253   // The routine checks that the DI parent and DB are different.
00254   bool dominatesAllUses(const Instruction *DI, const Instruction *UI,
00255                         const BasicBlock *DB) const;
00256 
00257   // Replace select with select operand SIOpd in SI-ICmp sequence when possible
00258   bool replacedSelectWithOperand(SelectInst *SI, const ICmpInst *Icmp,
00259                                  const unsigned SIOpd);
00260 
00261 private:
00262   bool ShouldChangeType(Type *From, Type *To) const;
00263   Value *dyn_castNegVal(Value *V) const;
00264   Value *dyn_castFNegVal(Value *V, bool NoSignedZero = false) const;
00265   Type *FindElementAtOffset(Type *PtrTy, int64_t Offset,
00266                             SmallVectorImpl<Value *> &NewIndices);
00267   Instruction *FoldOpIntoSelect(Instruction &Op, SelectInst *SI);
00268 
00269   /// ShouldOptimizeCast - Return true if the cast from "V to Ty" actually
00270   /// results in any code being generated and is interesting to optimize out. If
00271   /// the cast can be eliminated by some other simple transformation, we prefer
00272   /// to do the simplification first.
00273   bool ShouldOptimizeCast(Instruction::CastOps opcode, const Value *V,
00274                           Type *Ty);
00275 
00276   Instruction *visitCallSite(CallSite CS);
00277   Instruction *tryOptimizeCall(CallInst *CI, const DataLayout *DL);
00278   bool transformConstExprCastCall(CallSite CS);
00279   Instruction *transformCallThroughTrampoline(CallSite CS,
00280                                               IntrinsicInst *Tramp);
00281   Instruction *transformZExtICmp(ICmpInst *ICI, Instruction &CI,
00282                                  bool DoXform = true);
00283   Instruction *transformSExtICmp(ICmpInst *ICI, Instruction &CI);
00284   bool WillNotOverflowSignedAdd(Value *LHS, Value *RHS, Instruction *CxtI);
00285   bool WillNotOverflowUnsignedAdd(Value *LHS, Value *RHS, Instruction *CxtI);
00286   bool WillNotOverflowSignedSub(Value *LHS, Value *RHS, Instruction *CxtI);
00287   bool WillNotOverflowUnsignedSub(Value *LHS, Value *RHS, Instruction *CxtI);
00288   bool WillNotOverflowSignedMul(Value *LHS, Value *RHS, Instruction *CxtI);
00289   Value *EmitGEPOffset(User *GEP);
00290   Instruction *scalarizePHI(ExtractElementInst &EI, PHINode *PN);
00291   Value *EvaluateInDifferentElementOrder(Value *V, ArrayRef<int> Mask);
00292 
00293 public:
00294   // InsertNewInstBefore - insert an instruction New before instruction Old
00295   // in the program.  Add the new instruction to the worklist.
00296   //
00297   Instruction *InsertNewInstBefore(Instruction *New, Instruction &Old) {
00298     assert(New && !New->getParent() &&
00299            "New instruction already inserted into a basic block!");
00300     BasicBlock *BB = Old.getParent();
00301     BB->getInstList().insert(&Old, New); // Insert inst
00302     Worklist.Add(New);
00303     return New;
00304   }
00305 
00306   // InsertNewInstWith - same as InsertNewInstBefore, but also sets the
00307   // debug loc.
00308   //
00309   Instruction *InsertNewInstWith(Instruction *New, Instruction &Old) {
00310     New->setDebugLoc(Old.getDebugLoc());
00311     return InsertNewInstBefore(New, Old);
00312   }
00313 
00314   // ReplaceInstUsesWith - This method is to be used when an instruction is
00315   // found to be dead, replacable with another preexisting expression.  Here
00316   // we add all uses of I to the worklist, replace all uses of I with the new
00317   // value, then return I, so that the inst combiner will know that I was
00318   // modified.
00319   //
00320   Instruction *ReplaceInstUsesWith(Instruction &I, Value *V) {
00321     Worklist.AddUsersToWorkList(I); // Add all modified instrs to worklist.
00322 
00323     // If we are replacing the instruction with itself, this must be in a
00324     // segment of unreachable code, so just clobber the instruction.
00325     if (&I == V)
00326       V = UndefValue::get(I.getType());
00327 
00328     DEBUG(dbgs() << "IC: Replacing " << I << "\n"
00329                     "    with " << *V << '\n');
00330 
00331     I.replaceAllUsesWith(V);
00332     return &I;
00333   }
00334 
00335   /// Creates a result tuple for an overflow intrinsic \p II with a given
00336   /// \p Result and a constant \p Overflow value. If \p ReUseName is true the
00337   /// \p Result's name is taken from \p II.
00338   Instruction *CreateOverflowTuple(IntrinsicInst *II, Value *Result,
00339                                     bool Overflow, bool ReUseName = true) {
00340     if (ReUseName)
00341       Result->takeName(II);
00342     Constant *V[] = { UndefValue::get(Result->getType()),
00343                       Overflow ? Builder->getTrue() : Builder->getFalse() };
00344     StructType *ST = cast<StructType>(II->getType());
00345     Constant *Struct = ConstantStruct::get(ST, V);
00346     return InsertValueInst::Create(Struct, Result, 0);
00347   }
00348         
00349   // EraseInstFromFunction - When dealing with an instruction that has side
00350   // effects or produces a void value, we can't rely on DCE to delete the
00351   // instruction.  Instead, visit methods should return the value returned by
00352   // this function.
00353   Instruction *EraseInstFromFunction(Instruction &I) {
00354     DEBUG(dbgs() << "IC: ERASE " << I << '\n');
00355 
00356     assert(I.use_empty() && "Cannot erase instruction that is used!");
00357     // Make sure that we reprocess all operands now that we reduced their
00358     // use counts.
00359     if (I.getNumOperands() < 8) {
00360       for (User::op_iterator i = I.op_begin(), e = I.op_end(); i != e; ++i)
00361         if (Instruction *Op = dyn_cast<Instruction>(*i))
00362           Worklist.Add(Op);
00363     }
00364     Worklist.Remove(&I);
00365     I.eraseFromParent();
00366     MadeIRChange = true;
00367     return nullptr; // Don't do anything with FI
00368   }
00369 
00370   void computeKnownBits(Value *V, APInt &KnownZero, APInt &KnownOne,
00371                         unsigned Depth = 0, Instruction *CxtI = nullptr) const {
00372     return llvm::computeKnownBits(V, KnownZero, KnownOne, DL, Depth,
00373                                   AT, CxtI, DT);
00374   }
00375 
00376   bool MaskedValueIsZero(Value *V, const APInt &Mask,
00377                          unsigned Depth = 0,
00378                          Instruction *CxtI = nullptr) const {
00379     return llvm::MaskedValueIsZero(V, Mask, DL, Depth, AT, CxtI, DT);
00380   }
00381   unsigned ComputeNumSignBits(Value *Op, unsigned Depth = 0,
00382                               Instruction *CxtI = nullptr) const {
00383     return llvm::ComputeNumSignBits(Op, DL, Depth, AT, CxtI, DT);
00384   }
00385 
00386 private:
00387   /// SimplifyAssociativeOrCommutative - This performs a few simplifications for
00388   /// operators which are associative or commutative.
00389   bool SimplifyAssociativeOrCommutative(BinaryOperator &I);
00390 
00391   /// SimplifyUsingDistributiveLaws - This tries to simplify binary operations
00392   /// which some other binary operation distributes over either by factorizing
00393   /// out common terms (eg "(A*B)+(A*C)" -> "A*(B+C)") or expanding out if this
00394   /// results in simplifications (eg: "A & (B | C) -> (A&B) | (A&C)" if this is
00395   /// a win).  Returns the simplified value, or null if it didn't simplify.
00396   Value *SimplifyUsingDistributiveLaws(BinaryOperator &I);
00397 
00398   /// SimplifyDemandedUseBits - Attempts to replace V with a simpler value
00399   /// based on the demanded bits.
00400   Value *SimplifyDemandedUseBits(Value *V, APInt DemandedMask, APInt &KnownZero,
00401                                  APInt &KnownOne, unsigned Depth,
00402                                  Instruction *CxtI = nullptr);
00403   bool SimplifyDemandedBits(Use &U, APInt DemandedMask, APInt &KnownZero,
00404                             APInt &KnownOne, unsigned Depth = 0);
00405   /// Helper routine of SimplifyDemandedUseBits. It tries to simplify demanded
00406   /// bit for "r1 = shr x, c1; r2 = shl r1, c2" instruction sequence.
00407   Value *SimplifyShrShlDemandedBits(Instruction *Lsr, Instruction *Sftl,
00408                                     APInt DemandedMask, APInt &KnownZero,
00409                                     APInt &KnownOne);
00410 
00411   /// SimplifyDemandedInstructionBits - Inst is an integer instruction that
00412   /// SimplifyDemandedBits knows about.  See if the instruction has any
00413   /// properties that allow us to simplify its operands.
00414   bool SimplifyDemandedInstructionBits(Instruction &Inst);
00415 
00416   Value *SimplifyDemandedVectorElts(Value *V, APInt DemandedElts,
00417                                     APInt &UndefElts, unsigned Depth = 0);
00418 
00419   Value *SimplifyVectorOp(BinaryOperator &Inst);
00420   Value *SimplifyBSwap(BinaryOperator &Inst);
00421 
00422   // FoldOpIntoPhi - Given a binary operator, cast instruction, or select
00423   // which has a PHI node as operand #0, see if we can fold the instruction
00424   // into the PHI (which is only possible if all operands to the PHI are
00425   // constants).
00426   //
00427   Instruction *FoldOpIntoPhi(Instruction &I);
00428 
00429   // FoldPHIArgOpIntoPHI - If all operands to a PHI node are the same "unary"
00430   // operator and they all are only used by the PHI, PHI together their
00431   // inputs, and do the operation once, to the result of the PHI.
00432   Instruction *FoldPHIArgOpIntoPHI(PHINode &PN);
00433   Instruction *FoldPHIArgBinOpIntoPHI(PHINode &PN);
00434   Instruction *FoldPHIArgGEPIntoPHI(PHINode &PN);
00435   Instruction *FoldPHIArgLoadIntoPHI(PHINode &PN);
00436 
00437   Instruction *OptAndOp(Instruction *Op, ConstantInt *OpRHS,
00438                         ConstantInt *AndRHS, BinaryOperator &TheAnd);
00439 
00440   Value *FoldLogicalPlusAnd(Value *LHS, Value *RHS, ConstantInt *Mask,
00441                             bool isSub, Instruction &I);
00442   Value *InsertRangeTest(Value *V, Constant *Lo, Constant *Hi, bool isSigned,
00443                          bool Inside);
00444   Instruction *PromoteCastOfAllocation(BitCastInst &CI, AllocaInst &AI);
00445   Instruction *MatchBSwap(BinaryOperator &I);
00446   bool SimplifyStoreAtEndOfBlock(StoreInst &SI);
00447   Instruction *SimplifyMemTransfer(MemIntrinsic *MI);
00448   Instruction *SimplifyMemSet(MemSetInst *MI);
00449 
00450   Value *EvaluateInDifferentType(Value *V, Type *Ty, bool isSigned);
00451 
00452   /// Descale - Return a value X such that Val = X * Scale, or null if none.  If
00453   /// the multiplication is known not to overflow then NoSignedWrap is set.
00454   Value *Descale(Value *Val, APInt Scale, bool &NoSignedWrap);
00455 };
00456 
00457 } // end namespace llvm.
00458 
00459 #undef DEBUG_TYPE
00460 
00461 #endif