[LLVMdev] getCanonicalInductionVariable

Will Dietz willdtz at gmail.com
Sat May 21 21:47:24 PDT 2011


Also, make sure you're running the necessary transform passes as well,
I've run into this testing my analysis on unoptimized code.

There are various loop/induction variable passes, and offhand I think
things like -mem2reg help too.

Good luck!

~Will

On Sat, May 21, 2011 at 8:45 PM, Arushi Aggarwal <arushi987 at gmail.com> wrote:
> Hi,
> What does your LLVM IR look like. Are you sure the loop hasnt been optimized
> away?
> Arushi
>
> On Sat, May 21, 2011 at 5:52 PM, Malveeka Tewari <mtewari at eng.ucsd.edu>
> wrote:
>>
>> Hi
>> I have the followed code for which I am writing a loop pass.
>> int main() {
>>   int i = 0;
>>   for (i=0; i<20; i++) {
>>     printf ("hello world %d\n", i);
>>   }
>>   return 0;
>> }
>> In the function runOnLoop, I have the following instruction
>> PHINode *indv = NULL;
>> indv = L->getCanonicalInductionVariable();
>> However, when I check indv is always set to NULL.
>> Since the code has a canonical induction variable, I was expecting the
>> endv to start pointing to the induction var phi node.
>> Please let me what I'm missing here
>> Thanks
>> Malveeka
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>




More information about the llvm-dev mailing list