[PATCH] D32839: SimplifyLibCalls: Optimize wcslen

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 14:16:23 PDT 2017


efriedma added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:3038
     // length of the string must be zero.
-    Str = "";
+    Index.Array = nullptr;
+    Index.Offset = 0;
----------------
Do we care about the size of the array in this case?


================
Comment at: lib/Analysis/ValueTracking.cpp:3069
+    Str = "";
+    return true;
+  }
----------------
See https://bugs.llvm.org//show_bug.cgi?id=32124 .


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:458
+             I < E; ++I) {
+          if (Index.Array->getElementAsInteger(I) == 0) {
+            NullTermIdx = I;
----------------
Could you use an iterator which returns the elements of the ConstantDataArray, instead of using explicit indexing everywhere?


Repository:
  rL LLVM

https://reviews.llvm.org/D32839





More information about the llvm-commits mailing list