[all-commits] [llvm/llvm-project] 008167: [DAGCombiner][RISCV] Make foldBinOpIntoSelect work...

Craig Topper via All-commits all-commits at lists.llvm.org
Sat Oct 22 19:14:01 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 00816714f96505c59c236f3f0fd2eb815c57f674
      https://github.com/llvm/llvm-project/commit/00816714f96505c59c236f3f0fd2eb815c57f674
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-10-22 (Sat, 22 Oct 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    A llvm/test/CodeGen/RISCV/pr58511.ll

  Log Message:
  -----------
  [DAGCombiner][RISCV] Make foldBinOpIntoSelect work correctly with opaque constants.

The CanFoldNonConst doesn't work correctly with opaque constants
because getNode won't constant fold constants if one is opaque. Even
if the operation is AND/OR. This can lead to infinite loops.

This patch does the folding manually in the DAGCombine. Alternatively,
we could improve getNode but that seemed likely to have bigger impact
and possibly increase compile time for the additional checks. We wouldn't
want to directly constant fold because we need to preserve the opaque flag.

Fixes PR58511.

Reviewed By: spatel

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




More information about the All-commits mailing list