Skip to content

Commit 0db4b1d

Browse files
committed
[SimplifyLibCalls] Adjust code comment in optimizeStringLength. NFC
The limitation in LibCallSimplifier::optimizeStringLength to only optimize when the string is an i8 array was changed already in commit 50ec0b5 back in 2017. We still only simplify when 's' points at an array of 'CharSize', so the comment is still valid in the sense that we do not support arbitrary array types. Differential Revision: https://reviews.llvm.org/D135261
1 parent 3d6c63d commit 0db4b1d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,9 +927,9 @@ Value *LibCallSimplifier::optimizeStringLength(CallInst *CI, IRBuilderBase &B,
927927
// strlen(s + x) to strlen(s) - x, when x is known to be in the range
928928
// [0, strlen(s)] or the string has a single null terminator '\0' at the end.
929929
// We only try to simplify strlen when the pointer s points to an array
930-
// of i8. Otherwise, we would need to scale the offset x before doing the
931-
// subtraction. This will make the optimization more complex, and it's not
932-
// very useful because calling strlen for a pointer of other types is
930+
// of CharSize elements. Otherwise, we would need to scale the offset x before
931+
// doing the subtraction. This will make the optimization more complex, and
932+
// it's not very useful because calling strlen for a pointer of other types is
933933
// very uncommon.
934934
if (GEPOperator *GEP = dyn_cast<GEPOperator>(Src)) {
935935
// TODO: Handle subobjects.

0 commit comments

Comments
 (0)