Problem getting LoopInfo inside non-LoopPass

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5
LLVMers,

   I am doing a CallGraphPass but would like to get the LoopInfo of the functions inside this pass, is this possible? Currently I have a function inside the CallGraph struct:

    void getAnalysisUsage(AnalysisUsage &AU) const {
        AU.addRequired<LoopInfo>();
        AU.addPreserved<LoopInfo>();
    }

And later inside the pass I am calling:

LoopInfo &LI = getAnalysis<LoopInfo>();

I have also tried to pass the Function pointer to getAnalysis but that doesn't work either. With the above code my error is:

UNREACHABLE executed!
0  opt             0x00000000008edc2f
1  opt             0x00000000008edfda
2  libpthread.so.0 0x00007f9c8e69bc60
3  libc.so.6       0x00007f9c8d986d05 gsignal + 53
4  libc.so.6       0x00007f9c8d98aab6 abort + 390
5  opt             0x00000000008da974 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 356
6  opt             0x000000000087e046
7  opt             0x0000000000882b45 llvm::PMDataManager::add(llvm::Pass*, bool) + 741
8  opt             0x000000000087f413 llvm::PassManager::add(llvm::Pass*) + 259
9  opt             0x00000000004ab9be main + 2174
10 libc.so.6       0x00007f9c8d971eff __libc_start_main + 255
11 opt             0x000000000049f5f9
Stack dump:


Any help would be appreciated, thanks!


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem getting LoopInfo inside non-LoopPass

John Criswell-4
On 11/10/11 11:06 AM, Ryan Taylor wrote:
LLVMers,

   I am doing a CallGraphPass but would like to get the LoopInfo of the functions inside this pass, is this possible? Currently I have a function inside the CallGraph struct:

    void getAnalysisUsage(AnalysisUsage &AU) const {
        AU.addRequired<LoopInfo>();
        AU.addPreserved<LoopInfo>();
    }

And later inside the pass I am calling:

LoopInfo &LI = getAnalysis<LoopInfo>();

I have also tried to pass the Function pointer to getAnalysis but that doesn't work either. With the above code my error is:

1) You may need to pass a Function pointer or reference if your pass is not a FunctionPass (e.g., if it is a ModulePass).

2) If you have to specify a Function pointer or reference, you need to make sure that the Function is *not* a declaration:

if (!(F->getDeclaration()))
    getAnalysis<LoopInfo>(F);

-- John T.


UNREACHABLE executed!
0  opt             0x00000000008edc2f
1  opt             0x00000000008edfda
2  libpthread.so.0 0x00007f9c8e69bc60
3  libc.so.6       0x00007f9c8d986d05 gsignal + 53
4  libc.so.6       0x00007f9c8d98aab6 abort + 390
5  opt             0x00000000008da974 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 356
6  opt             0x000000000087e046
7  opt             0x0000000000882b45 llvm::PMDataManager::add(llvm::Pass*, bool) + 741
8  opt             0x000000000087f413 llvm::PassManager::add(llvm::Pass*) + 259
9  opt             0x00000000004ab9be main + 2174
10 libc.so.6       0x00007f9c8d971eff __libc_start_main + 255
11 opt             0x000000000049f5f9
Stack dump:


Any help would be appreciated, thanks!



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem getting LoopInfo inside non-LoopPass

John Criswell-4
On 11/10/11 11:48 AM, Ryan Taylor wrote:
John,

  Thanks, this does not compile though, I get this error:

First, please CC the llvmdev list.  That way, others having the same question can see the conversation, and others on the list can help correct any errors I make.
:)


cdfg_pass.cpp:511:11: error: ‘class llvm::Function’ has no member named ‘getDeclaration’

Sorry.  I believe the method name is Function::isDeclaration().

BTW, you should double-check my answers (and other people's answers) against the LLVM doxygen documentation.  This is because:

1) I often don't take the time to consult the documentation to ensure I have every detail correct.
2) The LLVM API is fluid, so some details of it may have changed since I last used a particular feature.


Also, when I try to pass the pointer to getAnalysis I get this error:

cdfg_pass.cpp:512:41: error: no matching function for call to ‘<unnamed>::CDFGPass::getAnalysis(llvm::Function*&)’

First, double check that it's a Function * and not a Function & that is required.

Second, what type of pass is your pass?  Is it a ModulePass, a FunctionPass, or some other type of pass?  For a FunctionPass, no argument is necessary.  For a ModulePass, a Function argument is necessary.  For other types of passes, I do not know: you'll either have to wait for someone else to respond or just figure it out using trial and error.

Third, are you including the header file that provides the definition of LoopInfo?  If not, that could be a problem.

-- John T.


Here is the code I'm using:

        Function *F = CGNode->getFunction();
        errs()<<"#Get Loop Info\n";
        if (!(F->getDeclaration()))
                LoopInfo &LI = getAnalysis<LoopInfo>(F);


On Thu, Nov 10, 2011 at 9:13 AM, John Criswell <[hidden email]> wrote:
On 11/10/11 11:06 AM, Ryan Taylor wrote:
LLVMers,

   I am doing a CallGraphPass but would like to get the LoopInfo of the functions inside this pass, is this possible? Currently I have a function inside the CallGraph struct:

    void getAnalysisUsage(AnalysisUsage &AU) const {
        AU.addRequired<LoopInfo>();
        AU.addPreserved<LoopInfo>();
    }

