This is an archive of the discontinued LLVM Phabricator instance.

[LoopInterchange] Prevent interchange when affine load result is branch condition
Needs ReviewPublic

Authored by geng on Nov 10 2020, 7:27 PM.

Details

Summary

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.

Diff Detail

Event Timeline

geng created this revision.Nov 10 2020, 7:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2020, 7:27 PM
geng requested review of this revision.Nov 10 2020, 7:27 PM
geng changed the visibility from "Public (No Login Required)" to "No One".Nov 10 2020, 11:03 PM
geng changed the visibility from "No One" to "Public (No Login Required)".Nov 12 2020, 12:37 AM