[all-commits] [llvm/llvm-project] 116841: RISCV: clean up target expression handling

Saleem Abdulrasool via All-commits all-commits at lists.llvm.org
Thu Jun 17 13:37:16 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 116841c623747972d0ae80239d3ea7b8409b868b
      https://github.com/llvm/llvm-project/commit/116841c623747972d0ae80239d3ea7b8409b868b
  Author: Saleem Abdulrasool <compnerd at compnerd.org>
  Date:   2021-06-17 (Thu, 17 Jun 2021)

  Changed paths:
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
    A llvm/test/MC/RISCV/expressions.s

  Log Message:
  -----------
  RISCV: clean up target expression handling

The target specific expression handling was slightly regressed by
bbea64250f65480d787e1c5ff45c4de3ec2dcda8.  This restores the proper
sub-expression evaluation to allow for constant folding within the
expression.  We explicitly discard the layout and assembler when
evaluating the expression to avoid any symbolic computation and instead
using the `evaluateAsRelocatable` to canonicalise and constant fold
only.

We can also simplify the expression handling - none of the target
variants support symbolic difference.  This simplifies the logic for
that and adds additional tests to ensure that we do not accidentally
regress here in the future.

Reviewed By: maskray

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




More information about the All-commits mailing list