mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-27 05:50:12 +00:00
[LowerMemIntrinsics] Explicitly use i8 type in memmove lowering
By convention, memcpy/memmove intrinsics are always used with i8 pointers (though this is not enforced), so in practice this code was always using an i8 type. Make that explicit. Of course, i8 is not a very profitable choice, and this code could be more performant by picking an appropriate larger type. But that would require additional test coverage and correctness review, and certainly shouldn't be a decision based on the pointer element type.
This commit is contained in:
parent
8f7f3c1f99
commit
c9032f1a69
@ -297,7 +297,13 @@ static void createMemMoveLoop(Instruction *InsertBefore, Value *SrcAddr,
|
||||
Function *F = OrigBB->getParent();
|
||||
const DataLayout &DL = F->getParent()->getDataLayout();
|
||||
|
||||
Type *EltTy = SrcAddr->getType()->getPointerElementType();
|
||||
// TODO: Use different element type if possible?
|
||||
IRBuilder<> CastBuilder(InsertBefore);
|
||||
Type *EltTy = CastBuilder.getInt8Ty();
|
||||
Type *PtrTy =
|
||||
CastBuilder.getInt8PtrTy(SrcAddr->getType()->getPointerAddressSpace());
|
||||
SrcAddr = CastBuilder.CreateBitCast(SrcAddr, PtrTy);
|
||||
DstAddr = CastBuilder.CreateBitCast(DstAddr, PtrTy);
|
||||
|
||||
// Create the a comparison of src and dst, based on which we jump to either
|
||||
// the forward-copy part of the function (if src >= dst) or the backwards-copy
|
||||
|
Loading…
x
Reference in New Issue
Block a user