Changes

Summary

  1. [flang] Move External IO tests to use GTest (details)
  2. [clang-tidy] Fix cppcoreguidelines-init-variables by removing the enum (details)
  3. AMDGPU/GlobalISel: Remove special case lowering for non-pow-2 stores (details)
  4. AMDGPU/GlobalISel: Fix tests using illegal copies to physregs (details)
  5. XFAIL ppc => powerpc (details)
  6. GlobalISel: Have load lowering handle some unaligned accesses (details)
  7. Reland "[LV] Use lookThroughAnd with logical reductions" (details)
  8. [SLP]Improve splats vectorization. (details)
  9. GlobalISel: Have lowerLoad scalarize unaligned vectors (details)
Commit 65436e6ba12786dd27785b21e9436ded750ce8e3 by ashermancinelli
[flang] Move External IO tests to use GTest

Port external-io test to use GTest. Remove Runtime tests directory.
Rename RuntimeGTest directory to Runtime.

This is the last in a series of patches which ported tests from the old
flang/unittests/Runtime test directory to use GTest in a temporary
unittest directory under flang/unittests/RuntimeGTest. Now that all the
tests in the old directory have been ported to use GTest, the old
directory has been removed and the GTest directory has been renamed to
flang/unittests/Runtime.

Differential Revision: https://reviews.llvm.org/D105315
Reviewed by: Meinersbur, awarzynski
The file was removedflang/unittests/RuntimeGTest/tools.h
The file was removedflang/unittests/Runtime/external-io.cpp
The file was addedflang/unittests/Runtime/CharacterTest.cpp
The file was addedflang/unittests/Runtime/CrashHandlerFixture.h
The file was removedflang/unittests/RuntimeGTest/CrashHandlerFixture.h
The file was addedflang/unittests/Runtime/NumericalFormatTest.cpp
The file was removedflang/unittests/RuntimeGTest/NumericalFormatTest.cpp
The file was removedflang/unittests/RuntimeGTest/Reduction.cpp
The file was removedflang/unittests/RuntimeGTest/Numeric.cpp
The file was removedflang/unittests/RuntimeGTest/Random.cpp
The file was addedflang/unittests/Runtime/Numeric.cpp
The file was addedflang/unittests/Runtime/tools.h
The file was removedflang/unittests/RuntimeGTest/Format.cpp
The file was addedflang/unittests/Runtime/Format.cpp
The file was removedflang/unittests/RuntimeGTest/MiscIntrinsic.cpp
The file was modifiedflang/unittests/CMakeLists.txt
The file was addedflang/unittests/Runtime/CrashHandlerFixture.cpp
The file was addedflang/unittests/Runtime/ExternalIOTest.cpp
The file was addedflang/unittests/Runtime/Namelist.cpp
The file was addedflang/unittests/Runtime/Reduction.cpp
The file was removedflang/unittests/RuntimeGTest/CharacterTest.cpp
The file was addedflang/unittests/Runtime/Random.cpp
The file was removedflang/unittests/RuntimeGTest/BufferTest.cpp
The file was addedflang/unittests/Runtime/Transformational.cpp
The file was removedflang/unittests/Runtime/testing.cpp
The file was addedflang/unittests/Runtime/ListInputTest.cpp
The file was addedflang/unittests/Runtime/MiscIntrinsic.cpp
The file was removedflang/unittests/RuntimeGTest/Transformational.cpp
The file was removedflang/unittests/RuntimeGTest/ListInputTest.cpp
The file was addedflang/unittests/Runtime/BufferTest.cpp
The file was addedflang/unittests/Runtime/Matmul.cpp
The file was addedflang/unittests/Runtime/Time.cpp
The file was removedflang/unittests/RuntimeGTest/Time.cpp
The file was removedflang/unittests/RuntimeGTest/CMakeLists.txt
The file was removedflang/unittests/RuntimeGTest/Matmul.cpp
The file was removedflang/unittests/RuntimeGTest/RuntimeCrashTest.cpp
The file was modifiedflang/unittests/Runtime/CMakeLists.txt
The file was removedflang/unittests/RuntimeGTest/CrashHandlerFixture.cpp
The file was removedflang/unittests/Runtime/testing.h
The file was removedflang/unittests/RuntimeGTest/Namelist.cpp
The file was addedflang/unittests/Runtime/RuntimeCrashTest.cpp
Commit 4a097efe7784767b7d12ffcb8f2b22b9f4d045e2 by whisperity
[clang-tidy] Fix cppcoreguidelines-init-variables by removing the enum
FixIt, and add support for initialization check of scoped enum

In C++, the enumeration is never Integer, and the enumeration condition judgment is added to avoid compiling errors when it is initialized to an integer.
Add support for initialization check of scope enum.

As the following case show, clang-tidy will give a wrong automatic fix:

    enum Color {Red, Green, Blue};
    enum class Gender {Male, Female};
    void func() {
      Color color; // Color color = 0; <--- fix bug
      Gender gender; // <--- no warning
    }

Reviewd By: aaron.ballman, whisperity

