[all-commits] [llvm/llvm-project] b8917a: [LICM] Reassociate GEPs to allow hoisting

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Apr 11 01:37:19 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b8917ac62ad49a0ce6de026c086599fc5fa35566
      https://github.com/llvm/llvm-project/commit/b8917ac62ad49a0ce6de026c086599fc5fa35566
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-04-11 (Tue, 11 Apr 2023)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LICM.cpp
    M llvm/test/CodeGen/PowerPC/no-ctr-loop-if-exit-in-nested-loop.ll
    M llvm/test/Transforms/LICM/gep-reassociate.ll

  Log Message:
  -----------
  [LICM] Reassociate GEPs to allow hoisting

Reassociate gep (gep ptr, idx1), idx2 to gep (gep ptr, idx2), idx1
if this would make the inner GEP loop invariant and thus hoistable.

This is intended to replace an InstCombine fold that does this (in
https://github.com/llvm/llvm-project/blob/04f61fb73dc6a994ab267d431f2fdaedc67430ff/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp#L2006).
The problem with the InstCombine fold is that LoopInfo is an optional
dependency, so it is not performed reliably.

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




More information about the All-commits mailing list