Burkhard Ilsen
2011-Jun-17 20:16 UTC
[LLVMdev] how to let loop induction variable count down
Hi all! I am new to llvm, writing a backend. The documentation for -indvars (http://llvm.org/docs/Passes.html#indvars) says: 'Additionally, on targets where it is profitable, the loop could be transformed to count down to zero (the "do loop" optimization). ' Does this mean that void fn(void) { volatile int temp; int i; for(i = 0; i != 100; ++i) { temp = 99 - i; } } can be optimized to void fn(void) { volatile int temp; int i = 100; while(--i >= 0) { temp = i; } } ??? This "do loop" optimization would be profitable for my target, so how is it performed? Is there another pass available or an option for the command line? Or do I have to write this pass by myself? Thanks, Burkhard
Apparently Analagous Threads
- [LLVMdev] induction variable computation not preserving scev
- [LLVMdev] induction variable computation not preserving scev
- [LLVMdev] induction variable computation not preserving scev
- loop induction variables at IR level
- [LLVMdev] induction variable computation not preserving scev