Remove outdated references to dominance frontiers.
[oota-llvm.git] / include / llvm / Transforms / Utils / Local.h
index 0b8147e76dfd95865db9b34d4a62c63ead3ad88c..26b5dd8365f193800be955dbc4e227aa3df97317 100644 (file)
@@ -27,20 +27,9 @@ class PHINode;
 class AllocaInst;
 class ConstantExpr;
 class TargetData;
-class DbgInfoIntrinsic;
 
 template<typename T> class SmallVectorImpl;
   
-//===----------------------------------------------------------------------===//
-//  Local analysis.
-//
-
-/// isSafeToLoadUnconditionally - Return true if we know that executing a load
-/// from this value cannot trap.  If it is not obviously safe to load from the
-/// specified pointer, we do a quick local scan of the basic block containing
-/// ScanFrom, to determine if the address is already accessed.
-bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom);
-
 //===----------------------------------------------------------------------===//
 //  Local constant propagation.
 //
@@ -80,6 +69,10 @@ bool RecursivelyDeleteDeadPHINode(PHINode *PN);
 ///
 /// This returns true if it changed the code, note that it can delete
 /// instructions in other blocks as well in this block.
+///
+/// WARNING: Do not use this function on unreachable blocks, as recursive
+/// simplification is not able to handle corner-case scenarios that can
+/// arise in them.
 bool SimplifyInstructionsInBlock(BasicBlock *BB, const TargetData *TD = 0);
     
 //===----------------------------------------------------------------------===//
@@ -129,9 +122,7 @@ bool EliminateDuplicatePHINodes(BasicBlock *BB);
 /// of the CFG.  It returns true if a modification was made, possibly deleting
 /// the basic block that was pointed to.
 ///
-/// WARNING:  The entry node of a method may not be simplified.
-///
-bool SimplifyCFG(BasicBlock *BB);
+bool SimplifyCFG(BasicBlock *BB, const TargetData *TD = 0);
 
 /// FoldBranchToCommonDest - If this basic block is ONLY a setcc and a branch,
 /// and if a predecessor branches to us and one of our successors, fold the
@@ -154,11 +145,17 @@ AllocaInst *DemoteRegToStack(Instruction &X,
 /// The phi node is deleted and it returns the pointer to the alloca inserted. 
 AllocaInst *DemotePHIToStack(PHINode *P, Instruction *AllocaPoint = 0);
 
-/// OnlyUsedByDbgIntrinsics - Return true if the instruction I is only used
-/// by DbgIntrinsics. If DbgInUses is specified then the vector is filled 
-/// with DbgInfoIntrinsic that use the instruction I.
-bool OnlyUsedByDbgInfoIntrinsics(Instruction *I, 
-                           SmallVectorImpl<DbgInfoIntrinsic *> *DbgInUses = 0);
+/// getOrEnforceKnownAlignment - If the specified pointer has an alignment that
+/// we can determine, return it, otherwise return 0.  If PrefAlign is specified,
+/// and it is more than the alignment of the ultimate object, see if we can
+/// increase the alignment of the ultimate object, making this check succeed.
+unsigned getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
+                                    const TargetData *TD = 0);
+
+/// getKnownAlignment - Try to infer an alignment for the specified pointer.
+static inline unsigned getKnownAlignment(Value *V, const TargetData *TD = 0) {
+  return getOrEnforceKnownAlignment(V, 0, TD);
+}
 
 } // End llvm namespace