Skip to content
  1. Jul 25, 2014
    • Hal Finkel's avatar
      Convert noalias parameter attributes into noalias metadata during inlining · ff0bcb60
      Hal Finkel authored
      This functionality is currently turned off by default.
      
      Part of the motivation for introducing scoped-noalias metadata is to enable the
      preservation of noalias parameter attribute information after inlining.
      Sometimes this can be inferred from the code in the caller after inlining, but
      often we simply lose valuable information.
      
      The overall process if fairly simple:
       1. Create a new unqiue scope domain.
       2. For each (used) noalias parameter, create a new alias scope.
       3. For each pointer, collect the underlying objects. Add a noalias scope for
          each noalias parameter from which we're not derived (and has not been
          captured prior to that point).
       4. Add an alias.scope for each noalias parameter from which we might be
          derived (or has been captured before that point).
      
      Note that the capture checks apply only if one of the underlying objects is not
      an identified function-local object.
      
      llvm-svn: 213949
      ff0bcb60
  2. Jul 24, 2014
    • Hal Finkel's avatar
      Add scoped-noalias metadata · 9414665a
      Hal Finkel authored
      This commit adds scoped noalias metadata. The primary motivations for this
      feature are:
        1. To preserve noalias function attribute information when inlining
        2. To provide the ability to model block-scope C99 restrict pointers
      
      Neither of these two abilities are added here, only the necessary
      infrastructure. In fact, there should be no change to existing functionality,
      only the addition of new features. The logic that converts noalias function
      parameters into this metadata during inlining will come in a follow-up commit.
      
      What is added here is the ability to generally specify noalias memory-access
      sets. Regarding the metadata, alias-analysis scopes are defined similar to TBAA
      nodes:
      
      !scope0 = metadata !{ metadata !"scope of foo()" }
      !scope1 = metadata !{ metadata !"scope 1", metadata !scope0 }
      !scope2 = metadata !{ metadata !"scope 2", metadata !scope0 }
      !scope3 = metadata !{ metadata !"scope 2.1", metadata !scope2 }
      !scope4 = metadata !{ metadata !"scope 2.2", metadata !scope2 }
      
      Loads and stores can be tagged with an alias-analysis scope, and also, with a
      noalias tag for a specific scope:
      
      ... = load %ptr1, !alias.scope !{ !scope1 }
      ... = load %ptr2, !alias.scope !{ !scope1, !scope2 }, !noalias !{ !scope1 }
      
      When evaluating an aliasing query, if one of the instructions is associated
      with an alias.scope id that is identical to the noalias scope associated with
      the other instruction, or is a descendant (in the scope hierarchy) of the
      noalias scope associated with the other instruction, then the two memory
      accesses are assumed not to alias.
      
      Note that is the first element of the scope metadata is a string, then it can
      be combined accross functions and translation units. The string can be replaced
      by a self-reference to create globally unqiue scope identifiers.
      
      [Note: This overview is slightly stylized, since the metadata nodes really need
      to just be numbers (!0 instead of !scope0), and the scope lists are also global
      unnamed metadata.]
      
      Existing noalias metadata in a callee is "cloned" for use by the inlined code.
      This is necessary because the aliasing scopes are unique to each call site
      (because of possible control dependencies on the aliasing properties). For
      example, consider a function: foo(noalias a, noalias b) { *a = *b; } that gets
      inlined into bar() { ... if (...) foo(a1, b1); ... if (...) foo(a2, b2); } --
      now just because we know that a1 does not alias with b1 at the first call site,
      and a2 does not alias with b2 at the second call site, we cannot let inlining
      these functons have the metadata imply that a1 does not alias with b2.
      
      llvm-svn: 213864
      9414665a
  3. Jun 30, 2014
    • David Blaikie's avatar
      DebugInfo: Preserve debug location information when transforming a call into... · 644d2eee
      David Blaikie authored
      DebugInfo: Preserve debug location information when transforming a call into an invoke during inlining.
      
      This both improves basic debug info quality, but also fixes a larger
      hole whenever we inline a call/invoke without a location (debug info for
      the entire inlining is lost and other badness that the debug info
      emission code is currently working around but shouldn't have to).
      
      llvm-svn: 212065
      644d2eee
  4. Jun 09, 2014
    • Evgeniy Stepanov's avatar
      Fix line numbers for code inlined from __nodebug__ functions. · 2be29929
      Evgeniy Stepanov authored
      Instructions from __nodebug__ functions don't have file:line
      information even when inlined into no-nodebug functions. As a result,
      intrinsics (SSE and other) from <*intrin.h> clang headers _never_
      have file:line information.
      
      With this change, an instruction without !dbg metadata gets one from
      the call instruction when inlined.
      
      Fixes PR19001.
      
      llvm-svn: 210459
      2be29929
  5. May 15, 2014
  6. Apr 25, 2014
  7. Apr 23, 2014
  8. Apr 21, 2014
    • Reid Kleckner's avatar
      Fix PR7272 in -tailcallelim instead of the inliner · 9b2cc647
      Reid Kleckner authored
      The -tailcallelim pass should be checking if byval or inalloca args can
      be captured before marking calls as tail calls.  This was the real root
      cause of PR7272.
      
      With a better fix in place, revert the inliner change from r105255.  The
      test case it introduced still passes and has been moved to
      test/Transforms/Inline/byval-tail-call.ll.
      
      Reviewers: chandlerc
      
      Differential Revision: http://reviews.llvm.org/D3403
      
      llvm-svn: 206789
      9b2cc647
  9. Apr 15, 2014
  10. Mar 09, 2014
    • Chandler Carruth's avatar
      [C++11] Add range based accessors for the Use-Def chain of a Value. · cdf47884
      Chandler Carruth authored
      This requires a number of steps.
      1) Move value_use_iterator into the Value class as an implementation
         detail
      2) Change it to actually be a *Use* iterator rather than a *User*
         iterator.
      3) Add an adaptor which is a User iterator that always looks through the
         Use to the User.
      4) Wrap these in Value::use_iterator and Value::user_iterator typedefs.
      5) Add the range adaptors as Value::uses() and Value::users().
      6) Update *all* of the callers to correctly distinguish between whether
         they wanted a use_iterator (and to explicitly dig out the User when
         needed), or a user_iterator which makes the Use itself totally
         opaque.
      
      Because #6 requires churning essentially everything that walked the
      Use-Def chains, I went ahead and added all of the range adaptors and
      switched them to range-based loops where appropriate. Also because the
      renaming requires at least churning every line of code, it didn't make
      any sense to split these up into multiple commits -- all of which would
      touch all of the same lies of code.
      
      The result is still not quite optimal. The Value::use_iterator is a nice
      regular iterator, but Value::user_iterator is an iterator over User*s
      rather than over the User objects themselves. As a consequence, it fits
      a bit awkwardly into the range-based world and it has the weird
      extra-dereferencing 'operator->' that so many of our iterators have.
      I think this could be fixed by providing something which transforms
      a range of T&s into a range of T*s, but that *can* be separated into
      another patch, and it isn't yet 100% clear whether this is the right
      move.
      
      However, this change gets us most of the benefit and cleans up
      a substantial amount of code around Use and User. =]
      
      llvm-svn: 203364
      cdf47884
  11. Mar 06, 2014
  12. Mar 04, 2014
  13. Feb 18, 2014
  14. Dec 08, 2013
    • Mark Seaborn's avatar
      Fix inlining to not lose the "cleanup" clause from landingpads · 1b3dd352
      Mark Seaborn authored
      This fixes PR17872.  This bug can lead to C++ destructors not being
      called when they should be, when an exception is thrown.
      
      llvm-svn: 196711
      1b3dd352
    • Mark Seaborn's avatar
      Fix inlining to not produce duplicate landingpad clauses · ef3dbb93
      Mark Seaborn authored
      Before this change, inlining one "invoke" into an outer "invoke" call
      site can lead to the outer landingpad's catch/filter clauses being
      copied multiple times into the resulting landingpad.  This happens:
      
       * when the inlined function contains multiple "resume" instructions,
         because forwardResume() copies the clauses but is called multiple
         times;
      
       * when the inlined function contains a "resume" and a "call", because
         HandleCallsInBlockInlinedThroughInvoke() copies the clauses but is
         redundant with forwardResume().
      
      Fix this by deduplicating the code.
      
      This problem doesn't lead to any incorrect execution; it's only
      untidy.
      
      This change will make fixing PR17872 a little easier.
      
      llvm-svn: 196710
      ef3dbb93
  15. Dec 02, 2013
  16. Nov 03, 2013
  17. Oct 31, 2013
    • Manman Ren's avatar
      Do not convert "call asm" to "invoke asm" in Inliner. · 87a2adc7
      Manman Ren authored
      Given that backend does not handle "invoke asm" correctly ("invoke asm" will be
      handled by SelectionDAGBuilder::visitInlineAsm, which does not have the right
      setup for LPadToCallSiteMap) and we already made the assumption that inline asm
      does not throw in InstCombiner::visitCallSite, we are going to make the same
      assumption in Inliner to make sure we don't convert "call asm" to "invoke asm".
      
      If it becomes necessary to add support for "invoke asm" later on, we will need
      to modify the backend as well as remove the assumptions that inline asm does
      not throw.
      
      Fix rdar://15317907
      
      llvm-svn: 193808
      87a2adc7
  18. Oct 24, 2013
  19. May 01, 2013
  20. Apr 30, 2013
  21. Apr 23, 2013
  22. Mar 22, 2013
  23. 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
  24. Dec 03, 2012
    • Chandler Carruth's avatar
      Use the new script to sort the includes of every file under lib. · ed0881b2
      Chandler Carruth authored
      Sooooo many of these had incorrect or strange main module includes.
      I have manually inspected all of these, and fixed the main module
      include to be the nearest plausible thing I could find. If you own or
      care about any of these source files, I encourage you to take some time
      and check that these edits were sensible. I can't have broken anything
      (I strictly added headers, and reordered them, never removed), but they
      may not be the headers you'd really like to identify as containing the
      API being implemented.
      
      Many forward declarations and missing includes were added to a header
      files to allow them to parse cleanly when included first. The main
      module rule does in fact have its merits. =]
      
      llvm-svn: 169131
      ed0881b2
  25. Nov 13, 2012
  26. Oct 08, 2012
  27. Jun 29, 2012
    • Chandler Carruth's avatar
      Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.h · aafe0918
      Chandler Carruth authored
      This was always part of the VMCore library out of necessity -- it deals
      entirely in the IR. The .cpp file in fact was already part of the VMCore
      library. This is just a mechanical move.
      
      I've tried to go through and re-apply the coding standard's preferred
      header sort, but at 40-ish files, I may have gotten some wrong. Please
      let me know if so.
      
      I'll be committing the corresponding updates to Clang and Polly, and
      Duncan has DragonEgg.
      
      Thanks to Bill and Eric for giving the green light for this bit of cleanup.
      
      llvm-svn: 159421
      aafe0918
  28. Jun 28, 2012
  29. Jun 09, 2012
  30. Mar 26, 2012
Loading