diff options
author | Chris Lattner <sabre@nondot.org> | 2004-03-12 05:53:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-03-12 05:53:03 +0000 |
commit | 17fd273512037da9838240b522619f4a6d2792b7 (patch) | |
tree | 653100e889dc934362db6ef320593a70928a5232 /lib/Transforms/Utils/Local.cpp | |
parent | 6e32372fcdbac8eff07ab82c0b5b269d53bd9c51 (diff) |
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
Diffstat (limited to 'lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | lib/Transforms/Utils/Local.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 821d1e13eb..c54765b427 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<Constant>(I->getOperand(2))) + return ConstantExpr::getSelect(Op0, Op1, Op2); + return 0; case Instruction::GetElementPtr: std::vector<Constant*> IdxList; IdxList.reserve(I->getNumOperands()-1); |