[PATCH] Fix SROA creating invalid bitcasts between address spaces

David Tweed david.tweed at gmail.com
Thu Nov 21 04:05:42 PST 2013



================
Comment at: lib/Transforms/Scalar/SROA.cpp:2530
@@ -2528,2 +2529,3 @@
 
-    Type *OtherPtrTy = NewAI.getType();
+    unsigned OtherAS = OtherPtr->getType()->getPointerAddressSpace();
+    Type *OtherPtrTy = NewAllocaTy->getPointerTo(OtherAS);
----------------
The patch as a whole seems to make sense, but I wonder if it might make sense in the long run to add a convenience member function "getPointerToInSameAddrSpace(OtherPtr)"? It probably depends how many places crop up that need this, but if more are going to turn up it might be clearer. Not sure.


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



More information about the llvm-commits mailing list