[PATCH] Address Space Casting

Eli Friedman eli.friedman at gmail.com
Tue Sep 3 13:16:36 PDT 2013



================
Comment at: docs/LangRef.rst:5701
@@ +5700,3 @@
+performed with ``bitcast`` instruction.
+
+Example:
----------------
This isn't a very good description of what the semantics are; you should note that argument and the result reference the same location in memory.

================
Comment at: docs/LangRef.rst:5658
@@ -5653,2 +5657,3 @@
+instructions first.
 
 Example:
----------------
It would be more clear to say "Pointer types may only be converted to other pointer types with the same address space".

================
Comment at: docs/LangRef.rst:5708
@@ +5707,3 @@
+      %X = bitcast i32* %x to addrspace(1) i32*    ; yields addrspace(1) i32*:%x
+      %Y = bitcast addrspace(1) <2 x i32>* %y to addrspace(2) i64*    ; yields addrspace(2) i32*:%y
+
----------------
Might want to double-check this. :)

================
Comment at: lib/IR/AutoUpgrade.cpp:404
@@ +403,2 @@
+  return Opc;
+}
----------------
This isn't appropriate: this transformation changes the semantics of the code.  bitcast is explicitly not equivalent to addrspacecast; it's equivalent to a ptrtoint+inttoptr pair.

================
Comment at: lib/IR/Instructions.cpp:2830
@@ -2788,1 +2829,3 @@
+      return false;
+
     // Now we know we're not dealing with a pointer/non-pointer mismatch. In all
----------------
It would probably be clearer to write "if (SrcTy->isPointerTy()) return SrcTy->getPointerAddressSpace() == DstTy->getPointerAddressSpace();".


http://llvm-reviews.chandlerc.com/D1401



More information about the llvm-commits mailing list