And later inside the pass I am calling:

LoopInfo &LI = getAnalysis<LoopInfo>();

I have also tried to pass the Function pointer to getAnalysis but that doesn't work either. With the above code my error is:

1) You may need to pass a Function pointer or reference if your pass is not a FunctionPass (e.g., if it is a ModulePass).

2) If you have to specify a Function pointer or reference, you need to make sure that the Function is *not* a declaration:

if (!(F->getDeclaration()))
    getAnalysis<LoopInfo>(F);

-- John T.


UNREACHABLE executed!
0  opt             0x00000000008edc2f
1  opt             0x00000000008edfda
2  libpthread.so.0 0x00007f9c8e69bc60
3  libc.so.6       0x00007f9c8d986d05 gsignal + 53
4  libc.so.6       0x00007f9c8d98aab6 abort + 390
5  opt             0x00000000008da974 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 356
6  opt             0x000000000087e046
7  opt             0x0000000000882b45 llvm::PMDataManager::add(llvm::Pass*, bool) + 741
8  opt             0x000000000087f413 llvm::PassManager::add(llvm::Pass*) + 259
9  opt             0x00000000004ab9be main + 2174
10 libc.so.6       0x00007f9c8d971eff __libc_start_main + 255
11 opt             0x000000000049f5f9
Stack dump:


Any help would be appreciated, thanks!



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5
1. Ok will do.
2. Ok, will do.
3. It's a CallGraphPass. I mentioned this in my first post.
4. Yep, I have the header files included, I'm not sure it would compile otherwise (previously). I would get an error like LoopInfo not declared.

I'll try your suggestions, thanks again!

On Thu, Nov 10, 2011 at 9:57 AM, John Criswell <[hidden email]> wrote:
On 11/10/11 11:48 AM, Rc   Add Bcc   Edit Subject   Attach a file   Insert: Invitation yan Taylor wrote:
John,

  Thanks, this does not compile though, I get this error:

First, please CC the llvmdev list.  That way, others having the same question can see the conversation, and others on the list can help correct any errors I make.
:)



cdfg_pass.cpp:511:11: error: ‘class llvm::Function’ has no member named ‘getDeclaration’

Sorry.  I believe the method name is Function::isDeclaration().

BTW, you should double-check my answers (and other people's answers) against the LLVM doxygen documentation.  This is because:

1) I often don't take the time to consult the documentation to ensure I have every detail correct.
2) The LLVM API is fluid, so some details of it may have changed since I last used a particular feature.



Also, when I try to pass the pointer to getAnalysis I get this error:

cdfg_pass.cpp:512:41: error: no matching function for call to ‘<unnamed>::CDFGPass::getAnalysis(llvm::Function*&)’

First, double check that it's a Function * and not a Function & that is required.

Second, what type of pass is your pass?  Is it a ModulePass, a FunctionPass, or some other type of pass?  For a FunctionPass, no argument is necessary.  For a ModulePass, a Function argument is necessary.  For other types of passes, I do not know: you'll either have to wait for someone else to respond or just figure it out using trial and error.

Third, are you including the header file that provides the definition of LoopInfo?  If not, that could be a problem.

-- John T.



Here is the code I'm using:

        Function *F = CGNode->getFunction();
        errs()<<"#Get Loop Info\n";
        if (!(F->getDeclaration()))
                LoopInfo &LI = getAnalysis<LoopInfo>(F);


On Thu, Nov 10, 2011 at 9:13 AM, John Criswell <[hidden email]> wrote:
On 11/10/11 11:06 AM, Ryan Taylor wrote:
LLVMers,

   I am doing a CallGraphPass but would like to get the LoopInfo of the functions inside this pass, is this possible? Currently I have a function inside the CallGraph struct:

    void getAnalysisUsage(AnalysisUsage &AU) const {
        AU.addRequired<LoopInfo>();
        AU.addPreserved<LoopInfo>();
    }

And later inside the pass I am calling:

LoopInfo &LI = getAnalysis<LoopInfo>();

I have also tried to pass the Function pointer to getAnalysis but that doesn't work either. With the above code my error is:

1) You may need to pass a Function pointer or reference if your pass is not a FunctionPass (e.g., if it is a ModulePass).

2) If you have to specify a Function pointer or reference, you need to make sure that the Function is *not* a declaration:

if (!(F->getDeclaration()))
    getAnalysis<LoopInfo>(F);

-- John T.


UNREACHABLE executed!
0  opt             0x00000000008edc2f
1  opt             0x00000000008edfda
2  libpthread.so.0 0x00007f9c8e69bc60
3  libc.so.6       0x00007f9c8d986d05 gsignal + 53
4  libc.so.6       0x00007f9c8d98aab6 abort + 390
5  opt             0x00000000008da974 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 356
6  opt             0x000000000087e046
7  opt             0x0000000000882b45 llvm::PMDataManager::add(llvm::Pass*, bool) + 741
8  opt             0x000000000087f413 llvm::PassManager::add(llvm::Pass*) + 259
9  opt             0x00000000004ab9be main + 2174
10 libc.so.6       0x00007f9c8d971eff __libc_start_main + 255
11 opt             0x000000000049f5f9
Stack dump:


Any help would be appreciated, thanks!



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5
John,

  This did not work. It compiles (isDeclaration was the name of the function) and I passed a reference (&F) (F is a function pointer). I still get the opt load error from the original message (UNREACHABLE exectuted!).

