Skip to content
  1. Jun 08, 2017
  2. Jun 06, 2017
    • Chandler Carruth's avatar
      Sort the remaining #include lines in include/... and lib/.... · 6bda14b3
      Chandler Carruth authored
      I did this a long time ago with a janky python script, but now
      clang-format has built-in support for this. I fed clang-format every
      line with a #include and let it re-sort things according to the precise
      LLVM rules for include ordering baked into clang-format these days.
      
      I've reverted a number of files where the results of sorting includes
      isn't healthy. Either places where we have legacy code relying on
      particular include ordering (where possible, I'll fix these separately)
      or where we have particular formatting around #include lines that
      I didn't want to disturb in this patch.
      
      This patch is *entirely* mechanical. If you get merge conflicts or
      anything, just ignore the changes in this patch and run clang-format
      over your #include lines in the files.
      
      Sorry for any noise here, but it is important to keep these things
      stable. I was seeing an increasing number of patches with irrelevant
      re-ordering of #include lines because clang-format was used. This patch
      at least isolates that churn, makes it easy to skip when resolving
      conflicts, and gets us to a clean baseline (again).
      
      llvm-svn: 304787
      6bda14b3
    • Davide Italiano's avatar
      [SelectionDAG] Update the dominator after splitting critical edges. · fb4d5c09
      Davide Italiano authored
      Running `llc -verify-dom-info` on the attached testcase results in a
      crash in the verifier, due to a stale dominator tree.
      
      i.e.
      
        DominatorTree is not up to date!
        Computed:
        =============================--------------------------------
        Inorder Dominator Tree:
          [1] %safe_mod_func_uint8_t_u_u.exit.i.i.i {0,7}
            [2] %lor.lhs.false.i61.i.i.i {1,2}
            [2] %safe_mod_func_int8_t_s_s.exit.i.i.i {3,6}
              [3] %safe_div_func_int64_t_s_s.exit66.i.i.i {4,5}
      
        Actual:
        =============================--------------------------------
        Inorder Dominator Tree:
          [1] %safe_mod_func_uint8_t_u_u.exit.i.i.i {0,9}
            [2] %lor.lhs.false.i61.i.i.i {1,2}
            [2] %safe_mod_func_int8_t_s_s.exit.i.i.i {3,8}
              [3] %safe_div_func_int64_t_s_s.exit66.i.i.i {4,5}
              [3] %safe_mod_func_int8_t_s_s.exit.i.i.i.lor.lhs.false.i61.i.i.i_crit_edge {6,7}
      
      This is because in `SelectionDAGIsel` we split critical edges without
      updating the corresponding dominator for the function (and we claim
      in `MachineFunctionPass::getAnalysisUsage()` that the domtree is preserved).
      
      We could either stop preserving the domtree in `getAnalysisUsage`
      or tell `splitCriticalEdge()` to update it.
      As the second option is easy to implement, that's the one I chose.
      
      Differential Revision:  https://reviews.llvm.org/D33800
      
      llvm-svn: 304742
      fb4d5c09
  3. Jun 02, 2017
  4. May 25, 2017
  5. May 10, 2017
    • Ahmed Bougacha's avatar
      [CodeGen] Don't require AA in SDAGISel at -O0. · 604526fe
      Ahmed Bougacha authored
      Before r247167, the pass manager builder controlled which AA
      implementations were used, exporting them all in the AliasAnalysis
      analysis group.
      
      Now, AAResultsWrapperPass always uses BasicAA, but still uses other AA
      implementations if made available in the pass pipeline.
      
      But regardless, SDAGISel is required at O0, and really doesn't need to
      be doing fancy optimizations based on useful AA results.
      
      Don't require AA at CodeGenOpt::None, and only use it otherwise.
      
      This does have a functional impact (and one testcase is pessimized
      because we can't reuse a load).  But I think that's desirable no matter
      what.
      
      Note that this alone doesn't result in less DT computations: TwoAddress
      was previously able to reuse the DT we computed for SDAG.  That will be
      fixed separately.
      
      Differential Revision: https://reviews.llvm.org/D32766
      
      llvm-svn: 302611
      604526fe
  6. May 09, 2017
    • Reid Kleckner's avatar
      Re-land "Use the frame index side table for byval and inalloca arguments" · 3a363fff
      Reid Kleckner authored
      This re-lands r302483. It was not the cause of PR32977.
      
      llvm-svn: 302544
      3a363fff
    • Reid Kleckner's avatar
      Revert "Use the frame index side table for byval and inalloca arguments" · 9f29914d
      Reid Kleckner authored
      This reverts r302483 and it's follow up fix.
      
      llvm-svn: 302493
      9f29914d
    • Reid Kleckner's avatar
      Use the frame index side table for byval and inalloca arguments · 45efcf0c
      Reid Kleckner authored
      Summary:
      For inalloca functions, this is a very common code pattern:
      
        %argpack = type <{ i32, i32, i32 }>
        define void @f(%argpack* inalloca %args) {
        entry:
          %a = getelementptr inbounds %argpack, %argpack* %args, i32 0, i32 0
          %b = getelementptr inbounds %argpack, %argpack* %args, i32 0, i32 1
          %c = getelementptr inbounds %argpack, %argpack* %args, i32 0, i32 2
          tail call void @llvm.dbg.declare(metadata i32* %a, ... "a")
          tail call void @llvm.dbg.declare(metadata i32* %c, ... "b")
          tail call void @llvm.dbg.declare(metadata i32* %b, ... "c")
      
      Even though these GEPs can be simplified to a constant offset from EBP
      or RSP, we don't do that at -O0, and each GEP is computed into a
      register. Registers used to compute argument addresses are typically
      spilled and clobbered very quickly after the initial computation, so
      live debug variable tracking loses information very quickly if we use
      DBG_VALUE instructions.
      
      This change moves processing of dbg.declare between argument lowering
      and basic block isel, so that we can ask if an argument has a frame
      index or not. If the argument lives in a register as is the case for
      byval arguments on some targets, then we don't put it in the side table
      and during ISel we emit DBG_VALUE instructions.
      
      Reviewers: aprantl
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D32980
      
      llvm-svn: 302483
      45efcf0c
  7. Apr 28, 2017
  8. Mar 30, 2017
    • Ahmed Bougacha's avatar
      [CodeGen] Pass SDAG an ORE, and replace FastISel stats with remarks. · 6dd60824
      Ahmed Bougacha authored
      In the long-term, we want to replace statistics with something
      finer-grained that lets us gather per-function data.
      Remarks are that replacement.
      
      Create an ORE instance in SelectionDAGISel, and pass it to
      SelectionDAG.
      
      SelectionDAG was used so that we can emit remarks from all
      SelectionDAG-related code, including TargetLowering and DAGCombiner.
      This isn't used in the current patch but Adam tells me he's interested
      for the fp-contract combines.
      
      Use the ORE instance to emit FastISel failures as remarks (instead of
      the mix of dbgs() dumps and statistics that we currently have).
      
      Eventually, we want to have an API that tells us whether remarks are
      enabled (http://llvm.org/PR32352) so that we don't emit expensive
      remarks (in this case, dumping IR) when it's not needed.  For now, use
      'isEnabled' as a crude replacement.
      
      This does mean that the replacement for '-fast-isel-verbose' is now
      '-pass-remarks-missed=isel'.  Additionally, clang users also need to
      enable remark diagnostics, using '-Rpass-missed=isel'.
      
      This also removes '-fast-isel-verbose2': there are no static statistics
      that we want to only enable in asserts builds, so we can always use
      the remarks regardless of the build type.
      
      Differential Revision: https://reviews.llvm.org/D31405
      
      llvm-svn: 299093
      6dd60824
  9. Mar 14, 2017
    • Nirav Dave's avatar
      Recommitting Craig Topper's patch now that r296476 has been recommitted. · 4fc8401a
      Nirav Dave authored
      When checking if chain node is foldable, make sure the intermediate nodes have a single use across all results not just the result that was used to reach the chain node.
      
      This recovers a test case that was severely broken by r296476, my making sure we don't create ADD/ADC that loads and stores when there is also a flag dependency.
      
      llvm-svn: 297698
      4fc8401a
  10. Mar 03, 2017
    • Chandler Carruth's avatar
      [SDAG] Revert r296476 (and r296486, r296668, r296690). · ce52b807
      Chandler Carruth authored
      This patch causes compile times for some patterns to explode. I have
      a (large, unreduced) test case that slows down by more than 20x and
      several test cases slow down by 2x. I'm sending some of the test cases
      directly to Nirav and following up with more details in the review log,
      but this should unblock anyone else hitting this.
      
      llvm-svn: 296862
      ce52b807
  11. Mar 01, 2017
    • Reid Kleckner's avatar
      Elide argument copies during instruction selection · f7c0980c
      Reid Kleckner authored
      Summary:
      Avoids tons of prologue boilerplate when arguments are passed in memory
      and left in memory. This can happen in a debug build or in a release
      build when an argument alloca is escaped.  This will dramatically affect
      the code size of x86 debug builds, because X86 fast isel doesn't handle
      arguments passed in memory at all. It only handles the x86_64 case of up
      to 6 basic register parameters.
      
      This is implemented by analyzing the entry block before ISel to identify
      copy elision candidates. A copy elision candidate is an argument that is
      used to fully initialize an alloca before any other possibly escaping
      uses of that alloca. If an argument is a copy elision candidate, we set
      a flag on the InputArg. If the the target generates loads from a fixed
      stack object that matches the size and alignment requirements of the
      alloca, the SelectionDAG builder will delete the stack object created
      for the alloca and replace it with the fixed stack object. The load is
      left behind to satisfy any remaining uses of the argument value. The
      store is now dead and is therefore elided. The fixed stack object is
      also marked as mutable, as it may now be modified by the user, and it
      would be invalid to rematerialize the initial load from it.
      
      Supersedes D28388
      
      Fixes PR26328
      
      Reviewers: chandlerc, MatzeB, qcolombet, inglorion, hans
      
      Subscribers: igorb, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D29668
      
      llvm-svn: 296683
      f7c0980c
    • Ahmed Bougacha's avatar
      [CodeGen] Remove dead FastISel code after SDAG emitted a tailcall. · 20b3e9a8
      Ahmed Bougacha authored
      When SDAGISel (top-down) selects a tail-call, it skips the remainder
      of the block.
      
      If, before that, FastISel (bottom-up) selected some of the (no-op) next
      few instructions, we can end up with dead instructions following the
      terminator (selected by SDAGISel).
      
      We need to erase them, as we know they aren't necessary (in addition to
      being incorrect).
      
      We already do this when FastISel falls back on the tail-call itself.
      Also remove the FastISel-emitted code if we fallback on the
      instructions between the tail-call and the return.
      
      llvm-svn: 296552
      20b3e9a8
  12. Feb 28, 2017
    • Craig Topper's avatar
      [DAGISel] When checking if chain node is foldable, make sure the intermediate... · 419f145e
      Craig Topper authored
      [DAGISel] When checking if chain node is foldable, make sure the intermediate nodes have a single use across all results not just the result that was used to reach the chain node.
      
      This recovers a test case that was severely broken by r296476, my making sure we don't create ADD/ADC that loads and stores when there is also a flag dependency.
      
      llvm-svn: 296486
      419f145e
  13. Feb 27, 2017
  14. Feb 14, 2017
    • Aditya Nandakumar's avatar
      [Tablegen] Instrumenting table gen DAGGenISelDAG · bb0483bc
      Aditya Nandakumar authored
      To help assist in debugging ISEL or to prioritize GlobalISel backend
      work, this patch adds two more tables to <Target>GenISelDAGISel.inc -
      one which contains the patterns that are used during selection and the
      other containing include source location of the patterns
      Enabled through CMake varialbe LLVM_ENABLE_DAGISEL_COV
      
      llvm-svn: 295081
      bb0483bc
  15. Feb 13, 2017
    • Quentin Colombet's avatar
      [FastISel] Add a diagnostic to warm on fallback. · fbae5fcb
      Quentin Colombet authored
      This is consistent with what we do for GlobalISel. That way, it is easy
      to see whether or not FastISel is able to fully select a function.
      At some point we may want to switch that to an optimization remark.
      
      llvm-svn: 294970
      fbae5fcb
  16. Feb 10, 2017
    • Simon Pilgrim's avatar
      [DAGCombine] Allow vector constant folding of any value type before type legalization · bfb17478
      Simon Pilgrim authored
      The patch comes in 2 parts:
      
      1 - it makes use of the SelectionDAG::NewNodesMustHaveLegalTypes flag to tell when it can safely constant fold illegal types.
      
      2 - it correctly resets SelectionDAG::NewNodesMustHaveLegalTypes at the start of each call to SelectionDAGISel::CodeGenAndEmitDAG so all the pre-legalization stages can make use of it - not just the first basic block that gets handled.
      
      Fix for PR30760
      
      Differential Revision: https://reviews.llvm.org/D29568
      
      llvm-svn: 294749
      bfb17478
    • Craig Topper's avatar
      [SelectionDAG] Dump the DAG after legalizing vector ops and after the second type legalization · a9f11218
      Craig Topper authored
      Summary:
      With -debug, we aren't dumping the DAG after legalizing vector ops. In particular, on X86 with AVX1 only, we don't dump the DAG after we split 256-bit integer ops into pairs of 128-bit ADDs since this occurs during vector legalization.
      
      I'm only dumping if the legalize vector ops changes something since we don't print anything during legalize vector ops. So this dump shows up right after the first type-legalization dump happens. So if nothing changed this second dump is unnecessary.
      
      Having said that though, I think we should probably fix legalize vector ops to log what its doing.
      
      Reviewers: RKSimon, eli.friedman, spatel, arsenm, chandlerc
      
      Reviewed By: RKSimon
      
      Subscribers: wdng, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D29554
      
      llvm-svn: 294711
      a9f11218
  17. Feb 07, 2017
    • Reid Kleckner's avatar
      [SDAGISel] Simplify some SDAGISel code, NFC · 0887d44a
      Reid Kleckner authored
      Hoist entry block code for arguments and swift error values out of the
      basic block instruction selection loop. Lowering arguments once up front
      seems much more readable than doing it conditionally inside the loop. It
      also makes it clear that argument lowering can update StaticAllocaMap
      because no instructions have been selected yet.
      
      Also use range-based for loops where possible.
      
      llvm-svn: 294329
      0887d44a
  18. Feb 04, 2017
  19. Feb 03, 2017
  20. Jan 30, 2017
  21. Jan 28, 2017
    • Matthias Braun's avatar
      Cleanup dump() functions. · 8c209aa8
      Matthias Braun authored
      We had various variants of defining dump() functions in LLVM. Normalize
      them (this should just consistently implement the things discussed in
      http://lists.llvm.org/pipermail/cfe-dev/2014-January/034323.html
      
      For reference:
      - Public headers should just declare the dump() method but not use
        LLVM_DUMP_METHOD or #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
      - The definition of a dump method should look like this:
        #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
        LLVM_DUMP_METHOD void MyClass::dump() {
          // print stuff to dbgs()...
        }
        #endif
      
      llvm-svn: 293359
      8c209aa8
  22. Jan 27, 2017
    • Andrew Kaylor's avatar
      Add intrinsics for constrained floating point operations · a0a1164c
      Andrew Kaylor authored
      This commit introduces a set of experimental intrinsics intended to prevent
      optimizations that make assumptions about the rounding mode and floating point
      exception behavior.  These intrinsics will later be extended to specify
      flush-to-zero behavior.  More work is also required to model instruction
      dependencies in machine code and to generate these instructions from clang
      (when required by pragmas and/or command line options that are not currently
      supported).
      
      Differential Revision: https://reviews.llvm.org/D27028
      
      llvm-svn: 293226
      a0a1164c
  23. Dec 01, 2016
    • Matthias Braun's avatar
      Move most EH from MachineModuleInfo to MachineFunction · d0ee66c2
      Matthias Braun authored
      Recommitting r288293 with some extra fixes for GlobalISel code.
      
      Most of the exception handling members in MachineModuleInfo is actually
      per function data (talks about the "current function") so it is better
      to keep it at the function instead of the module.
      
      This is a necessary step to have machine module passes work properly.
      
      Also:
      - Rename TidyLandingPads() to tidyLandingPads()
      - Use doxygen member groups instead of "//===- EH ---"... so it is clear
        where a group ends.
      - I had to add an ugly const_cast at two places in the AsmPrinter
        because the available MachineFunction pointers are const, but the code
        wants to call tidyLandingPads() in between
        (markFunctionEnd()/endFunction()).
      
      Differential Revision: https://reviews.llvm.org/D27227
      
      llvm-svn: 288405
      d0ee66c2
    • Eric Christopher's avatar
      Temporarily Revert "Move most EH from MachineModuleInfo to MachineFunction" · e70b7c3d
      Eric Christopher authored
      This apprears to have broken the global isel bot:
      http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-globalisel_build/5174/console
      
      This reverts commit r288293.
      
      llvm-svn: 288322
      e70b7c3d
    • Matthias Braun's avatar
      Move most EH from MachineModuleInfo to MachineFunction · ed14cb06
      Matthias Braun authored
      Most of the exception handling members in MachineModuleInfo is actually
      per function data (talks about the "current function") so it is better
      to keep it at the function instead of the module.
      
      This is a necessary step to have machine module passes work properly.
      
      Also:
      - Rename TidyLandingPads() to tidyLandingPads()
      - Use doxygen member groups instead of "//===- EH ---"... so it is clear
        where a group ends.
      - I had to add an ugly const_cast at two places in the AsmPrinter
        because the available MachineFunction pointers are const, but the code
        wants to call tidyLandingPads() in between
        (markFunctionEnd()/endFunction()).
      
      Differential Revision: https://reviews.llvm.org/D27227
      
      llvm-svn: 288293
      ed14cb06
  24. Nov 18, 2016
    • Matthias Braun's avatar
      Timer: Track name and description. · 9f15a79e
      Matthias Braun authored
      The previously used "names" are rather descriptions (they use multiple
      words and contain spaces), use short programming language identifier
      like strings for the "names" which should be used when exporting to
      machine parseable formats.
      
      Also removed a unused TimerGroup from Hexxagon.
      
      Differential Revision: https://reviews.llvm.org/D25583
      
      llvm-svn: 287369
      9f15a79e
  25. Oct 11, 2016
  26. Oct 08, 2016
    • Arnold Schwaighofer's avatar
      swifterror: Don't compute swifterror vregs during instruction selection · 3f256581
      Arnold Schwaighofer authored
      The code used llvm basic block predecessors to decided where to insert phi
      nodes. Instruction selection can and will liberally insert new machine basic
      block predecessors. There is not a guaranteed one-to-one mapping from pred.
      llvm basic blocks and machine basic blocks.
      
      Therefore the current approach does not work as it assumes we can mark
      predecessor machine basic block as needing a copy, and needs to know the set of
      all predecessor machine basic blocks to decide when to insert phis.
      
      Instead of computing the swifterror vregs as we select instructions, propagate
      them at the end of instruction selection when the MBB CFG is complete.
      
      When an instruction needs a swifterror vreg and we don't know the value yet,
      generate a new vreg and remember this "upward exposed" use, and reconcile this
      at the end of instruction selection.
      
      This will only happen if the target supports promoting swifterror parameters to
      registers and the swifterror attribute is used.
      
      rdar://28300923
      
      llvm-svn: 283617
      3f256581
  27. Sep 14, 2016
  28. Sep 09, 2016
  29. Aug 27, 2016
  30. Aug 23, 2016
    • Pete Cooper's avatar
      Fix some more asserts after r279466. · 036b94da
      Pete Cooper authored
      That commit added a new version of Intrinsic::getName which should only
      be called when the intrinsic has no overloaded types.  There are several
      debugging paths, such as SDNode::dump which are printing the name of the
      intrinsic but don't have the overloaded types.  These paths should be ok
      to just print the name instead of crashing.
      
      The fix here is ultimately to just add a 'None' second argument as that
      calls the overload capable getName, which is less efficient, but this is a
      debugging path anyway, and not perf critical.
      
      Thanks to Björn Pettersson for pointing out that there were more crashes.
      
      llvm-svn: 279528
      036b94da
  31. Aug 12, 2016
Loading