[PATCH] D57616: [DAGCombiner] Discard pointer info when combining extract_vector_elt of a vector load when the index isn't constant

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 1 14:08:37 PST 2019


craig.topper updated this revision to Diff 184841.
craig.topper added a comment.

Actually include the change and not just the comments I wrote after making the change.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57616/new/

https://reviews.llvm.org/D57616

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp


Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -15640,11 +15640,17 @@
     Offset = DAG.getConstant(PtrOff, DL, PtrType);
     MPI = OriginalLoad->getPointerInfo().getWithOffset(PtrOff);
   } else {
+    // We can't preserve pointer info, so don't do this transform if the the
+    // access isn't in the default address space.
+    if (OriginalLoad->getPointerInfo().getAddrSpace() != 0)
+      return SDValue();
     Offset = DAG.getZExtOrTrunc(EltNo, DL, PtrType);
     Offset = DAG.getNode(
         ISD::MUL, DL, PtrType, Offset,
         DAG.getConstant(VecEltVT.getStoreSize(), DL, PtrType));
-    MPI = OriginalLoad->getPointerInfo();
+    // Discard the pointer info because the memory operand can't represent this
+    // new access since the offset is variable.
+    MPI = MachinePointerInfo();
   }
   NewPtr = DAG.getNode(ISD::ADD, DL, PtrType, NewPtr, Offset);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57616.184841.patch
Type: text/x-patch
Size: 1039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190201/9b836552/attachment.bin>


More information about the llvm-commits mailing list