[llvm-commits] [llvm] r82353 - /llvm/trunk/lib/VMCore/ConstantFold.cpp

Nick Lewycky nicholas at mxc.ca
Sat Sep 19 19:11:47 PDT 2009


Author: nicholas
Date: Sat Sep 19 21:11:47 2009
New Revision: 82353

URL: http://llvm.org/viewvc/llvm-project?rev=82353&view=rev
Log:
Delete dead code. sext and zext can not turn integers into pointers. Further,
the optimization described in the comment is only valid with target data.

Modified:
    llvm/trunk/lib/VMCore/ConstantFold.cpp

Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=82353&r1=82352&r2=82353&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.cpp Sat Sep 19 21:11:47 2009
@@ -1248,21 +1248,6 @@
                                     Constant::getNullValue(CE1Op0->getType()), 
                                     sgnd);
       }
-
-      // If the dest type is a pointer type, and the RHS is a constantexpr cast
-      // from the same type as the src of the LHS, evaluate the inputs.  This is
-      // important for things like "icmp eq (cast 4 to int*), (cast 5 to int*)",
-      // which happens a lot in compilers with tagged integers.
-      if (ConstantExpr *CE2 = dyn_cast<ConstantExpr>(V2))
-        if (CE2->isCast() && isa<PointerType>(CE1->getType()) &&
-            CE1->getOperand(0)->getType() == CE2->getOperand(0)->getType() &&
-            CE1->getOperand(0)->getType()->isInteger()) {
-          bool sgnd = isSigned;
-          if (CE1->getOpcode() == Instruction::ZExt) isSigned = false;
-          if (CE1->getOpcode() == Instruction::SExt) isSigned = true;
-          return evaluateICmpRelation(Context, CE1->getOperand(0), 
-                                      CE2->getOperand(0), sgnd);
-        }
       break;
 
     case Instruction::GetElementPtr:





More information about the llvm-commits mailing list