[all-commits] [llvm/llvm-project] ba0485: [InstSimplify] add tests for min/max idioms; NFC

RotateRight via All-commits all-commits at lists.llvm.org
Mon Aug 16 11:36:04 PDT 2021


  Branch: refs/heads/release/13.x
  Home:   https://github.com/llvm/llvm-project
  Commit: ba048518e08fcb227359fae94da2a10dd37d2139
      https://github.com/llvm/llvm-project/commit/ba048518e08fcb227359fae94da2a10dd37d2139
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-08-16 (Mon, 16 Aug 2021)

  Changed paths:
    M llvm/test/Transforms/InstSimplify/maxmin.ll

  Log Message:
  -----------
  [InstSimplify] add tests for min/max idioms; NFC

(cherry picked from commit 9b942a545cb53d4bae2071a2dea513be74f68221)


  Commit: f4006c59497d425f5a3df5e68da5add21f8e467d
      https://github.com/llvm/llvm-project/commit/f4006c59497d425f5a3df5e68da5add21f8e467d
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-08-16 (Mon, 16 Aug 2021)

  Changed paths:
    M llvm/include/llvm/Analysis/ValueTracking.h
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/test/Transforms/InstSimplify/maxmin.ll

  Log Message:
  -----------
  [InstSimplify] fold min/max with limit constant

This is already done within InstCombine:
https://alive2.llvm.org/ce/z/MiGE22

...but leaving it out of analysis makes it
harder to avoid infinite loops there.

(cherry picked from commit e260e10c4a21784c146c94a2a14b7e78b09a9cf7)


  Commit: 5b60faae3f10e9a7bdf0c1b5b3d123265ce55407
      https://github.com/llvm/llvm-project/commit/5b60faae3f10e9a7bdf0c1b5b3d123265ce55407
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2021-08-16 (Mon, 16 Aug 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/select-min-max.ll

  Log Message:
  -----------
  [InstCombine] avoid infinite loops from min/max canonicalization

The intrinsics have an extra chunk of known bits logic
compared to the normal cmp+select idiom. That allows
folding the icmp in each case to something better, but
that then opposes the canonical form of min/max that
we try to form for a select.

I'm carving out a narrow exception to preserve all
existing regression tests while avoiding the inf-loop.
It seems unlikely that this is the only bug like this
left, but this should fix:
https://llvm.org/PR51419

(cherry picked from commit b267d3ce8defa092600bda717ff18440d002f316)


Compare: https://github.com/llvm/llvm-project/compare/0dd4f002e1d3...5b60faae3f10


More information about the All-commits mailing list