aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/ConstantFold.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r--lib/VMCore/ConstantFold.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 5f7e0ef1b8..db21bd3d78 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.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.
///