[PATCH] D128364: [InstCombine] Look through more casts when folding memchr and memcmp

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 11:50:24 PDT 2022


efriedma added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4196
+    Op0 = Op0->stripPointerCasts();
     const GlobalVariable *GV = dyn_cast<GlobalVariable>(Op0);
     if (!GV)
----------------
Maybe it makes sense to just drop the `dyn_cast<GlobalVariable>` here?


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4287
   if (Slice.Array == nullptr) {
-    if (TrimAtNul) {
+    if (Slice.Length && TrimAtNul) {
       Str = StringRef();
----------------
Not sure I understand this change; why does it matter if the slice is zero-length here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128364



More information about the llvm-commits mailing list