[all-commits] [llvm/llvm-project] 884825: [SROA] Unfold gep of index phi (round 2) (#83494)

Arthur Eubanks via All-commits all-commits at lists.llvm.org
Mon Mar 4 14:21:38 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8848258f7bf67fbaf49213a2fb7edb8a3c2f0493
      https://github.com/llvm/llvm-project/commit/8848258f7bf67fbaf49213a2fb7edb8a3c2f0493
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2024-03-04 (Mon, 04 Mar 2024)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SROA.cpp
    M llvm/test/Transforms/SROA/phi-and-select.ll
    M llvm/test/Transforms/SROA/phi-gep.ll

  Log Message:
  -----------
  [SROA] Unfold gep of index phi (round 2) (#83494)

If a gep has only one phi as one of its operands and the remaining
indexes are constant, we can unfold `gep ptr, (phi idx1, idx2)` to `phi
((gep ptr, idx1), (gep ptr, idx2))`.

Take care not to unfold recursive phis.

Followup to #80983.

This was initially was #83087. Initial PR did not handle allocas in
entry block that weren't at the beginning of the function, causing GEPs
to be inserted after the first chunk of allocas but potentially before
an alloca not at the beginning. Insert GEPs at the end of the entry
block instead since constants/arguments/static allocas can all be used
there.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list