Skip to content

Commit 092b865

Browse files
committed
[AMDGPU] Use poison instead of undef for non-demanded elements
1 parent bbe6c81 commit 092b865

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ static Value *simplifyAMDGCNMemoryIntrinsicDemanded(InstCombiner &IC,
12611261

12621262
unsigned NewNumElts = DemandedElts.popcount();
12631263
if (!NewNumElts)
1264-
return UndefValue::get(IIVTy);
1264+
return PoisonValue::get(IIVTy);
12651265

12661266
if (NewNumElts >= VWidth && DemandedElts.isMask()) {
12671267
if (DMaskIdx >= 0)
@@ -1299,7 +1299,7 @@ static Value *simplifyAMDGCNMemoryIntrinsicDemanded(InstCombiner &IC,
12991299

13001300
if (IsLoad) {
13011301
if (NewNumElts == 1) {
1302-
return IC.Builder.CreateInsertElement(UndefValue::get(IIVTy), NewCall,
1302+
return IC.Builder.CreateInsertElement(PoisonValue::get(IIVTy), NewCall,
13031303
DemandedElts.countr_zero());
13041304
}
13051305

llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4792,7 +4792,7 @@ define amdgpu_ps float @extract_elt0_image_sample_2d_v4f32_f32(float %s, float %
47924792

47934793
define amdgpu_ps float @extract_elt0_dmask_0000_image_sample_3d_v4f32_f32(float %s, float %t, float %r, <8 x i32> inreg %sampler, <4 x i32> inreg %rsrc) #0 {
47944794
; CHECK-LABEL: @extract_elt0_dmask_0000_image_sample_3d_v4f32_f32(
4795-
; CHECK-NEXT: ret float undef
4795+
; CHECK-NEXT: ret float poison
47964796
;
47974797
%data = call <4 x float> @llvm.amdgcn.image.sample.3d.v4f32.f32(i32 0, float %s, float %t, float %r, <8 x i32> %sampler, <4 x i32> %rsrc, i1 false, i32 0, i32 0)
47984798
%elt0 = extractelement <4 x float> %data, i32 0

llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4791,7 +4791,7 @@ define amdgpu_ps float @extract_elt0_image_sample_2d_v4f32_f32(float %s, float %
47914791

47924792
define amdgpu_ps float @extract_elt0_dmask_0000_image_sample_3d_v4f32_f32(float %s, float %t, float %r, <8 x i32> inreg %sampler, <4 x i32> inreg %rsrc) #0 {
47934793
; CHECK-LABEL: @extract_elt0_dmask_0000_image_sample_3d_v4f32_f32(
4794-
; CHECK-NEXT: ret float undef
4794+
; CHECK-NEXT: ret float poison
47954795
;
47964796
%data = call <4 x float> @llvm.amdgcn.image.sample.3d.v4f32.f32(i32 0, float %s, float %t, float %r, <8 x i32> %sampler, <4 x i32> %rsrc, i1 false, i32 0, i32 0)
47974797
%elt0 = extractelement <4 x float> %data, i32 0

0 commit comments

Comments
 (0)