[all-commits] [llvm/llvm-project] 171102: AMDGPU: Use isLiteralConstantLike to check whether...

Changpeng Fang via All-commits all-commits at lists.llvm.org
Thu Mar 31 08:07:31 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1711020c3769d38e146c2c116376a2255630613a
      https://github.com/llvm/llvm-project/commit/1711020c3769d38e146c2c116376a2255630613a
  Author: Changpeng Fang <Changpeng.Fang at amd.com>
  Date:   2022-03-31 (Thu, 31 Mar 2022)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
    M llvm/lib/Target/AMDGPU/SIInstructions.td
    A llvm/test/CodeGen/AMDGPU/literal-constant-like-operand-instruction-size.ll

  Log Message:
  -----------
  AMDGPU: Use isLiteralConstantLike to check whether the operand could ever be literal

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.

Reviewers: arsenm

Differential Revision: https://reviews.llvm.org/D122778




More information about the All-commits mailing list