1. Jul 20, 2016
    • Simon Pilgrim's avatar
      [X86][AVX512] Added AVX512 subvector broadcast tests · 5366d0e0
      Simon Pilgrim authored
      llvm-svn: 275994
      5366d0e0
    • Matthias Gehre's avatar
      cppcoreguidelines-pro-bounds-constant-array-index: ignore implicit constructor · dd117cf0
      Matthias Gehre authored
      Summary:
      The code
      
        struct A {
          int x[3];
        };
      
      gets an compiler-generated copy constructor that uses ArraySubscriptExpr (see below).
      Previously, the check would generate a warning on that copy constructor.
      This commit disables the warning on implicitly generated code.
      AST:
      
        |-CXXConstructorDecl 0x337b3c8 <col:8> col:8 implicit used constexpr A 'void (const struct A &) noexcept' inline
        | |-ParmVarDecl 0x337b510 <col:8> col:8 used 'const struct A &'
        | |-CXXCtorInitializer Field 0x3379238 'x' 'int [3]'
        | | `-ImplicitCastExpr 0x337e158 <col:8> 'int' <LValueToRValue>
        | |   `-ArraySubscriptExpr 0x337e130 <col:8> 'const int' lvalue
        | |     |-ImplicitCastExpr 0x337e118 <col:8> 'const int *' <ArrayToPointerDecay>
        | |     | `-MemberExpr 0x337dfc8 <col:8> 'int const[3]' lvalue .x 0x3379238
        | |     |   `-DeclRefExpr 0x337dfa0 <col:8> 'const struct A' lvalue ParmVar 0x337b510 '' 'const struct A &'
        | |     `-ImplicitCastExpr 0x337e098 <col:8> 'unsigned long' <LValueToRValue>
        | |       `-DeclRefExpr 0x337e070 <col:8> 'unsigned long' lvalue Var 0x337e010 '__i0' 'unsigned long'
      
      Reviewers: alexfh, aaron.ballman
      
      Subscribers: aemerson, nemanjai, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D22381
      
      llvm-svn: 275993
      dd117cf0
    • Simon Pilgrim's avatar
      [X86][AVX] Fixed typo in test names · f2d02cb0
      Simon Pilgrim authored
      llvm-svn: 275992
      f2d02cb0
    • Chad Rosier's avatar
      [DSE] Add additional debug output. NFC. · 667b1ca0
      Chad Rosier authored
      llvm-svn: 275991
      667b1ca0
    • Sanjay Patel's avatar
      add missing test for simplifySelectBitTest() · d2ff6d72
      Sanjay Patel authored
      llvm-svn: 275990
      d2ff6d72
    • Tobias Grosser's avatar
      [InstCombine] Enable cast-folding in logic(cast(icmp), cast(icmp)) · 1c382622
      Tobias Grosser authored
      Summary:
      Currently, InstCombine is already able to fold expressions of the form `logic(cast(A), cast(B))` to the simpler form `cast(logic(A, B))`, where logic designates one of `and`/`or`/`xor`. This transformation is implemented in `foldCastedBitwiseLogic()` in InstCombineAndOrXor.cpp. However, this optimization will not be performed if both `A` and `B` are `icmp` instructions. The decision to preclude casts of `icmp` instructions originates in r48715 in combination with r261707, and can be best understood by the title of the former one:
      
      > Transform (zext (or (icmp), (icmp))) to (or (zext (cimp), (zext icmp))) if at least one of the (zext icmp) can be transformed to eliminate an icmp.
      
      Apparently, it introduced a transformation that is a reverse of the transformation that is done in `foldCastedBitwiseLogic()`. Its purpose is to expose pairs of `zext icmp` that would subsequently be optimized by `transformZExtICmp()` in InstCombineCasts.cpp. Therefore, in order to avoid an endless loop of switching back and forth between these two transformations, the one in `foldCastedBitwiseLogic()` has been restricted to exclude `icmp` instructions which is mirrored in the responsible check:
      
      `if ((!isa<ICmpInst>(Cast0Src) || !isa<ICmpInst>(Cast1Src)) && ...`
      
      This check seems to sort out more cases than necessary because:
      - the reverse transformation is obviously done for `or` instructions only
      - and also not every `zext icmp` pair is necessarily the result of this reverse transformation
      
      Therefore we now remove this check and replace it by a more finegrained one in `shouldOptimizeCast()` that now rejects only those `logic(zext(icmp), zext(icmp))` that would be able to be optimized by `transformZExtICmp()`, which also avoids the mentioned endless loop. That means we are now able to also simplify expressions of the form `logic(cast(icmp), cast(icmp))` to `cast(logic(icmp, icmp))` (`cast` being an arbitrary `CastInst`).
      
      As an example, consider the following IR snippet
      
      ```
      %1 = icmp sgt i64 %a, %b
      %2 = zext i1 %1 to i8
      %3 = icmp slt i64 %a, %c
      %4 = zext i1 %3 to i8
      %5 = and i8 %2, %4
      ```
      
      which would now be transformed to
      
      ```
      %1 = icmp sgt i64 %a, %b
      %2 = icmp slt i64 %a, %c
      %3 = and i1 %1, %2
      %4 = zext i1 %3 to i8
      ```
      
      This issue became apparent when experimenting with the programming language Julia, which makes use of LLVM. Currently, Julia lowers its `Bool` datatype to LLVM's `i8` (also see https://github.com/JuliaLang/julia/pull/17225). In fact, the above IR example is the lowered form of the Julia snippet `(a > b) & (a < c)`. Like shown above, this may introduce `zext` operations, casting between `i1` and `i8`, which could for example hinder ScalarEvolution and Polly on certain code.
      
      Reviewers: grosser, vtjnash, majnemer
      
      Subscribers: majnemer, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D22511
      
      Contributed-by: Matthias Reisinger
      llvm-svn: 275989
      1c382622
    • Matt Arsenault's avatar
      AMDGPU: Only use legal inline immediates with kill pseudo · 03006fd3
      Matt Arsenault authored
      Only if the value is negative or positive is what matters,
      so use a constant that doesn't require an instruction to
      materialize.
      
      These should really just emit the write exec directly,
      but for stick with the kill pseudo-terminator.
      
      llvm-svn: 275988
      03006fd3
  2. Jul 19, 2016