[LLVMdev] Induction Variables

Chris Lattner sabre at nondot.org
Mon Sep 8 10:23:01 PDT 2003


> What is the status of the InductionVariable "semi-pass"?  I have tested
> it out on spec benchmarks, and while it does correctly identify some of
> the variables, it fails to recognize most.  Typically the following
> scenario arises

The -indvars pass promote simple induction variables that only live in
registers.

> a_loop:
> ...
> %tmp.19 = load int* %bsLive
> %tmp.20 = add int %tmp.19, -8
> store int %tmp.20, int* %bsLive
> %tmp.5 = setgt int %tmp.20, 0
> br bool %tmp.5, label a_loop, label a_exit
>
> a_exit:
> Is there any way to force this variable to stay in a register, such that
> it is handled with a phi node, and recognized by the InductionVariable
> class?

In this case, try running the -licm pass, which will promote that memory
location to be a register in the body of the loop, as long as there are
not may-aliased stores inside of the loop.  You can play around with the
different AA implementations if the simple default one isn't good enough
(but if you just have one must-aliased store like above there should
obviously be no problem.

More info on the AA stuff is here:
http://llvm.cs.uiuc.edu/docs/AliasAnalysis.html

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list