[all-commits] [llvm/llvm-project] b05160: [SelectionDAG] Simplify how we drop poison flags i...

Craig Topper via All-commits all-commits at lists.llvm.org
Mon Jul 11 13:42:50 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b05160dbdf828d333e4b71577f70e38d77d2e212
      https://github.com/llvm/llvm-project/commit/b05160dbdf828d333e4b71577f70e38d77d2e212
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-07-11 (Mon, 11 Jul 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

  Log Message:
  -----------
  [SelectionDAG] Simplify how we drop poison flags in SimplifyDemandedBits.

As far as I can tell what was happening in the original code is
that the getNode call receives the same operands as the original
node with different SDNodeFlags. The logic inside getNode detects
that the node already exists and intersects the flags into the
existing node and returns it. This results in Op and NewOp for the
TLO.CombineTo call always being the same node.

We may have already called CombineTo as part of the recursive handling.
A second call to CombineTo as we unwind the recursion overwrites
the previous CombineTo. I think this means any time we updated the
poison flags that was the only change that ends up getting made
and we relied on DAGCombiner to revisit and call SimplifyDemandedBits
again. The second time the poison flags wouldn't need to be dropped
and we would keep the CombineTo call from further down the recursion.

We can instead call setFlags to drop the poison flags and remove the
call to TLO.CombineTo. This way we keep the CombineTo from deeper in
the recursion which should be more efficient.

Reviewed By: spatel

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




More information about the All-commits mailing list