Skip to content
  1. Apr 09, 2013
    • Nadav Rotem's avatar
      Add support for bottom-up SLP vectorization infrastructure. · 2d9dec32
      Nadav Rotem authored
      This commit adds the infrastructure for performing bottom-up SLP vectorization (and other optimizations) on parallel computations.
      The infrastructure has three potential users:
      
        1. The loop vectorizer needs to be able to vectorize AOS data structures such as (sum += A[i] + A[i+1]).
      
        2. The BB-vectorizer needs this infrastructure for bottom-up SLP vectorization, because bottom-up vectorization is faster to compute.
      
        3. A loop-roller needs to be able to analyze consecutive chains and roll them into a loop, in order to reduce code size. A loop roller does not need to create vector instructions, and this infrastructure separates the chain analysis from the vectorization.
      
      This patch also includes a simple (100 LOC) bottom up SLP vectorizer that uses the infrastructure, and can vectorize this code:
      
      void SAXPY(int *x, int *y, int a, int i) {
        x[i]   = a * x[i]   + y[i];
        x[i+1] = a * x[i+1] + y[i+1];
        x[i+2] = a * x[i+2] + y[i+2];
        x[i+3] = a * x[i+3] + y[i+3];
      }
      
      llvm-svn: 179117
      2d9dec32
    • Shuxin Yang's avatar
      Redo the fix Benjamin Kramer committed in r178793 about iterator invalidation in Reassociate. · 331f01dc
      Shuxin Yang authored
      I brazenly think this change is slightly simpler than r178793 because: 
        - no "state" in functor
        - "OpndPtrs[i]" looks simpler than "&Opnds[OpndIndices[i]]" 
      
        While I can reproduce the probelm in Valgrind, it is rather difficult to come up
      a standalone testing case. The reason is that when an iterator is invalidated,
      the stale invalidated elements are not yet clobbered by nonsense data, so the
      optimizer can still proceed successfully. 
      
        Thank Benjamin for fixing this bug and generously providing the test case.
      
      llvm-svn: 179062
      331f01dc
  2. Apr 07, 2013
    • Chandler Carruth's avatar
      Fix PR15674 (and PR15603): a SROA think-o. · 0e8a52d1
      Chandler Carruth authored
      The fix for PR14972 in r177055 introduced a real think-o in the *store*
      side, likely because I was much more focused on the load side. While we
      can arbitrarily widen (or narrow) a loaded value, we can't arbitrarily
      widen a value to be stored, as that changes the width of memory access!
      Lock down the code path in the store rewriting which would do this to
      only handle the intended circumstance.
      
      All of the existing tests continue to pass, and I've added a test from
      the PR.
      
      llvm-svn: 178974
      0e8a52d1
  3. Apr 06, 2013
    • Michael Gottesman's avatar
      Removed trailing whitespace. · 7924997c
      Michael Gottesman authored
      llvm-svn: 178932
      7924997c
    • Michael Gottesman's avatar
      An objc_retain can serve as a use for a different pointer. · 31ba23aa
      Michael Gottesman authored
      This is the counterpart to commit r160637, except it performs the action
      in the bottomup portion of the data flow analysis.
      
      llvm-svn: 178922
      31ba23aa
    • Michael Gottesman's avatar
      Properly model precise lifetime when given an incomplete dataflow sequence. · 1d8d2577
      Michael Gottesman authored
      The normal dataflow sequence in the ARC optimizer consists of the following
      states:
      
          Retain -> CanRelease -> Use -> Release
      
      The optimizer before this patch stored the uses that determine the lifetime of
      the retainable object pointer when it bottom up hits a retain or when top down
      it hits a release. This is correct for an imprecise lifetime scenario since what
      we are trying to do is remove retains/releases while making sure that no
      ``CanRelease'' (which is usually a call) deallocates the given pointer before we
      get to the ``Use'' (since that would cause a segfault).
      
      If we are considering the precise lifetime scenario though, this is not
      correct. In such a situation, we *DO* care about the previous sequence, but
      additionally, we wish to track the uses resulting from the following incomplete
      sequences:
      
        Retain -> CanRelease -> Release   (TopDown)
        Retain <- Use <- Release          (BottomUp)
      
      *NOTE* This patch looks large but the most of it consists of updating
      test cases. Additionally this fix exposed an additional bug. I removed
      the test case that expressed said bug and will recommit it with the fix
      in a little bit.
      
      llvm-svn: 178921
      1d8d2577
  4. Apr 05, 2013
  5. Apr 04, 2013
  6. Apr 03, 2013
    • Michael Gottesman's avatar
      Remove an optimization where we were changing an objc_autorelease into an... · b8c88365
      Michael Gottesman authored
      Remove an optimization where we were changing an objc_autorelease into an objc_autoreleaseReturnValue.
      
      The semantics of ARC implies that a pointer passed into an objc_autorelease
      must live until some point (potentially down the stack) where an
      autorelease pool is popped. On the other hand, an
      objc_autoreleaseReturnValue just signifies that the object must live
      until the end of the given function at least.
      
      Thus objc_autorelease is stronger than objc_autoreleaseReturnValue in
      terms of the semantics of ARC* implying that performing the given
      strength reduction without any knowledge of how this relates to
      the autorelease pool pop that is further up the stack violates the
      semantics of ARC.
      
      *Even though objc_autoreleaseReturnValue if you know that no RV
      optimization will occur is more computationally expensive.
      
      llvm-svn: 178612
      b8c88365
    • Michael Gottesman's avatar
      Improved comment. No functionality change. · 62424391
      Michael Gottesman authored
      llvm-svn: 178605
      62424391
  7. Apr 02, 2013
    • Bill Wendling's avatar
      Use a worklist to avoid a sneaky iterator invalidation. · 88d06c3b
      Bill Wendling authored
      The iterator could be invalidated when it's recursively deleting a whole bunch
      of constant expressions in a constant initializer.
      
      Note: This was only reproducible if `opt' was run on a `.bc' file. If `opt' was
      run on a `.ll' file, it wouldn't crash. This is why the test first pushes the
      `.ll' file through `llvm-as' before feeding it to `opt'.
      
      PR15440
      
      llvm-svn: 178531
      88d06c3b
  8. Apr 01, 2013
  9. Mar 30, 2013
    • Shuxin Yang's avatar
      Implement XOR reassociation. It is based on following rules: · 7b0c94e2
      Shuxin Yang authored
        rule 1: (x | c1) ^ c2 => (x & ~c1) ^ (c1^c2),
           only useful when c1=c2
        rule 2: (x & c1) ^ (x & c2) = (x & (c1^c2))
        rule 3: (x | c1) ^ (x | c2) = (x & c3) ^ c3 where c3 = c1 ^ c2
        rule 4: (x | c1) ^ (x & c2) => (x & c3) ^ c1, where c3 = ~c1 ^ c2
      
       It reduces an application's size (in terms of # of instructions) by 8.9%.
       Reviwed by Pete Cooper. Thanks a lot!
      
       rdar://13212115  
      
      llvm-svn: 178409
      7b0c94e2
  10. Mar 29, 2013
  11. Mar 28, 2013
  12. Mar 26, 2013
    • Bill Wendling's avatar
      Use the full path when outputting the `.gcda' file. · 5aa82397
      Bill Wendling authored
      If we compile a single source program, the `.gcda' file will be generated where
      the program was executed. This isn't desirable, because that place may be at an
      unpredictable place (the program could call `chdir' for instance).
      
      Instead, we will output the `.gcda' file in the same place we output the `.gcno'
      file. I.e., the directory where the executable was generated. This matches GCC's
      behavior.
      
      <rdar://problem/13061072> & PR11809
      
      llvm-svn: 178084
      5aa82397
    • Ulrich Weigand's avatar
      Make InstCombineCasts.cpp:OptimizeIntToFloatBitCast endian safe. · 8a51d8ea
      Ulrich Weigand authored
      The OptimizeIntToFloatBitCast converts shift-truncate sequences
      into extractelement operations.  The computation of the element
      index to be used in the resulting operation is currently only
      correct for little-endian targets.
      
      This commit fixes the element index computation to be correct
      for big-endian targets as well.  If the target byte order is
      unknown, the optimization cannot be performed at all.
      
      llvm-svn: 178031
      8a51d8ea
    • Alexey Samsonov's avatar
      [ASan] Change the ABI of __asan_before_dynamic_init function: now it takes... · e1e26bf1
      Alexey Samsonov authored
      [ASan] Change the ABI of __asan_before_dynamic_init function: now it takes pointer to private string with module name. This string serves as a unique module ID in ASan runtime. LLVM part
      
      llvm-svn: 178013
      e1e26bf1
    • Michael Gottesman's avatar
      [ObjCARC Annotations] Added support for displaying the state of pointers at... · cd4de0f9
      Michael Gottesman authored
      [ObjCARC Annotations] Added support for displaying the state of pointers at the bottom/top of BBs of the ARC dataflow analysis for both bottomup and topdown analyses.
      
      This will allow for verification and analysis of the merge function of
      the data flow analyses in the ARC optimizer.
      
      The actual implementation of this feature is by introducing calls to
      the functions llvm.arc.annotation.{bottomup,topdown}.{bbstart,bbend}
      which are only declared. Each such call takes in a pointer to a global
      with the same name as the pointer whose provenance is being tracked and
      a pointer whose name is one of our Sequence states and points to a
      string that contains the same name.
      
      To ensure that the optimizer does not consider these annotations in any
      way, I made it so that the annotations are considered to be of IC_None
      type.
      
      A test case is included for this commit and the previous
      ObjCARCAnnotation commit.
      
      llvm-svn: 177952
      cd4de0f9
    • Michael Gottesman's avatar
      [ObjCARC Annotations] Implemented ARC annotation metadata to expose the ARC... · 81b1d437
      Michael Gottesman authored
      [ObjCARC Annotations] Implemented ARC annotation metadata to expose the ARC data flow analysis state in the IR via metadata.
      
      Previously the inner works of the data flow analysis in ObjCARCOpts was hard to
      get out of the optimizer for analysis of bugs or testing. All of the current ARC
      unit tests are based off of testing the effect of the data flow
      analysis (i.e. what statements are removed or moved, etc.). This creates
      weakness in the current unit testing regimem since we are not actually testing
      what effects various instructions have on the modeled pointer state.
      Additionally in order to analyze a bug in the optimizer, one would need to track
      by hand what the optimizer was actually doing either through use of DEBUG
      statements or through the usage of a debugger, both yielding large loses in
      developer productivity.
      
      This patch deals with these two issues by providing ARC annotation
      metadata that annotates instructions with the state changes that they cause in
      various pointers as well as provides metadata to annotate provenance sources.
      
      Specifically, we introduce the following metadata types:
      
      1. llvm.arc.annotation.bottomup.
      2. llvm.arc.annotation.topdown.
      3. llvm.arc.annotation.provenancesource.
      
      llvm.arc.annotation.{bottomup,topdown}: These annotations describes a state
      change in a pointer when we are visiting instructions bottomup/topdown
      respectively. The output format for both is the same:
      
        !1 = metadata !{metadata !"(test,%x)", metadata !"S_Release", metadata !"S_Use"}
      
      The first element is a string tuple with the following format:
      
        (function,variable name)
      
      The second two elements of the metadata show the previous state of the
      pointer (in this case S_Release) and the new state of the pointer (S_Use). We
      write the metadata in such a manner to ensure that it is easy for outside tools
      to parse. This is important since I am currently working on a tool for taking
      this information and pretty printing it besides the IR and that can be used for
      LIT style testing via the generation of an index.
      
      llvm.arc.annotation.provenancesource: This metadata is used to annotate
      instructions which act as provenance sources, i.e. ones that introduce a
      new (from the optimizer's perspective) non-argument pointer to track. This
      enables cross-referencing in between provenance sources and the state changes
      that occur to them.
      
      This is still a work in progress. Additionally I plan on committing
      later today additions to the annotations that annotate at the top/bottom
      of basic blocks the state of the various pointers being tracked.
      
      *NOTE* The metadata support is conditionally compiled into libObjCARCOpts only
      when we are producing a debug build of llvm/clang and even so are
      disabled by default. To enable the annotation metadata, pass in
      -enable-objc-arc-annotations to opt.
      
      llvm-svn: 177951
      81b1d437
  13. Mar 25, 2013
Loading