This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Trim trailing undefs from the end of image and buffer store
ClosedPublic

Authored by matejam on Jun 8 2023, 6:02 AM.

Details

Summary

Remove undef values from the end of the vector operand in image and
buffer store instructions.

Continuation of: 88421ea973916e Trim zero components from buffer and image stores.

Diff Detail

Event Timeline

matejam created this revision.Jun 8 2023, 6:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2023, 6:02 AM
matejam requested review of this revision.Jun 8 2023, 6:02 AM
arsenm added inline comments.Jun 8 2023, 7:24 AM
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
391–396

You can skip the whole computeKnownFPClass call in this case

llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-simplify-image-buffer-stores.ll
93

Should use poison in place of undef

matejam updated this revision to Diff 529915.Jun 9 2023, 4:55 AM

Instead of call to computeKnownFPClass, use findScalarElement.

foad added inline comments.Jun 15 2023, 3:47 AM
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
387–388

I don't think there's any need for this. Almost everything is an Instruction or a Constant, and anything that is not will just break out of the loop on the first iteration anyway.

394

Should use isNullValue because we don't want to match -0.0.

matejam updated this revision to Diff 531720.Jun 15 2023, 6:01 AM

Remove unnecessary if, use isNullValue instead of isZeroValue.
Thanks @foad.

foad accepted this revision.Jun 15 2023, 6:10 AM
foad added inline comments.
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
403

Should really put braces around the "else" part if there are braces around the "if" part.

This revision is now accepted and ready to land.Jun 15 2023, 6:10 AM
This revision was landed with ongoing or failed builds.Jun 15 2023, 6:20 AM
This revision was automatically updated to reflect the committed changes.
matejam marked an inline comment as done.Jun 15 2023, 6:20 AM