[PATCH] D91228: [LoopInterchange] Prevent interchange when affine load result is branch condition

Geng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 19:27:24 PST 2020


geng created this revision.
geng added reviewers: fhahn, karthikthecool.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
geng requested review of this revision.

This patch prevent the the loop interchanging when the affine load result is the branch condtions.

In the following case, the loop interchange will change store order of the global variable.

char b[][8] = {{}, {}, {}, {}, {5}, {}, 2, 3};

int c, d;

short e;

static char f() {

  for (; c <= 7; c++) {
  
    d = 4;
  
    for (; d; d--)
  
      b[d + 2][c] && (e = b[d][0]);
  
  }

}

We forbid these cases when control flow depends on the affine load value.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91228

Files:
  llvm/lib/Transforms/Scalar/LoopInterchange.cpp
  llvm/test/Transforms/LoopInterchange/affine-load-condition-no-interchange.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91228.304382.patch
Type: text/x-patch
Size: 6236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201111/52ce1b03/attachment.bin>


More information about the llvm-commits mailing list