-
Notifications
You must be signed in to change notification settings - Fork 15.4k
AMDGPU: Make is.shared and is.private propagate poison #128617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AMDGPU: Make is.shared and is.private propagate poison #128617
Conversation
|
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-backend-amdgpu Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/128617.diff 2 Files Affected:
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 5fdb918c87545..aafe8105482d2 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
; --------------------------------------------------------------------
|
feca2a8 to
c5d0362
Compare
shiltian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good but what is the benefit of doing it?
poison folds out better and we want to get rid of undef |

No description provided.