[PATCH] D123628: [InstCombine] Fold memrchr calls with an excessive size to null.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 02:56:23 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:903
+      // Fold out-of-bounds accesses to null.
+      return Constant::getNullValue(CI->getType());
+  }
----------------
While this is correct, I do wonder whether we should be going out of our way to fold this to null, rather than simply bailing out of the transform. In particular, I wonder whether this will end up suppressing an asan/msan warning. It's okay to do that, as these are "best effort", but it's probably better to avoid if it doesn't cost us any additional effort?


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

https://reviews.llvm.org/D123628



More information about the llvm-commits mailing list