[all-commits] [llvm/llvm-project] d58b0f: AMDGPU/MC: Try harder to evaluate absolute MC expr...

Nicolai Hähnle via All-commits all-commits at lists.llvm.org
Thu Jun 26 19:23:05 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d58b0f23d062db6250c8114b8420416260b78bd0
      https://github.com/llvm/llvm-project/commit/d58b0f23d062db6250c8114b8420416260b78bd0
  Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
  Date:   2025-06-26 (Thu, 26 Jun 2025)

  Changed paths:
    M llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCCodeEmitter.cpp

  Log Message:
  -----------
  AMDGPU/MC: Try harder to evaluate absolute MC expressions (#145146)

This is a follow-up to commit 24c860547e8 ("AMDGPU/MC: Fix emitting
absolute expressions (#136789)").

In some downstream work, we end up with an MCTargetExpr that is a
maximum (AGVK_Max) in an instruction operand. getMachineOpValueCommon
recognizes the absolute nature of the expression and doesn't emit a
fixup. getLitEncoding needs to be aligned with this decision, else we
end up with a 0 immediate without a corresponding fixup.

Note that evaluateAsAbsolute checks for MCConstantExpr as a fast path,
so this accepts strictly more cases than before.

I've tried several ways to write a test for this without success. The
challenge is that there is no upstream way to generate this kind of
expression in an instruction operand natively, and trying to create one
via inline assembly fails because the assembly parser evaluates the
expression to a constant during parsing.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list