1. [StringExtras] Add a helper class for comma-separated lists (details)
  2. CGDebugInfo: Delete unused DIFile* parameter (details)
  3. [LoopDeletion] Break backedge of outermost loops when known not taken (details)
  4. Revert "[X86][SSE] Fold unpack(hop(),hop()) -> permute(hop())" (details)
Commit 407b1e65a464081e28c325273b65e8eafdfad1d4 by kazu
[StringExtras] Add a helper class for comma-separated lists

This patch introduces a helper class SubsequentDelim to simplify loops
that generate a comma-separated lists.

For example, consider the following loop, taken from

    for (auto I = pred_begin(), E = pred_end(); I != E; ++I) {
      if (I != pred_begin())
        OS << ", ";
      OS << printMBBReference(**I);

The new class allows us to rewrite the loop as:

    SubsequentDelim SD;
    for (auto I = pred_begin(), E = pred_end(); I != E; ++I)
      OS << SD << printMBBReference(**I);

where SD evaluates to the empty string for the first time and ", " for
subsequent iterations.

Unlike interleaveComma, defined in llvm/include/llvm/ADT/STLExtras.h,
SubsequentDelim can accommodate a wider variety of loops, including:

- those that conditionally skip certain items,
- those that need iterators to call getSuccProbability(I), and
- those that iterate over integer ranges.

As an example, this patch cleans up MachineBasicBlock::print.

Differential Revision:
The file was modifiedllvm/unittests/ADT/StringExtrasTest.cpp
The file was modifiedllvm/lib/CodeGen/MachineBasicBlock.cpp
The file was modifiedllvm/include/llvm/ADT/StringExtras.h
Commit 02bc320545deb0212a43acae24fcf2383755d383 by i
CGDebugInfo: Delete unused DIFile* parameter
The file was modifiedclang/lib/CodeGen/CGDebugInfo.cpp
The file was modifiedclang/lib/CodeGen/CGDebugInfo.h
Commit 4739dd67e7a08b715f1d23f71fb4af16007fe80a by listmail
[LoopDeletion] Break backedge of outermost loops when known not taken

This is a resubmit of dd6bb367 (which was reverted due to stage2 build failures in 7c63aac), with the additional restriction added to the transform to only consider outer most loops.

As shown in the added test case, ensuring LCSSA is up to date when deleting an inner loop is tricky as we may actually need to remove blocks from any outer loops, thus changing the exit block set.   For the moment, just avoid transforming this case.  I plan to return to this case in a follow up patch and see if we can do better.

Original commit message follows...

The basic idea is that if SCEV can prove the backedge isn't taken, we can go ahead and get rid of the backedge (and thus the loop) while leaving the rest of the control in place. This nicely handles cases with dispatch between multiple exits and internal side effects.

Differential Revision:
The file was modifiedllvm/test/Transforms/LoopDeletion/zero-btc.ll
The file was modifiedllvm/lib/Transforms/Scalar/LoopDeletion.cpp
The file was modifiedllvm/test/Transforms/LoopDeletion/update-scev.ll
The file was modifiedllvm/include/llvm/Transforms/Utils/LoopUtils.h
The file was modifiedllvm/lib/Transforms/Utils/LoopUtils.cpp
The file was modifiedllvm/test/Transforms/IndVarSimplify/exit_value_test2.ll
Commit d43a264a5dd3c72bf9dc663551c0993921b28136 by thakis
Revert "[X86][SSE] Fold unpack(hop(),hop()) -> permute(hop())"

This reverts commit 80dee7965dffdfb866afa9d74f3a4a97453708b2.
Makes clang sometimes hang forever. See for a
stand-alone repro.
The file was modifiedllvm/lib/Target/X86/X86ISelLowering.cpp
The file was modifiedllvm/test/CodeGen/X86/horizontal-shuffle-2.ll