Thanks.

On Thu, Nov 10, 2011 at 10:00 AM, Ryan Taylor <[hidden email]> wrote:
1. Ok will do.
2. Ok, will do.
3. It's a CallGraphPass. I mentioned this in my first post.
4. Yep, I have the header files included, I'm not sure it would compile otherwise (previously). I would get an error like LoopInfo not declared.

I'll try your suggestions, thanks again!

On Thu, Nov 10, 2011 at 9:57 AM, John Criswell <[hidden email]> wrote:

On 11/10/11 11:48 AM, Rc   Add Bcc   Edit Subject   Attach a file   Insert: Invitation yan Taylor wrote:
John,

  Thanks, this does not compile though, I get this error:

First, please CC the llvmdev list.  That way, others having the same question can see the conversation, and others on the list can help correct any errors I make.
:)



cdfg_pass.cpp:511:11: error: ‘class llvm::Function’ has no member named ‘getDeclaration’

Sorry.  I believe the method name is Function::isDeclaration().

BTW, you should double-check my answers (and other people's answers) against the LLVM doxygen documentation.  This is because:

1) I often don't take the time to consult the documentation to ensure I have every detail correct.
2) The LLVM API is fluid, so some details of it may have changed since I last used a particular feature.



Also, when I try to pass the pointer to getAnalysis I get this error:

cdfg_pass.cpp:512:41: error: no matching function for call to ‘<unnamed>::CDFGPass::getAnalysis(llvm::Function*&)’

First, double check that it's a Function * and not a Function & that is required.

Second, what type of pass is your pass?  Is it a ModulePass, a FunctionPass, or some other type of pass?  For a FunctionPass, no argument is necessary.  For a ModulePass, a Function argument is necessary.  For other types of passes, I do not know: you'll either have to wait for someone else to respond or just figure it out using trial and error.

Third, are you including the header file that provides the definition of LoopInfo?  If not, that could be a problem.

-- John T.



Here is the code I'm using:

        Function *F = CGNode->getFunction();
        errs()<<"#Get Loop Info\n";
        if (!(F->getDeclaration()))
                LoopInfo &LI = getAnalysis<LoopInfo>(F);


On Thu, Nov 10, 2011 at 9:13 AM, John Criswell <[hidden email]> wrote:
On 11/10/11 11:06 AM, Ryan Taylor wrote:
LLVMers,

   I am doing a CallGraphPass but would like to get the LoopInfo of the functions inside this pass, is this possible? Currently I have a function inside the CallGraph struct:

    void getAnalysisUsage(AnalysisUsage &AU) const {
        AU.addRequired<LoopInfo>();
        AU.addPreserved<LoopInfo>();
    }

And later inside the pass I am calling:

LoopInfo &LI = getAnalysis<LoopInfo>();

I have also tried to pass the Function pointer to getAnalysis but that doesn't work either. With the above code my error is:

1) You may need to pass a Function pointer or reference if your pass is not a FunctionPass (e.g., if it is a ModulePass).

2) If you have to specify a Function pointer or reference, you need to make sure that the Function is *not* a declaration:

if (!(F->getDeclaration()))
    getAnalysis<LoopInfo>(F);

-- John T.


UNREACHABLE executed!
0  opt             0x00000000008edc2f
1  opt             0x00000000008edfda
2  libpthread.so.0 0x00007f9c8e69bc60
3  libc.so.6       0x00007f9c8d986d05 gsignal + 53
4  libc.so.6       0x00007f9c8d98aab6 abort + 390
5  opt             0x00000000008da974 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 356
6  opt             0x000000000087e046
7  opt             0x0000000000882b45 llvm::PMDataManager::add(llvm::Pass*, bool) + 741
8  opt             0x000000000087f413 llvm::PassManager::add(llvm::Pass*) + 259
9  opt             0x00000000004ab9be main + 2174
10 libc.so.6       0x00007f9c8d971eff __libc_start_main + 255
11 opt             0x000000000049f5f9
Stack dump:


Any help would be appreciated, thanks!



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev






_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem getting LoopInfo inside non-LoopPass

Devang Patel
Ryan,

Why do your call graph pass need loop info ? Why can't it be a LoopPass ?
-
Devang

On Nov 10, 2011, at 10:03 AM, Ryan Taylor wrote:

John,

  This did not work. It compiles (isDeclaration was the name of the function) and I passed a reference (&F) (F is a function pointer). I still get the opt load error from the original message (UNREACHABLE exectuted!).

Thanks.

On Thu, Nov 10, 2011 at 10:00 AM, Ryan Taylor <[hidden email]> wrote:
1. Ok will do.
2. Ok, will do.
3. It's a CallGraphPass. I mentioned this in my first post.
4. Yep, I have the header files included, I'm not sure it would compile otherwise (previously). I would get an error like LoopInfo not declared.

I'll try your suggestions, thanks again!

On Thu, Nov 10, 2011 at 9:57 AM, John Criswell <[hidden email]> wrote:

On 11/10/11 11:48 AM, Rc   Add Bcc   Edit Subject   Attach a file   Insert: Invitation yan Taylor wrote:
John,

  Thanks, this does not compile though, I get this error:

First, please CC the llvmdev list.  That way, others having the same question can see the conversation, and others on the list can help correct any errors I make.
:)



