[all-commits] [llvm/llvm-project] c5bcfb: [RISCV] Avoid infinite loop between DAGCombiner::v...

Alex Bradbury via All-commits all-commits at lists.llvm.org
Wed Feb 23 03:06:42 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c5bcfb983e47167a8a1826c1a64d7aa1849add06
      https://github.com/llvm/llvm-project/commit/c5bcfb983e47167a8a1826c1a64d7aa1849add06
  Author: Alex Bradbury <asb at lowrisc.org>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
    M llvm/test/CodeGen/RISCV/addimm-mulimm.ll

  Log Message:
  -----------
  [RISCV] Avoid infinite loop between DAGCombiner::visitMUL and RISCVISelLowering::transformAddImmMulImm

See https://github.com/llvm/llvm-project/issues/53831 for a full discussion.

The basic issue is that DAGCombiner::visitMUL and
RISCVISelLowering;:transformAddImmMullImm get stuck in a loop, as the
current checks in transformAddImmMulImm aren't sufficient to avoid all
cases where DAGCombiner::isMulAddWithConstProfitable might trigger a
transformation. This patch makes transformAddImmMulImm bail out if C0
(the constant used for multiplication) has more than one use.

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




More information about the All-commits mailing list