Skip to content

Commit 07ece4e

Browse files
committed
[SimplifyLibCalls] Drop redundant CreatePointerCast in optimizeSPrintFString
Given the transition into using opaque pointers we no longer need to add casts to handle "mismatched pointer types" as all pointers types involved now are the same.
1 parent 08fdbbe commit 07ece4e

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,9 +3103,6 @@ Value *LibCallSimplifier::optimizeSPrintFString(CallInst *CI,
31033103
return ConstantInt::get(CI->getType(), SrcLen - 1);
31043104
} else if (Value *V = emitStpCpy(Dest, CI->getArgOperand(2), B, TLI)) {
31053105
// sprintf(dest, "%s", str) -> stpcpy(dest, str) - dest
3106-
// Handle mismatched pointer types (goes away with typeless pointers?).
3107-
V = B.CreatePointerCast(V, B.getInt8PtrTy());
3108-
Dest = B.CreatePointerCast(Dest, B.getInt8PtrTy());
31093106
Value *PtrDiff = B.CreatePtrDiff(B.getInt8Ty(), V, Dest);
31103107
return B.CreateIntCast(PtrDiff, CI->getType(), false);
31113108
}

0 commit comments

Comments
 (0)