[all-commits] [llvm/llvm-project] 5969e5: [IR] Handle large element size when calculating GE...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Sep 24 13:20:39 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5969e5743ae9cd17d08436a4b1139b8c4a24cc4d
      https://github.com/llvm/llvm-project/commit/5969e5743ae9cd17d08436a4b1139b8c4a24cc4d
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-09-24 (Fri, 24 Sep 2021)

  Changed paths:
    M llvm/lib/IR/DataLayout.cpp
    A llvm/test/Transforms/GlobalOpt/large-element-size.ll

  Log Message:
  -----------
  [IR] Handle large element size when calculating GEP indices

This is a fix for the issue reported at
https://reviews.llvm.org/D110043#3019942:
The ElementSize is a uint64_t and as such may be larger than the
index space, or be negative in the index space. This is UB, but
shouldn't cause assertion failures.

We address this by detecting whether the size is too large and
use a zero index in that case (which is always conservatively
correct).

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




More information about the All-commits mailing list