This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Use isLiteralConstantLike to check whether the operand could ever be literal
ClosedPublic

Authored by cfang on Mar 30 2022, 7:09 PM.

Details

Summary

To compute the size of a VALU/SALU instruction, we need to check whether an operand could ever be literal.
Previously isLiteralConstant was used, which missed cases like global variables or external symbols. These misses lead to under-estimation of the instruction size and branch offset, and thus incorrectly skip the necessary branch relaxation when the branch offset is actually greater than what the branch bits can hold.
In this work, we use isLiteralConstantLike to check the operands. It maybe conservative, but it is safe.

Diff Detail

Event Timeline

cfang created this revision.Mar 30 2022, 7:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2022, 7:09 PM
cfang requested review of this revision.Mar 30 2022, 7:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2022, 7:09 PM
cfang added a reviewer: Restricted Project.
arsenm accepted this revision.Mar 31 2022, 6:55 AM
This revision is now accepted and ready to land.Mar 31 2022, 6:55 AM
This revision was landed with ongoing or failed builds.Mar 31 2022, 8:07 AM
This revision was automatically updated to reflect the committed changes.