This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Remove isLiteralConstant and isLiteralConstantLike
ClosedPublic

Authored by foad on May 17 2022, 3:32 AM.

Details

Summary

isLiteralConstant and isLiteralConstantLike were similar to
!isInlineConstant with slight differences like handling isReg operands.

To avoid a profusion of similar functions with undocumented differences,
this patch removes all the isLiteralConstant* variants. Callers are responsible
for handling the isReg case.

Diff Detail

Event Timeline

foad created this revision.May 17 2022, 3:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 17 2022, 3:32 AM
foad requested review of this revision.May 17 2022, 3:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 17 2022, 3:32 AM
arsenm added inline comments.May 17 2022, 6:27 AM
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
3640–3641

This doesn't make any sense to me

foad added inline comments.May 17 2022, 6:38 AM
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
3640–3641

Yeah, so this function needs a better name - something that means "is this operand guaranteed not to make the instruction 4 bytes bigger?". I suppose that is (the converse of) what the isLiteralConstantLike name was supposed to imply.

arsenm added inline comments.May 17 2022, 7:34 AM
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
3640–3641

Most of the uses are checking register as is, so could this just assert on registers?

arsenm requested changes to this revision.Nov 16 2022, 4:32 PM
arsenm added inline comments.
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
3640–3641

I think this should be an assert and users should have to explicitly look for registers

This revision now requires changes to proceed.Nov 16 2022, 4:32 PM
foad updated this revision to Diff 476107.Nov 17 2022, 6:25 AM

Stop handling register operands in isInlineConstant.

foad marked an inline comment as done.Nov 17 2022, 6:26 AM
arsenm accepted this revision.Nov 17 2022, 8:30 AM

LGTM

This revision is now accepted and ready to land.Nov 17 2022, 8:30 AM
foad edited the summary of this revision. (Show Details)Nov 17 2022, 8:45 AM
This revision was automatically updated to reflect the committed changes.