This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Refine undef handling for llvm.amdgcn.class intrinsic
ClosedPublic

Authored by arsenm on May 24 2023, 8:29 AM.

Details

Reviewers
foad
rampitec
Group Reviewers
Restricted Project
Summary

This barely matters since 99% are converted to the generic intrinsic now,
and the only real difference is the target intrinsic supports a variable
test mask. Start propagating poison. Prefer folding to a defined result (false)
for an undef test mask. Propagate undef for the first operand.

Diff Detail

Event Timeline

arsenm created this revision.May 24 2023, 8:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2023, 8:29 AM
arsenm requested review of this revision.May 24 2023, 8:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2023, 8:29 AM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm updated this revision to Diff 525194.May 24 2023, 8:31 AM
arsenm updated this revision to Diff 525195.
Harbormaster completed remote builds in B234214: Diff 525195.
This revision is now accepted and ready to land.May 24 2023, 9:59 AM
foad added inline comments.May 24 2023, 1:29 PM
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
471

I don't think this is sound, e.g if the RHS is 0 (but not a ConstantInt) then the result should be 0, not undef.

Perhaps you could fold it to RHS != 0?

arsenm added inline comments.May 24 2023, 11:25 PM
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
471

icmp ne x, undef folds to undef, so that would be the same thing

foad added inline comments.May 24 2023, 11:54 PM
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
471

No we're talking about the case where LHS is undef.

arsenm updated this revision to Diff 525775.May 25 2023, 1:39 PM

Compare with undef

foad accepted this revision.May 26 2023, 1:10 AM