[all-commits] [llvm/llvm-project] d092df: [InstSimplify] Add tests for zero-offset opaque pt...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Apr 4 04:04:45 PDT 2022


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

  Changed paths:
    M llvm/test/Transforms/InstSimplify/opaque-ptr.ll

  Log Message:
  -----------
  [InstSimplify] Add tests for zero-offset opaque ptr constexpr GEP (NFC)


  Commit: 3c9f3f76f105196cd354a34f597b1ce88bee9b5d
      https://github.com/llvm/llvm-project/commit/3c9f3f76f105196cd354a34f597b1ce88bee9b5d
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-04-04 (Mon, 04 Apr 2022)

  Changed paths:
    M llvm/lib/IR/ConstantFold.cpp
    M llvm/test/Transforms/IndVarSimplify/lftr-opaque-pointers.ll
    M llvm/test/Transforms/InstSimplify/opaque-ptr.ll

  Log Message:
  -----------
  [ConstantFold] Fold zero-index GEPs with opaque pointers

With opaque pointers, we can eliminate zero-index GEPs even if
they have multiple indices, as this no longer impacts the result
type of the GEP.

This optimization is already done for instructions in InstSimplify,
but we were missing the corresponding constant expression handling.

The constexpr transform is a bit more powerful, because it can
produce a vector splat constant and also handles undef values --
it is an extension of an existing single-index transform.


Compare: https://github.com/llvm/llvm-project/compare/ad59bd0be976...3c9f3f76f105


More information about the All-commits mailing list