Skip to content
  1. Feb 28, 2014
    • Tobias Grosser's avatar
      Add 'remark' diagnostic type in LLVM · e8d4c9a2
      Tobias Grosser authored
      A 'remark' is information that is not an error or a warning, but rather some
      additional information provided to the user. In contrast to a 'note' a 'remark'
      is an independent diagnostic, whereas a 'note' always depends on another
      diagnostic.
      
      A typical use case for remark nodes is information provided to the user, e.g.
      information provided by the vectorizer about loops that have been vectorized.
      
      llvm-svn: 202474
      e8d4c9a2
  2. Feb 26, 2014
    • Rafael Espindola's avatar
      Use DataLayout from the module when easily available. · 339430f9
      Rafael Espindola authored
      Eventually DataLayoutPass should go away, but for now that is the only easy
      way to get a DataLayout in some APIs. This patch only changes the ones that
      have easy access to a Module.
      
      One interesting issue with sometimes using DataLayoutPass and sometimes
      fetching it from the Module is that we have to make sure they are equivalent.
      We can get most of the way there by always constructing the pass with a Module.
      In fact, the pass could be changed to point to an external DataLayout instead
      of owning one to make this stricter.
      
      Unfortunately, the C api passes a DataLayout, so it has to be up to the caller
      to make sure the pass and the module are in sync.
      
      llvm-svn: 202204
      339430f9
  3. Feb 25, 2014
  4. Feb 24, 2014
    • Rafael Espindola's avatar
      Replace the F_Binary flag with a F_Text one. · 90c7f1cc
      Rafael Espindola authored
      After this I will set the default back to F_None. The advantage is that
      before this patch forgetting to set F_Binary would corrupt a file on windows.
      Forgetting to set F_Text produces one that cannot be read in notepad, which
      is a better failure mode :-)
      
      llvm-svn: 202052
      90c7f1cc
  5. Feb 19, 2014
    • Rafael Espindola's avatar
      move getNameWithPrefix and getSymbol to TargetMachine. · a3ad4e69
      Rafael Espindola authored
      TargetLoweringBase is implemented in CodeGen, so before this patch we had
      a dependency fom Target to CodeGen. This would show up as a link failure of
      llvm-stress when building with -DBUILD_SHARED_LIBS=ON.
      
      This fixes pr18900.
      
      llvm-svn: 201711
      a3ad4e69
    • Rafael Espindola's avatar
      Add back r201608, r201622, r201624 and r201625 · daeafb4c
      Rafael Espindola authored
      r201608 made llvm corretly handle private globals with MachO. r201622 fixed
      a bug in it and r201624 and r201625 were changes for using private linkage,
      assuming that llvm would do the right thing.
      
      They all got reverted because r201608 introduced a crash in LTO. This patch
      includes a fix for that. The issue was that TargetLoweringObjectFile now has
      to be initialized before we can mangle names of private globals. This is
      trivially true during the normal codegen pipeline (the asm printer does it),
      but LTO has to do it manually.
      
      llvm-svn: 201700
      daeafb4c
    • Daniel Jasper's avatar
      Revert r201622 and r201608. · 7e198ad8
      Daniel Jasper authored
      This causes the LLVMgold plugin to segfault. More information on the
      replies to r201608.
      
      llvm-svn: 201669
      7e198ad8
  6. Feb 18, 2014
    • Rafael Espindola's avatar
      Fix PR18743. · 09dcc6a5
      Rafael Espindola authored
      The IR
      @foo = private constant i32 42
      
      is valid, but before this patch we would produce an invalid MachO from it. It
      was invalid because it would use an L label in a section where the liker needs
      the labels in order to atomize it.
      
      One way of fixing it would be to just reject this IR in the backend, but that
      would not be very front end friendly.
      
      What this patch does is use an 'l' prefix in sections that we know the linker
      requires symbols for atomizing them. This allows frontends to just use
      private and not worry about which sections they go to or how the linker handles
      them.
      
      One small issue with this strategy is that now a symbol name depends on the
      section, which is not available before codegen. This is not a problem in
      practice. The reason is that it only happens with private linkage, which will
      be ignored by the non codegen users (llvm-nm and llvm-ar).
      
      llvm-svn: 201608
      09dcc6a5
  7. Jan 23, 2014
    • Juergen Ributzka's avatar
      Add target analysis passes to the codegen pipeline for MCJIT. · 5fe955cb
      Juergen Ributzka authored
      This patch adds the target analysis passes (usually TargetTransformInfo) to the
      codgen pipeline. We also expose now the AddAnalysisPasses method through the C
      API, because the optimizer passes would also benefit from better target-specific
      cost models.
      
      Reviewed by Andrew Kaylor
      
      llvm-svn: 199926
      5fe955cb
  8. Jan 15, 2014
    • Quentin Colombet's avatar
      [LTO] Add a hook to map LLVM diagnostics into the clients of LTO. · 5fa1f6f5
      Quentin Colombet authored
      Add a hook in the C API of LTO so that clients of the code generator can set
      their own handler for the LLVM diagnostics.
      The handler is defined like this:
      typedef void (*lto_diagnostic_handler_t)(lto_codegen_diagnostic_severity_t
      severity, const char *diag, void *ctxt)
      - severity says how bad this is.
      - diag is a string that contains the diagnostic message.
      - ctxt is the registered context for this handler.
      
      This hook is more general than the lto_get_error_message, since this function
      keeps only the latest message and can only be queried when something went wrong
      (no warning for instance).
      
      <rdar://problem/15517596>
      
      llvm-svn: 199338
      5fa1f6f5
  9. Jan 14, 2014
    • Duncan P. N. Exon Smith's avatar
      Reapply "LTO: add API to set strategy for -internalize" · 93be7c4f
      Duncan P. N. Exon Smith authored
      Reapply r199191, reverted in r199197 because it carelessly broke
      Other/link-opts.ll.  The problem was that calling
      createInternalizePass("main") would select
      createInternalizePass(bool("main")) instead of
      createInternalizePass(ArrayRef<const char *>("main")).  This commit
      fixes the bug.
      
      The original commit message follows.
      
      Add API to LTOCodeGenerator to specify a strategy for the -internalize
      pass.
      
      This is a new attempt at Bill's change in r185882, which he reverted in
      r188029 due to problems with the gold linker.  This puts the onus on the
      linker to decide whether (and what) to internalize.
      
      In particular, running internalize before outputting an object file may
      change a 'weak' symbol into an internal one, even though that symbol
      could be needed by an external object file --- e.g., with arclite.
      
      This patch enables three strategies:
      
      - LTO_INTERNALIZE_FULL: the default (and the old behaviour).
      - LTO_INTERNALIZE_NONE: skip -internalize.
      - LTO_INTERNALIZE_HIDDEN: only -internalize symbols with hidden
        visibility.
      
      LTO_INTERNALIZE_FULL should be used when linking an executable.
      
      Outputting an object file (e.g., via ld -r) is more complicated, and
      depends on whether hidden symbols should be internalized.  E.g., for
      ld -r, LTO_INTERNALIZE_NONE can be used when -keep_private_externs, and
      LTO_INTERNALIZE_HIDDEN can be used otherwise.  However,
      LTO_INTERNALIZE_FULL is inappropriate, since the output object file will
      eventually need to link with others.
      
      lto_codegen_set_internalize_strategy() sets the strategy for subsequent
      calls to lto_codegen_write_merged_modules() and lto_codegen_compile*().
      
      <rdar://problem/14334895>
      
      llvm-svn: 199244
      93be7c4f
    • NAKAMURA Takumi's avatar
      Revert r199191, "LTO: add API to set strategy for -internalize" · 23c0ab53
      NAKAMURA Takumi authored
      Please update also Other/link-opts.ll, in next time.
      
      llvm-svn: 199197
      23c0ab53
    • Duncan P. N. Exon Smith's avatar
      LTO: add API to set strategy for -internalize · 43ea3478
      Duncan P. N. Exon Smith authored
      Add API to LTOCodeGenerator to specify a strategy for the -internalize
      pass.
      
      This is a new attempt at Bill's change in r185882, which he reverted in
      r188029 due to problems with the gold linker.  This puts the onus on the
      linker to decide whether (and what) to internalize.
      
      In particular, running internalize before outputting an object file may
      change a 'weak' symbol into an internal one, even though that symbol
      could be needed by an external object file --- e.g., with arclite.
      
      This patch enables three strategies:
      
      - LTO_INTERNALIZE_FULL: the default (and the old behaviour).
      - LTO_INTERNALIZE_NONE: skip -internalize.
      - LTO_INTERNALIZE_HIDDEN: only -internalize symbols with hidden
        visibility.
      
      LTO_INTERNALIZE_FULL should be used when linking an executable.
      
      Outputting an object file (e.g., via ld -r) is more complicated, and
      depends on whether hidden symbols should be internalized.  E.g., for
      ld -r, LTO_INTERNALIZE_NONE can be used when -keep_private_externs, and
      LTO_INTERNALIZE_HIDDEN can be used otherwise.  However,
      LTO_INTERNALIZE_FULL is inappropriate, since the output object file will
      eventually need to link with others.
      
      lto_codegen_set_internalize_strategy() sets the strategy for subsequent
      calls to lto_codegen_write_merged_modules() and lto_codegen_compile*().
      
      <rdar://problem/14334895>
      
      llvm-svn: 199191
      43ea3478
  10. Jan 13, 2014
    • Chandler Carruth's avatar
      [cleanup] Move the Dominators.h and Verifier.h headers into the IR · 5ad5f15c
      Chandler Carruth authored
      directory. These passes are already defined in the IR library, and it
      doesn't make any sense to have the headers in Analysis.
      
      Long term, I think there is going to be a much better way to divide
      these matters. The dominators code should be fully separated into the
      abstract graph algorithm and have that put in Support where it becomes
      obvious that evn Clang's CFGBlock's can use it. Then the verifier can
      manually construct dominance information from the Support-driven
      interface while the Analysis library can provide a pass which both
      caches, reconstructs, and supports a nice update API.
      
      But those are very long term, and so I don't want to leave the really
      confusing structure until that day arrives.
      
      llvm-svn: 199082
      5ad5f15c
  11. Jan 10, 2014
  12. Jan 07, 2014
  13. Jan 03, 2014
    • Rafael Espindola's avatar
      Make the llvm mangler depend only on DataLayout. · 58873566
      Rafael Espindola authored
      Before this patch any program that wanted to know the final symbol name of a
      GlobalValue had to link with Target.
      
      This patch implements a compromise solution where the mangler uses DataLayout.
      This way, any tool that already links with Target (llc, clang) gets the exact
      behavior as before and new IR files can be mangled without linking with Target.
      
      With this patch the mangler is constructed with just a DataLayout and DataLayout
      is extended to include the information the Mangler needs.
      
      llvm-svn: 198438
      58873566
  14. Dec 12, 2013
  15. Dec 05, 2013
    • Rafael Espindola's avatar
      Remove the isImplicitlyPrivate argument of getNameWithPrefix. · 117b20c4
      Rafael Espindola authored
      getSymbolWithGlobalValueBase use is to create a name of a new symbol based
      on the name of an existing GV. Assert that and then remove the last call
      to pass true to isImplicitlyPrivate.
      
      This gives the mangler API a 1:1 mapping from GV to names, which is what we
      need to drop the mangler dependency on the target (and use an extended
      datalayout instead).
      
      llvm-svn: 196472
      117b20c4
  16. Nov 16, 2013
  17. Nov 12, 2013
    • Justin Bogner's avatar
      Protect user-supplied runtime library functions in LTO · b10a520c
      Justin Bogner authored
      Add user-supplied C runtime and compiler-rt library functions to
      llvm.compiler.used to protect them from premature optimization by
      passes like -globalopt and -ipsccp.  Calls to (seemingly unused)
      runtime library functions can be added by -instcombine and instruction
      lowering.
      
      Patch by Duncan Exon Smith, thanks!
      
      Fixes <rdar://problem/14740087>
      
      llvm-svn: 194514
      b10a520c
  18. Oct 31, 2013
    • Rafael Espindola's avatar
      Use LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN instead of the "dso list". · 282a4703
      Rafael Espindola authored
      There are two ways one could implement hiding of linkonce_odr symbols in LTO:
      * LLVM tells the linker which symbols can be hidden if not used from native
        files.
      * The linker tells LLVM which symbols are not used from other object files,
        but will be put in the dso symbol table if present.
      
      GOLD's API is the second option. It was implemented almost 1:1 in llvm by
      passing the list down to internalize.
      
      LLVM already had partial support for the first option. It is also very similar
      to how ld64 handles hiding these symbols when *not* doing LTO.
      
      This patch then
      * removes the APIs for the DSO list.
      * marks LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN all linkonce_odr unnamed_addr
        global values and other linkonce_odr whose address is not used.
      * makes the gold plugin responsible for handling the API mismatch.
      
      llvm-svn: 193800
      282a4703
  19. Oct 29, 2013
  20. Oct 16, 2013
  21. Oct 03, 2013
    • Rafael Espindola's avatar
      Optimize linkonce_odr unnamed_addr functions during LTO. · cda2911c
      Rafael Espindola authored
      Generalize the API so we can distinguish symbols that are needed just for a DSO
      symbol table from those that are used from some native .o.
      
      The symbols that are only wanted for the dso symbol table can be dropped if
      llvm can prove every other dso has a copy (linkonce_odr) and the address is not
      important (unnamed_addr).
      
      llvm-svn: 191922
      cda2911c
  22. Oct 02, 2013
  23. Sep 30, 2013
  24. Sep 25, 2013
  25. Sep 04, 2013
  26. Aug 27, 2013
    • Shuxin Yang's avatar
      Revert 189297, the original commit message is following. · 388b52c0
      Shuxin Yang authored
      ----
        Add new API lto_codegen_compile_parallel().
      
        This API is proposed by Nick Kledzik. The semantic is:
      
        --------------------------------------------------------------------------
         Generate code for merged module into an array of native object files. On 
         success returns a pointer to an array of NativeObjectFile.  The count 
         parameter returns the number of elements in the array.  Each element is 
         a pointer/length for a generated mach-o/ELF buffer.  The buffer is owned
         by the lto_code_gen_t and will be freed when lto_codegen_dispose() is called, 
         or lto_codegen_compile() is called again. On failure, returns NULL 
         (check lto_get_error_message() for details).
      
         extern const struct  NativeObjectFile*
         lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count);
        ---------------------------------------------------------------------------
      
        This API is currently only called on OSX platform. Linux or other Unixes
      using GNU gold are not supposed to call this function, because on these systems, 
      object files are fed back to linker via disk file instead of memory buffer.
      
        In this commit, lto_codegen_compile_parallel() simply calls
      lto_codegen_compile() to return a single object file. In the near future,
      this function is the entry point for compilation with partition. Linker can
      blindly call this function even if partition is turned off; in this case,
      compiler will return only one object file.
      
      llvm-svn: 189386
      388b52c0
    • Shuxin Yang's avatar
      Add new API lto_codegen_compile_parallel(). · a44362e4
      Shuxin Yang authored
        This API is proposed by Nick Kledzik. The semantic is:
      
        --------------------------------------------------------------------------
         Generate code for merged module into an array of native object files. On 
         success returns a pointer to an array of NativeObjectFile.  The count 
         parameter returns the number of elements in the array.  Each element is 
         a pointer/length for a generated mach-o/ELF buffer.  The buffer is owned
         by the lto_code_gen_t and will be freed when lto_codegen_dispose() is called, 
         or lto_codegen_compile() is called again. On failure, returns NULL 
         (check lto_get_error_message() for details).
      
         extern const struct  NativeObjectFile*
         lto_codegen_compile_parallel(lto_code_gen_t cg, size_t *count);
        ---------------------------------------------------------------------------
      
        This API is currently only called on OSX platform. Linux or other Unixes
      using GNU gold are not supposed to call this function, because on these systems, 
      object files are fed back to linker via disk file instead of memory buffer.
      
        In this commit, lto_codegen_compile_parallel() simply calls
      lto_codegen_compile() to return a single object file. In the near future,
      this function is the entry point for compilation with partition. Linker can
      blindly call this function even if partition is turned off; in this case,
      compiler will return only one object file.
      
      llvm-svn: 189297
      a44362e4
  27. Aug 12, 2013
    • Shuxin Yang's avatar
      Revert r188188 and r188200. · 1826ae23
      Shuxin Yang authored
      In order to appease people (in Apple) who accuse me for committing "huge change" (?) without proper review. 
      
      Thank Eric for fixing a compile-warning. 
      
      llvm-svn: 188204
      1826ae23
    • Shuxin Yang's avatar
      Misc enhancements to LTO: · 76d082b5
      Shuxin Yang authored
        1. Add some helper classes for partitions. They are designed in a
           way such that the top-level LTO driver will not see much difference 
           with or without partitioning.
      
        2. Introduce work-dir. Now all intermediate files generated during 
           LTO phases will be saved under work-dir. User can specify the workdir
           via -lto-workdir=/path/to/dir. By default the work-dir will be 
           erased before linker exit. To keep the workdir, do -lto-keep, or -lto-keep=1.
      
          TODO: Erase the workdir, if the linker exit prematurely.  
            We are currently not able to remove directory on signal. The support 
            routines simply ignore directory.
      
        3. Add one new API lto_codegen_get_files_need_remove().
           Linker and LTO plugin will communicate via this API about which files
          (including directories) need to removed before linker exit.
      
      llvm-svn: 188188
      76d082b5
  28. Aug 09, 2013
  29. Aug 07, 2013
  30. Aug 06, 2013
  31. Jul 27, 2013
Loading