[PATCH] D149507: [SeparateConstOffsetFromGEP] Fix bug handling negative offsets

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 29 06:09:22 PDT 2023


tstellar added a comment.

In D149507#4307404 <https://reviews.llvm.org/D149507#4307404>, @Peakulorain wrote:

> Transforming `zext(A op B)` to `zext(A) op zext(B)` should guarantee that `A` and `B` are **non-negative**.  I think it would be better to do this fix during `ConstantOffsetExtractor::CanTraceInto`.

The problem I'm running into is that it's very difficult to to prove a value is non-negative, so adding those kinds of checks into CanTraceInto more or less disables the pass.  The pass also makes an incorrect assumption that operands to an inbounds GEP are always non-negative.  And it's not just assuming that direct operands to inbounds GEPS are non-negative, it assumes that any operands in the tree of values feeding into the GEP are non-negative.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149507/new/

https://reviews.llvm.org/D149507



More information about the llvm-commits mailing list