[PATCH] D33442: [ARM] Fix lowering of misaligned memcpy/memset

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 11:06:07 PDT 2017


efriedma added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4782
   if (VT == MVT::Other) {
+    EVT PointerVT = TLI.getPointerTy(DAG.getDataLayout(), DstAS);
     if (DstAlign >= DAG.getDataLayout().getPointerPrefAlignment(DstAS) ||
----------------
The use of getPointerTy() here seems dubious. On many architectures, you can use getPointerTy as a rough proxy for the largest legal integer type, but that's not universal, and the usage of DstAS doesn't make any sense.

Maybe just loop over {i64, i32, i16}.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4796
     MVT LVT = MVT::i64;
     while (!TLI.isTypeLegal(LVT))
       LVT = (MVT::SimpleValueType)(LVT.SimpleTy - 1);
----------------
The use of isTypeLegal() here looks suspicious; i16 is not legal on ARM, but we definitely want to use i16 stores if we can.  Do you have any testcases where the known alignment is two?


Repository:
  rL LLVM

https://reviews.llvm.org/D33442





More information about the llvm-commits mailing list