[PATCH] D18230: [SimplifyLibCalls] Simplify strlen to a subtraction for certain cases

Li Huang via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 13:40:01 PDT 2016


lihuang added a comment.

I tried to make getConstantStringInfo work for this case but didn't find a good way.

I think this case needs a different logic than getConstantStringInfo, though requiring same checks on the GEP. getConstantStringInfo returns the string pointed to by the input pointer, but the string is not decided at compile time when the input pointer is a GEP with variable index. We could extend the logic of getConstantStringInfo, but that will need changing the signature and refactoring lots of code, as this function is already used in many places.

In order to avoid duplicate code, I could extract the GEP part from getConstantStringInfo into another function so it could be shared.


http://reviews.llvm.org/D18230





More information about the llvm-commits mailing list