diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 821d1e13ebc..c54765b4278 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -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(I->getOperand(2))) + return ConstantExpr::getSelect(Op0, Op1, Op2); + return 0; case Instruction::GetElementPtr: std::vector IdxList; IdxList.reserve(I->getNumOperands()-1);