[PATCH] D7241: Partially fix memcpy / memset / memmove lowering in SelectionDAG construction if address space != 0.

Manuel Jacob via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 29 09:35:40 PST 2015


mjacob added inline comments.

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4560
@@ +4559,3 @@
+  if (AS != 0 && !TLI->isNoopAddrSpaceCast(AS, 0)) {
+    report_fatal_error("cannot lower memory intrinsic in address space " +
+                       Twine(AS));
----------------
theraven wrote:
> I'm not sure why we're doing this assertion at all.  The correct thing to do is delegate to the target here and ask it for the *correct* memcpy variant.  We currently work around this limitation by doing an IR pass that translates memcpy intrinsics into the correct calls but that prevents expansion in the back end.
I agree. A few points, though:

1) This removes an assert in SelectionDAGBuilder which (a) is completely x86-specific and (b) is not present in release builds which are used by most LLVM users, generating wrong code without even giving a warning.

2) This solution works fine for the common case where the memcpy comes from a small aggregate assignment in the frontend or is formed from a few consecutive loads and stores by the optimizer. In other cases an error is reported instead of emitting wrong code.

While the change here is not solving all problems for everyone, it makes the situation strictly better than before in my opinion.


http://reviews.llvm.org/D7241





More information about the llvm-commits mailing list