Just shows me what I expect
void getAnalysisUsage(AnalysisUsage &AU) const {
DominatorTree *dt = &getAnalysis<DominatorTree>();
So I'm only using it for DominatorTree(so I can use PromoteMemToReg).
Thanks
On Tue, Nov 8, 2011 at 2:28 PM, Tobias Grosser <tobias at grosser.es>
wrote:> On 11/08/2011 07:33 PM, ret val wrote:
>>
>> Sorry to keep dragging this out on you. Im now getting: Assertion
>> failed: (ResultPass&& "getAnalysis*() called on an
analysis that was
>> not " "'required' by pass!"), function
getAnalysisID
>>
>> But I already have:
>> void getAnalysisUsage(AnalysisUsage&AU) const {
>> AU.addRequired<DominatorTree>();
>> }
>>
>> And changed the bottom of my pass too:
>>
>> char Hello::ID = 0;
>> namespace llvm { void initializeHelloPass(llvm::PassRegistry&); }
>> INITIALIZE_PASS_BEGIN(Hello, "hello", "Hello World
Pass", false, true)
>> INITIALIZE_PASS_DEPENDENCY(DominatorTree)
>> INITIALIZE_PASS_END(Hello, "hello", "Hello World
Pass", false, true)
>>
>> class StaticInitializer {
>> public:
>> StaticInitializer() {
>> PassRegistry&Registry =
*PassRegistry::getPassRegistry();
>> initializeHelloPass(Registry);
>> }
>> };
>>
>> static StaticInitializer InitializeEverything;
>
> Looks good to me. Are you sure you call getAnalysis only for the
> DominatorTree? What is the output of "grep getAnalysis
YourPass.cpp"?
>
> Cheers
> Tobi
>
On 11/08/2011 08:50 PM, ret val wrote:> Just shows me what I expect > void getAnalysisUsage(AnalysisUsage&AU) const { > DominatorTree *dt =&getAnalysis<DominatorTree>(); > > So I'm only using it for DominatorTree(so I can use PromoteMemToReg).Interesting. Is the same assert triggered when you use RegisterPass to register the pass? Is getAnalysisUsage() called at all? My definition of getAnalysisUsage looks like: virtual void getAnalysisUsage(AnalysisUsage &AU) const ^^^^^^^ Why do you omit the 'virtual'? Cheers Tobi
I changed it to virtual void getAnalysisUsage(AnalysisUsage &AU) const with no luck. The function does get called, I see the errs() call I inserted before the asserted is tripped. Really not sure how to go about debugging this now. Thanks again On Tue, Nov 8, 2011 at 2:57 PM, Tobias Grosser <tobias at grosser.es> wrote:> On 11/08/2011 08:50 PM, ret val wrote: >> >> Just shows me what I expect >> void getAnalysisUsage(AnalysisUsage&AU) const { >> DominatorTree *dt =&getAnalysis<DominatorTree>(); >> >> So I'm only using it for DominatorTree(so I can use PromoteMemToReg). > > Interesting. Is the same assert triggered when you use RegisterPass to > register the pass? Is getAnalysisUsage() called at all? > > My definition of getAnalysisUsage looks like: > > virtual void getAnalysisUsage(AnalysisUsage &AU) const > ^^^^^^^ > > Why do you omit the 'virtual'? > > Cheers > Tobi >
Something's different here, earlier in the thread you said you had:
void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<DominatorTree>();
}
Now you have:
void getAnalysisUsage(AnalysisUsage &AU) const {
DominatorTree *dt = &getAnalysis<DominatorTree>();
I'm sort of confused, why did this change happen? I think the
"AU.addRequired" was correct to have in getAnalysisUsage, and the
"getAnalysis" goes e.g. in the top of runOnFunction/Module/Whatever.
Sorry
if I misunderstood what's going on.
On Tue, Nov 8, 2011 at 12:50 PM, ret val <retval386 at gmail.com> wrote:
> Just shows me what I expect
> void getAnalysisUsage(AnalysisUsage &AU) const {
> DominatorTree *dt = &getAnalysis<DominatorTree>();
>
> So I'm only using it for DominatorTree(so I can use PromoteMemToReg).
>
> Thanks
>
> On Tue, Nov 8, 2011 at 2:28 PM, Tobias Grosser <tobias at grosser.es>
wrote:
> > On 11/08/2011 07:33 PM, ret val wrote:
> >>
> >> Sorry to keep dragging this out on you. Im now getting: Assertion
> >> failed: (ResultPass&& "getAnalysis*() called on an
analysis that was
> >> not " "'required' by pass!"), function
getAnalysisID
> >>
> >> But I already have:
> >> void getAnalysisUsage(AnalysisUsage&AU) const {
> >> AU.addRequired<DominatorTree>();
> >> }
> >>
> >> And changed the bottom of my pass too:
> >>
> >> char Hello::ID = 0;
> >> namespace llvm { void
initializeHelloPass(llvm::PassRegistry&); }
> >> INITIALIZE_PASS_BEGIN(Hello, "hello", "Hello World
Pass", false, true)
> >> INITIALIZE_PASS_DEPENDENCY(DominatorTree)
> >> INITIALIZE_PASS_END(Hello, "hello", "Hello World
Pass", false, true)
> >>
> >> class StaticInitializer {
> >> public:
> >> StaticInitializer() {
> >> PassRegistry&Registry =
*PassRegistry::getPassRegistry();
> >> initializeHelloPass(Registry);
> >> }
> >> };
> >>
> >> static StaticInitializer InitializeEverything;
> >
> > Looks good to me. Are you sure you call getAnalysis only for the
> > DominatorTree? What is the output of "grep getAnalysis
YourPass.cpp"?
> >
> > Cheers
> > Tobi
> >
>
> _______________________________________________
> 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/20111108/813a5fc3/attachment.html>
I still have the addRequired:
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<DominatorTree>();
}
The other line
DominatorTree *dt = &getAnalysis<DominatorTree>();
Is for later use when I try to use PromoteMemToReg
On Tue, Nov 8, 2011 at 4:22 PM, Michael Ilseman <michael at lunarg.com>
wrote:> Something's different here, earlier in the thread you said you had:
> void getAnalysisUsage(AnalysisUsage &AU) const {
> AU.addRequired<DominatorTree>();
> }
> Now you have:
> void getAnalysisUsage(AnalysisUsage &AU) const {
> DominatorTree *dt = &getAnalysis<DominatorTree>();
>
> I'm sort of confused, why did this change happen? I think the
> "AU.addRequired" was correct to have in getAnalysisUsage, and the
> "getAnalysis" goes e.g. in the top of
runOnFunction/Module/Whatever. Sorry
> if I misunderstood what's going on.
>
> On Tue, Nov 8, 2011 at 12:50 PM, ret val <retval386 at gmail.com>
wrote:
>>
>> Just shows me what I expect
>> void getAnalysisUsage(AnalysisUsage &AU) const {
>> DominatorTree *dt =
&getAnalysis<DominatorTree>();
>>
>> So I'm only using it for DominatorTree(so I can use
PromoteMemToReg).
>>
>> Thanks
>>
>> On Tue, Nov 8, 2011 at 2:28 PM, Tobias Grosser <tobias at
grosser.es> wrote:
>> > On 11/08/2011 07:33 PM, ret val wrote:
>> >>
>> >> Sorry to keep dragging this out on you. Im now getting:
Assertion
>> >> failed: (ResultPass&& "getAnalysis*() called on
an analysis that was
>> >> not " "'required' by pass!"), function
getAnalysisID
>> >>
>> >> But I already have:
>> >> void getAnalysisUsage(AnalysisUsage&AU) const {
>> >> AU.addRequired<DominatorTree>();
>> >> }
>> >>
>> >> And changed the bottom of my pass too:
>> >>
>> >> char Hello::ID = 0;
>> >> namespace llvm { void
initializeHelloPass(llvm::PassRegistry&); }
>> >> INITIALIZE_PASS_BEGIN(Hello, "hello", "Hello
World Pass", false, true)
>> >> INITIALIZE_PASS_DEPENDENCY(DominatorTree)
>> >> INITIALIZE_PASS_END(Hello, "hello", "Hello
World Pass", false, true)
>> >>
>> >> class StaticInitializer {
>> >> public:
>> >> StaticInitializer() {
>> >> PassRegistry&Registry >> >>
*PassRegistry::getPassRegistry();
>> >> initializeHelloPass(Registry);
>> >> }
>> >> };
>> >>
>> >> static StaticInitializer InitializeEverything;
>> >
>> > Looks good to me. Are you sure you call getAnalysis only for the
>> > DominatorTree? What is the output of "grep getAnalysis
YourPass.cpp"?
>> >
>> > Cheers
>> > Tobi
>> >
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>