cdfg_pass.cpp:511:11: error: ‘class llvm::Function’ has no member named ‘getDeclaration’

Sorry.  I believe the method name is Function::isDeclaration().

BTW, you should double-check my answers (and other people's answers) against the LLVM doxygen documentation.  This is because:

1) I often don't take the time to consult the documentation to ensure I have every detail correct.
2) The LLVM API is fluid, so some details of it may have changed since I last used a particular feature.



Also, when I try to pass the pointer to getAnalysis I get this error:

cdfg_pass.cpp:512:41: error: no matching function for call to ‘<unnamed>::CDFGPass::getAnalysis(llvm::Function*&)’

First, double check that it's a Function * and not a Function & that is required.

Second, what type of pass is your pass?  Is it a ModulePass, a FunctionPass, or some other type of pass?  For a FunctionPass, no argument is necessary.  For a ModulePass, a Function argument is necessary.  For other types of passes, I do not know: you'll either have to wait for someone else to respond or just figure it out using trial and error.

Third, are you including the header file that provides the definition of LoopInfo?  If not, that could be a problem.

-- John T.



Here is the code I'm using:

        Function *F = CGNode->getFunction();
        errs()<<"#Get Loop Info\n";
        if (!(F->getDeclaration()))
                LoopInfo &LI = getAnalysis<LoopInfo>(F);


On Thu, Nov 10, 2011 at 9:13 AM, John Criswell <[hidden email]> wrote:
On 11/10/11 11:06 AM, Ryan Taylor wrote:
LLVMers,

   I am doing a CallGraphPass but would like to get the LoopInfo of the functions inside this pass, is this possible? Currently I have a function inside the CallGraph struct:

    void getAnalysisUsage(AnalysisUsage &AU) const {
        AU.addRequired<LoopInfo>();
        AU.addPreserved<LoopInfo>();
    }

And later inside the pass I am calling:

LoopInfo &LI = getAnalysis<LoopInfo>();

I have also tried to pass the Function pointer to getAnalysis but that doesn't work either. With the above code my error is:

1) You may need to pass a Function pointer or reference if your pass is not a FunctionPass (e.g., if it is a ModulePass).

2) If you have to specify a Function pointer or reference, you need to make sure that the Function is *not* a declaration:

if (!(F->getDeclaration()))
    getAnalysis<LoopInfo>(F);

-- John T.


UNREACHABLE executed!
0  opt             0x00000000008edc2f
1  opt             0x00000000008edfda
2  libpthread.so.0 0x00007f9c8e69bc60
3  libc.so.6       0x00007f9c8d986d05 gsignal + 53
4  libc.so.6       0x00007f9c8d98aab6 abort + 390
5  opt             0x00000000008da974 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 356
6  opt             0x000000000087e046
7  opt             0x0000000000882b45 llvm::PMDataManager::add(llvm::Pass*, bool) + 741
8  opt             0x000000000087f413 llvm::PassManager::add(llvm::Pass*) + 259
9  opt             0x00000000004ab9be main + 2174
10 libc.so.6       0x00007f9c8d971eff __libc_start_main + 255
11 opt             0x000000000049f5f9
Stack dump:


Any help would be appreciated, thanks!



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Fwd: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5


---------- Forwarded message ----------
From: Ryan Taylor <[hidden email]>
Date: Thu, Nov 10, 2011 at 10:31 AM
Subject: Re: [LLVMdev] Problem getting LoopInfo inside non-LoopPass
To: Devang Patel <[hidden email]>


I need to iterate bottom up on the nodes, but within that I want to break up BBs within a loop. I could just create a loop pass as another opt and call that, I just thought it'd be easier to get the loop info inside the opt I'm already doing.


On Thu, Nov 10, 2011 at 10:25 AM, Devang Patel <[hidden email]> wrote:
Ryan,

Why do your call graph pass need loop info ? Why can't it be a LoopPass ?
-
Devang

On Nov 10, 2011, at 10:03 AM, Ryan Taylor wrote:

John,

  This did not work. It compiles (isDeclaration was the name of the function) and I passed a reference (&F) (F is a function pointer). I still get the opt load error from the original message (UNREACHABLE exectuted!).

Thanks.

On Thu, Nov 10, 2011 at 10:00 AM, Ryan Taylor <[hidden email]> wrote:
1. Ok will do.
2. Ok, will do.
3. It's a CallGraphPass. I mentioned this in my first post.
4. Yep, I have the header files included, I'm not sure it would compile otherwise (previously). I would get an error like LoopInfo not declared.

I'll try your suggestions, thanks again!

On Thu, Nov 10, 2011 at 9:57 AM, John Criswell <[hidden email]> wrote:

On 11/10/11 11:48 AM, Rc   Add Bcc   Edit Subject   Attach a file   Insert: Invitation yan Taylor wrote:
John,

  Thanks, this does not compile though, I get this error:

First, please CC the llvmdev list.  That way, others having the same question can see the conversation, and others on the list can help correct any errors I make.
:)



cdfg_pass.cpp:511:11: error: ‘class llvm::Function’ has no member named ‘getDeclaration’

Sorry.  I believe the method name is Function::isDeclaration().

BTW, you should double-check my answers (and other people's answers) against the LLVM doxygen documentation.  This is because:

1) I often don't take the time to consult the documentation to ensure I have every detail correct.
2) The LLVM API is fluid, so some details of it may have changed since I last used a particular feature.



