[PATCH] D101245: [GlobalOpt] Disable heap SROA when GEP of the only storer is used

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 11:10:59 PDT 2021


aeubanks added a comment.

In D101245#2719956 <https://reviews.llvm.org/D101245#2719956>, @MaskRay wrote:

> In D101245#2717561 <https://reviews.llvm.org/D101245#2717561>, @aeubanks wrote:
>
>> I'm not familiar with the terminology of "storer", so the description is confusing to me.
>
> I mean the instruction which stores to the malloc return value. I don't know an appropriate term.

"the store into the malloc return value/pointer" seems clearer to me



================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:1016
-    // Must index into the array and into the struct.
-    if (isa<GetElementPtrInst>(Inst) && Inst->getNumOperands() >= 3) {
-      if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Inst, GV, PHIs))
----------------
seems like this doesn't take into account when the global variable is an array.
normally, if we just have a normal struct, the GEP's first operand is the GV, second operand is something like 0, and the third operand indexes into the struct itself, which is fine for SROA. having fewer than 3 operands can directly reference the struct
with an array, we need to account for an extra index to index into the array



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101245



More information about the llvm-commits mailing list