[all-commits] [llvm/llvm-project] b83c4a: [x86] Fix infinite loop inside DAG combiner with l...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Fri Apr 22 17:02:07 PDT 2022


  Branch: refs/heads/release/14.x
  Home:   https://github.com/llvm/llvm-project
  Commit: b83c4a2dc0fb620761301f57e92118a3971f66cd
      https://github.com/llvm/llvm-project/commit/b83c4a2dc0fb620761301f57e92118a3971f66cd
  Author: Pierre Gousseau <pierre.gousseau at sony.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/lzcnt-zext-cmp.ll

  Log Message:
  -----------
  [x86] Fix infinite loop inside DAG combiner with lzcnt feature.

The issue affects targets supporting fast-lzcnt such as btver2.
This removes extraneous zext/trunc node insertions to fix the infinite
loop.
This fixes Issue https://github.com/llvm/llvm-project/issues/54694

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

Reviewed By: RKSimon, spatel, lebedev.ri

(cherry picked from commit a3d5f1cf5d88dfbbed931951e07f328d5ceba510)
Signed-off-by: Warren Ristow <warren.ristow at sony.com>

In https://reviews.llvm.org/D122900 a new function (to exercise the
infinite-loop bug) was added to llvm/test/CodeGen/X86/lzcnt-zext-cmp.ll.
In applying the fix in the main branch, two previously existing
functions in that test also changed behavior slightly, and in the review
it was noted:
    The instructions generated end up being reordered in some cases
    but I think it is equivalent.
That reordering did not happen in those pre-existing functions when
applying the fix to the slightly older code-base of the llvm14 branch,
and so they are suppressed here.  So the updated version of the test in
this commit has the additional function added to it, but it is otherwise
identical to the previous llvm14 version of the test.


  Commit: 9a3e81e1f91fa8793857fdfdacfd7e70ac365bb8
      https://github.com/llvm/llvm-project/commit/9a3e81e1f91fa8793857fdfdacfd7e70ac365bb8
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/ashr-lshr.ll
    M llvm/test/Transforms/InstCombine/logical-select.ll
    M llvm/test/Transforms/InstCombine/truncating-saturate.ll

  Log Message:
  -----------
  [InstCombine] canonicalize select with signbit test

This is part of solving issue #54750 - in that example
we have both forms of the compare and do not recognize
the equivalence.

(cherry picked from commit 2c2568f39ec641aa8f1dcc011f2ce642c2d3423f)


Compare: https://github.com/llvm/llvm-project/compare/0fbe860711be...9a3e81e1f91f


More information about the All-commits mailing list