[llvm] 5deb2aa - AMDGPU: Make is.shared and is.private propagate poison (#128617)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 24 21:56:46 PST 2025
Author: Matt Arsenault
Date: 2025-02-25T12:56:43+07:00
New Revision: 5deb2aa9eb454db266fb1ad38502dc6fac92ae48
URL: https://github.com/llvm/llvm-project/commit/5deb2aa9eb454db266fb1ad38502dc6fac92ae48
DIFF: https://github.com/llvm/llvm-project/commit/5deb2aa9eb454db266fb1ad38502dc6fac92ae48.diff
LOG: AMDGPU: Make is.shared and is.private propagate poison (#128617)
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
index bac3bb5fde7b0..ebc00e59584ac 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
@@ -1256,7 +1256,10 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
}
case Intrinsic::amdgcn_is_shared:
case Intrinsic::amdgcn_is_private: {
- if (isa<UndefValue>(II.getArgOperand(0)))
+ Value *Src = II.getArgOperand(0);
+ if (isa<PoisonValue>(Src))
+ return IC.replaceInstUsesWith(II, PoisonValue::get(II.getType()));
+ if (isa<UndefValue>(Src))
return IC.replaceInstUsesWith(II, UndefValue::get(II.getType()));
if (isa<ConstantPointerNull>(II.getArgOperand(0)))
diff --git a/llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll b/llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
index 54d7bdc1717da..3605c4a929c58 100644
--- a/llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
+++ b/llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
@@ -5671,6 +5671,14 @@ define i1 @test_is_shared_undef() nounwind {
ret i1 %val
}
+define i1 @test_is_shared_poison() nounwind {
+; CHECK-LABEL: @test_is_shared_poison(
+; CHECK-NEXT: ret i1 poison
+;
+ %val = call i1 @llvm.amdgcn.is.shared(ptr poison)
+ ret i1 %val
+}
+
; --------------------------------------------------------------------
; llvm.amdgcn.is.private
; --------------------------------------------------------------------
@@ -5693,6 +5701,14 @@ define i1 @test_is_private_undef() nounwind {
ret i1 %val
}
+define i1 @test_is_private_poison() nounwind {
+; CHECK-LABEL: @test_is_private_poison(
+; CHECK-NEXT: ret i1 poison
+;
+ %val = call i1 @llvm.amdgcn.is.private(ptr poison)
+ ret i1 %val
+}
+
; --------------------------------------------------------------------
; llvm.amdgcn.trig.preop
; --------------------------------------------------------------------
More information about the llvm-commits
mailing list