[all-commits] [llvm/llvm-project] 18e137: [BPF] Undo transformation for LICM.cpp:hoistMinMax()

eddyz87 via All-commits all-commits at lists.llvm.org
Tue Jul 11 12:32:47 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 18e13739b8c02e0b82e3e587c33e8731c8a46b0a
  Author: Eduard Zingerman <eddyz87 at gmail.com>
  Date:   2023-07-11 (Tue, 11 Jul 2023)

  Changed paths:
    M llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp
    A llvm/test/CodeGen/BPF/sink-min-max.ll

  Log Message:
  [BPF] Undo transformation for LICM.cpp:hoistMinMax()

Extended BPFCheckAndAdjustIR pass with sinkMinMax() transformation
that undoes LICM hoistMinMax pass.

The undo transformation converts the following patterns:

    x < min(a, b) -> x < a && x < b
    x > min(a, b) -> x > a || x > b
    x < max(a, b) -> x < a || x < b
    x > max(a, b) -> x > a && x > b

Where 'a' or 'b' is a constant.
Also supports `sext min(...) ...` and `zext min(...) ...`.


This was previously commited as 09feee559a29 and reverted in
0bf9bfeacc8c because of the testbot memory leak report:

The memory leak issue was caused by incorrect instruction removal
sequence in skinMinMaxBB():

    I->dropAllReferences();  -------->  I->eraseFromParent();
    I->removeFromParent();   fixed to

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

More information about the All-commits mailing list