Fix a bug in my previous patch, thanks to Jay Foad for
authorChris Lattner <sabre@nondot.org>
Wed, 12 Dec 2007 03:56:54 +0000 (03:56 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 12 Dec 2007 03:56:54 +0000 (03:56 +0000)
pointing this out and correcting the patch!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44907 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ConstantFolding.cpp

index ebf2786cc0d653ab397ffbdf7799e11dab3b6fb9..a810b0f0d766ac47d829db73010784364cf1b4b2 100644 (file)
@@ -427,10 +427,10 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate,
       // there is a truncation or extension that we aren't modeling.
       if ((CE0->getOpcode() == Instruction::IntToPtr &&
            CE0->getOperand(0)->getType() == IntPtrTy &&
-           CE0->getOperand(1)->getType() == IntPtrTy) ||
+           Ops[1]->getOperand(0)->getType() == IntPtrTy) ||
           (CE0->getOpcode() == Instruction::PtrToInt &&
            CE0->getType() == IntPtrTy &&
-           CE0->getOperand(0)->getType() == CE0->getOperand(1)->getType())) {
+           CE0->getOperand(0)->getType() == Ops[1]->getOperand(0)->getType())) {
         Constant *NewOps[] = { 
           CE0->getOperand(0), cast<ConstantExpr>(Ops[1])->getOperand(0) 
         };