Also, when I try to pass the pointer to getAnalysis I get this error:

cdfg_pass.cpp:512:41: error: no matching function for call to ‘<unnamed>::CDFGPass::getAnalysis(llvm::Function*&)’

First, double check that it's a Function * and not a Function & that is required.

Second, what type of pass is your pass?  Is it a ModulePass, a FunctionPass, or some other type of pass?  For a FunctionPass, no argument is necessary.  For a ModulePass, a Function argument is necessary.  For other types of passes, I do not know: you'll either have to wait for someone else to respond or just figure it out using trial and error.

Third, are you including the header file that provides the definition of LoopInfo?  If not, that could be a problem.

-- John T.



Here is the code I'm using:

        Function *F = CGNode->getFunction();
        errs()<<"#Get Loop Info\n";
        if (!(F->getDeclaration()))
                LoopInfo &LI = getAnalysis<LoopInfo>(F);


On Thu, Nov 10, 2011 at 9:13 AM, John Criswell <[hidden email]> wrote:
On 11/10/11 11:06 AM, Ryan Taylor wrote:
LLVMers,

   I am doing a CallGraphPass but would like to get the LoopInfo of the functions inside this pass, is this possible? Currently I have a function inside the CallGraph struct:

    void getAnalysisUsage(AnalysisUsage &AU) const {
        AU.addRequired<LoopInfo>();
        AU.addPreserved<LoopInfo>();
    }

And later inside the pass I am calling:

LoopInfo &LI = getAnalysis<LoopInfo>();

I have also tried to pass the Function pointer to getAnalysis but that doesn't work either. With the above code my error is:

1) You may need to pass a Function pointer or reference if your pass is not a FunctionPass (e.g., if it is a ModulePass).

2) If you have to specify a Function pointer or reference, you need to make sure that the Function is *not* a declaration:

if (!(F->getDeclaration()))
    getAnalysis<LoopInfo>(F);

-- John T.


UNREACHABLE executed!
0  opt             0x00000000008edc2f
1  opt             0x00000000008edfda
2  libpthread.so.0 0x00007f9c8e69bc60
3  libc.so.6       0x00007f9c8d986d05 gsignal + 53
4  libc.so.6       0x00007f9c8d98aab6 abort + 390
5  opt             0x00000000008da974 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 356
6  opt             0x000000000087e046
7  opt             0x0000000000882b45 llvm::PMDataManager::add(llvm::Pass*, bool) + 741
8  opt             0x000000000087f413 llvm::PassManager::add(llvm::Pass*) + 259
9  opt             0x00000000004ab9be main + 2174
10 libc.so.6       0x00007f9c8d971eff __libc_start_main + 255
11 opt             0x000000000049f5f9
Stack dump:


Any help would be appreciated, thanks!



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem getting LoopInfo inside non-LoopPass

Devang Patel
In reply to this post by Devang Patel
Ryan,

[ Please continue the discussion on mailing for the benefit of everyone. ]

On Nov 10, 2011, at 10:31 AM, Ryan Taylor wrote:

> I need to iterate bottom up on the nodes, but within that I want to break up BBs within a loop. I could just create a loop pass as another opt and call that, I just thought it'd be easier to get the loop info inside the opt I'm already doing.

It is better and easier to write a separate pass.
-
Devang


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5
LLVMers,

  So, I'm trying to write a pass that changes the names of the basic blocks through the use of Value, so:

  Value *V = *BasicBlockPtr;
  const Twine Tname("new_name");
  V->setName(Tname);

But when I run the opt and look at the IR output nothing is changed? Not sure what I'm doing wrong.

