Displaying 20 results from an estimated 20 matches for "getcanonicalinductionvari".
2011 May 21
4
[LLVMdev] getCanonicalInductionVariable
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
-------------- next part --------------
An HTML attachment...
2011 May 22
0
[LLVMdev] getCanonicalInductionVariable
...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
>
> ______...
2011 May 23
0
[LLVMdev] Fwd: getCanonicalInductionVariable
Forwarding to list :)
~Will
---------- Forwarded message ----------
From: Malveeka Tewari <mtewari at eng.ucsd.edu>
Date: Sun, May 22, 2011 at 12:38 AM
Subject: Re: [LLVMdev] getCanonicalInductionVariable
To: willdtz at gmail.com
Adding -mem2reg fixed the problem !
Thanks a lot!
Malveeka
On Sat, May 21, 2011 at 9:47 PM, Will Dietz <willdtz at gmail.com> wrote:
>
> Also, make sure you're running the necessary transform passes as well,
> I've run into this testing my anal...
2012 Jul 25
2
[LLVMdev] regarding opt -indvars
Hello .
opt -indvars pass does not generate canonical induction variable.
(NULL == loop->getCanonicalInductionVariable();)
PLEASE explain why? and how can I fix it?
Thanks in advance,
Edvard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120724/92a28ed5/attachment.html>
2017 Jul 25
2
loop canonical variables
I call this function and it returns only "i" in my example. Are there any
ways to return "j" also?
2017-07-25 19:11 GMT+02:00 Michael Kruse <llvmdev at meinersbur.de>:
> There is Loop::getCanonicalInductionVariable()
>
> You may need to run the "-indvars" (IndVarSimplify) pass before it
> returns a value. I am not sure it normalizes the step size to 1 in all
> cases.
>
> Michael
>
> 2017-07-25 18:12 GMT+02:00 Anastasiya Ruzhanskaya via llvm-dev
> <llvm-dev at lists....
2017 Jul 01
2
loop induction variables at IR level
Hi,
I was looking at trying to get loop induction variable at IR level. LLVM
documentation mentioned indvars pass and getCanonicalInductionVariable() to
get them, I tried running the indvars pass and then a custom pass which
iterates through loops and uses the function to obtain variable for a
simple loop program. But the API returns null. I also read in similar posts
that the indvars pass is not available in the current version but
docume...
2017 Jul 25
2
loop canonical variables
...frtk.ru>:
>> I call this function and it returns only "i" in my example. Are there any
>> ways to return "j" also?
>
> That would contradict it being the /canonical/ induction variable, wouldn't it?
>
> If you look into the imlplementation of
> getCanonicalInductionVariable(), it just walks the IR instructions and
> checks some conditions. You can have your own implementation that,
> instead of returning the first matching PHI, return all matching PHIs.
> SimplifyIndVar won't try to canonicalize, though.
>
> Michael
> ________________________...
2016 Aug 25
3
Canonicalize induction variables
...ief
look at LLVM OPT (dev trunk). I would expect loop simplification and
induction variable canonicalization pass (IndVarSimplify pass) should be
able to convert the following loops into a simple canonical form, i.e.,
there is a canonical induction variable which starts at zero and steps by
one, getCanonicalInductionVariable() returns the first PHI node in the
loop header block.
int test1 (int x[], int k, int s) {
int sum = 0;
for (int i = 0; i < k; i+=s) {
sum += x[i];
}
return sum;
}
int test2(int x[], int k, int s) {
int sum = 0;
for (int i = k; i > 0; i--) {
sum += x[i];
}
retur...
2017 Jul 25
2
loop canonical variables
Hello,
I need to perform the analysis of loop induction variables. However, as I
understood, directly it is possible to extract only a canonical induction
variable which is only one. If I have multiple induction variables with the
step not one, are there any methods to extract their phi node?
int a[10];
int b[10];
for (int i = 0, j = 1; i < 10, j < 10; i++, j+=2) {
2016 Oct 16
3
Induction variable identification?
Hi,
How does LLVM identify induction variables of a loop?
Is the algorithm based on SSA graphs?
I have a complicated loop and I need to do some analysis around it.
Can anyone please point me to source of identification part?
--
*Disclaimer: Views, concerns, thoughts, questions, ideas expressed in this
mail are of my own and my employer has no take in it. *
Thank You.
Madhur D. Amilkanthwar
2011 May 07
1
[LLVMdev] Loop transformations using LLVM
On May 5, 2011, at 5:11 AM, Rotem, Nadav wrote:
> Malveeka,
>
> You can use the LoopInfo analysis to find the induction variable.
>
> http://llvm.org/docs/doxygen/html/classllvm_1_1Loop.html#a72bbf45d2e00971f56bf8cfe4e1df01c
>
> Cheers,
> Nadav
getCanonicalInductionVariable is a good example of finding IVs without iterating over instructions. But you may need to generalize it a bit for your purpose.
A completely general approach to IV analysis is ScalarEvolution. You can query the expression for a loop header phi using ScalarEvolution::getSCEV. If it returns SCEV...
2018 Aug 07
4
Generating a loop from llvm bitcode
...proper loop structures; instead it relied on labels and goto statements. Therefore, I am trying to find a way to identify the loop structure and print it out in the backend. So far, the main issue I’ve been having trouble with is identifying the loop induction variable in a straight forward manner; getCanonicalInductionVariable doesn’t always succeed, and I’ve tried using InductionDescriptor, but it fails in cases where the CFG doesn’t include a loop preheader. Also, in both cases, I couldn’t find a direct way of determining the loop exit condition. I am wondering if there are any passes or data structures that would...
2005 Jul 28
2
[LLVMdev] help with pointer-to-array conversion
...{
> std::cerr << "Block Before: " << *GEPI->getParent();
> Instruction *mul =
BinaryOperator::createMul(saved_trip_count,
> LI->getLoopFor( phi->getIncomingBlock(1) )
> ->getCanonicalInductionVariable(), "mul.",
GEPI);
> Instruction *add = BinaryOperator::createAdd(mul,
NewAdd, "add.", GEPI);
> GEPI->setOperand( 0, phi->getIncomingValue(0) );
> GEPI->setOperand( 1, add );
> std::cerr...
2010 Aug 12
0
[LLVMdev] Questions about trip count
..."\n" ;
errs() << "Is simplifyed loop?\t" << l->isLoopSimplifyForm() <<
"\n" ;
errs() << "Tripcount " << l->getSmallConstantTripCount() << "\n"
;
const PHINode* phi = l->getCanonicalInductionVariable();
errs() << "Induction variable: " << *phi << "\n";
}
}
}
When I feed it with this program:
int main(int argc, char** argv) {
int i = 0;
for (; i < 4; i++) {
int j = 0;
for (; j < 8; j++) {...
2012 Jul 24
0
[LLVMdev] regarding opt -indvars
Hello .
I ran opt with -indvars options , got wrong result.
This is my example:
test.cc :
int test(int a)
{
for (int i = 2; i < a; ++i) {
a += ;
}
return a;
}
clang -O3 -emit-llvm -S test.cc -o test.ll
opt -indvards -S test.ll -o indvars.ll > /dev/null
indvars.ll :
; ModuleID = 'test.ll'
target datalayout =
2016 Aug 25
4
Canonicalize induction variables
...expect loop simplification and induction
> > variable canonicalization pass (IndVarSimplify pass) should be able to
> > convert the following loops into a simple canonical form, i.e., there is
> a
> > canonical induction variable which starts at zero and steps by one,
> > getCanonicalInductionVariable() returns the first PHI node in the loop
> > header block.
> >
> > int test1 (int x[], int k, int s) {
> > int sum = 0;
> > for (int i = 0; i < k; i+=s) {
> > sum += x[i];
> > }
> > return sum;
> > }
>
> s could be zero...
2011 May 05
0
[LLVMdev] Loop transformations using LLVM
Malveeka,
You can use the LoopInfo analysis to find the induction variable.
http://llvm.org/docs/doxygen/html/classllvm_1_1Loop.html#a72bbf45d2e00971f56bf8cfe4e1df01c
Cheers,
Nadav
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Malveeka Tewari
Sent: Thursday, May 05, 2011 14:51
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Loop transformations
2012 Jul 24
4
[LLVMdev] loop detection
Hello .
I'm trying to implement FunctionPass for detecting loops in llvm IR.
How can I get <condition> for loop from llvm::Loop object.?
Is there any example?
Thanks in advance,
Edvard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120723/85e7f2f9/attachment.html>
2011 May 05
2
[LLVMdev] Loop transformations using LLVM
Hi
I am trying to write up a transformation for the following code where
instead of incrementing the loop variable by 1, I increment it by 2 ie.
for (i=0; i < THRES; *i++*) {
//do something
}
gets transformed to
for (i=0; i < THRES; *i+=2*) {
//do something
}
I am thinking of transforming the llvm bit-code in the following way.
Iterate over the function for the original code till I
2005 Jul 28
0
[LLVMdev] help with pointer-to-array conversion
...<< "Block Before: " << *GEPI->getParent();
>> Instruction *mul =
> BinaryOperator::createMul(saved_trip_count,
>> LI->getLoopFor( phi->getIncomingBlock(1) )
>> ->getCanonicalInductionVariable(), "mul.",
> GEPI);
>> Instruction *add = BinaryOperator::createAdd(mul,
> NewAdd, "add.", GEPI);
>> GEPI->setOperand( 0, phi->getIncomingValue(0) );
>> GEPI->setOperand( 1,...