1. Aug 25, 2016
  2. Aug 24, 2016
    • Samuel Antao's avatar
      Add target REQUIRES directives to offload bundler test. · cee92556
      Samuel Antao authored
      llvm-svn: 279635
      cee92556
    • Samuel Antao's avatar
      [Driver][OpenMP][CUDA] Add capability to bundle object files in sections of the host binary format. · 424619e4
      Samuel Antao authored
      Summary:
      This patch adds the capability to bundle object files in sections of the host binary using a designated naming convention for these sections. This patch uses the functionality of the object reader already in the LLVM library to read bundled files, and invokes clang with the incremental linking options to create bundle files. 
      
      Bundling files involves creating an IR file with the contents of the bundle assigned as initializers of globals binded to the designated sections. This way the bundling implementation is agnostic of the host object format.
      
      The features added by this patch were requested in the RFC discussion in  http://lists.llvm.org/pipermail/cfe-dev/2016-February/047547.html.
      
      Reviewers: echristo, tra, jlebar, hfinkel, ABataev, Hahnfeld
      
      Subscribers: mkuron, whchung, cfe-commits, andreybokhanko, Hahnfeld, arpith-jacob, carlo.bertolli, mehdi_amini, caomhin
      
      Differential Revision: https://reviews.llvm.org/D21851
      
      llvm-svn: 279634
      424619e4
    • Tim Northover's avatar
      GlobalISel: fix cmp test to be in SSA form · 65f6336f
      Tim Northover authored
      llvm-svn: 279633
      65f6336f
    • Samuel Antao's avatar
      clang-offload-bundler - offload files bundling/unbundling tool · 1006ca71
      Samuel Antao authored
      Summary:
      One of the goals of programming models that support offloading (e.g. OpenMP) is to enable users to offload with little effort, by annotating the code with a few pragmas. I'd also like to save users the trouble of changing their existent applications' build system. So having the compiler always return a single file instead of one for the host and each target even if the user is doing separate compilation is desirable.
      
      This diff proposes a tool named clang-offload-bundler (happy to change the name if required) that is used to bundle files associated with the same user source file but different targets, or to unbundle a file into separate files associated with different targets.
      
      This tool supports the driver support for OpenMP under review in http://reviews.llvm.org/D9888. The tool is used there to enable separate compilation, so that the very first action on input files that are not source files is a "unbundling action" and the very last non-linking action is a "bundling action".
      
      The format of the bundled files is currently very simple: text formats are concatenated with comments that have a magic string and target identifying triple in between, and binary formats have a header that contains the triple and the offset and size of the code for host and each target.
      
      The goal is to improve this tool in the future to deal with archive files so that each individual file in the archive is properly dealt with. We see that archives are very commonly used in current applications to combine separate compilation results. So I'm convinced users would enjoy this feature.
      
      This tool can be used like this:
      
      `clang-offload-bundler -targets=triple1,triple2 -type=ii -inputs=a.triple1.ii,a.triple2.ii -outputs=a.ii`
      
      or 
      
      `clang-offload-bundler -targets=triple1,triple2 -type=ii -outputs=a.triple1.ii,a.triple2.ii -inputs=a.ii -unbundle`
      
      I implemented the tool under clang/tools. Please let me know if something like this should live somewhere else.
      
      This patch is prerequisite for http://reviews.llvm.org/D9888.
      
      Reviewers: hfinkel, rsmith, echristo, chandlerc, tra, jlebar, ABataev, Hahnfeld
      
      Subscribers: whchung, caomhin, andreybokhanko, arpith-jacob, carlo.bertolli, mehdi_amini, guansong, Hahnfeld, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D13909
      
      llvm-svn: 279632
      1006ca71
    • Teresa Johnson's avatar
      [ThinLTO/gold] Add caching support to gold-plugin · 57891a50
      Teresa Johnson authored
      Summary:
      With support now in the new LTO API for caching (r279576), add
      optional ThinLTO caching in the gold-plugin.
      
      Reviewers: mehdi_amini
      
      Subscribers: mehdi_amini, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D23836
      
      llvm-svn: 279631
      57891a50
    • Simon Pilgrim's avatar
      27252176
    • Wei Ding's avatar
      AMDGPU : Add V_SAD_U32 instruction pattern. · 1041a646
      Wei Ding authored
      Differential Revision: http://reviews.llvm.org/D23069
      
      llvm-svn: 279629
      1041a646
    • Ying Yi's avatar
      [llvm-cov] Add the project summary to each source file coverage report. · 84dc971e
      Ying Yi authored
      This patch includes the following changes:
      - Included header "Code coverage report" and include the date that the report was created.
      - Included title (as specified in a command line option, (i.e llvm-cov  -project-title="Simple Test")
      - In the summary, list the elf files that the source code file has contributed to.
      - Used column heading for "Line No.", "Count No.", Source".
      
      Differential Revision: https://reviews.llvm.org/D23345
      
      llvm-svn: 279628
      84dc971e
    • Pavel Labath's avatar
      Fix mismatched new/free in Process:RunPrivateStateThread · c22e32de
      Pavel Labath authored
      NFC
      
      llvm-svn: 279627
      c22e32de
    • Sanjay Patel's avatar
      [InstCombine] add assert and explanatory comment for fold removed in r279568; NFC · 8e297749
      Sanjay Patel authored
      I deleted a fold from InstCombine at:
      https://reviews.llvm.org/rL279568
      
      because it (like any InstCombine to a constant?) should always happen in InstSimplify,
      however, it's not obvious what the assumptions are in the remaining code.
      
      Add a comment and assert to make it clearer.
      
      Differential Revision: https://reviews.llvm.org/D23819
      
      llvm-svn: 279626
      8e297749
    • Krzysztof Parzyszek's avatar
      Create subranges for new intervals resulting from live interval splitting · a7ed090b
      Krzysztof Parzyszek authored
      The register allocator can split a live interval of a register into a set
      of smaller intervals. After the allocation of registers is complete, the
      rewriter will modify the IR to replace virtual registers with the corres-
      ponding physical registers. At this stage, if a register corresponding
      to a subregister of a virtual register is used, the rewriter will check
      if that subregister is undefined, and if so, it will add the <undef> flag
      to the machine operand. The function verifying liveness of the subregis-
      ter would assume that it is undefined, unless any of the subranges of the
      live interval proves otherwise.
      The problem is that the live intervals created during splitting do not
      have any subranges, even if the original parent interval did. This could
      result in the <undef> flag placed on a register that is actually defined.
      
      Differential Revision: http://reviews.llvm.org/D21189
      
      llvm-svn: 279625
      a7ed090b
    • Simon Dardis's avatar
      [mips] Preparatory work for a generic scheduler · f1148209
      Simon Dardis authored
      Extend instruction definitions from nearly all ISAs to include
      appropriate instruction itineraries. Change MIPS16s gp prologue
      generation to use real instructions instead of using a pseudo
      instruction.
      
      Reviewers: dsanders, vkalintiris
      
      Differential Review: https://reviews.llvm.org/D23548
      
      llvm-svn: 279623
      f1148209
    • Simon Pilgrim's avatar
    • Simon Pilgrim's avatar
      [X86][F16C] Regenerated f16c tests · 3c8cd3df
      Simon Pilgrim authored
      llvm-svn: 279621
      3c8cd3df
    • Gil Rapaport's avatar
      [Loop Vectorizer] Support predication of div/rem · 550148b2
      Gil Rapaport authored
      div/rem instructions in basic blocks that require predication currently prevent
      vectorization. This patch extends the existing mechanism for predicating stores
      to handle other instructions and leverages it to predicate divs and rems.
      
      Differential Revision: https://reviews.llvm.org/D22918
      
      llvm-svn: 279620
      550148b2
    • Simon Pilgrim's avatar
      [X86][SSE] Add support for 32-bit element vectors to X86ISD::VZEXT_LOAD · 6392b8d4
      Simon Pilgrim authored
      Consecutive load matching (EltsFromConsecutiveLoads) currently uses VZEXT_LOAD (load scalar into lowest element and zero uppers) for vXi64 / vXf64 vectors only.
      
      For vXi32 / vXf32 vectors it instead creates a scalar load, SCALAR_TO_VECTOR and finally VZEXT_MOVL (zero upper vector elements), relying on tablegen patterns to match this into an equivalent of VZEXT_LOAD.
      
      This patch adds the VZEXT_LOAD patterns for vXi32 / vXf32 vectors directly and updates EltsFromConsecutiveLoads to use this.
      
      This has proven necessary to allow us to easily make VZEXT_MOVL a full member of the target shuffle set - without this change the call to combineShuffle (which is the main caller of EltsFromConsecutiveLoads) tended to recursively recreate VZEXT_MOVL nodes......
      
      Differential Revision: https://reviews.llvm.org/D23673
      
      llvm-svn: 279619
      6392b8d4
    • Chandler Carruth's avatar
      [PM] Introduce basic update capabilities to the new PM's CGSCC pass · 88823468
      Chandler Carruth authored
      manager, including both plumbing and logic to handle function pass
      updates.
      
      There are three fundamentally tied changes here:
      1) Plumbing *some* mechanism for updating the CGSCC pass manager as the
         CG changes while passes are running.
      2) Changing the CGSCC pass manager infrastructure to have support for
         the underlying graph to mutate mid-pass run.
      3) Actually updating the CG after function passes run.
      
      I can separate them if necessary, but I think its really useful to have
      them together as the needs of #3 drove #2, and that in turn drove #1.
      
      The plumbing technique is to extend the "run" method signature with
      extra arguments. We provide the call graph that intrinsically is
      available as it is the basis of the pass manager's IR units, and an
      output parameter that records the results of updating the call graph
      during an SCC passes's run. Note that "...UpdateResult" isn't a *great*
      name here... suggestions very welcome.
      
      I tried a pretty frustrating number of different data structures and such
      for the innards of the update result. Every other one failed for one
      reason or another. Sometimes I just couldn't keep the layers of
      complexity right in my head. The thing that really worked was to just
      directly provide access to the underlying structures used to walk the
      call graph so that their updates could be informed by the *particular*
      nature of the change to the graph.
      
      The technique for how to make the pass management infrastructure cope
      with mutating graphs was also something that took a really, really large
      number of iterations to get to a place where I was happy. Here are some
      of the considerations that drove the design:
      
      - We operate at three levels within the infrastructure: RefSCC, SCC, and
        Node. In each case, we are working bottom up and so we want to
        continue to iterate on the "lowest" node as the graph changes. Look at
        how we iterate over nodes in an SCC running function passes as those
        function passes mutate the CG. We continue to iterate on the "lowest"
        SCC, which is the one that continues to contain the function just
        processed.
      
      - The call graph structure re-uses SCCs (and RefSCCs) during mutation
        events for the *highest* entry in the resulting new subgraph, not the
        lowest. This means that it is necessary to continually update the
        current SCC or RefSCC as it shifts. This is really surprising and
        subtle, and took a long time for me to work out. I actually tried
        changing the call graph to provide the opposite behavior, and it
        breaks *EVERYTHING*. The graph update algorithms are really deeply
        tied to this particualr pattern.
      
      - When SCCs or RefSCCs are split apart and refined and we continually
        re-pin our processing to the bottom one in the subgraph, we need to
        enqueue the newly formed SCCs and RefSCCs for subsequent processing.
        Queuing them presents a few challenges:
        1) SCCs and RefSCCs use wildly different iteration strategies at
           a high level. We end up needing to converge them on worklist
           approaches that can be extended in order to be able to handle the
           mutations.
        2) The order of the enqueuing need to remain bottom-up post-order so
           that we don't get surprising order of visitation for things like
           the inliner.
        3) We need the worklists to have set semantics so we don't duplicate
           things endlessly. We don't need a *persistent* set though because
           we always keep processing the bottom node!!!! This is super, super
           surprising to me and took a long time to convince myself this is
           correct, but I'm pretty sure it is... Once we sink down to the
           bottom node, we can't re-split out the same node in any way, and
           the postorder of the current queue is fixed and unchanging.
        4) We need to make sure that the "current" SCC or RefSCC actually gets
           enqueued here such that we re-visit it because we continue
           processing a *new*, *bottom* SCC/RefSCC.
      
      - We also need the ability to *skip* SCCs and RefSCCs that get merged
        into a larger component. We even need the ability to skip *nodes* from
        an SCC that are no longer part of that SCC.
      
      This led to the design you see in the patch which uses SetVector-based
      worklists. The RefSCC worklist is always empty until an update occurs
      and is just used to handle those RefSCCs created by updates as the
      others don't even exist yet and are formed on-demand during the
      bottom-up walk. The SCC worklist is pre-populated from the RefSCC, and
      we push new SCCs onto it and blacklist existing SCCs on it to get the
      desired processing.
      
      We then *directly* update these when updating the call graph as I was
      never able to find a satisfactory abstraction around the update
      strategy.
      
      Finally, we need to compute the updates for function passes. This is
      mostly used as an initial customer of all the update mechanisms to drive
      their design to at least cover some real set of use cases. There are
      a bunch of interesting things that came out of doing this:
      
      - It is really nice to do this a function at a time because that
        function is likely hot in the cache. This means we want even the
        function pass adaptor to support online updates to the call graph!
      
      - To update the call graph after arbitrary function pass mutations is
        quite hard. We have to build a fairly comprehensive set of
        data structures and then process them. Fortunately, some of this code
        is related to the code for building the cal graph in the first place.
        Unfortunately, very little of it makes any sense to share because the
        nature of what we're doing is so very different. I've factored out the
        one part that made sense at least.
      
      - We need to transfer these updates into the various structures for the
        CGSCC pass manager. Once those were more sanely worked out, this
        became relatively easier. But some of those needs necessitated changes
        to the LazyCallGraph interface to make it significantly easier to
        extract the changed SCCs from an update operation.
      
      - We also need to update the CGSCC analysis manager as the shape of the
        graph changes. When an SCC is merged away we need to clear analyses
        associated with it from the analysis manager which we didn't have
        support for in the analysis manager infrsatructure. New SCCs are easy!
        But then we have the case that the original SCC has its shape changed
        but remains in the call graph. There we need to *invalidate* the
        analyses associated with it.
      
      - We also need to invalidate analyses after we *finish* processing an
        SCC. But the analyses we need to invalidate here are *only those for
        the newly updated SCC*!!! Because we only continue processing the
        bottom SCC, if we split SCCs apart the original one gets invalidated
        once when its shape changes and is not processed farther so its
        analyses will be correct. It is the bottom SCC which continues being
        processed and needs to have the "normal" invalidation done based on
        the preserved analyses set.
      
      All of this is mostly background and context for the changes here.
      
      Many thanks to all the reviewers who helped here. Especially Sanjoy who
      caught several interesting bugs in the graph algorithms, David, Sean,
      and others who all helped with feedback.
      
      Differential Revision: http://reviews.llvm.org/D21464
      
      llvm-svn: 279618
      88823468
    • Peter Smith's avatar
      Canonicalize output section name for .ARM.exidx sections · a52864a7
      Peter Smith authored
          
      The ARM Exception handling ABI requires that all ARM exception index
      table sections have a prefix of .ARM.exidx and are combined into a
      single contiguous block either in their own output section or as part
      of another output section.
          
      In general clang will output a single .ARM.exidx section per object,
      but will use .ARM.exidx.<section name> when -ffunction-sections is used.
          
      This change canonicalizes the names of sections with the .ARM.exidx
      prefix to just .ARM.exidx, which ensures that there is only a single
      output section.
      
      Differential Revision: https://reviews.llvm.org/D23775
      
      llvm-svn: 279617
      a52864a7
    • Akira Hatanaka's avatar
      [asan] Mark asan-symbolize-sanity-test.cc as UNSUPPORTED on x86_64-apple · 1164cae5
      Akira Hatanaka authored
      and x86_64h-apple.
      
      Mark the test as UNSUPPORTED to fix a bot that is failing.
      
      http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check
      
      The bot is failing because asan_symbolize.py cannot tell whether the
      reported address is from an x86_64 slice or an x86_64h slice by the
      length of the address alone, so it ends up passing the wrong arch to
      atos.
      
      rdar://problem/27907889
      
      llvm-svn: 279614
      1164cae5