[all-commits] [llvm/llvm-project] 45a0b8: [InstCombine] Remove early constant fold

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Feb 20 07:48:59 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 45a0b812fa13ec255cae91f974540a4d805a8d79
      https://github.com/llvm/llvm-project/commit/45a0b812fa13ec255cae91f974540a4d805a8d79
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/pr38677.ll

  Log Message:
  -----------
  [InstCombine] Remove early constant fold

InstCombine currently performs a constant folding attempt as part
of the main InstCombine loop, before visiting the instruction.
However, each visit method will also attempt to simplify the
instruction, which will in turn constant fold it. (Additionally,
we also constant fold instructions before the main InstCombine loop
and use a constant folding IR builder, so this is doubly redundant.)

There is one place where InstCombine visit methods currently don't
call into simplification, and that's casts. To be conservative,
I've added an explicit constant folding call there (though it has
no impact on tests).

This makes for a mild compile-time improvement and in particular
mitigates the compile-time regression from enabling load
simplification in be88b5814d9efce131dbc0c8e288907e2e6c89be.

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




More information about the All-commits mailing list