[llvm-branch-commits] [llvm-gcc-branch] r79606 - /llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp

Bill Wendling isanbard at gmail.com
Fri Aug 21 00:34:14 PDT 2009


Author: void
Date: Fri Aug 21 02:34:13 2009
New Revision: 79606

URL: http://llvm.org/viewvc/llvm-project?rev=79606&view=rev
Log:
$ svn merge -c 79605 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Merging r79605 into '.':
U    gcc/llvm-convert.cpp


Modified:
    llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp?rev=79606&r1=79605&r2=79606&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Bender-SWB/gcc/llvm-convert.cpp Fri Aug 21 02:34:13 2009
@@ -3318,9 +3318,21 @@
   Value *In  = Emit(TREE_OPERAND(exp, 0), 0);
   Value *Amt = Emit(TREE_OPERAND(exp, 1), 0);
 
-  if (isa<PointerType>(In->getType()))
-    In = Builder.CreatePtrToInt(In, Amt->getType(),
+  if (isa<PointerType>(In->getType())) {
+    const Type *Ty = 0;
+
+    switch (getInt64(TYPE_SIZE (TREE_TYPE (TREE_OPERAND (exp, 0))), true)) {
+    default: assert(0 && "Pointer size in bits not a power of 2!");
+    case 1:  Ty = Type::getInt1Ty(Context);  break;
+    case 8:  Ty = Type::getInt8Ty(Context);  break;
+    case 16: Ty = Type::getInt16Ty(Context); break;
+    case 32: Ty = Type::getInt32Ty(Context); break;
+    case 64: Ty = Type::getInt64Ty(Context); break;
+    }
+
+    In = Builder.CreatePtrToInt(In, Ty,
                                 (In->getNameStr()+".cast").c_str());
+  }
 
   if (Amt->getType() != In->getType())
     Amt = Builder.CreateIntCast(Amt, In->getType(), false,





More information about the llvm-branch-commits mailing list