similar to: [LLVMdev] how to get the condition from loop information with llvm classes

Displaying 20 results from an estimated 4000 matches similar to: "[LLVMdev] how to get the condition from loop information with llvm classes"

2010 Nov 15
0
[LLVMdev] how to get the condition from loop information with llvm classes
On Nov 14, 2010, at 1:08 AM, chenneng5758 wrote: > I want to get some condition from loop information,for example, > for(int i=0; i<COUNT; i++){} > I want to get some message such as i<COUNT, which classes can work? COUNT is a loop trip count here. See LoopInfo.h and ScalarEvalution.h (and related SCEV interface) for more information. - Devang > >
2010 Apr 06
2
[LLVMdev] Get the loop trip count variable
Thanks a lot for your guys' help!!! I guess once I am able to get *V* (which probably is a pointer to a Value object), then, I can instrument some code at the IR level to dump V. As long as I maintain V at this pass stage, I should be able to dump the loop trip count. This is true, isn't it? Basically, what I am going to do is to add a function call before the loop body, such as:
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 >
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
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 front
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
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 09
0
[LLVMdev] [PATCH] Split LoopUnroll pass into mechanism and policy
Hi All, the attached patch performs the splitting in the proposed manner. before applying the patch, please execute svn cp lib/Transforms/Scalar/LoopUnroll.cpp lib/Transforms/Utils/UnrollLoop.cpp to make the patch apply and preserve proper history. Transforms/Utils/UnrollLoop.cpp contains the unrollLoop function, which is now used by the LoopUnroll pass. I've also moved the
2005 Jul 28
2
[LLVMdev] help with pointer-to-array conversion
I now understand that IndVarSimplify.cpp is capable of reproducing array references when the pointer initialization from the array address is found inside the immediately enclosing loop, such that in the following code: int A[20000], B[100], Z; int main() { int i, j, *a, *b; for ( a = &A[0], i = 0; i != 200; i++ ) for ( b = &B[0], j = 0; j != 100; j++
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 += getV(i); } return 0;
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. There doesn't seem to be any documentation on this. Does anybody
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>
2010 May 10
2
[LLVMdev] Separate loop condition and loop body
Hi, Is it possible to get the list of BasicBlocks building the condition of a loop and the list of BasicBlocks that form the body? My first approach was to iterate over the list of all Basicblocks of a loop and separate the header as the condition and the remaining as the body of the loop. However, this is not correct for instance in the case of a while loop in the form: while( A & B) do {
2011 Dec 20
2
[LLVMdev] Loop exit condition analysis
Hi all, I am doing loop exit condition analysis. As the following sample code segments demonstrated, .... int *c = &a; while (*c == 0); .... I want to decide which variables are related to ending this spin-loop. E.g., in above sample, c is the direct variable while a is an indirect one. Does LLVM provide any existing analysis tools or APIs I can leverage? I am new to compiler
2010 May 10
0
[LLVMdev] Separate loop condition and loop body
On May 10, 2010, at 8:43 AM, Xinfinity wrote: > Is it possible to get the list of BasicBlocks building the condition > of a > loop and the list of BasicBlocks that form the body? Based on my (limited) experience with Loop and LoopInfo, this isn't possible. (But don't take my word for it.) > My aim is to manipulate for loops, while and do-while loops unitary, > but 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
2011 Dec 20
0
[LLVMdev] Loop exit condition analysis
On Mon, Dec 19, 2011 at 10:13 PM, Hanfeng Qin <hanfengtsin at gmail.com> wrote: > Hi all, > I am doing loop exit condition analysis. As the following sample code > segments demonstrated, > > .... > int *c = &a; > while (*c == 0); > .... > > I want to decide which variables are related to ending this spin-loop. E.g., > in above sample, c is the direct
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); } } ---------- example 2 ---------- test2(int
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
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 > > > _______________________________________________