aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-12-15 06:11:33 +0000
committerCraig Topper <craig.topper@gmail.com>2015-12-15 06:11:33 +0000
commit1c3f28313ed0f0282c5a4f339611a15cca61bfdd (patch)
tree1654fd30ffd316b9b2ca5cf8e214e9eb2a782f33 /llvm/lib/IR/ConstantFold.cpp
parent350311974b6b67fc5832f6984fb711d8263e0703 (diff)
downloadllvm-1c3f28313ed0f0282c5a4f339611a15cca61bfdd.zip
llvm-1c3f28313ed0f0282c5a4f339611a15cca61bfdd.tar.gz
llvm-1c3f28313ed0f0282c5a4f339611a15cca61bfdd.tar.bz2
Use CmpInst::Predicate instead of 'unsigned short' in some places. NFC
llvm-svn: 255623
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 979bbbd..ce3fe03 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1685,7 +1685,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
// Otherwise, for integer compare, pick the same value as the non-undef
// operand, and fold it to true or false.
if (isIntegerPredicate)
- return ConstantInt::get(ResultTy, CmpInst::isTrueWhenEqual(pred));
+ return ConstantInt::get(ResultTy, CmpInst::isTrueWhenEqual(Predicate));
// Choosing NaN for the undef will always make unordered comparison succeed
// and ordered comparison fails.
@@ -1869,7 +1869,8 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
} else {
// Evaluate the relation between the two constants, per the predicate.
int Result = -1; // -1 = unknown, 0 = known false, 1 = known true.
- switch (evaluateICmpRelation(C1, C2, CmpInst::isSigned(pred))) {
+ switch (evaluateICmpRelation(C1, C2,
+ CmpInst::isSigned((CmpInst::Predicate)pred))) {
default: llvm_unreachable("Unknown relational!");
case ICmpInst::BAD_ICMP_PREDICATE:
break; // Couldn't determine anything about these constants.
@@ -1950,8 +1951,10 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
// If the left hand side is an extension, try eliminating it.
if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
- if ((CE1->getOpcode() == Instruction::SExt && ICmpInst::isSigned(pred)) ||
- (CE1->getOpcode() == Instruction::ZExt && !ICmpInst::isSigned(pred))){
+ if ((CE1->getOpcode() == Instruction::SExt &&
+ ICmpInst::isSigned((ICmpInst::Predicate)pred)) ||
+ (CE1->getOpcode() == Instruction::ZExt &&
+ !ICmpInst::isSigned((ICmpInst::Predicate)pred))){
Constant *CE1Op0 = CE1->getOperand(0);
Constant *CE1Inverse = ConstantExpr::getTrunc(CE1, CE1Op0->getType());
if (CE1Inverse == CE1Op0) {