[all-commits] [llvm/llvm-project] dd0226: [IR] Add helper to convert offset to GEP indices

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Sep 20 11:20:36 PDT 2021


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

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

  Log Message:
  -----------
  [IR] Add helper to convert offset to GEP indices

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::getGEPIndicesForOffset() 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.

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




More information about the All-commits mailing list