Differential Revision: http://reviews.llvm.org/D106431
The file was modifiedclang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-init-variables.rst
The file was modifiedclang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
The file was modifiedclang-tools-extra/docs/ReleaseNotes.rst
The file was modifiedclang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-init-variables.cpp
Commit faccf427dfd137b857df916b358c0c888118918e by Matthew.Arsenault
AMDGPU/GlobalISel: Remove special case lowering for non-pow-2 stores

We end up with extra copies from buildAnyExtOrTrunc if these are
lowered after the register types are legalized.
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-store.mir
The file was modifiedllvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-store-global.mir
Commit 05ecd7a2acbf62d415c8529108944966f6425b33 by Matthew.Arsenault
AMDGPU/GlobalISel: Fix tests using illegal copies to physregs

These are unlegalizable and introduce spurious failures. Ideally the
verifier would reject them. Also avoid some weird G_INSERTs.
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-local.mir
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-private.mir
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-constant.mir
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-global.mir
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-flat.mir
Commit c15d9822b3ab767d744e93d7d9c25d5f7d2faac8 by paul.robinson
XFAIL ppc => powerpc
The file was modifiedclang/test/Driver/as-no-warnings.c
Commit f19226dda5aea6d677b0e52b309ef9c605178a51 by Matthew.Arsenault
GlobalISel: Have load lowering handle some unaligned accesses

The code for splitting an unaligned access into 2 pieces is
essentially the same as for splitting a non-power-of-2 load for
scalars. It would be better to pick an optimal memory access size and
directly use it, but splitting in half is what the DAG does.

As-is this fixes handling of some unaligned sextload/zextloads for
AMDGPU. In the future this will help drop the ugly abuse of
narrowScalar to handle splitting unaligned accesses.
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-zextload-global.mir
The file was modifiedllvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-sextload-global.mir
Commit 9d355949937038c32c7608ebb558bbc3984f6340 by kerry.mclaughlin
Reland "[LV] Use lookThroughAnd with logical reductions"

If a reduction Phi has a single user which `AND`s the Phi with a type mask,
`lookThroughAnd` will return the user of the Phi and the narrower type represented
by the mask. Currently this is only used for arithmetic reductions, whereas loops
containing logical reductions will create a reduction intrinsic using the widened
type, for example:

  for.body:
    %phi = phi i32 [ %and, %for.body ], [ 255, %entry ]
    %mask = and i32 %phi, 255
    %gep = getelementptr inbounds i8, i8* %ptr, i32 %iv
    %load = load i8, i8* %gep
    %ext = zext i8 %load to i32
    %and = and i32 %mask, %ext
    ...

^ this will generate an and reduction intrinsic such as the following:
    call i32 @llvm.vector.reduce.and.v8i32(<8 x i32>...)

The same example for an add instruction would create an intrinsic of type i8:
    call i8 @llvm.vector.reduce.add.v8i8(<8 x i8>...)

This patch changes AddReductionVar to call lookThroughAnd for other integer
reductions, allowing loops similar to the example above with reductions such
as and, or & xor to vectorize.

Reviewed By: david-arm, dmgreen

Differential Revision: https://reviews.llvm.org/D105632
The file was addedllvm/test/Transforms/LoopVectorize/trunc-reductions.ll
The file was modifiedllvm/lib/Analysis/IVDescriptors.cpp
The file was modifiedllvm/test/Transforms/LoopVectorize/reduction-inloop-pred.ll
The file was modifiedllvm/test/Transforms/LoopVectorize/reduction-inloop.ll
Commit 95e5d401ae6c773e9f531f9c6ce62faf03dcd394 by a.bataev
[SLP]Improve splats vectorization.

Replace insertelement instructions for splats with just single
insertelement + broadcast shuffle. Also, try to merge these instructions
if they come from the same/shuffled gather node.

Differential Revision: https://reviews.llvm.org/D107104
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/diamond.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/barriercall.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/bad-reduction.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/multi_user.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/tiny-tree.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/horizontal-list.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/AArch64/loadi8.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/saxpy.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/PR35628_2.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/loopinvariant.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/AArch64/vectorize-free-extracts-inserts.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/extractcost.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/diamond_broadcast.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/slp-max-phi-size.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/insert-after-bundle.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/broadcast.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/commutativity.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/resched.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/used-reduced-op.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/AArch64/vectorizable-selects-uniform-cmps.ll
The file was modifiedllvm/test/Transforms/SLPVectorizer/X86/cse.ll
The file was modifiedllvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Commit e46badd4e9cd2bf2f412b1a857f62ecc88bde5a1 by Matthew.Arsenault
GlobalISel: Have lowerLoad scalarize unaligned vectors

This could be smarter by picking an ideal type, or at least splitting
the vector in half first. Also handles lower for non-power-of-2,
non-extending vector loads.

Currently this just avoids failing to legalize some odd vector AMDGPU
tests, but is a step towards removing the split logic from the
NarrowScalar logic.
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-local.mir
The file was modifiedllvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-flat.mir
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-global.mir
The file was modifiedllvm/test/CodeGen/AMDGPU/GlobalISel/legalize-load-constant.mir