[all-commits] [llvm/llvm-project] 0eb1ef: [DAGCombiner] When combining REM ensure optimized ...

Bradley Smith via All-commits all-commits at lists.llvm.org
Wed Dec 1 03:39:23 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0eb1efb92c3078789242d89a1e914d968cf1297f
      https://github.com/llvm/llvm-project/commit/0eb1efb92c3078789242d89a1e914d968cf1297f
  Author: Bradley Smith <bradley.smith at arm.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    A llvm/test/CodeGen/AArch64/sve-srem-combine-loop.ll

  Log Message:
  -----------
  [DAGCombiner] When combining REM ensure optimized div nodes are unique

The REM DAG combine uses the visitDivLike functions to try and get an
optimized DIV node to provide better codegen, however in some cases this
visitDivLike call ends up in the BuildSDIVPow2 target hook, which in
turn sometimes will return the same node passed in to indicate not to
change it. The REM DAG combine does not anticipate this and creates a
cycle in the DAG because of it.

Fix this by ensuring any such optimized div node returned is distinct
from the node being combined.

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




More information about the All-commits mailing list