Move some constant folding logic for loads out of instcombine into

Analysis/ConstantFolding.cpp.  This doesn't change the behavior of
instcombine but makes other clients of ConstantFoldInstruction
able to handle loads.  This was partially extracted from Eli's patch
in PR3152.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84836 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-10-22 06:25:11 +00:00
parent 62d1723a9c
commit 878e494670
3 changed files with 57 additions and 42 deletions

View File

@@ -62,6 +62,10 @@ Constant *ConstantFoldCompareInstOperands(unsigned Predicate,
LLVMContext &Context,
const TargetData *TD = 0);
/// ConstantFoldLoadFromConstPtr - Return the value that a load from C would
/// produce if it is constant and determinable. If this is not determinable,
/// return null.
Constant *ConstantFoldLoadFromConstPtr(Constant *C, const TargetData *TD = 0);
/// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a
/// getelementptr constantexpr, return the constant value being addressed by the