3

I am using -indvars pass in LLVM. It says that is makes the loop counter start from 0 where it is possible. I used it for a simple loop, but its not making the loop count start from 0. Any idea why is it so?

The loop is

for(i=30;i<90;++i){
        a1[i]=i*2;
        a1[i]=a1[i]+1;;
}
coder hacker
  • 4,819
  • 1
  • 25
  • 50
  • Probably relevant: https://groups.google.com/forum/#!topic/llvm-dev/U1A8KRxIkQQ – Marco A. Nov 16 '14 at 23:39
  • @MarcoA. Thanks, still the suggestion of loop-rotate doesn't work. However I found the old indvar simplify pass and included in my source and got it to work. I don't know why they removed such an important pass in the first place – coder hacker Nov 16 '14 at 23:54
  • Good, you should add that as an answer and mark it as accepted. – Marco A. Nov 17 '14 at 00:03

1 Answers1

4

After some digging I found out that -indvars pass now don't canonicalize induction variable because most other passes now are made to work without need for canonical loops.

However my pass required that loops be in canonical form, so I found the old induction variable simplify pass and explicitly included in my file.

If someone is interested here is the old pass.

coder hacker
  • 4,819
  • 1
  • 25
  • 50