[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Jun 22 15:49:01 PDT 2003


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.45 -> 1.46

---
Log message:

Fix bug: InstCombine/2003-06-22-ConstantExprCrash.ll


---
Diffs of the changes:

Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.45 llvm/lib/VMCore/Constants.cpp:1.46
--- llvm/lib/VMCore/Constants.cpp:1.45	Mon Jun 16 07:11:33 2003
+++ llvm/lib/VMCore/Constants.cpp	Sun Jun 22 15:48:30 2003
@@ -243,8 +243,14 @@
   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));
 }





More information about the llvm-commits mailing list