Ryan Taylor
2011-Nov-21 18:35 UTC
[LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass
I would have thought this would have been possible. On Thu, Nov 17, 2011 at 3:49 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:> So is this simply not possible? > > > On Thu, Nov 17, 2011 at 10:31 AM, Ryan Taylor <ryta1203 at gmail.com> 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 <nicholas at mxc.ca> 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* <ryta1203 at gmail.com <mailto:ryta1203 at gmail.com>> >>>> Date: Wed, Nov 16, 2011 at 5:23 PM >>>> Subject: Re: [LLVMdev] Problem getting LoopInfo inside non-LoopPass >>>> To: llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu> >>>> >>>> >>>> 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 >>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >>>> >>> >>> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111121/90788e97/attachment.html>
Ryan Taylor
2011-Nov-30 02:59 UTC
[LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass
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); } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111129/644fc7d8/attachment.html>
David Blaikie
2011-Nov-30 06:13 UTC
[LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass
On Tue, Nov 29, 2011 at 6:59 PM, Ryan Taylor <ryta1203 at gmail.com> 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 > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
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 > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
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 <dpatel at apple.com> To: Ryan Taylor <ryta1203 at gmail.com> Cc: llvmdev at cs.uiuc.edu 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 > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev_______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111130/4c0ac113/attachment.html>
Thanks for the info. Curious, do you know if there is an opt that will put all loops, including nested ones, in functions (ie each loop in it's own function)? What I'm trying to do is create a way for each loop to have only one exit. I want all loops to be single exit loops? I can write my own pass but I'd rather not. I think that if I can put each loop into it's own function then call merge return that might do it. Ideas? On Thu, Dec 1, 2011 at 12:32 AM, Pankaj Gode <godepankaj at yahoo.com> wrote:> 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 <dpatel at apple.com> > *To:* Ryan Taylor <ryta1203 at gmail.com> > *Cc:* llvmdev at cs.uiuc.edu > *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 > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111201/08d13487/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass
- [LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass
- [LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass
- [LLVMdev] Problem getting LoopInfo inside non-LoopPass
- [LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass