[all-commits] [llvm/llvm-project] f7a977: [InstCombine] Revisit user of newly one-use instru...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Jun 14 00:12:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f7a977c7b3b4d8efebb92ed803585168df369831
      https://github.com/llvm/llvm-project/commit/f7a977c7b3b4d8efebb92ed803585168df369831
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-06-14 (Wed, 14 Jun 2023)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/InstructionWorklist.h
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/test/Other/print-debug-counter.ll
    M llvm/test/Transforms/InstCombine/or-shifted-masks.ll

  Log Message:
  -----------
  [InstCombine] Revisit user of newly one-use instructions

Many folds in InstCombine are limited to one-use instructions. For
that reason, if the use-count of an instruction drops to one, it
makes sense to revisit that one user. This is one of the most
common reasons why InstCombine fails to finish in a single iteration.

Doing this revisit actually slightly improves compile-time, because
we save an extra InstCombine iteration in enough cases to make a
visible difference.

This is conceptually NFC, but not NFC in practice, because differences
in worklist order can result in slightly different folding behavior.

The regressed tests in or-shifted-masks.ll now require a sequence of
instcombine,early-cse,instcombine to fold fully. D152876 would make
these fold in a single instcombine run again.

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




More information about the All-commits mailing list