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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 19 13:01:48 PDT 2021


nikic created this revision.
nikic added a reviewer: aeubanks.
Herald added subscribers: dexonsmith, hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We implement logic to convert a byte offset into a sequence of GEP indices for that offset in a number of places. This patch adds a `DataLayout::getIndicesForOffset()` method, which implements the core logic. I've updated SROA, ConstantFolding and InstCombine to use it, and there's a few more places where it looks relevant.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110043

Files:
  llvm/include/llvm/IR/DataLayout.h
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/IR/DataLayout.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/test/Transforms/InstCombine/getelementptr.ll
  llvm/test/Transforms/SROA/scalable-vectors.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110043.373474.patch
Type: text/x-patch
Size: 17271 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210919/a05dc672/attachment.bin>


More information about the llvm-commits mailing list