[PATCH] Update users of allowsUnalignedMemoryAccesses to pass the address space

Matt Arsenault Matthew.Arsenault at amd.com
Wed Feb 5 14:55:44 PST 2014



================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3627
@@ -3626,3 +3626,3 @@
   if (VT == MVT::Other) {
-    if (DstAlign >= TLI.getDataLayout()->getPointerPrefAlignment() ||
-        TLI.allowsUnalignedMemoryAccesses(VT)) {
+    unsigned AS = 0;
+    if (DstAlign >= TLI.getDataLayout()->getPointerPrefAlignment(AS) ||
----------------
Quentin Colombet wrote:
> Instead of using the default address space here, shouldn't we add a parameter to FindOptimalMemOpLowering?
> That said, I don’t think it is possible to specify the address space for a memcpy/memset, thus I am fine with that… just asking :). 
I was also wondering a few things about that part. If memcpy / memset means the LLVM intrinsic and not the libc function, then it can have an address space. Actually, it can have a different one for the source and destination, so both need to be considered and I'm not immediately sure how to best handle that. There are special instructions for copying between some address spaces while not going through registers, so it might not be desirable to expand memcpys in that case. For some reason, I do not frequently see memcpys coming out of OpenCL, so I figured I would figure it out when I ran into it.



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



More information about the llvm-commits mailing list