[all-commits] [llvm/llvm-project] b6d9ad: [InstCombine] Optimize select(freeze(icmp eq/ne x, ...

Juneyoung Lee via All-commits all-commits at lists.llvm.org
Fri Aug 7 23:22:52 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b6d9add71b1a7bc77ce504ed09a43288ca67c0cd
      https://github.com/llvm/llvm-project/commit/b6d9add71b1a7bc77ce504ed09a43288ca67c0cd
  Author: Juneyoung Lee <aqjune at gmail.com>
  Date:   2020-08-08 (Sat, 08 Aug 2020)

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

  Log Message:
  -----------
  [InstCombine] Optimize select(freeze(icmp eq/ne x, y), x, y)

This patch adds an optimization that folds select(freeze(icmp eq/ne x, y), x, y)
to x or y.
This was needed to resolve slowdown after D84940 is applied.

I tried to bake this logic into foldSelectInstWithICmp, but it wasn't clear.
This patch conservatively writes the pattern in a separate function,
foldSelectWithFrozenICmp.

The output does not need freeze; https://alive2.llvm.org/ce/z/X49hNE (from @nikic)

Reviewed By: nikic

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




More information about the All-commits mailing list