[llvm-commits] [llvm] r50994 - in /llvm/trunk/lib: Bitcode/Reader/BitcodeReader.cpp VMCore/Instructions.cpp

Nate Begeman natebegeman at mac.com
Mon May 12 13:11:05 PDT 2008


Author: sampo
Date: Mon May 12 15:11:05 2008
New Revision: 50994

URL: http://llvm.org/viewvc/llvm-project?rev=50994&view=rev
Log:
Pointer comparisons should be handled by icmp, not vicmp :)

Modified:
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=50994&r1=50993&r2=50994&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon May 12 15:11:05 2008
@@ -1359,7 +1359,7 @@
           OpNum+1 != Record.size())
         return Error("Invalid CMP record");
       
-      if (LHS->getType()->isInteger())
+      if (LHS->getType()->isInteger() || isa<PointerType>(LHS->getType()))
         I = new ICmpInst((ICmpInst::Predicate)Record[OpNum], LHS, RHS);
       else if (LHS->getType()->isFloatingPoint())
         I = new FCmpInst((FCmpInst::Predicate)Record[OpNum], LHS, RHS);

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=50994&r1=50993&r2=50994&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Mon May 12 15:11:05 2008
@@ -2335,7 +2335,7 @@
 CmpInst::CmpInst(const Type *ty, OtherOps op, unsigned short predicate,
                  Value *LHS, Value *RHS, const std::string &Name,
                  Instruction *InsertBefore)
-  : Instruction(Type::Int1Ty, op,
+  : Instruction(ty, op,
                 OperandTraits<CmpInst>::op_begin(this),
                 OperandTraits<CmpInst>::operands(this),
                 InsertBefore) {
@@ -2348,7 +2348,7 @@
 CmpInst::CmpInst(const Type *ty, OtherOps op, unsigned short predicate,
                  Value *LHS, Value *RHS, const std::string &Name,
                  BasicBlock *InsertAtEnd)
-  : Instruction(Type::Int1Ty, op,
+  : Instruction(ty, op,
                 OperandTraits<CmpInst>::op_begin(this),
                 OperandTraits<CmpInst>::operands(this),
                 InsertAtEnd) {





More information about the llvm-commits mailing list