[all-commits] [llvm/llvm-project] 36cbda: [InstCombine] Fix inbounds preservation when swapp...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue May 31 06:48:30 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 36cbdaa163bd4250923eff0812f0e84ca129347e
      https://github.com/llvm/llvm-project/commit/36cbdaa163bd4250923eff0812f0e84ca129347e
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-05-31 (Tue, 31 May 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/gep-combine-loop-invariant.ll
    M llvm/test/Transforms/LoopVectorize/ARM/mve-reductions.ll
    M llvm/test/Transforms/LoopVectorize/X86/x86-interleaved-accesses-masked-group.ll
    M llvm/test/Transforms/LoopVectorize/X86/x86-interleaved-store-accesses-with-gaps.ll
    M llvm/test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll
    M llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll

  Log Message:
  -----------
  [InstCombine] Fix inbounds preservation when swapping GEPs (PR44206)

When reassociating GEPs, we can only keep inbounds if both original
GEPs were inbounds, and their offsets have the same sign. For the
sake of simplicity, I only handle the case where both offsets are
non-negative here.

It would probably be fine to just not preserve inbounds at all here,
but as I don't see a compile-time impact for adding the
isKnownNonNegative() calls I went with this more conservative
approach.

Fixes https://github.com/llvm/llvm-project/issues/44206.

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




More information about the All-commits mailing list