Skip to content
  1. Dec 20, 2017
    • Matt Arsenault's avatar
      DAG: Tolerate non-MemSDNodes for OPC_RecordMemRef · d60951f4
      Matt Arsenault authored
      When intrinsics are allowed to have mem operands, there
      are two ways this can happen. First is an intrinsic
      that is marked has having a mem operand, but is not handled
      by getTgtMemIntrinsic.
      
      The second way can occur even for intrinsics which do not
      have a mem operand. It seems the selector table does
      some kind of sorting based on the opcode, and the
      mem ref recording can happen in the same scope for
      intrinsics that both do and do not have mem refs.
      I haven't been able to figure out exactly why this happens
      (although it happens even with the matcher optimizations disabled).
      I'm not sure if it's worth trying to avoid hitting this for
      these nodes since I think it's still reasonable to handle
      this in case getTgtMemIntrinic is not implemented.
      
      llvm-svn: 321208
      d60951f4
  2. Dec 15, 2017
  3. Dec 11, 2017
    • Alex Bradbury's avatar
      [RISCV] Support lowering FrameIndex · 660bccec
      Alex Bradbury authored
      Introduces the AddrFI "addressing mode", which is necessary simply because 
      it's not possible to write a pattern that directly matches a frameindex.
      
      Ensure callee-saved registers are accessed relative to the stackpointer. This
      is necessary as callee-saved register spills are performed before the frame
      pointer is set.
      
      Move HexagonDAGToDAGISel::isOrEquivalentToAdd to SelectionDAGISel, so we can 
      make use of it in the RISC-V backend.
      
      Differential Revision: https://reviews.llvm.org/D39848
      
      llvm-svn: 320353
      660bccec
  4. Dec 04, 2017
    • Francis Visoiu Mistrih's avatar
      [CodeGen] Unify MBB reference format in both MIR and debug output · 25528d6d
      Francis Visoiu Mistrih authored
      As part of the unification of the debug format and the MIR format, print
      MBB references as '%bb.5'.
      
      The MIR printer prints the IR name of a MBB only for block definitions.
      
      * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" \) -type f -print0 | xargs -0 sed -i '' -E 's/BB#" << ([a-zA-Z0-9_]+)->getNumber\(\)/" << printMBBReference(*\1)/g'
      * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" \) -type f -print0 | xargs -0 sed -i '' -E 's/BB#" << ([a-zA-Z0-9_]+)\.getNumber\(\)/" << printMBBReference(\1)/g'
      * find . \( -name "*.txt" -o -name "*.s" -o -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" \) -type f -print0 | xargs -0 sed -i '' -E 's/BB#([0-9]+)/%bb.\1/g'
      * grep -nr 'BB#' and fix
      
      Differential Revision: https://reviews.llvm.org/D40422
      
      llvm-svn: 319665
      25528d6d
  5. Dec 01, 2017
    • Matt Morehouse's avatar
      Revert "[X86] Improvement in CodeGen instruction selection for LEAs." · 9e658c97
      Matt Morehouse authored
      This reverts r319543, due to ASan bot breakage.
      
      llvm-svn: 319591
      9e658c97
    • Jatin Bhateja's avatar
      [X86] Improvement in CodeGen instruction selection for LEAs. · 328199ec
      Jatin Bhateja authored
      Summary:
      1/  Operand folding during complex pattern matching for LEAs has been extended, such that it promotes Scale to
           accommodate similar operand appearing in the DAG  e.g.
                       T1 = A + B
                       T2 = T1 + 10
                       T3 = T2 + A
          For above DAG rooted at T3, X86AddressMode will now look like
                      Base = B , Index = A , Scale = 2 , Disp = 10
      
      2/  During OptimizeLEAPass down the pipeline factorization is now performed over LEAs so that if there is an opportunity
           then complex LEAs (having 3 operands) could be factored out  e.g.
                       leal 1(%rax,%rcx,1), %rdx
                       leal 1(%rax,%rcx,2), %rcx
           will be factored as following
                       leal 1(%rax,%rcx,1), %rdx
                       leal (%rdx,%rcx)   , %edx
      
      3/ Aggressive operand folding for AM based selection for LEAs is sensitive to loops, thus avoiding creation of any complex LEAs within a loop.
      
      4/ Simplify LEA converts (lea (BASE,1,INDEX,0)  --> add (BASE, INDEX) which offers better through put.
      
      PR32755 will be taken care of by this pathc.
      
      Previous patch revisions : r313343 , r314886
      
      Reviewers: lsaba, RKSimon, craig.topper, qcolombet, jmolloy, jbhateja
      
      Reviewed By: lsaba, RKSimon, jbhateja
      
      Subscribers: jmolloy, spatel, igorb, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D35014
      
      llvm-svn: 319543
      328199ec
  6. Nov 22, 2017
  7. Nov 17, 2017
  8. Nov 16, 2017
    • Yaxun Liu's avatar
      Fix APInt bit size in processDbgDeclares · 4d9a4d7a
      Yaxun Liu authored
      processDbgDeclares assumes pointer size is the same for different addr spaces.
      It uses pointer size for addr space 0 for all pointers, which causes assertion
      in stripAndAccumulateInBoundsConstantOffsets for amdgcn---amdgiz since
      pointer in addr space 5 has different size than in addr space 0.
      
      This patch fixes that.
      
      Differential Revision: https://reviews.llvm.org/D40085
      
      llvm-svn: 318370
      4d9a4d7a
  9. Nov 08, 2017
  10. Oct 25, 2017
    • Adrian Prantl's avatar
      Implement salavageDebugInfo functionality for SelectionDAG. · 2eb7cbf9
      Adrian Prantl authored
      Similar to how llvm::salvagDebugInfo hooks into InstCombine, this adds
      a hook that can be invoked before an SDNode that is associated with an
      SDDbgValue is erased to capture the effect of the deleted node in a
      DIExpression.
      
      The motivating example is an SDDebugValue attached to an ADD operation
      that gets folded into a LOAD+OFFSET operation.
      
      rdar://problem/32121503
      
      llvm-svn: 316525
      2eb7cbf9
  11. Oct 16, 2017
  12. Oct 10, 2017
  13. Oct 04, 2017
    • Hans Wennborg's avatar
      Revert r314886 "[X86] Improvement in CodeGen instruction selection for LEAs... · 2a6c9adb
      Hans Wennborg authored
      Revert r314886 "[X86] Improvement in CodeGen instruction selection for LEAs (re-applying post required revision changes.)"
      
      It broke the Chromium / SQLite build; see PR34830.
      
      > Summary:
      >    1/  Operand folding during complex pattern matching for LEAs has been
      >        extended, such that it promotes Scale to accommodate similar operand
      >        appearing in the DAG.
      >        e.g.
      >          T1 = A + B
      >          T2 = T1 + 10
      >          T3 = T2 + A
      >        For above DAG rooted at T3, X86AddressMode will no look like
      >          Base = B , Index = A , Scale = 2 , Disp = 10
      >
      >    2/  During OptimizeLEAPass down the pipeline factorization is now performed over LEAs
      >        so that if there is an opportunity then complex LEAs (having 3 operands)
      >        could be factored out.
      >        e.g.
      >          leal 1(%rax,%rcx,1), %rdx
      >          leal 1(%rax,%rcx,2), %rcx
      >        will be factored as following
      >          leal 1(%rax,%rcx,1), %rdx
      >          leal (%rdx,%rcx)   , %edx
      >
      >    3/ Aggressive operand folding for AM based selection for LEAs is sensitive to loops,
      >       thus avoiding creation of any complex LEAs within a loop.
      >
      > Reviewers: lsaba, RKSimon, craig.topper, qcolombet, jmolloy
      >
      > Reviewed By: lsaba
      >
      > Subscribers: jmolloy, spatel, igorb, llvm-commits
      >
      >     Differential Revision: https://reviews.llvm.org/D35014
      
      llvm-svn: 314919
      2a6c9adb
    • Jatin Bhateja's avatar
      [X86] Improvement in CodeGen instruction selection for LEAs (re-applying post... · 3c29bacd
      Jatin Bhateja authored
      [X86] Improvement in CodeGen instruction selection for LEAs (re-applying post required revision changes.)
      
      Summary:
         1/  Operand folding during complex pattern matching for LEAs has been
             extended, such that it promotes Scale to accommodate similar operand
             appearing in the DAG.
             e.g.
               T1 = A + B
               T2 = T1 + 10
               T3 = T2 + A
             For above DAG rooted at T3, X86AddressMode will no look like
               Base = B , Index = A , Scale = 2 , Disp = 10
      
         2/  During OptimizeLEAPass down the pipeline factorization is now performed over LEAs
             so that if there is an opportunity then complex LEAs (having 3 operands)
             could be factored out.
             e.g.
               leal 1(%rax,%rcx,1), %rdx
               leal 1(%rax,%rcx,2), %rcx
             will be factored as following
               leal 1(%rax,%rcx,1), %rdx
               leal (%rdx,%rcx)   , %edx
      
         3/ Aggressive operand folding for AM based selection for LEAs is sensitive to loops,
            thus avoiding creation of any complex LEAs within a loop.
      
      Reviewers: lsaba, RKSimon, craig.topper, qcolombet, jmolloy
      
      Reviewed By: lsaba
      
      Subscribers: jmolloy, spatel, igorb, llvm-commits
      
          Differential Revision: https://reviews.llvm.org/D35014
      
      llvm-svn: 314886
      3c29bacd
  14. Sep 20, 2017
  15. Sep 15, 2017
    • Hans Wennborg's avatar
      Revert r313343 "[X86] PR32755 : Improvement in CodeGen instruction selection for LEAs." · 534bfbd3
      Hans Wennborg authored
      This caused PR34629: asserts firing when building Chromium. It also broke some
      buildbots building test-suite as reported on the commit thread.
      
      > Summary:
      >    1/  Operand folding during complex pattern matching for LEAs has been
      >        extended, such that it promotes Scale to accommodate similar operand
      >        appearing in the DAG.
      >        e.g.
      >           T1 = A + B
      >           T2 = T1 + 10
      >           T3 = T2 + A
      >        For above DAG rooted at T3, X86AddressMode will no look like
      >           Base = B , Index = A , Scale = 2 , Disp = 10
      >
      >    2/  During OptimizeLEAPass down the pipeline factorization is now performed over LEAs
      >        so that if there is an opportunity then complex LEAs (having 3 operands)
      >        could be factored out.
      >        e.g.
      >           leal 1(%rax,%rcx,1), %rdx
      >           leal 1(%rax,%rcx,2), %rcx
      >        will be factored as following
      >           leal 1(%rax,%rcx,1), %rdx
      >           leal (%rdx,%rcx)   , %edx
      >
      >    3/ Aggressive operand folding for AM based selection for LEAs is sensitive to loops,
      >       thus avoiding creation of any complex LEAs within a loop.
      >
      > Reviewers: lsaba, RKSimon, craig.topper, qcolombet
      >
      > Reviewed By: lsaba
      >
      > Subscribers: spatel, igorb, llvm-commits
      >
      > Differential Revision: https://reviews.llvm.org/D35014
      
      llvm-svn: 313376
      534bfbd3
    • Jatin Bhateja's avatar
      [X86] PR32755 : Improvement in CodeGen instruction selection for LEAs. · 908c8b37
      Jatin Bhateja authored
      Summary:
         1/  Operand folding during complex pattern matching for LEAs has been
             extended, such that it promotes Scale to accommodate similar operand
             appearing in the DAG.
             e.g.
                T1 = A + B
                T2 = T1 + 10
                T3 = T2 + A
             For above DAG rooted at T3, X86AddressMode will no look like
                Base = B , Index = A , Scale = 2 , Disp = 10
      
         2/  During OptimizeLEAPass down the pipeline factorization is now performed over LEAs
             so that if there is an opportunity then complex LEAs (having 3 operands)
             could be factored out.
             e.g.
                leal 1(%rax,%rcx,1), %rdx
                leal 1(%rax,%rcx,2), %rcx
             will be factored as following
                leal 1(%rax,%rcx,1), %rdx
                leal (%rdx,%rcx)   , %edx
      
         3/ Aggressive operand folding for AM based selection for LEAs is sensitive to loops,
            thus avoiding creation of any complex LEAs within a loop.
      
      Reviewers: lsaba, RKSimon, craig.topper, qcolombet
      
      Reviewed By: lsaba
      
      Subscribers: spatel, igorb, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D35014
      
      llvm-svn: 313343
      908c8b37
  16. Sep 05, 2017
    • Reid Kleckner's avatar
      Add llvm.codeview.annotation to implement MSVC __annotation · e33c94f1
      Reid Kleckner authored
      Summary:
      This intrinsic represents a label with a list of associated metadata
      strings. It is modelled as reading and writing inaccessible memory so
      that it won't be removed as dead code. I think the intention is that the
      annotation strings should appear at most once in the debug info, so I
      marked it noduplicate. We are allowed to inline code with annotations as
      long as we strip the annotation, but that can be done later.
      
      Reviewers: majnemer
      
      Subscribers: eraman, llvm-commits, hiraditya
      
      Differential Revision: https://reviews.llvm.org/D36904
      
      llvm-svn: 312569
      e33c94f1
  17. Aug 20, 2017
  18. Aug 07, 2017
    • Guy Blank's avatar
      [SelectionDAG] reset NewNodesMustHaveLegalTypes flag between basic blocks · 5ca01695
      Guy Blank authored
      The NewNodesMustHaveLegalTypes flag is set to false at the beginning of CodeGenAndEmitDAG, and set to true after legalizing types.
      But before calling CodeGenAndEmitDAG we build the DAG for the basic block.
      So for the first basic block NewNodesMustHaveLegalTypes would be 'false' during the SDAG building, and for all other basic blocks it would be 'true'.
      
      This patch sets the flag to false before SDAG building each basic block.
      
      Differential Revision:
      https://reviews.llvm.org/D33435
      
      llvm-svn: 310239
      5ca01695
  19. Aug 03, 2017
  20. Jul 29, 2017
  21. Jul 09, 2017
  22. Jul 04, 2017
    • Anna Thomas's avatar
      [FastISel][SelectionDAG]Teach fastISel about GC intrinsics · a66a98cc
      Anna Thomas authored
      Summary:
      We are crashing in LLC at O0 when gc intrinsics are present in the block.
      The reason being FastISel performs basic block ISel by modifying GC.relocates
      to be the first instruction in the block. This can cause us to visit the GC
      relocate before it's corresponding GC.statepoint is visited, which is incorrect.
      When we lower the statepoint, we record the base and derived pointers, along
      with the gc.relocates. After this we can visit the gc.relocate.
      
      This patch avoids fastISel from incorrectly creating the block with gc.relocate
      as the first instruction.
      
      Reviewers: qcolombet, skatkov, qikon, reames
      
      Reviewed by: skatkov
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D34421
      
      llvm-svn: 307084
      a66a98cc
  23. Jun 17, 2017
  24. Jun 15, 2017
    • Arnold Schwaighofer's avatar
      ISel: Fix FastISel of swifterror values · ae9312c4
      Arnold Schwaighofer authored
      The code assumed that we process instructions in basic block order.  FastISel
      processes instructions in reverse basic block order. We need to pre-assign
      virtual registers before selecting otherwise we get def-use relationships wrong.
      
      This only affects code with swifterror registers.
      
      rdar://32659327
      
      llvm-svn: 305484
      ae9312c4
  25. Jun 08, 2017
  26. 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
  27. Jun 02, 2017
  28. May 25, 2017
  29. 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
  30. 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
  31. Apr 28, 2017
Loading