[all-commits] [llvm/llvm-project] e351b9: [EarlyIfCvt] Don't if-convert if condition has onl...

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri May 12 11:21:34 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e351b9b66da088e5905ad3238ccf11e777943ead
      https://github.com/llvm/llvm-project/commit/e351b9b66da088e5905ad3238ccf11e777943ead
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2023-05-12 (Fri, 12 May 2023)

  Changed paths:
    M llvm/lib/CodeGen/EarlyIfConversion.cpp
    M llvm/test/CodeGen/AArch64/early-ifcvt-likely-predictable.mir

  Log Message:
  -----------
  [EarlyIfCvt] Don't if-convert if condition has only loop-invariant ops.

This patch adds a heuristic to skip if-conversion if the condition has a
high chance of being predictable.

If the condition is in a loop, consider it predictable if the condition
itself or all its operands are loop-invariant. E.g. this considers a load
from a loop-invariant address predictable; we were unable to prove that it
doesn't alias any of the memory-writes in the loop, but it is likely to
read to same value multiple times.

This is a relatively crude heuristic, but it helps to prevent excessive
if-conversion in multiple workloads in practice.

Reviewed By: apostolakis

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




More information about the All-commits mailing list