[PATCH] D107580: [VectorCombine] Support AND/UREM indices that require freezing.

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 8 17:39:03 PDT 2021


aqjune added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:779
+/// if a freeze needs to be inserted.
+class ScalarizationResult {
+  enum class StatusTy { Unsafe, Safe, SafeWithFreeze };
----------------
spatel wrote:
> Other than the name, this looks like it could be a generic freeze utility. Should we put it in some header for other potential callers? cc @aqjune  @hyeongyukim 
Not sure whether this class can be reused, but I agree that having a header containing utilities for dealing with freeze is a good idea (or probably reuse Local.h?).
It's because we might want to keep freezes in a specific pattern for easier optimization. Currently, it is InstCombine's work to keep freeze-including expressions in a specific pattern, but it is kind of hidden.
In the case of LoopUnswitch, naively freezing the branch condition caused many assembly diffs.
To resolve this regression, we are experimenting with (1) pushing freeze into icmp arguments (which could resolve assembly diffs a lot: https://reviews.llvm.org/D106041#2922020) (2) replacing all uses of a branch condition with the frozen one.
Once the scheme is set, I'd like to have FreezeBrCond(BranchInst) that performs what LoopUnswitch is supposed to do.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107580/new/

https://reviews.llvm.org/D107580



More information about the llvm-commits mailing list