[PATCH] D32839: SimplifyLibCalls: Optimize wcslen

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 14:01:00 PDT 2017


dblaikie added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:532
+  Type *Param0 = FT->getParamType(0);
+  unsigned CharSize = Param0->getPointerElementType()->getIntegerBitWidth();
+
----------------
Any call to "getPointerElementType" won't be valid post-typeless-pointer work. Pointers will be opaque blobs (think of it as if your C code was "all void* all the time"). Please avoid adding uses of a pointer's element type where practical (using it to determine if bitcasts need to be added, etc is unavoidable for now - and would go away once typeless pointers are done and pointer bitcasts are no longer meaningful/needed).

So, yes, I'm not sure how this could be done correctly in that case without some kind of target hint/info about the size of a wchar?


Repository:
  rL LLVM

https://reviews.llvm.org/D32839





More information about the llvm-commits mailing list