Add constant folding wrapper support for select instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12319 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-03-12 05:53:03 +00:00
parent 6e32372fcd
commit 17fd273512

View File

@ -79,6 +79,10 @@ Constant *llvm::ConstantFoldInstruction(Instruction *I) {
default: return 0;
case Instruction::Cast:
return ConstantExpr::getCast(Op0, I->getType());
case Instruction::Select:
if (Constant *Op2 = dyn_cast<Constant>(I->getOperand(2)))
return ConstantExpr::getSelect(Op0, Op1, Op2);
return 0;
case Instruction::GetElementPtr:
std::vector<Constant*> IdxList;
IdxList.reserve(I->getNumOperands()-1);