[all-commits] [llvm/llvm-project] 985b48: [DAGCombiner] check uses more strictly on select-o...

RotateRight via All-commits all-commits at lists.llvm.org
Wed Aug 25 11:15:24 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 985b48f18341082eba135741494f14eef3d9399e
      https://github.com/llvm/llvm-project/commit/985b48f18341082eba135741494f14eef3d9399e
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-08-25 (Wed, 25 Aug 2021)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AMDGPU/idiv-licm.ll
    M llvm/test/CodeGen/X86/select.ll

  Log Message:
  -----------
  [DAGCombiner] check uses more strictly on select-of-binop fold

There are 2 bugs here:
1. We were not checking uses of operand 2 (the false value of the select).
2. We were not checking for multiple uses of nodes that produce >1 result.

Correcting those is enough to avoid the crash in the reduced test based on:
https://llvm.org/PR51612

The additional use check on operand 0 (the condition value of the select)
should not strictly be necessary because we are only replacing one use
with another (whether it makes performance sense to do the transform with
that pattern is not clear). But as noted in the TODO, changing that
uncovers another bug.

Note: there's at least one more bug here - we aren't propagating EVTs
correctly, but I plan to fix that in another patch.




More information about the All-commits mailing list