[all-commits] [llvm/llvm-project] c3ea7c: [IR] Add ConstantExpr::getGetElementPtr() acceptin...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Sep 22 05:33:59 PDT 2026


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

  Changed paths:
    M clang/test/CodeGenCXX/cfi-stats.cpp
    M llvm/include/llvm/IR/Constants.h
    M llvm/lib/CodeGen/GlobalMerge.cpp
    M llvm/lib/IR/Constants.cpp
    M llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
    M llvm/lib/Transforms/Utils/SanitizerStats.cpp
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-dynamic-lds-test-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-dynamic-lds-test.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-lower-all.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-multi-static-dynamic-indirect-access-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-multi-static-dynamic-indirect-access.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-multiple-blocks-return-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-multiple-blocks-return.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-dynamic-indirect-access-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-dynamic-indirect-access.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-dynamic-lds-test-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-dynamic-lds-test.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access-function-param-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access-function-param.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access-lower-all.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access-no-kernel-lds-id.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-indirect-access.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-O0.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-no-heap-ptr.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-test-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-test-atomic-cmpxchg-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-test-atomicrmw-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-test-memintrinsic-asan.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-test.ll
    M llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-static-lds-vector-ptrs.ll
    M llvm/test/CodeGen/AMDGPU/lower-indirect-lds-references.ll
    M llvm/test/CodeGen/AMDGPU/lower-kernel-and-module-lds.ll
    M llvm/test/CodeGen/AMDGPU/lower-kernel-lds-super-align.ll
    M llvm/test/CodeGen/AMDGPU/lower-kernel-lds.ll
    M llvm/test/CodeGen/AMDGPU/lower-lds-struct-aa-memcpy.ll
    M llvm/test/CodeGen/AMDGPU/lower-lds-struct-aa-merge.ll
    M llvm/test/CodeGen/AMDGPU/lower-lds-struct-aa.ll
    M llvm/test/CodeGen/AMDGPU/lower-lds-with-noalias.ll
    M llvm/test/CodeGen/AMDGPU/lower-module-lds-constantexpr.ll
    M llvm/test/CodeGen/AMDGPU/lower-module-lds-precise-allocate-to-module-struct.ll
    M llvm/test/CodeGen/AMDGPU/lower-module-lds-single-var-unambiguous.ll
    M llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll
    M llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll
    M llvm/test/CodeGen/AMDGPU/lower-module-lds.ll
    M llvm/test/CodeGen/AMDGPU/machine-sink-temporal-divergence-swdev407790.ll
    M llvm/test/Transforms/GlobalMerge/alignment-2.ll
    M llvm/test/Transforms/GlobalMerge/alignment.ll
    M llvm/test/Transforms/GlobalMerge/basic.ll
    M llvm/test/Transforms/GlobalMerge/guid.ll
    M llvm/test/Transforms/GlobalMerge/macho-symbols.ll
    M llvm/test/Transforms/GlobalMerge/private-global.ll
    M llvm/test/Transforms/GlobalMerge/used.ll
    M llvm/unittests/IR/ConstantsTest.cpp

  Log Message:
  -----------
  [IR] Add ConstantExpr::getGetElementPtr() accepting DataLayout (#224652)

This overload takes GEP indices but produces a canonical i8 GEP in
ptradd representation. This is intended as a simple migration path for
places currently using `ConstantExpr::getGetElementPtr()` which cannot
be trivially replaced by `ConstantExpr::getPtrAdd()`.

This method is fallible, because something like `(getelementptr i32, ptr
@p, i64 CONST_EXPR)` can't be represented in ptradd form, because there
is no multiply constant expression. Not supporting this for constant
expressions is intentional, as we would not be able to emit a
relocatable expression for this anyway.

I have migrated a couple of sample usages in this PR. These are all
simple usages where the fallibility is not relevant.

The further plan here is to migrate everything (including IRBuilder) to
this new API, and then deprecated the one without the DataLayout
argument.



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