arcana-lab / noelle

NOELLE Offers Empowering LLVM Extensions
MIT License
72 stars 35 forks source link

Fix privatizer issue #100

Closed chenxiao2402 closed 8 months ago

chenxiao2402 commented 8 months ago

Add the PrivatizerIssue testcase to trigger the incorrect logic in Privatizer::getInitProgramPoint, then add a fix.

To check that a global array is completely initialized, privatizer expects the following pattern, where the instruction globalArray[i] = 20; is called a initializer of globalArray.

int globalArray[10];
void f() {
  for (int i = 0; i < 10; i++) {
    globalArray[i] = 20;
  }
}

Privatizer didn't check initializers rigorously enough so that it would say globalArray2[i] = 40; is also a initializer, which is incorrect because globalArray2 is not completely initialized.

int globalArray2[10];
void f() {
  for (int i = 0; i < 10; i++) {
    if (i > 7) {
      globalArray2[i] = 40;
    }
  }
}