Implemented constant propogation of cast instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1064 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2001-10-31 05:07:57 +00:00
parent 11c862cf46
commit 37aabf28b3
6 changed files with 49 additions and 4 deletions

View File

@@ -175,10 +175,16 @@ inline ConstPoolBool *operator<=(const ConstPoolVal &V1,
// Implement higher level instruction folding type instructions
//===----------------------------------------------------------------------===//
inline ConstPoolVal *ConstantFoldCastInstruction(ConstPoolVal *V,
const Type *DestTy) {
return ConstRules::get(*V)->castTo(V, DestTy);
}
inline ConstPoolVal *ConstantFoldUnaryInstruction(unsigned Opcode,
ConstPoolVal *V) {
switch (Opcode) {
case Instruction::Not: return !*V;
// TODO: Handle get element ptr instruction here in the future? GEP null?
}
return 0;
}