[all-commits] [llvm/llvm-project] 915351: [LSR] Allow already invariant operand for ICmpZero...

Philip Reames via All-commits all-commits at lists.llvm.org
Fri Jul 15 09:51:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9153515a7bea9fb9dd4c76f70053a170bf825f35
      https://github.com/llvm/llvm-project/commit/9153515a7bea9fb9dd4c76f70053a170bf825f35
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2022-07-15 (Fri, 15 Jul 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    M llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll
    M llvm/test/Transforms/LoopStrengthReduce/RISCV/icmp-zero.ll

  Log Message:
  -----------
  [LSR] Allow already invariant operand for ICmpZero matching

The ICmpZero matching is checking to see if the expression is loop invariant per SCEV and expandable. This allows expressions inside the loop which can be made loop invariant to be seamlessly expanded, but is overly conservative for expressions which already *are* loop invariant.

As a simple justification for why this is correct, consider a loop invariant urem as RHS vs an alternate function with that same urem wrapped inside a helper call. Why would it be legal to match the later, but not the former?

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




More information about the All-commits mailing list