Thanks.



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Fwd: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5
Basically I have two separate passes (first is a loop pass) which are two different files and two different opts but I need to keep the data consistent (ie, I want the changes to show up the resulting .bc output file from the first (loop) pass so the second pass can use these new names. Currently, when I print out "BB->getName().str()" after the code below, I get the correct renaming but this doesn't show up in the output file.

I'm calling the opt like this:

opt -load Release/lib/OptFile.so -optTag -S <file.bc> -o file.ll

I have also tried:

opt -load Release/lib/OptFile.so -optTag <file.bc> -o file.bc

Thanks.

---------- Forwarded message ----------
From: Ryan Taylor <[hidden email]>
Date: Wed, Nov 16, 2011 at 5:23 PM
Subject: Re: [LLVMdev] Problem getting LoopInfo inside non-LoopPass
To: [hidden email]


LLVMers,

  So, I'm trying to write a pass that changes the names of the basic blocks through the use of Value, so:

  Value *V = *BasicBlockPtr;
  const Twine Tname("new_name");
  V->setName(Tname);

But when I run the opt and look at the IR output nothing is changed? Not sure what I'm doing wrong.

Thanks.




_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Problem getting LoopInfo inside non-LoopPass

Nick Lewycky
Never create a Twine as a local variable.

   V->setName(Twine("new_name"));

should work fine, however. Note that Twine itself has an implicit
constructor from const char *, so this code:

   V->setName("new_name");

should also work fine.

Nick

Ryan Taylor wrote:

> Basically I have two separate passes (first is a loop pass) which are
> two different files and two different opts but I need to keep the data
> consistent (ie, I want the changes to show up the resulting .bc output
> file from the first (loop) pass so the second pass can use these new
> names. Currently, when I print out "BB->getName().str()" after the code
> below, I get the correct renaming but this doesn't show up in the output
> file.
>
> I'm calling the opt like this:
>
> opt -load Release/lib/OptFile.so -optTag -S <file.bc> -o file.ll
>
> I have also tried:
>
> opt -load Release/lib/OptFile.so -optTag <file.bc> -o file.bc
>
> Thanks.
>
> ---------- Forwarded message ----------
> From: *Ryan Taylor* <[hidden email] <mailto:[hidden email]>>
> Date: Wed, Nov 16, 2011 at 5:23 PM
> Subject: Re: [LLVMdev] Problem getting LoopInfo inside non-LoopPass
> To: [hidden email] <mailto:[hidden email]>
>
>
> LLVMers,
>
>    So, I'm trying to write a pass that changes the names of the basic
> blocks through the use of Value, so:
>
>    Value *V = *BasicBlockPtr;
>    const Twine Tname("new_name");
>    V->setName(Tname);
>
> But when I run the opt and look at the IR output nothing is changed? Not
> sure what I'm doing wrong.
>
> Thanks.
>
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5
Nick,

   Thanks for this info, though this didn't help my problem at all.

On Wed, Nov 16, 2011 at 7:21 PM, Nick Lewycky <[hidden email]> wrote:
Never create a Twine as a local variable.

 V->setName(Twine("new_name"));

should work fine, however. Note that Twine itself has an implicit constructor from const char *, so this code:

 V->setName("new_name");

should also work fine.

Nick

Ryan Taylor wrote:
Basically I have two separate passes (first is a loop pass) which are
two different files and two different opts but I need to keep the data
consistent (ie, I want the changes to show up the resulting .bc output
file from the first (loop) pass so the second pass can use these new
names. Currently, when I print out "BB->getName().str()" after the code
below, I get the correct renaming but this doesn't show up in the output
file.

I'm calling the opt like this:

opt -load Release/lib/OptFile.so -optTag -S <file.bc> -o file.ll

I have also tried:

opt -load Release/lib/OptFile.so -optTag <file.bc> -o file.bc

Thanks.

---------- Forwarded message ----------
From: *Ryan Taylor* <[hidden email] <mailto:[hidden email]>>
Date: Wed, Nov 16, 2011 at 5:23 PM
Subject: Re: [LLVMdev] Problem getting LoopInfo inside non-LoopPass
To: [hidden email] <mailto:[hidden email]>


LLVMers,

  So, I'm trying to write a pass that changes the names of the basic
blocks through the use of Value, so:

  Value *V = *BasicBlockPtr;
  const Twine Tname("new_name");
  V->setName(Tname);

But when I run the opt and look at the IR output nothing is changed? Not
sure what I'm doing wrong.

Thanks.





_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5
So is this simply not possible?

On Thu, Nov 17, 2011 at 10:31 AM, Ryan Taylor <[hidden email]> wrote:
Nick,

   Thanks for this info, though this didn't help my problem at all.


On Wed, Nov 16, 2011 at 7:21 PM, Nick Lewycky <[hidden email]> wrote:
Never create a Twine as a local variable.

 V->setName(Twine("new_name"));

should work fine, however. Note that Twine itself has an implicit constructor from const char *, so this code:

 V->setName("new_name");

should also work fine.

Nick

Ryan Taylor wrote:
Basically I have two separate passes (first is a loop pass) which are
two different files and two different opts but I need to keep the data
consistent (ie, I want the changes to show up the resulting .bc output
file from the first (loop) pass so the second pass can use these new
names. Currently, when I print out "BB->getName().str()" after the code
below, I get the correct renaming but this doesn't show up in the output
file.

I'm calling the opt like this:

opt -load Release/lib/OptFile.so -optTag -S <file.bc> -o file.ll

I have also tried:

opt -load Release/lib/OptFile.so -optTag <file.bc> -o file.bc

Thanks.

---------- Forwarded message ----------
From: *Ryan Taylor* <[hidden email] <mailto:[hidden email]>>
Date: Wed, Nov 16, 2011 at 5:23 PM
Subject: Re: [LLVMdev] Problem getting LoopInfo inside non-LoopPass
To: [hidden email] <mailto:[hidden email]>


LLVMers,

  So, I'm trying to write a pass that changes the names of the basic
blocks through the use of Value, so:

  Value *V = *BasicBlockPtr;
  const Twine Tname("new_name");
  V->setName(Tname);

But when I run the opt and look at the IR output nothing is changed? Not
sure what I'm doing wrong.

Thanks.





_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5
I would have thought this would have been possible.

On Thu, Nov 17, 2011 at 3:49 PM, Ryan Taylor <[hidden email]> wrote:
So is this simply not possible?


On Thu, Nov 17, 2011 at 10:31 AM, Ryan Taylor <[hidden email]> wrote:
Nick,

   Thanks for this info, though this didn't help my problem at all.


On Wed, Nov 16, 2011 at 7:21 PM, Nick Lewycky <[hidden email]> wrote:
Never create a Twine as a local variable.

 V->setName(Twine("new_name"));

should work fine, however. Note that Twine itself has an implicit constructor from const char *, so this code:

 V->setName("new_name");

should also work fine.

Nick

Ryan Taylor wrote:
Basically I have two separate passes (first is a loop pass) which are
two different files and two different opts but I need to keep the data
consistent (ie, I want the changes to show up the resulting .bc output
file from the first (loop) pass so the second pass can use these new
names. Currently, when I print out "BB->getName().str()" after the code
below, I get the correct renaming but this doesn't show up in the output
file.

I'm calling the opt like this:

opt -load Release/lib/OptFile.so -optTag -S <file.bc> -o file.ll

I have also tried:

opt -load Release/lib/OptFile.so -optTag <file.bc> -o file.bc

Thanks.

---------- Forwarded message ----------
From: *Ryan Taylor* <[hidden email] <mailto:[hidden email]>>
Date: Wed, Nov 16, 2011 at 5:23 PM
Subject: Re: [LLVMdev] Problem getting LoopInfo inside non-LoopPass
To: [hidden email] <mailto:[hidden email]>


LLVMers,

  So, I'm trying to write a pass that changes the names of the basic
blocks through the use of Value, so:

  Value *V = *BasicBlockPtr;
  const Twine Tname("new_name");
  V->setName(Tname);

But when I run the opt and look at the IR output nothing is changed? Not
sure what I'm doing wrong.

Thanks.





_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5
The following code is causing an "UNREACHABLE executed!" and a stack dump, any ideas?

namespace {
  struct myPass : public CallGraphSCCPass {
  static char ID;
  myPass() : CallGraphSCCPass(ID) {}
  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
           AU.setPreservesAll();
           AU.addRequired<LoopInfo>();
  }
  virtual bool runOnSCC(CallGraphSCC &SCC) {
       for (CallGraphSCC::iterator CGNodeItr = SCC.begin(), CFNodeItrE=SCC.end();CGNodeItr!=CGNodeItrE;++CGNodeItr)  }
                  const CallGraphNode *CGNode = *CGNodeItr;
                  Function *F = CGNode->getFunction();
                  if (!F->isDeclaration())
                               LoopInfo &LI = getAnalysis<LoopInfo>(*F);
        }
       return false;
   }
  };
   char myPass::ID = 0;
   static RegisterPass<myPass> X("myPass", "This is my pass", false, false);
}

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Problem getting LoopInfo inside non-LoopPass

David Blaikie
On Tue, Nov 29, 2011 at 6:59 PM, Ryan Taylor <[hidden email]> wrote:
> The following code is causing an "UNREACHABLE executed!" and a stack dump,
> any ideas?

The stack might be handy.

> namespace {
>   struct myPass : public CallGraphSCCPass {
>   static char ID;
>   myPass() : CallGraphSCCPass(ID) {}
>   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
>            AU.setPreservesAll();
>            AU.addRequired<LoopInfo>();
>   }
>   virtual bool runOnSCC(CallGraphSCC &SCC) {
>        for (CallGraphSCC::iterator CGNodeItr = SCC.begin(),
> CFNodeItrE=SCC.end();CGNodeItr!=CGNodeItrE;++CGNodeItr)  }
>                   const CallGraphNode *CGNode = *CGNodeItr;
>                   Function *F = CGNode->getFunction();
>                   if (!F->isDeclaration())
>                                LoopInfo &LI = getAnalysis<LoopInfo>(*F);
>         }
>        return false;
>    }
>   };
>    char myPass::ID = 0;
>    static RegisterPass<myPass> X("myPass", "This is my pass", false, false);
> }
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5

