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

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 20 10:34:01 PDT 2021


aeubanks accepted this revision.
aeubanks added inline comments.
This revision is now accepted and ready to land.


================
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) {
----------------
nikic wrote:
> 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.
ah I didn't see the bitcast below


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

https://reviews.llvm.org/D110043



More information about the llvm-commits mailing list