[all-commits] [llvm/llvm-project] e21ab4: [InstCombine] Infer nuw for gep inbounds from base...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Dec 10 01:01:12 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e21ab4d16b555c28ded307571d138f594f33e325
      https://github.com/llvm/llvm-project/commit/e21ab4d16b555c28ded307571d138f594f33e325
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-12-10 (Tue, 10 Dec 2024)

  Changed paths:
    M clang/test/CodeGen/attr-counted-by.c
    M clang/test/CodeGen/union-tbaa1.c
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/AMDGPU/memcpy-from-constant.ll
    M llvm/test/Transforms/InstCombine/cast_phi.ll
    M llvm/test/Transforms/InstCombine/load-cmp.ll
    M llvm/test/Transforms/InstCombine/memcpy-addrspace.ll
    M llvm/test/Transforms/InstCombine/memcpy-from-global.ll
    M llvm/test/Transforms/InstCombine/stpcpy-1.ll
    M llvm/test/Transforms/InstCombine/stpcpy_chk-1.ll
    M llvm/test/Transforms/InstCombine/strlen-1.ll
    M llvm/test/Transforms/InstCombine/strlen-4.ll
    M llvm/test/Transforms/InstCombine/strncat-2.ll
    M llvm/test/Transforms/InstCombine/strnlen-3.ll
    M llvm/test/Transforms/InstCombine/strnlen-4.ll
    M llvm/test/Transforms/InstCombine/strnlen-5.ll
    M llvm/test/Transforms/InstCombine/sub-gep.ll
    M llvm/test/Transforms/InstCombine/wcslen-1.ll
    M llvm/test/Transforms/InstCombine/wcslen-3.ll
    M llvm/test/Transforms/InstCombine/wcslen-5.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve-interleaved-accesses.ll
    M llvm/test/Transforms/LoopVectorize/AArch64/sve2-histcnt.ll
    M llvm/test/Transforms/LoopVectorize/X86/small-size.ll
    M llvm/test/Transforms/LoopVectorize/X86/x86_fp80-vector-store.ll
    M llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
    M llvm/test/Transforms/LoopVectorize/multiple-address-spaces.ll
    M llvm/test/Transforms/LoopVectorize/non-const-n.ll
    M llvm/test/Transforms/PhaseOrdering/X86/excessive-unrolling.ll
    M llvm/test/Transforms/SLPVectorizer/X86/operandorder.ll

  Log Message:
  -----------
  [InstCombine] Infer nuw for gep inbounds from base of object (#119225)

When we have a gep inbounds from the base of an object (e.g. alloca or
global), we know that the index cannot be negative, as this would go out
of bounds. As such, we can infer nuw as well.

The implementation is a bit stricter than necessary, we could also
accept one unknown index followed by known-non-negative indices.

Proof: https://alive2.llvm.org/ce/z/Hp7-6w (Note that alive2 currently
incorrectly doesn't require the inbounds for the alloca case, see
https://github.com/AliveToolkit/alive2/issues/1138).



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