Hi, Devang Patel wrote:> On Tue, Nov 17, 2009 at 9:03 AM, Andreas Neustifter > <astifter-llvm at gmx.at> wrote: > >> Okay, so the ProfileInfoLoader is working, but when I examine the executions more closely I see that the ProfileInfo generated by the ProfileInfoLoader is immediately discarded, when the SelectionDAGISel kicks in the "No Profile Info"-Implementation is used: >> >> > 0x1c1a740 Executing Pass 'Profiling information loader' on Module 'main.c-O0.ll.bc'... >> > -*- 'Profiling information loader' is the last user of following pass instances. Free these instances >> > 0x1c1a740 Freeing Pass 'Profiling information loader' on Module 'main.c-O0.ll.bc'... >> > 0x1c1a740 Executing Pass 'Function Pass Manager' on Module 'main.c-O0.ll.bc'... >> > 0x1c301a0 Executing Pass 'Preliminary module verification' on Function 'main'... >> > 0x1c301a0 Executing Pass 'Dominator Tree Construction' on Function 'main'... > ... > > Did you update all these function passes to preserve profile info ?Ja, they are all either PreserveAll or I have updated them to AU.setPreserved<ProfileInfo>(). Andi
Hi, On 17/11/09 20:16, Andreas Neustifter wrote:> Devang Patel wrote: >> On Tue, Nov 17, 2009 at 9:03 AM, Andreas Neustifter >> <astifter-llvm at gmx.at> wrote: >> >>> Okay, so the ProfileInfoLoader is working, but when I examine the executions more closely I see that the ProfileInfo generated by the ProfileInfoLoader is immediately discarded, when the SelectionDAGISel kicks in the "No Profile Info"-Implementation is used: >>> >>> > 0x1c1a740 Executing Pass 'Profiling information loader' on Module 'main.c-O0.ll.bc'... >>> > -*- 'Profiling information loader' is the last user of following pass instances. Free these instances >>> > 0x1c1a740 Freeing Pass 'Profiling information loader' on Module 'main.c-O0.ll.bc'... >>> > 0x1c1a740 Executing Pass 'Function Pass Manager' on Module 'main.c-O0.ll.bc'... >>> > 0x1c301a0 Executing Pass 'Preliminary module verification' on Function 'main'... >>> > 0x1c301a0 Executing Pass 'Dominator Tree Construction' on Function 'main'... >> ... >> >> Did you update all these function passes to preserve profile info ? > > Ja, they are all either PreserveAll or I have updated them to > AU.setPreserved<ProfileInfo>().I still have not found a solution for this, any other ideas? Whats the best way to debug why the passmanager is prefering a certain instance of analysis information over another instance? whats the rules in that case? Andi
Hi. On 11/17/2009 08:16 PM, Andreas Neustifter wrote:> Hi, > > Devang Patel wrote: >> On Tue, Nov 17, 2009 at 9:03 AM, Andreas Neustifter >> <astifter-llvm at gmx.at> wrote: >> >>> Okay, so the ProfileInfoLoader is working, but when I examine the executions more closely I see that the ProfileInfo generated by the ProfileInfoLoader is immediately discarded, when the SelectionDAGISel kicks in the "No Profile Info"-Implementation is used: >>> >>> > 0x1c1a740 Executing Pass 'Profiling information loader' on Module 'main.c-O0.ll.bc'... >>> > -*- 'Profiling information loader' is the last user of following pass instances. Free these instances >>> > 0x1c1a740 Freeing Pass 'Profiling information loader' on Module 'main.c-O0.ll.bc'... >>> > 0x1c1a740 Executing Pass 'Function Pass Manager' on Module 'main.c-O0.ll.bc'... >>> > 0x1c301a0 Executing Pass 'Preliminary module verification' on Function 'main'... >>> > 0x1c301a0 Executing Pass 'Dominator Tree Construction' on Function 'main'... >> ... >> >> Did you update all these function passes to preserve profile info ? > > Ja, they are all either PreserveAll or I have updated them to > AU.setPreserved<ProfileInfo>().So I have tried this for some days now, I don't get it: If I use AU.addRequired<ProfileInfo>() in SelectionDAGISel.cpp the wrong ProfileInfo is used. It uses the "No ProfileInfo" implementation if ProfileInfo but not the one from ProfileInfoLoaderPass. (Which is immediately discarded after creation.) When I use AU.addRequiredID(ProfileLoaderPassID) I get assertions that a normal constructor is not available. Interesting enough its not the ProfileInfoLoader constructor thats misssing but the one from MachineFunctionAnalysis, which indeed has none. This raises the question why different passes are loaded (in a different order) when I use addRequiredID instead of addRequired<>. To get this clear: I try to use the ProfileInfo form a ModulePass in a subsequent FunctionPass, can this be a problem? Andi
Hello, Andreas> When I use AU.addRequiredID(ProfileLoaderPassID) I get assertions that a > normal constructor is not available. Interesting enough its not the > ProfileInfoLoader constructor thats misssing but the one from > MachineFunctionAnalysis, which indeed has none.Right. You cannot schedule any pass IR-level pass after MachineFunctionAnalysis. I have no idea whether this is intentional or not. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
On Fri, Nov 20, 2009 at 6:54 AM, Andreas Neustifter <astifter-llvm at gmx.at> wrote:> > If I use AU.addRequired<ProfileInfo>() in SelectionDAGISel.cpp the > wrong ProfileInfo is used. It uses the "No ProfileInfo" implementation > if ProfileInfo but not the one from ProfileInfoLoaderPass. (Which is > immediately discarded after creation.) >You need to debug pass manager yourself in a debugger to understand why pass manager is discarding ProfileInfoLoaderPass. Usually it is because 1) The pass manager does not know of any user of your pass - If that's not the case then find out why? This may be a bug. 2) Someone is not preserving this pass. If that's the case then who is it? Is it explicitly claiming to preserve your pass ? - Devang