[PATCH] D123497: [ValueTracking] Make getStringLenth aware of strdup

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 12 09:13:17 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4254
+    if (TLIFn == LibFunc_strdup || TLIFn == LibFunc_dunder_strdup)
+      return GetStringLengthH(CB->getArgOperand(0), PHIs, TLI, CharSize);
+
----------------
efriedma wrote:
> Do you need to check somewhere that the string returned by strdup hasn't been modified?  The existing code gets away without any checks for modification because getConstantDataArrayInfo only works on constant globals, but strdup returns a modifiable buffer.
Great point, sorry for missing that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123497



More information about the llvm-commits mailing list