[PATCH] D24324: AMDGPU: Fix selection failure with dead AssertZext
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 7 16:36:40 PDT 2016
arsenm created this revision.
arsenm added a reviewer: tstellarAMD.
arsenm added a subscriber: llvm-commits.
Herald added subscribers: nhaehnle, wdng, arsenm.
Remove the dead AssertZext or else the ValueType operand will
fail to select for some reason.
https://reviews.llvm.org/D24324
Files:
lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
test/CodeGen/AMDGPU/captured-frame-index.ll
Index: test/CodeGen/AMDGPU/captured-frame-index.ll
===================================================================
--- test/CodeGen/AMDGPU/captured-frame-index.ll
+++ test/CodeGen/AMDGPU/captured-frame-index.ll
@@ -163,4 +163,23 @@
ret void
}
+ at g1 = external addrspace(1) global i32*
+
+; This was leaving a dead node around resulting in failing to select
+; on the leftover AssertZext's ValueType operand.
+
+; GCN-LABEL: {{^}}cannot_select_assertzext_valuetype:
+; GCN: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, g1 at GOTPCREL+4
+; GCN: v_mov_b32_e32 [[FI:v[0-9]+]], 0{{$}}
+; GCN: buffer_store_dword [[FI]]
+define void @cannot_select_assertzext_valuetype(i32 addrspace(1)* %out, i32 %idx) #0 {
+entry:
+ %b = alloca i32, align 4
+ %tmp1 = load volatile i32*, i32* addrspace(1)* @g1, align 4
+ %arrayidx = getelementptr inbounds i32, i32* %tmp1, i32 %idx
+ %tmp2 = load i32, i32* %arrayidx, align 4
+ store volatile i32* %b, i32* addrspace(1)* undef
+ ret void
+}
+
attributes #0 = { nounwind }
Index: lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
+++ lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
@@ -1550,6 +1550,9 @@
CurDAG->UpdateNodeOperands(M, makeArrayRef(NewOps, OpN));
}
+
+ if (EffectiveFI->use_empty())
+ CurDAG->RemoveDeadNode(EffectiveFI.getNode());
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24324.70619.patch
Type: text/x-patch
Size: 1423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160907/0831dbbe/attachment.bin>
More information about the llvm-commits
mailing list