[all-commits] [llvm/llvm-project] ad7f02: [InstCombine] Process blocks in RPO

Nikita Popov via All-commits all-commits at lists.llvm.org
Sun Jul 30 09:39:08 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ad7f02010f32bff28fec139e103ad0240e160aa9
      https://github.com/llvm/llvm-project/commit/ad7f02010f32bff28fec139e103ad0240e160aa9
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-07-30 (Sun, 30 Jul 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/oss_fuzz_32759.ll
    M llvm/test/Transforms/InstCombine/pr44245.ll
    M llvm/test/Transforms/InstCombine/select.ll
    M llvm/test/Transforms/InstCombine/store.ll

  Log Message:
  -----------
  [InstCombine] Process blocks in RPO

InstComine currently processes blocks in an arbitrary
depth-first order. This can break the usual invariant that the
operands of an instruction should be simplified before the
instruction itself, if uses across basic blocks (particularly
inside phi nodes) are involved.

This patch switches the initial worklist population to use RPO
instead, which will ensure that predecessors are visited before
successors (back-edges notwithstanding).

This allows us to fold more cases within a single InstCombine
iteration, in preparation for D154579. This change by itself
is a minor compile-time regression of about 0.1%, which will
be more than recovered by switching to single-iteration InstCombine.

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




More information about the All-commits mailing list