[PATCH] D130922: [InstCombine] Add support for stpncpy folding

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 06:20:41 PDT 2022


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:717
   else
-    return nullptr;
+    N = UINT64_MAX;
 
----------------
Can we keep the early return for non-constant size here? As far as I can tell, you don't do anything useful in that case, it just gets discarded later by the `N > 128` check. That's a lot less obvious than immediately rejecting all non-constant sizes here.


================
Comment at: llvm/test/Transforms/InstCombine/stpncpy-1.ll:18
+; (trading space for speed).
+ at str = private constant [4 x i8] c"4\00\00\00"
+ at str.1 = private constant [10 x i8] c"4\00\00\00\00\00\00\00\00\00"
----------------
These are probably intended to have CHECK prefixes? You can use `--check-globals` to generate them.


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

https://reviews.llvm.org/D130922



More information about the llvm-commits mailing list