[PATCH] Make SROA handle addrspacecast

Sanjoy Das sanjoy at playingwithpointers.com
Tue Jun 16 13:20:16 PDT 2015

Comment at: lib/Transforms/Scalar/SROA.cpp:1825
@@ +1824,3 @@
+  if (Ptr->getType() != PointerTy) {
+    Ptr = IRB.CreatePointerBitCastOrAddrSpaceCast(Ptr, PointerTy,
+                                                  NamePrefix + "sroa_cast");
Will this transform a "gep(addrspacecast X), Y)" to "addrspacecast(gep X, Y')"?  If so, I think we need a target specific hook that does a legality check on the addrspacecast we're about to insert -- I don't think "addrspacecast X" is legal implies an addrspacecast on a GEP derived from X is also legal.



More information about the llvm-commits mailing list