[PATCH] D65167: [GlobalISel] Support for inlining memcpy, memset and memmove calls

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 15:02:30 PDT 2019


aemerson marked 2 inline comments as done.
aemerson added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:880
+    return false; // Leave it to the legalizer to lower it to a libcall.
+  unsigned KnownLen = LenVRegAndVal->Value;
+
----------------
paquette wrote:
> IIRC this returns an int64_t and can return negative values; should we check that this is positive? Or is it not possible for it to be negative?
I don't think it's possible to specify a "negative" length, if it somehow happened then it would be UB I think.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:882-885
+  if (KnownLen == 0) {
+    MI.eraseFromParent();
+    return true;
+  }
----------------
paquette wrote:
> should we assert that KnownLen != 0 in the optimize functions now?
Will do.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65167





More information about the llvm-commits mailing list