[PATCH] D109527: [Delinearization] Delinearization of Array-of-Struct. Proof-of-Concept.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 9 10:13:58 PDT 2021


Meinersbur created this revision.
Herald added subscribers: javed.absar, hiraditya.
Meinersbur requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

  struct  __attribute__((packed)) Pair { int x; long y; };
  void foo(unsigned long N,  struct Pair A[][N]) {
    for (unsigned long i = 0; i < N; i+=1)
        A[i][i].y = 0;
  }

lowered to

  %0 = mul nsw i64 %i.0, %N
  %arrayidx = getelementptr inbounds %struct.Pair, %struct.Pair* %A, i64 %0
  %arrayidx1 = getelementptr inbounds %struct.Pair, %struct.Pair* %arrayidx, i64 %i.0
  %y = getelementptr inbounds %struct.Pair, %struct.Pair* %arrayidx1, i64 0, i32 1

corresponding to the SCEVExpr

  {4,+,(12 + (12 * %N))}<%for.cond>

delinearized to

  ArrayDecl[UnknownSize][%N][12]
  ArrayRef[{0,+,1}<%for.cond>][{0,+,1}<%for.cond>][4]

See test case `array_of_struct.ll`


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109527

Files:
  llvm/include/llvm/Analysis/Delinearization.h
  llvm/lib/Analysis/Delinearization.cpp
  llvm/test/Analysis/Delinearization/array_of_struct.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109527.371643.patch
Type: text/x-patch
Size: 7517 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210909/f6c9facd/attachment.bin>


More information about the llvm-commits mailing list