[all-commits] [llvm/llvm-project] 94d912: [InstCombine] Add test for infinite combine loop (...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Sep 16 12:02:00 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 94d912021ff35d33cde96dacd6f1db925fe9f2b8
      https://github.com/llvm/llvm-project/commit/94d912021ff35d33cde96dacd6f1db925fe9f2b8
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-09-16 (Wed, 16 Sep 2020)

  Changed paths:
    M llvm/test/Transforms/InstCombine/select.ll

  Log Message:
  -----------
  [InstCombine] Add test for infinite combine loop (NFC)

Test courtesy of bkramer for the infinite combine loop introduced
by D87480.


  Commit: 0bb06f297fe52a5125952cb6f1e264b4e7c48097
      https://github.com/llvm/llvm-project/commit/0bb06f297fe52a5125952cb6f1e264b4e7c48097
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-09-16 (Wed, 16 Sep 2020)

  Changed paths:
    M llvm/include/llvm/Analysis/InstructionSimplify.h
    M llvm/lib/Analysis/InstructionSimplify.cpp

  Log Message:
  -----------
  [InstSimplify] Clarify SimplifyWithOpReplaced() return value

If SimplifyWithOpReplaced() cannot simplify the value, null should
be returned. Make sure this really does happen in all cases,
including those where SimplifyBinOp() returns the original value.

This does not matter for existing users, but does mattter for
D87480, which would go into an infinite loop otherwise.


  Commit: 222bf3ffbc8419570fc2266a2e7d1c5f58cedaa7
      https://github.com/llvm/llvm-project/commit/222bf3ffbc8419570fc2266a2e7d1c5f58cedaa7
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-09-16 (Wed, 16 Sep 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/rem.ll
    M llvm/test/Transforms/InstCombine/select-binop-cmp.ll
    M llvm/test/Transforms/InstCombine/select.ll

  Log Message:
  -----------
  Reapply [InstCombine] Simplify select operand based on equality condition

Reapply after fixing SimplifyWithOpReplaced() to never return
the original value, which would lead to an infinite loop in this
transform.

-----

For selects of the type X == Y ? A : B, check if we can simplify A
by using the X == Y equality and replace the operand if that's
possible. We already try to do this in InstSimplify, but will only
fold if the result of the simplification is the same as B, in which
case the select can be dropped entirely. Here the select will be
retained, just one operand simplified.

As we are performing an actual replacement here, we don't have
problems with refinement / poison values.

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


Compare: https://github.com/llvm/llvm-project/compare/6859d95ea2d0...222bf3ffbc84


More information about the All-commits mailing list