1. Sep 07, 2019
  2. Sep 06, 2019
    • Fangrui Song's avatar
      Reland D66717 [ELF] Do not ICF two sections with different output sections (by SECTIONS commands) · 8d30c1dc
      Fangrui Song authored
      Recommit r370635 (reverted by r371202), with one change: move addOrphanSections() before ICF.
      
      Before, orphan sections in two different partitions may be folded and
      moved to the main partition.
      
      Now, InputSection->OutputSection assignment for orphans happens before
      ICF. ICF does not fold input sections with different output sections.
      
      With the PR43241 reproduce,
      `llvm-objcopy --extract-partition libvr.so libchrome__combined.so libvr.so` => no error
      
      Updated description:
      
      Fixes PR39418. Complements D47241 (the non-linker-script case).
      
      processSectionCommands() assigns input sections to output sections.
      ICF is called before it, so .text.foo and .text.bar may be folded even if
      their output sections are made different by SECTIONS commands.
      
      ```
      markLive<ELFT>()
      doIcf<ELFT>()                      // During ICF, we don't know the output sections
      writeResult()
        combineEhSections<ELFT>()
        script->processSectionCommands() // InputSection -> OutputSection assignment
      ```
      
      This patch splits processSectionCommands() into processSectionCommands()
      and processSymbolAssignments(), and moves
      processSectionCommands()/addOrphanSections() before ICF:
      
      ```
      markLive<ELFT>()
      combineEhSections<ELFT>()
      script->processSectionCommands()
      script->addOrphanSections();
      doIcf<ELFT>()                      // should remove folded input sections
      writeResult()
        script->processSymbolAssignments()
      ```
      
      An alternative approach is to unfold a section `sec` in
      processSectionCommands() when we find `sec` and `sec->repl` belong to
      different output sections. I feel this patch is superior because this
      can fold more sections and the decouple of
      SectionCommand/SymbolAssignment gives flexibility:
      
      * An ExprValue can't be evaluated before its section is assigned to an
        output section -> we can delete getOutputSectionVA and simplify
        another place where we had to check if the output section is null.
        Moreover, a case in linkerscript/early-assign-symbol.s can be handled
        now.
      * processSectionCommands/processSymbolAssignments can be freely moved
        around.
      
      llvm-svn: 371216
      8d30c1dc
    • Fangrui Song's avatar
      Revert "Revert r370635, it caused PR43241." · 5d9f419a
      Fangrui Song authored
      This reverts commit 50d2dca22b3b05d0ee4883b0cbf93d7d15f241fc.
      
      llvm-svn: 371215
      5d9f419a
    • Valery Pykhtin's avatar
      e8ade89b
    • Fangrui Song's avatar
      [ELF][test] Simplify and reorganize tests · 8f10a5f4
      Fangrui Song authored
      Add file-level comments
      Delete insignificant addresses to make them more tolerant to layout changes
      Simplify test output
      Delete simple Inputs/*.s files
      
      Delete version-script-copy-rel.s - covered by verdef-defaultver.s
      Delete version-wildcard.test - covered by version-script-glob.s
      
      llvm-svn: 371213
      8f10a5f4
    • Guillaume Chatelet's avatar
      [Alignment][NFC] Use Align with TargetLowering::setPrefFunctionAlignment · ad1cea0d
      Guillaume Chatelet authored
      Summary:
      This is patch is part of a series to introduce an Alignment type.
      See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
      See this patch for the introduction of the type: https://reviews.llvm.org/D64790
      
      Reviewers: courbet
      
      Subscribers: nemanjai, javed.absar, hiraditya, kbarton, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, s.egerton, pzheng, ychen, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67267
      
      llvm-svn: 371212
      ad1cea0d
    • Cyndy Ishida's avatar
      [Object] remove struct constructor, NFC · 4f8d0058
      Cyndy Ishida authored
      Summary: make POD struct by removing ctors
      
      Reviewers: avl, dblaikie
      
      Reviewed By: dblaikie
      
      Subscribers: ributzka, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67251
      
      llvm-svn: 371211
      4f8d0058
    • Guillaume Chatelet's avatar
      [Alignment][NFC] Use Align with TargetLowering::setPrefLoopAlignment · 9fcf066d
      Guillaume Chatelet authored
      Summary:
      This is patch is part of a series to introduce an Alignment type.
      See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
      See this patch for the introduction of the type: https://reviews.llvm.org/D64790
      
      Reviewers: courbet
      
      Subscribers: nemanjai, hiraditya, kbarton, MaskRay, jsji, ychen, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67278
      
      llvm-svn: 371210
      9fcf066d
    • Roman Lebedev's avatar
      [NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): pass a vector to EmitCheck() · f1d33842
      Roman Lebedev authored
      Will be easier to add a new 'check' in a follow-up.
      
      This was originally part of https://reviews.llvm.org/D67122
      
      llvm-svn: 371208
      f1d33842
    • Roman Lebedev's avatar
      [NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): refactor EmitGEPOffsetInBytes() helper · 8f03dcdc
      Roman Lebedev authored
      It shouldn't really be inlined into the EmitCheckedInBoundsGEP().
      Refactoring it beforehand will make follow-up changes more obvious.
      
      This was originally part of https://reviews.llvm.org/D67122
      
      llvm-svn: 371207
      8f03dcdc
    • Roman Lebedev's avatar
      [NFC][CodeGen][UBSan] EmitCheckedInBoundsGEP(): add some comments to pointer-overflow check · 624620ff
      Roman Lebedev authored
      It's rather eye-twiching, some comments may help here..
      
      This was originally part of https://reviews.llvm.org/D67122
      
      llvm-svn: 371206
      624620ff
    • Nico Weber's avatar
      libclang depends on ClangDriverOptions since r352803 · 06487b01
      Nico Weber authored
      Without this, the build would sometimes fail with
      
          In file included from clang/tools/libclang/CIndexer.cpp:17:
          In file included from clang/include/clang/Driver/Driver.h:15:
          clang/include/clang/Driver/Options.h:44:10: fatal error:
              'clang/Driver/Options.inc' file not found
          #include "clang/Driver/Options.inc"
                   ^~~~~~~~~~~~~~~~~
      
      if Options.inc wasn't generated before libclang was built
      by coincidence.
      
      (In the GN build, this works because lib/Driver there declares
      the dep on tablegen as a public_dep since the generated file
      is part of Driver's public interface, and then things work out
      automatically without every client of Driver having to be careful.)
      
      llvm-svn: 371205
      06487b01
    • Guillaume Chatelet's avatar
      [Alignment] fix dubious min function alignment · 5d870c2e
      Guillaume Chatelet authored
      Summary:
      This was discovered while introducing the llvm::Align type.
      The original setMinFunctionAlignment used to take alignment as log2, looking at the comment it seems like instructions are to be 2-bytes aligned and not 4-bytes aligned.
      
      Reviewers: uweigand
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67271
      
      llvm-svn: 371204
      5d870c2e
    • Nico Weber's avatar
      Revert r370635, it caused PR43241. · 8455294f
      Nico Weber authored
      llvm-svn: 371202
      8455294f
    • George Rimar's avatar
      [llvm-readelf] - Print unknown st_other value if present in GNU output. · edfd276c
      George Rimar authored
      This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40785.
      
      llvm-readelf does not print the st_value of the symbol when
      st_value has any non-visibility bits set.
      
      This patch:
      
      * Aligns "Ndx" row for the default and a new cases.
      (it was 1 space character off for the case when "PROTECTED" visibility was printed)
      
      * Prints "[<other>: 0x??]" for symbols which has an additional st_other bits set.
      In compare with GNU, this logic is a bit simpler and seems to be more consistent.
      
      For MIPS GNU can print named flags, though can't print a mix of them:
      0: 00000000 0 NOTYPE LOCAL DEFAULT UND 
      1: 00000000 0 NOTYPE GLOBAL DEFAULT [OPTIONAL] UND a1
      2: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PLT] UND a2
      3: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PIC] UND a3
      4: 00000000 0 NOTYPE GLOBAL DEFAULT [MICROMIPS] UND a4
      5: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS16] UND a5
      6: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: c] UND b1
      7: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: 28] UND b2
      
      On PPC64 it can print a localentry value that is encoded in the high bits of st_other
      63: 0000000000000850 208 FUNC GLOBAL DEFAULT [<localentry>: 8] 12
      
      We chose to print the raw st_other field, prefixed with '0x'.
      
      Differential revision: https://reviews.llvm.org/D67094
      
      llvm-svn: 371201
      edfd276c
    • Guillaume Chatelet's avatar
      [Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment · 4fc3ad9e
      Guillaume Chatelet authored
      Summary:
      This is patch is part of a series to introduce an Alignment type.
      See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
      See this patch for the introduction of the type: https://reviews.llvm.org/D64790
      
      Reviewers: courbet
      
      Subscribers: jyknight, sdardis, nemanjai, javed.absar, hiraditya, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, s.egerton, pzheng, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67229
      
      llvm-svn: 371200
      4fc3ad9e
    • Djordje Todorovic's avatar
      [test] Update the name of the debug entry values option. NFC · d409408e
      Djordje Todorovic authored
      llvm-svn: 371199
      d409408e
    • James Molloy's avatar
      [DFAPacketizer] Track resources for packetized instructions · db2fa067
      James Molloy authored
      This patch allows the DFAPacketizer to be queried after a packet is formed to work out which
      resources were allocated to the packetized instructions.
      
      This is particularly important for targets that do their own bundle packing - it's not
      sufficient to know simply that instructions can share a packet; which slots are used is
      also required for encoding.
      
      This extends the emitter to emit a side-table containing resource usage diffs for each
      state transition. The packetizer maintains a set of all possible resource states in its
      current state. After packetization is complete, all remaining resource states are
      possible packetization strategies.
      
      The sidetable is only ~500K for Hexagon, but the extra tracking is disabled by default
      (most uses of the packetizer like MachinePipeliner don't care and don't need the extra
      maintained state).
      
      Differential Revision: https://reviews.llvm.org/D66936
      
      llvm-svn: 371198
      db2fa067
    • Serge Guelton's avatar
      Remove call to obsolete gethostbyname, using getaddrinfo · 90d32df7
      Serge Guelton authored
      Differential Revision: https://reviews.llvm.org/D67230
      
      llvm-svn: 371195
      90d32df7
    • Haojian Wu's avatar
      [clangd] Use override keyword to override the base class method, NFC · 2ebd24cc
      Haojian Wu authored
      llvm-svn: 371194
      2ebd24cc
    • Jeremy Morse's avatar
      [DebugInfo] LiveDebugValues: explicitly terminate overwritten stack locations · 5d9cd3b4
      Jeremy Morse authored
      If a stack spill location is overwritten by another spill instruction,
      any variable locations pointing at that slot should be terminated. We
      cannot rely on spills always being restored to registers or variable
      locations being moved by a DBG_VALUE: the register allocator is entitled
      to spill a value and then forget about it when it goes out of liveness.
      
      To address this, scan for memory writes to spill locations, even those we
      don't consider to be normal "spills". isSpillInstruction and
      isLocationSpill distinguish the two now. After identifying spill
      overwrites, terminate the open range, and insert a $noreg DBG_VALUE for
      that variable.
      
      Differential Revision: https://reviews.llvm.org/D66941
      
      llvm-svn: 371193
      5d9cd3b4
    • Jay Foad's avatar
      [AMDGPU] Mark s_barrier as having side effects but not accessing memory. · 6c0204c7
      Jay Foad authored
      Summary:
      This fixes poor scheduling in a function containing a barrier and a few
      load instructions.
      
      Without this fix, ScheduleDAGInstrs::buildSchedGraph adds an artificial
      edge in the dependency graph from the barrier instruction to the exit
      node representing live-out latency, with a latency of about 500 cycles.
      Because of this it thinks the critical path through the graph also has
      a latency of about 500 cycles. And because of that it does not think
      that any of the load instructions are on the critical path, so it
      schedules them with no regard for their (80 cycle) latency, which gives
      poor results.
      
      Reviewers: arsenm, dstuttard, tpr, nhaehnle
      
      Subscribers: kzhuravl, jvesely, wdng, yaxunl, t-tye, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D67218
      
      llvm-svn: 371192
      6c0204c7
    • Nico Weber's avatar
      gn build: Merge r371182 · 68df9dc0
      Nico Weber authored
      llvm-svn: 371191
      68df9dc0
    • Nico Weber's avatar
      gn build: Merge r371179 · 3dbb5c7e
      Nico Weber authored
      llvm-svn: 371190
      3dbb5c7e
    • Fangrui Song's avatar
      [ELF][test] Update test after r371185 · 70e002b5
      Fangrui Song authored
      llvm-svn: 371189
      70e002b5