mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-04 19:26:30 +00:00
DAGCombiner: Don't narrow volatile vector loads + extract
llvm-svn: 273909
This commit is contained in:
parent
d3977a7b0d
commit
f5b65dbb5a
@ -12263,6 +12263,8 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
|
|||||||
|
|
||||||
SDValue DAGCombiner::ReplaceExtractVectorEltOfLoadWithNarrowedLoad(
|
SDValue DAGCombiner::ReplaceExtractVectorEltOfLoadWithNarrowedLoad(
|
||||||
SDNode *EVE, EVT InVecVT, SDValue EltNo, LoadSDNode *OriginalLoad) {
|
SDNode *EVE, EVT InVecVT, SDValue EltNo, LoadSDNode *OriginalLoad) {
|
||||||
|
assert(!OriginalLoad->isVolatile());
|
||||||
|
|
||||||
EVT ResultVT = EVE->getValueType(0);
|
EVT ResultVT = EVE->getValueType(0);
|
||||||
EVT VecEltVT = InVecVT.getVectorElementType();
|
EVT VecEltVT = InVecVT.getVectorElementType();
|
||||||
unsigned Align = OriginalLoad->getAlignment();
|
unsigned Align = OriginalLoad->getAlignment();
|
||||||
@ -12457,9 +12459,12 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
|
|||||||
ISD::isNormalLoad(InVec.getNode()) &&
|
ISD::isNormalLoad(InVec.getNode()) &&
|
||||||
!N->getOperand(1)->hasPredecessor(InVec.getNode())) {
|
!N->getOperand(1)->hasPredecessor(InVec.getNode())) {
|
||||||
SDValue Index = N->getOperand(1);
|
SDValue Index = N->getOperand(1);
|
||||||
if (LoadSDNode *OrigLoad = dyn_cast<LoadSDNode>(InVec))
|
if (LoadSDNode *OrigLoad = dyn_cast<LoadSDNode>(InVec)) {
|
||||||
return ReplaceExtractVectorEltOfLoadWithNarrowedLoad(N, VT, Index,
|
if (!OrigLoad->isVolatile()) {
|
||||||
OrigLoad);
|
return ReplaceExtractVectorEltOfLoadWithNarrowedLoad(N, VT, Index,
|
||||||
|
OrigLoad);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform only after legalization to ensure build_vector / vector_shuffle
|
// Perform only after legalization to ensure build_vector / vector_shuffle
|
||||||
|
@ -41,3 +41,37 @@ define void @bitcast_int_to_fpvector_extract_0(float addrspace(1)* %out, i64 add
|
|||||||
store float %extract, float addrspace(1)* %out
|
store float %extract, float addrspace(1)* %out
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; GCN-LABEL: {{^}}no_extract_volatile_load_extract0:
|
||||||
|
; GCN: buffer_load_dwordx4
|
||||||
|
; GCN: buffer_store_dword v
|
||||||
|
define void @no_extract_volatile_load_extract0(i32 addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
|
||||||
|
entry:
|
||||||
|
%vec = load volatile <4 x i32>, <4 x i32> addrspace(1)* %in
|
||||||
|
%elt0 = extractelement <4 x i32> %vec, i32 0
|
||||||
|
store i32 %elt0, i32 addrspace(1)* %out
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
||||||
|
; GCN-LABEL: {{^}}no_extract_volatile_load_extract2:
|
||||||
|
; GCN: buffer_load_dwordx4
|
||||||
|
; GCN: buffer_store_dword v
|
||||||
|
|
||||||
|
define void @no_extract_volatile_load_extract2(i32 addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
|
||||||
|
entry:
|
||||||
|
%vec = load volatile <4 x i32>, <4 x i32> addrspace(1)* %in
|
||||||
|
%elt2 = extractelement <4 x i32> %vec, i32 2
|
||||||
|
store i32 %elt2, i32 addrspace(1)* %out
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
||||||
|
; GCN-LABEL: {{^}}no_extract_volatile_load_dynextract:
|
||||||
|
; GCN: buffer_load_dwordx4
|
||||||
|
; GCN: buffer_store_dword v
|
||||||
|
define void @no_extract_volatile_load_dynextract(i32 addrspace(1)* %out, <4 x i32> addrspace(1)* %in, i32 %idx) {
|
||||||
|
entry:
|
||||||
|
%vec = load volatile <4 x i32>, <4 x i32> addrspace(1)* %in
|
||||||
|
%eltN = extractelement <4 x i32> %vec, i32 %idx
|
||||||
|
store i32 %eltN, i32 addrspace(1)* %out
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user