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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 15:10:56 PST 2023


fhahn created this revision.
fhahn added reviewers: dmgreen, spatel, apostolakis, Carrot, t.p.northover.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141639

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141639.488786.patch
Type: text/x-patch
Size: 6808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230112/86f60cf7/attachment.bin>


More information about the llvm-commits mailing list