[LLVMdev] input and output values from a loop
Imran Ashraf
iimran.aashraf at yahoo.com
Thu Jul 2 09:40:23 PDT 2015
Hi there,
I want to get input and output values from a loop. For this I am doing
something like this:
DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
CodeExtractor Extractor(DT, *L);
Extractor.findInputsOutputs(inputs, outputs);
When I print the input and output values for the following test code:
void aFunc(void)
{
int sum=0;
puts("aFunc()");
for (int i = 0; i < 10; i++)
{
int fact=i*2;
sum=sum+i+fact;
}
printf("%d",sum);
}
I get the following:
Inputs
type i32* name i
type i32* name fact
type i32* name sum
Outputs
However, I was expecting the output to be:
Inputs
type i32* name sum
Outputs
type i32* name sum
To my understanding, i and fact are declared inside the loop, hence they
are neither input nor output. Secondly, sum is being used outside the
loop, hence should appear in outputs.
Is this the right way of doing it or am i doing some thing wrong?
Complete working code can be found at:
https://github.com/imranashraf/llvm-pass-exercise1
Thanks in advance for help.
Kind regards,
More information about the llvm-dev
mailing list