[all-commits] [llvm/llvm-project] 78f880: [ConstantFold] Fix incorrect inbounds inference fo...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Feb 1 06:14:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 78f88082de3627ea04501c83a08f52cf1e60b4f7
      https://github.com/llvm/llvm-project/commit/78f88082de3627ea04501c83a08f52cf1e60b4f7
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-02-01 (Wed, 01 Feb 2023)

  Changed paths:
    M llvm/lib/IR/ConstantFold.cpp
    M llvm/test/CodeGen/WebAssembly/address-offsets.ll
    M llvm/test/Transforms/InstCombine/getelementptr.ll
    M llvm/test/Transforms/InstCombine/snprintf-2.ll
    M llvm/test/Transforms/InstCombine/snprintf-3.ll
    M llvm/test/Transforms/InstCombine/snprintf-4.ll

  Log Message:
  -----------
  [ConstantFold] Fix incorrect inbounds inference for [0 x T] GEPs

Previously all indices into [0 x T] arrays were considered in
range, which resulted in us incorrectly inferring inbounds for
all GEPs of that form. We should not consider them in range here,
and instead bail out of the rewriting logic (which would divide
by zero).

Do continue to consider 0 always in range, to avoid changing
behavior for zero-index GEPs.




More information about the All-commits mailing list