diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-03-12 05:53:32 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-03-12 05:53:32 +0000 |
| commit | 6ea4b52903beb11eb358c4d732ae1ec589384718 (patch) | |
| tree | 2ceb4b6bf51756fbed3afb9ee3f0b71b61e12cec /llvm/lib | |
| parent | 52bd5cb96709332e7c81cf0c5c37de4782403a9d (diff) | |
| download | bcm5719-llvm-6ea4b52903beb11eb358c4d732ae1ec589384718.tar.gz bcm5719-llvm-6ea4b52903beb11eb358c4d732ae1ec589384718.zip | |
Teach the constant folder how to do select instructions
llvm-svn: 12321
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/ConstantFolding.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/ConstantFolding.cpp b/llvm/lib/VMCore/ConstantFolding.cpp index 5f7e0ef1b81..db21bd3d782 100644 --- a/llvm/lib/VMCore/ConstantFolding.cpp +++ b/llvm/lib/VMCore/ConstantFolding.cpp @@ -582,6 +582,17 @@ Constant *llvm::ConstantFoldCastInstruction(const Constant *V, } } +Constant *llvm::ConstantFoldSelectInstruction(const Constant *Cond, + const Constant *V1, + const Constant *V2) { + if (Cond == ConstantBool::True) + return const_cast<Constant*>(V1); + else if (Cond == ConstantBool::False) + return const_cast<Constant*>(V2); + return 0; +} + + /// IdxCompare - Compare the two constants as though they were getelementptr /// indices. This allows coersion of the types to be the same thing. /// |

