[LLVMdev] Loading ProfileInfo in Backend. (Was: [PATCH] & Question: Preserving ProfileInfo for backend.)

Shuguang Feng shuguang.feng at gmail.com
Tue Oct 6 13:33:04 PDT 2009


I finally got a chance to sit down and stare at this again today.
>From what I can tell the ProfileInfoLoaderPass (LoaderPass) is
executing properly.  However, when I call &getAnalysis<ProfileInfo>()
I'm actually receiving a handle to the NoProfileInfo pass despite the
ordering of the passes that I see:

Target Data Layout
Create Garbage Collector Module Metadata
Basic Alias Analysis (default AA impl)
DWARF Information Writer
No Profile Information                      <---------- *This is being
returned to me by getAnalysis<ProfileInfo>
Module Information
  ModulePass Manager
    Profiling information loader            <---------- *This is what
I want a handle to
    FunctionPass Manager
      Preliminary module verification
      Dominator Tree Construction
      Module Verifier
      Natural Loop Construction
      Canonicalize natural loops
      Scalar Evolution Analysis
      Loop Pass Manager
        Loop Strength Reduction
      Lower Garbage Collection Instructions
      Remove unreachable blocks from the CFG
      Optimize for code generation
      Insert stack protectors
      X86 DAG->DAG Instruction Selection
      X86 FP_REG_KILL inserter
      X86 Maximal Stack Alignment Calculator
      <MY PASS RUNS HERE>

I'm guessing that this happens because both LoaderPass and
NoProfileInfo are part of the same AnalysisGroup (ProfileInfo) and
NoProfileInfo pass was registered as the *default* implementation.  I
couldn't find how to disable NoProfileInfo from running so I modified
the source code to make LoaderPass the default.  This allowed me to
grab the right handle in my MachineFunction pass but also lead me to
wonder 3 things:

1) Is my explanation for what was happening correct?
2) If so, what is the proper way to select between different
implementations of an AnalysisGroup?
3) I couldn't find anything in the source tree that explicitly called
createNoProfileInfoPass() so why is NoProfileInfo always being
executed?  Does this have to do with it being an ImmutablePass?

Thanks!



More information about the llvm-dev mailing list