mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
[SelectionDAG] Use the correct return type for memcpy, memmove, and memset.
When generating calls to memcpy, memmove, and memset, use void* as the return type rather than void, to match the standard signatures for these functions. This has no practical effect for most targets, since the return values of these calls aren't being used anyway, and most calling conventions tolerate this kind of mismatch. However, this change will help support future optimizations to utilize the return value to avoid holding the argument value live across a call. llvm-svn: 258691
This commit is contained in:
parent
fe66a6200d
commit
105451ecf0
@ -4662,7 +4662,7 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, SDLoc dl, SDValue Dst,
|
|||||||
CLI.setDebugLoc(dl)
|
CLI.setDebugLoc(dl)
|
||||||
.setChain(Chain)
|
.setChain(Chain)
|
||||||
.setCallee(TLI->getLibcallCallingConv(RTLIB::MEMCPY),
|
.setCallee(TLI->getLibcallCallingConv(RTLIB::MEMCPY),
|
||||||
Type::getVoidTy(*getContext()),
|
Dst.getValueType().getTypeForEVT(*getContext()),
|
||||||
getExternalSymbol(TLI->getLibcallName(RTLIB::MEMCPY),
|
getExternalSymbol(TLI->getLibcallName(RTLIB::MEMCPY),
|
||||||
TLI->getPointerTy(getDataLayout())),
|
TLI->getPointerTy(getDataLayout())),
|
||||||
std::move(Args), 0)
|
std::move(Args), 0)
|
||||||
@ -4723,7 +4723,7 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, SDLoc dl, SDValue Dst,
|
|||||||
CLI.setDebugLoc(dl)
|
CLI.setDebugLoc(dl)
|
||||||
.setChain(Chain)
|
.setChain(Chain)
|
||||||
.setCallee(TLI->getLibcallCallingConv(RTLIB::MEMMOVE),
|
.setCallee(TLI->getLibcallCallingConv(RTLIB::MEMMOVE),
|
||||||
Type::getVoidTy(*getContext()),
|
Dst.getValueType().getTypeForEVT(*getContext()),
|
||||||
getExternalSymbol(TLI->getLibcallName(RTLIB::MEMMOVE),
|
getExternalSymbol(TLI->getLibcallName(RTLIB::MEMMOVE),
|
||||||
TLI->getPointerTy(getDataLayout())),
|
TLI->getPointerTy(getDataLayout())),
|
||||||
std::move(Args), 0)
|
std::move(Args), 0)
|
||||||
@ -4785,7 +4785,7 @@ SDValue SelectionDAG::getMemset(SDValue Chain, SDLoc dl, SDValue Dst,
|
|||||||
CLI.setDebugLoc(dl)
|
CLI.setDebugLoc(dl)
|
||||||
.setChain(Chain)
|
.setChain(Chain)
|
||||||
.setCallee(TLI->getLibcallCallingConv(RTLIB::MEMSET),
|
.setCallee(TLI->getLibcallCallingConv(RTLIB::MEMSET),
|
||||||
Type::getVoidTy(*getContext()),
|
Dst.getValueType().getTypeForEVT(*getContext()),
|
||||||
getExternalSymbol(TLI->getLibcallName(RTLIB::MEMSET),
|
getExternalSymbol(TLI->getLibcallName(RTLIB::MEMSET),
|
||||||
TLI->getPointerTy(getDataLayout())),
|
TLI->getPointerTy(getDataLayout())),
|
||||||
std::move(Args), 0)
|
std::move(Args), 0)
|
||||||
|
@ -21,7 +21,7 @@ define i32 @foo() {
|
|||||||
; CHECK-LABEL: call_memcpy:
|
; CHECK-LABEL: call_memcpy:
|
||||||
; CHECK-NEXT: .param i32, i32, i32{{$}}
|
; CHECK-NEXT: .param i32, i32, i32{{$}}
|
||||||
; CHECK-NEXT: .result i32{{$}}
|
; CHECK-NEXT: .result i32{{$}}
|
||||||
; CHECK-NEXT: call memcpy@FUNCTION, $0, $1, $2{{$}}
|
; CHECK-NEXT: i32.call $discard=, memcpy@FUNCTION, $0, $1, $2{{$}}
|
||||||
; CHECK-NEXT: return $0{{$}}
|
; CHECK-NEXT: return $0{{$}}
|
||||||
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1)
|
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1)
|
||||||
define i8* @call_memcpy(i8* %p, i8* nocapture readonly %q, i32 %n) {
|
define i8* @call_memcpy(i8* %p, i8* nocapture readonly %q, i32 %n) {
|
||||||
|
Loading…
Reference in New Issue
Block a user