[all-commits] [llvm/llvm-project] 1cbb35: [InstCombine] Support GEP chains in foldCmpLoadFro...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Sep 9 07:51:07 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1cbb35e044e2902b049499116c93f98f9a30955e
      https://github.com/llvm/llvm-project/commit/1cbb35e044e2902b049499116c93f98f9a30955e
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2025-09-09 (Tue, 09 Sep 2025)

  Changed paths:
    M llvm/include/llvm/Analysis/Loads.h
    M llvm/lib/Analysis/Loads.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/test/Transforms/InstCombine/load-cmp.ll

  Log Message:
  -----------
  [InstCombine] Support GEP chains in foldCmpLoadFromIndexedGlobal() (#157447)

Currently this fold only supports a single GEP. However, in ptradd
representation, it may be split across multiple GEPs. In particular, PR
#151333 will split off constant offset GEPs.

To support this, add a new helper decomposeLinearExpression(), which
decomposes a pointer into a linear expression of the form BasePtr +
Index * Scale + Offset.

I plan to also extend this helper to look through mul/shl on the index
and use it in more places that currently use collectOffset() to extract
a single index * scale. This will make sure such optimizations are not
affected by the ptradd migration.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list