Dear LLVMers,
I am trying to implement a particular type of loop optimization, but I am having problems with global variables. To solve this problem, I would like to know if LLVM has some pass that moves loads outside loops. I will illustrate with an example. I want to transform this code below. I am writing in C for readability, but I am analysing LLVM IR:
int *vectorE;
void foo (int n) {
int i;
for (i = 0; i < n; i++)
vectorE[i] = i;
}
into this one:
int *vectorE;
void foo (int n) {
int i;
int* aux = vectorE;
for (i = 0; i < n; i++)
aux[i] = i;
}
Regards,
Gleison