search for: gettripcount

Displaying 20 results from an estimated 27 matches for "gettripcount".

2009 Mar 08
1
[LLVMdev] getTripCount()
Hello, I'm writing a new function pass, and I'm having trouble with getTripCount() in Loop. If I generate the bitcode for the test code with no optimization then getTripCount() returns NULL, but if I pass - O3 to the front-end then getTripCount() returns fine. My phase calls addRequiredID(LoopSimplifyID) from getAnalysisUsage() and I also tried putting -mem2reg at the...
2010 May 07
2
[LLVMdev] getTripCount requires which optimization passes?
Hi, For me, getTripCount always returns null, even for trivial loops such as: void simple(int j) { for (int i = 0; i < 10; i++) { j++; } } Looking through the mailing list archive, it appears that getTripCount requires certain optimization passes to run first, but it's not clear which ones...
2008 Sep 30
1
[LLVMdev] LoopInfo getTripCount modification proposal
Hi, I am trying to modify a loop by reducing the loop trip count from N to N-1 where N may be constant. I looked into using getTripCount[1] but discovered that this method returns a Value* which is N itself. This prevents me from using this method for changing the loop. I suggest creating another method for returning the 'cmp' instruction. The new getTripCount implementation will use the new method. Do y'all think that i...
2010 May 07
0
[LLVMdev] getTripCount requires which optimization passes?
hi, On Fri, May 7, 2010 at 8:59 AM, Trevor Harmon <Trevor.W.Harmon at nasa.gov>wrote: > Hi, > > For me, getTripCount always returns null, even for trivial loops such > as: > > void simple(int j) { > for (int i = 0; i < 10; i++) { > j++; > } > } > > Looking through the mailing list archive, it appears that getTripCount > requires certain optimization passes to run f...
2012 Jul 02
2
[LLVMdev] Alternative of Loop::getTripCount?
I found out that Loop::getTripCount method is obsolete in LLVM 3.1 Is there an alternative? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120702/ea6ca4e6/attachment.html>
2009 Mar 20
1
[LLVMdev] getTripCount and pointers
Hello, I'm having some trouble with getTripCount() ... again. In particular it fails in the first of the following two examples, although it works for the second. By fails, I mean it returns NULL. ---------- example 1 ---------- test1(int *a, const int *ip) { int k; for (k = 0; k < ip[2]; ++k) { a[k] = (k+11)/(k+2); }...
2010 May 07
2
[LLVMdev] getTripCount requires which optimization passes?
On May 6, 2010, at 6:32 PM, ether zhhb wrote: > As the comment said: > /// The IndVarSimplify pass transforms loops to have a form that > this > /// function easily understands. > > you could try -indvars. After adding -indvars to the opt command, getTripCount still returns null. I suppose it's possible, depending on the scheduling of the pass manager, that indvars is running after my pass runs. I could force it to run first by adding it to my pass's getAnalysisUsage: void MyPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.ad...
2012 Jul 03
0
[LLVMdev] Alternative of Loop::getTripCount?
Hi Taemin, On 03/07/2012 01:53, Taemin Kim wrote: > I found out that Loop::getTripCount method is obsolete in LLVM 3.1 > Is there an alternative? I use getSmallConstantTripCount() to get loop trip counts using the ScalarEvolution analysis pass. See include/llvm/Analysis/ScalarEvolution.h for a detailed explanation. Ivan > > > __________________________________________...
2010 May 10
0
[LLVMdev] getTripCount requires which optimization passes?
...10, at 6:32 PM, ether zhhb wrote: > >> As the comment said: >> /// The IndVarSimplify pass transforms loops to have a form that >> this >> /// function easily understands. >> >> you could try -indvars. > > After adding -indvars to the opt command, getTripCount still returns > null. Code coming from C front-ends typically also needs -loop-rotate, in addition to all the usual stuff (mem2reg, instcombine, simplifycfg, etc). It depends a fair amount on the front-end; take a look at what opt -O2 does and experiment with it. > > I suppose it'...
2008 Apr 26
2
[LLVMdev] Getting the trip count of a loop
Hi, I am trying to add a new loop pass in which I making a call to get the trip count of the loop using Value *TripCountValue = L->getTripCount() However I am always getting NULL for TripCountValue (confirmed through gdb). I am running this pass after the canonicalization of induction variables: opt --debug-pass=Structure -stats -indvars -loop-rotate -my-loop-pass < main.bc > main.unroll.s Pass Arguments: -domtree -loops -scalar-e...
2010 May 10
1
[LLVMdev] getTripCount requires which optimization passes?
On May 10, 2010, at 11:45 AM, Dan Gohman wrote: > just make your front-ends add -indvars before > adding your pass. Sorry, I don't have a clue how to do this, and I can't find any docs about it. I'm using llvm-gcc; how can I tell it to add a pass? Trevor
2010 Apr 06
2
[LLVMdev] Get the loop trip count variable
...y to insert some basic blocks and to rewrite the loop header in LLVM? Cheers, Zheng On 6 April 2010 17:27, Zakk <zakk0610 at gmail.com> wrote: > Hi, you should run some loop transformation passes(loop rotate, loop > simplify, -indvar), and then get TripCount. > loopinfo.h > /// getTripCount - Return a loop-invariant LLVM value indicating the number > of > /// times the loop will be executed. Note that this means that the backedge > /// of the loop executes N-1 times. If the trip-count cannot be determined, > /// this returns null. > > inline Value *getTripCount() con...
2008 Apr 26
0
[LLVMdev] Getting the trip count of a loop
Prakash Prabhu wrote: > I am trying to add a new loop pass in which I making a call to get the > trip count of the loop using > > Value *TripCountValue = L->getTripCount() That should work. Could you file a bug and attach the bytecode after 'opt -indvars -loop-rotate'? I would need that to determine why LoopInfo::getTripCount isn't returning any value. Nick
2010 Apr 06
0
[LLVMdev] Get the loop trip count variable
Sorry, I could not the the loop trip count with getTripCount(). I used a simple program as a test case: ------------------------------------------------------ #include <stdio.h> int getV(int i) { return i * 2; } int main() { int num = 10; int sum=0; int i; for (i=0; i<num; i++) { sum...
2010 Oct 14
0
[LLVMdev] MachineLoopInfo question
Dear all, I found many methods (such as getTripCount, isLCSSAForm) are not supported for machine loops in MachineLoopInfo.h file. Does this mean I can not use MachineLoopInfo if I need getTripCount? Why not support them in MachineLoopInfo? Thank you!
2008 May 07
1
[LLVMdev] [PATCH] Split LoopUnroll pass into mechanism and policy
...th policy and mechanism need these values, > that code > must be shared somehow as well. I see two options for that: > 1. Put two methods in the utility class, each of which return one of > those > values. > 2. Add two methods to the Loop class. Currently, there is a > getTripCount() > method that returns the trip count as a Value*. Perhaps we could > add a > getTripCountConst() (or getTripCountInt() ?) and > getTripCountMultiple() to > Loop? > > > It seems to me the second option is nicer, though it shouldn't make > too much >...
2008 May 07
8
[LLVMdev] [PATCH] Split LoopUnroll pass into mechanism and policy
Hello Matthijs, Separating mechanism from policy is a good thing for the LoopUnroll pass. Instead of moving the policy to a subclass though, I think it'd be better to move the mechanism, the unrollLoop function, out to be a standalone utility function, with the LoopInfo object passed in explicitly. FoldBlockIntoPredecessor would also be good to make into a standalone utility function, since
2008 May 07
0
[LLVMdev] [PATCH] Split LoopUnroll pass into mechanism and policy
...trip count and trip multiple. Since both policy and mechanism need these values, that code must be shared somehow as well. I see two options for that: 1. Put two methods in the utility class, each of which return one of those values. 2. Add two methods to the Loop class. Currently, there is a getTripCount() method that returns the trip count as a Value*. Perhaps we could add a getTripCountConst() (or getTripCountInt() ?) and getTripCountMultiple() to Loop? It seems to me the second option is nicer, though it shouldn't make too much of a difference. Furthermore, where to put this utilit...
2008 May 09
0
[LLVMdev] [PATCH] Split LoopUnroll pass into mechanism and policy
...change I think I made, was that the old code checked to see if the terminator instruction of the latch block was a conditional branch first, before looking at the trip count and the treshold. Since that check moved together with unrollLoop, it is done a bit later. However, AFAICS, none of the code (getTripCount, code size estimation) actually depends on this check, so it shouldn't change anything in the end. Lastly, the (original comments) say "This pass will multi-block loops only if they contain no non-unrolled subloops". I can't really find what this is supposed to mean, in particula...
2008 Dec 09
1
[LLVMdev] scalar-evolution + indvars fail to get the loop trip count?
...%tmp28 = mul i32 %indvar.lcssa, %x ; <i32> [#uses=1] %z.0.reg2mem.0 = add i32 %y, %x ; <i32> [#uses=1] %tmp4 = add i32 %z.0.reg2mem.0, %tmp28 ; <i32> [#uses=1] ret i32 %tmp4 } Surely the loop trip count is 256, but the Loop::getTripCount() will return NULL. This is due to the exit condition: %tmp16 = icmp slt i32 %tmp13, 0 ; <i1> [#uses=1] pass indvars should transform it into a canonical exit condtion EQ or NE, but as scalarevolution returned NonComputedItCount, it failed to do that. In pass ScalarEvolution three...