Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
16 changes: 16 additions & 0 deletions llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
; --------------------------------------------------------------------
Expand All @@ -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
; --------------------------------------------------------------------
Expand Down