Displaying 2 results from an estimated 2 matches for "modify_v2".
Did you mean:
modify_f
2009 Apr 22
4
[LLVMdev] Strange loop unrolling problem
...er, if the condition involves potentially
loop variant variables, the loop does get unrolled.
The volatile variable assignments are there just to keep loop
body from disappearing completely. In the real case this
is derived from, the loop body contains some inline assembly.
The code within #ifdef MODIFY_V2 in the attached C code is in
fact dead code, as the condition of the if statement is never
true. However, including this dead code in the compilation
causes unrolling to take place.
Am I missing something or should I file a bug? I tried looking
around at LoopUnroll.cpp and UnrollLoop.cpp, but did...
2009 Apr 27
1
[LLVMdev] Strange loop unrolling problem (partially solved)
...th -O3,
the following loop does not get unrolled if the ifdef'ed
dead code is not present.
------------------------------------
extern volatile int v1;
int unroll() {
int i;
int v2 = 0;
for(i = 0; i < 3; i++) {
if (i == v2) { v1 = 1000;
} else { v1 = 1001;
}
#ifdef MODIFY_V2
// Dead code
if (i == 3) { v2 = v2 + 1; }
#endif
}
return v2;
}
-----------------------------------
It turns out that the reason unrolling does not work
in the simpler case is that some optimization pass figures
out that the `then' branch of the if is always executed, and
lifts...