[PATCH] D110043: [IR] Add helper to convert offset to GEP indices

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 24 09:43:05 PDT 2021


aeubanks added a comment.

In D110043#3019942 <https://reviews.llvm.org/D110043#3019942>, @uabelho wrote:

> Hi @nikic,
>
> This (admittedly silly) example starts hitting an assertion with this patch:
>
>   opt -passes='globalopt' -S -o - very_large_offset.ll
>
> It fails with:
>
>   opt: ../lib/IR/DataLayout.cpp:913: void addElementIndex(SmallVectorImpl<llvm::APInt> &, llvm::TypeSize, llvm::APInt &): Assertion `Offset.isNonNegative() && "Remaining offset shouldn't be negative"' failed.
>
> The input contains a huge (larger than half the address space) array @s and also a Gep with a huge offset into that object so possibly this is all UB but I suppose in a very nice world the compiler shouldn't crash with an assertion anyway since I guess the input is legal?
> F19203185: very_large_offset.ll <https://reviews.llvm.org/F19203185>

Seems like `ElemSize` is greater than 2^32 and we're getting some weird math in `addElementIndex()`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110043



More information about the llvm-commits mailing list