aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-22 20:48:30 +0000
committerChris Lattner <sabre@nondot.org>2003-06-22 20:48:30 +0000
commit037d25831920ce26c6745fc7b18ccd93916658d3 (patch)
tree62b0ad0d6dd5f12110c43c7fb3ee6b785f92c0f0 /lib
parent066ab6ac80ae93af64857c5822efc81298eaca32 (diff)
Fix bug: InstCombine/2003-06-22-ConstantExprCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6857 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Constants.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index afe494e9bb..935c2938c2 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -243,8 +243,14 @@ ConstantExpr::ConstantExpr(unsigned Opcode, Constant *C, const Type *Ty)
Operands.push_back(Use(C, this));
}
+static bool isSetCC(unsigned Opcode) {
+ return Opcode == Instruction::SetEQ || Opcode == Instruction::SetNE ||
+ Opcode == Instruction::SetLT || Opcode == Instruction::SetGT ||
+ Opcode == Instruction::SetLE || Opcode == Instruction::SetGE;
+}
+
ConstantExpr::ConstantExpr(unsigned Opcode, Constant *C1, Constant *C2)
- : Constant(C1->getType()), iType(Opcode) {
+ : Constant(isSetCC(Opcode) ? Type::BoolTy : C1->getType()), iType(Opcode) {
Operands.push_back(Use(C1, this));
Operands.push_back(Use(C2, this));
}