[llvm] 5c375c3 - AMDGPU: Fix worklist management in simplifyDemandedVectorEltsIntrinsic
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 5 01:39:27 PST 2025
Author: Matt Arsenault
Date: 2025-03-05T16:39:19+07:00
New Revision: 5c375c3283fcd2bf4f98fe8627658e056e25dc44
URL: https://github.com/llvm/llvm-project/commit/5c375c3283fcd2bf4f98fe8627658e056e25dc44
DIFF: https://github.com/llvm/llvm-project/commit/5c375c3283fcd2bf4f98fe8627658e056e25dc44.diff
LOG: AMDGPU: Fix worklist management in simplifyDemandedVectorEltsIntrinsic
Fixes bot sanitizer error, but it does leave behind a dead instruction
if there is a bundle for some reason.
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
llvm/test/Transforms/InstCombine/AMDGPU/simplify-demanded-vector-elts-lane-intrinsics.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
index 70ccd7edce2ac..ebe740f884ea6 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
@@ -1599,11 +1599,10 @@ Value *GCNTTIImpl::simplifyAMDGCNLaneIntrinsicDemanded(
// TODO: Preserve callsite attributes?
CallInst *NewCall = IC.Builder.CreateCall(Remangled, {Extract}, OpBundles);
- Value *Result = IC.Builder.CreateInsertElement(PoisonValue::get(II.getType()),
- NewCall, FirstElt);
- IC.replaceInstUsesWith(II, Result);
- IC.eraseInstFromFunction(II);
- return Result;
+ // FIXME: If the call has a convergence bundle, we end up leaving the dead
+ // call behind.
+ return IC.Builder.CreateInsertElement(PoisonValue::get(II.getType()), NewCall,
+ FirstElt);
}
std::optional<Value *> GCNTTIImpl::simplifyDemandedVectorEltsIntrinsic(
diff --git a/llvm/test/Transforms/InstCombine/AMDGPU/simplify-demanded-vector-elts-lane-intrinsics.ll b/llvm/test/Transforms/InstCombine/AMDGPU/simplify-demanded-vector-elts-lane-intrinsics.ll
index e9d3b5e963b35..530cd1831cfaa 100644
--- a/llvm/test/Transforms/InstCombine/AMDGPU/simplify-demanded-vector-elts-lane-intrinsics.ll
+++ b/llvm/test/Transforms/InstCombine/AMDGPU/simplify-demanded-vector-elts-lane-intrinsics.ll
@@ -349,6 +349,7 @@ define i32 @extract_elt0_v2i32_readfirstlane_convergencetoken(<2 x i32> %src) co
; CHECK-LABEL: define i32 @extract_elt0_v2i32_readfirstlane_convergencetoken(
; CHECK-SAME: <2 x i32> [[SRC:%.*]]) #[[ATTR1:[0-9]+]] {
; CHECK-NEXT: [[T:%.*]] = call token @llvm.experimental.convergence.entry()
+; CHECK-NEXT: [[VEC:%.*]] = call <2 x i32> @llvm.amdgcn.readfirstlane.v2i32(<2 x i32> [[SRC]]) [ "convergencectrl"(token [[T]]) ]
; CHECK-NEXT: [[TMP1:%.*]] = extractelement <2 x i32> [[SRC]], i64 0
; CHECK-NEXT: [[ELT:%.*]] = call i32 @llvm.amdgcn.readfirstlane.i32(i32 [[TMP1]]) [ "convergencectrl"(token [[T]]) ]
; CHECK-NEXT: ret i32 [[ELT]]
More information about the llvm-commits
mailing list