Skip to content
  1. Feb 28, 2013
    • Bill Wendling's avatar
      Add the -disable-opt option to LTO. This adds: · c7e0a044
      Bill Wendling authored
      - Consistency with opt (which supports the same option with the same meaning and
        description).
      - Debugging gold plugin-based linking without optimizations getting in the way.
      - Debugging programs linked with the gold plugin while preserving the original
        debug info.
      - Fine-grained control over LTO passes using the gold plugin in combination with
        opt (or clang/dragonegg).
      
      Patch by Cristiano Giuffrida!
      
      llvm-svn: 176257
      c7e0a044
  2. Jan 15, 2013
  3. Jan 07, 2013
    • Chandler Carruth's avatar
      Switch TargetTransformInfo from an immutable analysis pass that requires · 664e354d
      Chandler Carruth authored
      a TargetMachine to construct (and thus isn't always available), to an
      analysis group that supports layered implementations much like
      AliasAnalysis does. This is a pretty massive change, with a few parts
      that I was unable to easily separate (sorry), so I'll walk through it.
      
      The first step of this conversion was to make TargetTransformInfo an
      analysis group, and to sink the nonce implementations in
      ScalarTargetTransformInfo and VectorTargetTranformInfo into
      a NoTargetTransformInfo pass. This allows other passes to add a hard
      requirement on TTI, and assume they will always get at least on
      implementation.
      
      The TargetTransformInfo analysis group leverages the delegation chaining
      trick that AliasAnalysis uses, where the base class for the analysis
      group delegates to the previous analysis *pass*, allowing all but tho
      NoFoo analysis passes to only implement the parts of the interfaces they
      support. It also introduces a new trick where each pass in the group
      retains a pointer to the top-most pass that has been initialized. This
      allows passes to implement one API in terms of another API and benefit
      when some other pass above them in the stack has more precise results
      for the second API.
      
      The second step of this conversion is to create a pass that implements
      the TargetTransformInfo analysis using the target-independent
      abstractions in the code generator. This replaces the
      ScalarTargetTransformImpl and VectorTargetTransformImpl classes in
      lib/Target with a single pass in lib/CodeGen called
      BasicTargetTransformInfo. This class actually provides most of the TTI
      functionality, basing it upon the TargetLowering abstraction and other
      information in the target independent code generator.
      
      The third step of the conversion adds support to all TargetMachines to
      register custom analysis passes. This allows building those passes with
      access to TargetLowering or other target-specific classes, and it also
      allows each target to customize the set of analysis passes desired in
      the pass manager. The baseline LLVMTargetMachine implements this
      interface to add the BasicTTI pass to the pass manager, and all of the
      tools that want to support target-aware TTI passes call this routine on
      whatever target machine they end up with to add the appropriate passes.
      
      The fourth step of the conversion created target-specific TTI analysis
      passes for the X86 and ARM backends. These passes contain the custom
      logic that was previously in their extensions of the
      ScalarTargetTransformInfo and VectorTargetTransformInfo interfaces.
      I separated them into their own file, as now all of the interface bits
      are private and they just expose a function to create the pass itself.
      Then I extended these target machines to set up a custom set of analysis
      passes, first adding BasicTTI as a fallback, and then adding their
      customized TTI implementations.
      
      The fourth step required logic that was shared between the target
      independent layer and the specific targets to move to a different
      interface, as they no longer derive from each other. As a consequence,
      a helper functions were added to TargetLowering representing the common
      logic needed both in the target implementation and the codegen
      implementation of the TTI pass. While technically this is the only
      change that could have been committed separately, it would have been
      a nightmare to extract.
      
      The final step of the conversion was just to delete all the old
      boilerplate. This got rid of the ScalarTargetTransformInfo and
      VectorTargetTransformInfo classes, all of the support in all of the
      targets for producing instances of them, and all of the support in the
      tools for manually constructing a pass based around them.
      
      Now that TTI is a relatively normal analysis group, two things become
      straightforward. First, we can sink it into lib/Analysis which is a more
      natural layer for it to live. Second, clients of this interface can
      depend on it *always* being available which will simplify their code and
      behavior. These (and other) simplifications will follow in subsequent
      commits, this one is clearly big enough.
      
      Finally, I'm very aware that much of the comments and documentation
      needs to be updated. As soon as I had this working, and plausibly well
      commented, I wanted to get it committed and in front of the build bots.
      I'll be doing a few passes over documentation later if it sticks.
      
      Commits to update DragonEgg and Clang will be made presently.
      
      llvm-svn: 171681
      664e354d
  4. Jan 05, 2013
  5. Jan 02, 2013
    • Chandler Carruth's avatar
      Move all of the header files which are involved in modelling the LLVM IR · 9fb823bb
      Chandler Carruth authored
      into their new header subdirectory: include/llvm/IR. This matches the
      directory structure of lib, and begins to correct a long standing point
      of file layout clutter in LLVM.
      
      There are still more header files to move here, but I wanted to handle
      them in separate commits to make tracking what files make sense at each
      layer easier.
      
      The only really questionable files here are the target intrinsic
      tablegen files. But that's a battle I'd rather not fight today.
      
      I've updated both CMake and Makefile build systems (I think, and my
      tests think, but I may have missed something).
      
      I've also re-sorted the includes throughout the project. I'll be
      committing updates to Clang, DragonEgg, and Polly momentarily.
      
      llvm-svn: 171366
      9fb823bb
    • Chandler Carruth's avatar
      b034cb77
  6. Dec 11, 2012
  7. Dec 10, 2012
  8. Dec 08, 2012
    • Bill Wendling's avatar
      Add the `lto_codegen_set_export_dynamic' function. · 65a6ee11
      Bill Wendling authored
      This function sets the `_exportDynamic' ivar. When that's set, we export all
      symbols (e.g. we don't run the internalize pass). This is equivalent to the
      `--export-dynamic' linker flag in GNU land:
      
      --export-dynamic
        When creating a dynamically linked executable, add all symbols to the dynamic
        symbol table. The dynamic symbol table is the set of symbols which are visible
        from dynamic objects at run time. If you do not use this option, the dynamic
        symbol table will normally contain only those symbols which are referenced by
        some dynamic object mentioned in the link. If you use dlopen to load a dynamic
        object which needs to refer back to the symbols defined by the program, rather
        than some other dynamic object, then you will probably need to use this option
        when linking the program itself.
      
      The Darwin linker will support this via the `-export_dynamic' flag. We should
      modify clang to support this via the `-rdynamic' flag.
      
      llvm-svn: 169656
      65a6ee11
  9. Dec 04, 2012
    • Chandler Carruth's avatar
      Sort the #include lines for tools/... · 4d88a1c2
      Chandler Carruth authored
      Again, tools are trickier to pick the main module header for than
      library source files. I've started to follow the pattern of using
      LLVMContext.h when it is included as a stub for program source files.
      
      llvm-svn: 169252
      4d88a1c2
  10. Nov 29, 2012
  11. Nov 27, 2012
    • Owen Anderson's avatar
      Revert r168635 "Step towards implementation of pass manager with... · 1db12f51
      Owen Anderson authored
      Revert r168635 "Step towards implementation of pass manager with doInitialization and doFinalization per module detangled from runOn?? calls, still has temporary code not to break ASAN to be removed when that pass conforms to the proposed model".
      It appears to have broken at least one buildbot.
      
      llvm-svn: 168654
      1db12f51
    • Owen Anderson's avatar
      Step towards implementation of pass manager with doInitialization and... · 336368c4
      Owen Anderson authored
      Step towards implementation of pass manager with doInitialization and doFinalization per module detangled from runOn?? calls, still has temporary code not to break ASAN to be removed when that pass conforms to the proposed model
      
      Patch by Pedro Artigas, with feedback from by Chandler Carruth.
      
      llvm-svn: 168635
      336368c4
  12. Nov 15, 2012
  13. Oct 19, 2012
  14. Oct 18, 2012
    • Bob Wilson's avatar
      Temporarily revert the TargetTransform changes. · d6d9ccca
      Bob Wilson authored
      The TargetTransform changes are breaking LTO bootstraps of clang.  I am
      working with Nadav to figure out the problem, but I am reverting it for now
      to get our buildbots working.
      
      This reverts svn commits: 165665 165669 165670 165786 165787 165997
      and I have also reverted clang svn 165741
      
      llvm-svn: 166168
      d6d9ccca
  15. Oct 16, 2012
  16. Oct 12, 2012
  17. Oct 08, 2012
  18. Sep 06, 2012
  19. Aug 09, 2012
  20. Aug 07, 2012
  21. Aug 06, 2012
  22. May 30, 2012
    • David Blaikie's avatar
      Reinstate -O3 for LTO. · 787705ae
      David Blaikie authored
      This broke in r144788 when the CodeGenOpt option was moved from everywhere else
      (specifically, from addPassesToEmitFile) to createTargetMachine. Since
      LTOCodeGenerator wasn't passing the 4th argument, when the 4th parameter became
      the 3rd, it silently continued to compile (int->bool conversion) but meant
      something completely different.
      
      This change preserves the existing (accidental) and previous (default)
      semantics of the addPassesToEmitFile and restores the previous/intended
      CodeGenOpt argument by passing it appropriately to createTargetMachine.
      
      (discovered by pending changes to -Wconversion to catch constant->bool
      conversions)
      
      llvm-svn: 157705
      787705ae
  23. Apr 16, 2012
  24. Apr 10, 2012
  25. Apr 09, 2012
  26. Apr 05, 2012
    • Bill Wendling's avatar
      The internalize pass can be dangerous for LTO. · 4f60125d
      Bill Wendling authored
      Consider the following program:
      
      $ cat main.c
      void foo(void) { }
      
      int main(int argc, char *argv[]) {
          foo();
          return 0;
      }
      $ cat bundle.c 
      extern void foo(void);
      
      void bar(void) {
           foo();
      }
      $ clang -o main main.c
      $ clang -o bundle.so bundle.c -bundle -bundle_loader ./main
      $ nm -m bundle.so
      0000000000000f40 (__TEXT,__text) external _bar
                       (undefined) external _foo (from executable)
                       (undefined) external dyld_stub_binder (from libSystem)
      $ clang -o main main.c -O4
      $ clang -o bundle.so bundle.c -bundle -bundle_loader ./main
      Undefined symbols for architecture x86_64:
        "_foo", referenced from:
            _bar in bundle-elQN6d.o
      ld: symbol(s) not found for architecture x86_64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      
      The linker was told that the 'foo' in 'main' was 'internal' and had no uses, so
      it was dead stripped.
      
      Another situation is something like:
      
      define void @foo() {
        ret void
      }
      
      define void @bar() {
        call asm volatile "call _foo" ...
        ret void
      }
      
      The only use of 'foo' is inside of an inline ASM call. Since we don't look
      inside those for uses of functions, we don't specify this as a "use."
      
      Get around this by not invoking the 'internalize' pass by default. This is an
      admitted hack for LTO correctness.
      <rdar://problem/11185386>
      
      llvm-svn: 154124
      4f60125d
  27. Apr 03, 2012
  28. Mar 31, 2012
  29. Jan 20, 2012
  30. Dec 02, 2011
    • Nick Lewycky's avatar
      Move global variables in TargetMachine into new TargetOptions class. As an API · 50f02cb2
      Nick Lewycky authored
      change, now you need a TargetOptions object to create a TargetMachine. Clang
      patch to follow.
      
      One small functionality change in PTX. PTX had commented out the machine
      verifier parts in their copy of printAndVerify. That now calls the version in
      LLVMTargetMachine. Users of PTX who need verification disabled should rely on
      not passing the command-line flag to enable it.
      
      llvm-svn: 145714
      50f02cb2
Loading