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

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 24 01:05:58 PDT 2021


uabelho added a comment.

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>


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