[llvm-commits] [dragonegg] r136334 - /dragonegg/trunk/src/Convert.cpp

Duncan Sands baldrick at free.fr
Wed Jul 27 22:45:16 PDT 2011


Author: baldrick
Date: Thu Jul 28 00:45:16 2011
New Revision: 136334

URL: http://llvm.org/viewvc/llvm-project?rev=136334&view=rev
Log:
Fix a few places that were making assumptions about the kind of
pointer type returned by ConvertType on a pointer.

Modified:
    dragonegg/trunk/src/Convert.cpp

Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=136334&r1=136333&r2=136334&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Thu Jul 28 00:45:16 2011
@@ -2413,7 +2413,7 @@
   // Perform a cast here if necessary.  For example, GCC sometimes forms an
   // ADDR_EXPR where the operand is an array, and the ADDR_EXPR type is a
   // pointer to the first element.
-  return Builder.CreateBitCast(LV.Ptr, ConvertType(TREE_TYPE(exp)));
+  return Builder.CreateBitCast(LV.Ptr, getRegType(TREE_TYPE(exp)));
 }
 
 Value *TreeToLLVM::EmitCondExpr(tree exp) {
@@ -6308,6 +6308,11 @@
     return Builder.CreateIntCast(V, RegTy, /*isSigned*/!TYPE_UNSIGNED(type));
   }
 
+  if (RegTy->isPointerTy()) {
+    assert(MemTy->isPointerTy() && "Type mismatch!");
+    return Builder.CreateBitCast(V, RegTy);
+  }
+
   if (RegTy->isStructTy()) {
     assert(TREE_CODE(type) == COMPLEX_TYPE && "Expected a complex type!");
     assert(MemTy->isStructTy() && "Type mismatch!");
@@ -6350,6 +6355,11 @@
     return Builder.CreateIntCast(V, MemTy, /*isSigned*/!TYPE_UNSIGNED(type));
   }
 
+  if (MemTy->isPointerTy()) {
+    assert(RegTy->isPointerTy() && "Type mismatch!");
+    return Builder.CreateBitCast(V, MemTy);
+  }
+
   if (MemTy->isStructTy()) {
     assert(TREE_CODE(type) == COMPLEX_TYPE && "Expected a complex type!");
     assert(RegTy->isStructTy() && "Type mismatch!");





More information about the llvm-commits mailing list