projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cfdd148
)
Teach the constant folder how to do select instructions
author
Chris Lattner
<sabre@nondot.org>
Fri, 12 Mar 2004 05:53:32 +0000
(
05:53
+0000)
committer
Chris Lattner
<sabre@nondot.org>
Fri, 12 Mar 2004 05:53:32 +0000
(
05:53
+0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12321
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/VMCore/ConstantFold.cpp
patch
|
blob
|
history
diff --git
a/lib/VMCore/ConstantFold.cpp
b/lib/VMCore/ConstantFold.cpp
index 5f7e0ef1b81ed8e409f8a71fbcdbf1dcf8ac5aa3..db21bd3d7822fff7007e6b9f816381bace9bf2da 100644
(file)
--- 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.
///