Skip to content
  1. Apr 15, 2014
  2. Apr 11, 2014
    • David Blaikie's avatar
      Implement depth_first and inverse_depth_first range factory functions. · ceec2bda
      David Blaikie authored
      Also updated as many loops as I could find using df_begin/idf_begin -
      strangely I found no uses of idf_begin. Is that just used out of tree?
      
      Also a few places couldn't use df_begin because either they used the
      member functions of the depth first iterators or had specific ordering
      constraints (I added a comment in the latter case).
      
      Based on a patch by Jim Grosbach. (Jim - you just had iterator_range<T>
      where you needed iterator_range<idf_iterator<T>>)
      
      llvm-svn: 206016
      ceec2bda
  3. Mar 28, 2014
  4. Mar 26, 2014
  5. Mar 20, 2014
  6. Mar 19, 2014
  7. Mar 18, 2014
  8. Mar 12, 2014
  9. Mar 11, 2014
  10. Mar 10, 2014
    • Evan Cheng's avatar
      For functions with ARM target specific calling convention, when simplify-libcall · 0e8f4612
      Evan Cheng authored
      optimize a call to a llvm intrinsic to something that invovles a call to a C
      library call, make sure it sets the right calling convention on the call.
      
      e.g.
      extern double pow(double, double);
      double t(double x) {
        return pow(10, x);
      }
      
      Compiles to something like this for AAPCS-VFP:
      define arm_aapcs_vfpcc double @t(double %x) #0 {
      entry:
        %0 = call double @llvm.pow.f64(double 1.000000e+01, double %x)
        ret double %0
      }
      
      declare double @llvm.pow.f64(double, double) #1
      
      Simplify libcall (part of instcombine) will turn the above into:
      define arm_aapcs_vfpcc double @t(double %x) #0 {
      entry:
        %__exp10 = call double @__exp10(double %x) #1
        ret double %__exp10
      }
      
      declare double @__exp10(double)
      
      The pre-instcombine code works because calls to LLVM builtins are special.
      Instruction selection will chose the right calling convention for the call.
      However, the code after instcombine is wrong. The call to __exp10 will use
      the C calling convention.
      
      I can think of 3 options to fix this.
      
      1. Make "C" calling convention just work since the target should know what CC
         is being used.
      
         This doesn't work because each function can use different CC with the "pcs"
         attribute.
      
      2. Have Clang add the right CC keyword on the calls to LLVM builtin.
      
         This will work but it doesn't match the LLVM IR specification which states
         these are "Standard C Library Intrinsics".
      
      3. Fix simplify libcall so the resulting calls to the C routines will have the
         proper CC keyword. e.g.
         %__exp10 = call arm_aapcs_vfpcc double @__exp10(double %x) #1
      
         This works and is the solution I implemented here.
      
      Both solutions #2 and #3 would work. After carefully considering the pros and
      cons, I decided to implement #3 for the following reasons.
      
      1. It doesn't change the "spec" of the intrinsics.
      2. It's a self-contained fix.
      
      There are a couple of potential downsides.
      1. There could be other places in the optimizer that is broken in the same way
         that's not addressed by this.
      2. There could be other calling conventions that need to be propagated by
         simplify-libcall that's not handled.
      
      But for now, this is the fix that I'm most comfortable with.
      
      llvm-svn: 203488
      0e8f4612
  11. Mar 09, 2014
    • Benjamin Kramer's avatar
      SimplifyCFG: Simplify the weight scaling algorithm. · 79da941f
      Benjamin Kramer authored
      No change in functionality.
      
      llvm-svn: 203413
      79da941f
    • 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
  12. Mar 06, 2014
  13. Mar 05, 2014
  14. Mar 04, 2014
  15. Mar 03, 2014
    • Diego Novillo's avatar
      Pass to emit DWARF path discriminators. · f5041ce5
      Diego Novillo authored
      DWARF discriminators are used to distinguish multiple control flow paths
      on the same source location. When this happens, instructions across
      basic block boundaries will share the same debug location.
      
      This pass detects this situation and creates a new lexical scope to one
      of the two instructions. This lexical scope is a child scope of the
      original and contains a new discriminator value. This discriminator is
      then picked up from MCObjectStreamer::EmitDwarfLocDirective to be
      written on the object file.
      
      This fixes http://llvm.org/bugs/show_bug.cgi?id=18270.
      
      llvm-svn: 202752
      f5041ce5
  16. Mar 02, 2014
  17. Feb 25, 2014
  18. Feb 21, 2014
  19. Feb 18, 2014
  20. Feb 10, 2014
    • Chandler Carruth's avatar
      [LPM] A terribly simple fix to a terribly complex bug: PR18773. · 756c22cd
      Chandler Carruth authored
      The crux of the issue is that LCSSA doesn't preserve stateful alias
      analyses. Before r200067, LICM didn't cause LCSSA to run in the LTO pass
      manager, where LICM runs essentially without any of the other loop
      passes. As a consequence the globalmodref-aa pass run before that loop
      pass manager was able to survive the loop pass manager and be used by
      DSE to eliminate stores in the function called from the loop body in
      Adobe-C++/loop_unroll (and similar patterns in other benchmarks).
      
      When LICM was taught to preserve LCSSA it had to require it as well.
      This caused it to be run in the loop pass manager and because it did not
      preserve AA, the stateful AA was lost. Most of LLVM's AA isn't stateful
      and so this didn't manifest in most cases. Also, in most cases LCSSA was
      already running, and so there was no interesting change.
      
      The real kicker is that LCSSA by its definition (injecting PHI nodes
      only) trivially preserves AA! All we need to do is mark it, and then
      everything goes back to working as intended. It probably was blocking
      some other weird cases of stateful AA but the only one I have is
      a 1000-line IR test case from loop_unroll, so I don't really have a good
      test case here.
      
      Hopefully this fixes the regressions on performance that have been seen
      since that revision.
      
      llvm-svn: 201104
      756c22cd
  21. Feb 04, 2014
  22. Feb 02, 2014
    • Duncan P. N. Exon Smith's avatar
      Lower llvm.expect intrinsic correctly for i1 · 1ff08e38
      Duncan P. N. Exon Smith authored
      LowerExpectIntrinsic previously only understood the idiom of an expect
      intrinsic followed by a comparison with zero. For llvm.expect.i1, the
      comparison would be stripped by the early-cse pass.
      
      Patch by Daniel Micay.
      
      llvm-svn: 200664
      1ff08e38
Loading