UNREACHABLE executed!
0  opt             0x00000000008edc2f
1  opt             0x00000000008edfda
2  libpthread.so.0 0x00007f9c8e69bc60
3  libc.so.6       0x00007f9c8d986d05 gsignal + 53
4  libc.so.6       0x00007f9c8d98aab6 abort + 390
5  opt             0x00000000008da974 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 356
6  opt             0x000000000087e046
7  opt             0x0000000000882b45 llvm::PMDataManager::add(llvm::Pass*, bool) + 741
8  opt             0x000000000087f413 llvm::PassManager::add(llvm::Pass*) + 259
9  opt             0x00000000004ab9be main + 2174
10 libc.so.6       0x00007f9c8d971eff __libc_start_main + 255
11 opt             0x000000000049f5f9
Stack dump:
On Wed, Nov 30, 2011 at 1:13 AM, David Blaikie <[hidden email]> wrote:
On Tue, Nov 29, 2011 at 6:59 PM, Ryan Taylor <[hidden email]> wrote:
> The following code is causing an "UNREACHABLE executed!" and a stack dump,
> any ideas?

The stack might be handy.

> namespace {
>   struct myPass : public CallGraphSCCPass {
>   static char ID;
>   myPass() : CallGraphSCCPass(ID) {}
>   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
>            AU.setPreservesAll();
>            AU.addRequired<LoopInfo>();
>   }
>   virtual bool runOnSCC(CallGraphSCC &SCC) {
>        for (CallGraphSCC::iterator CGNodeItr = SCC.begin(),
> CFNodeItrE=SCC.end();CGNodeItr!=CGNodeItrE;++CGNodeItr)  }
>                   const CallGraphNode *CGNode = *CGNodeItr;
>                   Function *F = CGNode->getFunction();
>                   if (!F->isDeclaration())
>                                LoopInfo &LI = getAnalysis<LoopInfo>(*F);
>         }
>        return false;
>    }
>   };
>    char myPass::ID = 0;
>    static RegisterPass<myPass> X("myPass", "This is my pass", false, false);
> }
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Problem getting LoopInfo inside non-LoopPass

