[all-commits] [llvm/llvm-project] ff2ed1: [MC] evaluateAsAbsolute requires MCValue::RefKind==0

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat Mar 15 15:34:28 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ff2ed154a8a9ea52adb3667833fe6fddd27b0487
      https://github.com/llvm/llvm-project/commit/ff2ed154a8a9ea52adb3667833fe6fddd27b0487
  Author: Fangrui Song <i at maskray.me>
  Date:   2025-03-15 (Sat, 15 Mar 2025)

  Changed paths:
    M llvm/lib/MC/MCExpr.cpp
    M llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp

  Log Message:
  -----------
  [MC] evaluateAsAbsolute requires MCValue::RefKind==0

In `.equ a, 3; .if a at plt`, a at plt does not evaluate to an absolute value
(MCExpr::evaluateAsRelocatableImpl disables evaluation when the Kind !=
0 at parse time). Similarly, when using MCTargetValue,
evaluateAsAbsolute should return false when MCValue::RefKind==0.

This allows us to remove `if (!Asm)` check from MipsMCExpr.cpp
(%hi(0xdeadbeef) is not evaluated to a constant without RefKind) and
make targets less error-prone.



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