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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 20 09:59:58 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:1008
+  // type.
+  // TODO: Should we avoid extra zero indices if it can't be reached anyway?
+  while (ElemTy != ResElemTy) {
----------------
aeubanks wrote:
> what do you mean by this?
We add extra zero indices in the hope that can return `ResType` without inserting a bitcast. But if that's not actually possible, we'll just add the maximum number of zeros and insert the bitcast anyway.


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

https://reviews.llvm.org/D110043



More information about the llvm-commits mailing list