Ryan Taylor-5
I didn't put this in the original post because I first wanted to know if I was using the getAnalysisUsage and getAnalysis correctly, which from what I've read, it seems so, below is the full error I am getting;

On Wed, Nov 30, 2011 at 11:00 AM, Ryan Taylor <[hidden email]> wrote:

UNREACHABLE executed!
0  opt             0x00000000008edc2f
1  opt             0x00000000008edfda
2  libpthread.so.0 0x00007f9c8e69bc60
3  libc.so.6       0x00007f9c8d986d05 gsignal + 53
4  libc.so.6       0x00007f9c8d98aab6 abort + 390
5  opt             0x00000000008da974 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 356
6  opt             0x000000000087e046
7  opt             0x0000000000882b45 llvm::PMDataManager::add(llvm::Pass*, bool) + 741
8  opt             0x000000000087f413 llvm::PassManager::add(llvm::Pass*) + 259
9  opt             0x00000000004ab9be main + 2174
10 libc.so.6       0x00007f9c8d971eff __libc_start_main + 255
11 opt             0x000000000049f5f9
Stack dump:
On Wed, Nov 30, 2011 at 1:13 AM, David Blaikie <[hidden email]> wrote:
On Tue, Nov 29, 2011 at 6:59 PM, Ryan Taylor <[hidden email]> wrote:
> The following code is causing an "UNREACHABLE executed!" and a stack dump,
> any ideas?

The stack might be handy.

> namespace {
>   struct myPass : public CallGraphSCCPass {
>   static char ID;
>   myPass() : CallGraphSCCPass(ID) {}
>   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
>            AU.setPreservesAll();
>            AU.addRequired<LoopInfo>();
>   }
>   virtual bool runOnSCC(CallGraphSCC &SCC) {
>        for (CallGraphSCC::iterator CGNodeItr = SCC.begin(),
> CFNodeItrE=SCC.end();CGNodeItr!=CGNodeItrE;++CGNodeItr)  }
>                   const CallGraphNode *CGNode = *CGNodeItr;
>                   Function *F = CGNode->getFunction();
>                   if (!F->isDeclaration())
>                                LoopInfo &LI = getAnalysis<LoopInfo>(*F);
>         }
>        return false;
>    }
>   };
>    char myPass::ID = 0;
>    static RegisterPass<myPass> X("myPass", "This is my pass", false, false);
> }
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem getting LoopInfo inside non-LoopPass

Devang Patel
In reply to this post by Ryan Taylor-5
Ryan,

See http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-November/045423.html

-
Devang

On Nov 29, 2011, at 6:59 PM, Ryan Taylor wrote:

> The following code is causing an "UNREACHABLE executed!" and a stack dump, any ideas?
>
> namespace {
>   struct myPass : public CallGraphSCCPass {
>   static char ID;
>   myPass() : CallGraphSCCPass(ID) {}
>   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
>            AU.setPreservesAll();
>            AU.addRequired<LoopInfo>();
>   }
>   virtual bool runOnSCC(CallGraphSCC &SCC) {
>        for (CallGraphSCC::iterator CGNodeItr = SCC.begin(), CFNodeItrE=SCC.end();CGNodeItr!=CGNodeItrE;++CGNodeItr)  }
>                   const CallGraphNode *CGNode = *CGNodeItr;
>                   Function *F = CGNode->getFunction();
>                   if (!F->isDeclaration())
>                                LoopInfo &LI = getAnalysis<LoopInfo>(*F);
>         }
>        return false;
>    }
>   };
>    char myPass::ID = 0;
>    static RegisterPass<myPass> X("myPass", "This is my pass", false, false);
> }
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem getting LoopInfo inside non-LoopPass

Pankaj Gode
In addition to the link below, please check for functions like "llvm.debug.declare", "llvm.debug.value", as you will not get LoopInfo for these.
 
Pankaj
 

From: Devang Patel <[hidden email]>
To: Ryan Taylor <[hidden email]>
Cc: [hidden email]
Sent: Wednesday, November 30, 2011 11:08 PM
Subject: Re: [LLVMdev] Problem getting LoopInfo inside non-LoopPass

Ryan,

See http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-November/045423.html

-
Devang

On Nov 29, 2011, at 6:59 PM, Ryan Taylor wrote:

> The following code is causing an "UNREACHABLE executed!" and a stack dump, any ideas?
>
> namespace {
>  struct myPass : public CallGraphSCCPass {
>  static char ID;
>  myPass() : CallGraphSCCPass(ID) {}
>  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
>            AU.setPreservesAll();
>            AU.addRequired<LoopInfo>();
>  }
>  virtual bool runOnSCC(CallGraphSCC &SCC) {
>        for (CallGraphSCC::iterator CGNodeItr = SCC.begin(), CFNodeItrE=SCC.end();CGNodeItr!=CGNodeItrE;++CGNodeItr)  }
>                  const CallGraphNode *CGNode = *CGNodeItr;
>                  Function *F = CGNode->getFunction();
>                  if (!F->isDeclaration())
>                                LoopInfo &LI = getAnalysis<LoopInfo>(*F);
>        }
>        return false;
>    }
>  };
>    char myPass::ID = 0;
>    static RegisterPass<myPass> X("myPass", "This is my pass", false, false);
> }
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]        http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]        http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
12