[llvm] r354926 - [AMDGPU] Fixed hang during DAG combine
Stanislav Mekhanoshin via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 26 12:56:25 PST 2019
Author: rampitec
Date: Tue Feb 26 12:56:25 2019
New Revision: 354926
URL: http://llvm.org/viewvc/llvm-project?rev=354926&view=rev
Log:
[AMDGPU] Fixed hang during DAG combine
SITargetLowering::reassociateScalarOps() does not touch constants
so that DAGCombiner::ReassociateOps() does not revert the combine.
However a global address is not a ConstantSDNode.
Switched to the method used by DAGCombiner::ReassociateOps() itself
to detect constants.
Differential Revision: https://reviews.llvm.org/D58695
Modified:
llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/trunk/test/CodeGen/AMDGPU/reassoc-scalar.ll
Modified: llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp?rev=354926&r1=354925&r2=354926&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp Tue Feb 26 12:56:25 2019
@@ -8477,7 +8477,8 @@ SDValue SITargetLowering::reassociateSca
// If either operand is constant this will conflict with
// DAGCombiner::ReassociateOps().
- if (isa<ConstantSDNode>(Op0) || isa<ConstantSDNode>(Op1))
+ if (DAG.isConstantIntBuildVectorOrConstantInt(Op0) ||
+ DAG.isConstantIntBuildVectorOrConstantInt(Op1))
return SDValue();
SDLoc SL(N);
Modified: llvm/trunk/test/CodeGen/AMDGPU/reassoc-scalar.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/reassoc-scalar.ll?rev=354926&r1=354925&r2=354926&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/reassoc-scalar.ll (original)
+++ llvm/trunk/test/CodeGen/AMDGPU/reassoc-scalar.ll Tue Feb 26 12:56:25 2019
@@ -109,5 +109,21 @@ bb:
ret void
}
+ at var = common hidden local_unnamed_addr addrspace(1) global [4 x i32] zeroinitializer, align 4
+
+; GCN-LABEL: reassoc_i32_ga:
+; GCN: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, var at rel32@lo+4
+; GCN: s_addc_u32 s{{[0-9]+}}, s{{[0-9]+}}, var at rel32@hi+4
+; GCN: s_endpgm
+define amdgpu_kernel void @reassoc_i32_ga(i64 %x) {
+bb:
+ %tid = tail call i32 @llvm.amdgcn.workitem.id.x()
+ %t64 = zext i32 %tid to i64
+ %add1 = getelementptr [4 x i32], [4 x i32] addrspace(1)* @var, i64 0, i64 %t64
+ %add2 = getelementptr i32, i32 addrspace(1)* %add1, i64 %x
+ store volatile i32 1, i32 addrspace(1)* %add2, align 4
+ ret void
+}
+
declare i32 @llvm.amdgcn.workitem.id.x()
declare i32 @llvm.amdgcn.workitem.id.y()
More information about the llvm-commits
mailing list