Add support for a simple constantexpr: cast of one ptr type to another


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5829 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/InstSelectSimple.cpp b/lib/Target/X86/InstSelectSimple.cpp
index 91d3013..6adccb1 100644
--- a/lib/Target/X86/InstSelectSimple.cpp
+++ b/lib/Target/X86/InstSelectSimple.cpp
@@ -307,6 +307,11 @@
       emitGEPOperation(MBB, IP, CE->getOperand(0),
                        CE->op_begin()+1, CE->op_end(), R);
       return;
+    } else if (CE->getOpcode() == Instruction::Cast &&
+               isa<PointerType>(CE->getType()) &&
+               isa<PointerType>(CE->getOperand(0)->getType())) {
+      copyConstantToRegister(MBB, IP, cast<Constant>(CE->getOperand(0)), R);
+      return;
     }
 
     std::cerr << "Offending expr: " << C << "\n";