1. Aug 16, 2021
    • Craig Topper's avatar
      [X86] Support avx512fp16 compare instructions in the IntelInstPrinter. · b82ce77b
      Craig Topper authored
      This enables printing of the mnemonics that contain the predicate
      in the Intel printer. This requires accounting for the memory size
      that is explicitly printed in Intel syntax. Those changes have been
      synced to the ATT printer as well.
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D108093
      b82ce77b
    • Fangrui Song's avatar
    • Fangrui Song's avatar
    • Sanjay Patel's avatar
      [Analysis][SimplifyLibCalls] improve function signature check for memcmp · ca637014
      Sanjay Patel authored
      This would assert/crash as shown in:
      https://llvm.org/PR50850
      
      The matching for bcmp/bcopy should probably also be updated,
      but that's another patch.
      ca637014
    • David Blaikie's avatar
      Add missing triple for test · 44d0a99a
      David Blaikie authored
      44d0a99a
    • Craig Topper's avatar
      [X86] Prevent accidentally accepting cmpeqsh as a valid mnemonic. · ff95d252
      Craig Topper authored
      We should only accept as vcmpeqsh.
      
      Same for all the other 31 comparison values.
      ff95d252
    • Craig Topper's avatar
      [X86] Modify the commuted load isel pattern for VCMPSHZrm to match VCMPSSZrm/VCMPSDZrm. · 819818f7
      Craig Topper authored
      This allows commuting any immediate value. The previous code only
      commuted equality immediates. This was inherited from an earlier
      version of VCMPSSZrm/VCMPSDZrm.
      819818f7
    • David Blaikie's avatar
      DWARFVerifier: Check section-relative references at the end of the section · 62a4c2c1
      David Blaikie authored
      This ensures that debug_types references aren't looked for in
      debug_info section.
      
      Behavior is still going to be questionable in an unlinked object file -
      since cross-cu references could refer to symbols in another .debug_info
      (or, in theory, .debug_types) chunk - but if a producer only uses
      ref_addr to refer to things within the same .debug_info chunk in an
      object file (eg: whole program optimization/LTO - producing two CUs into
      a single .debug_info section in an object file - the ref_addrs there
      could be resolved relative to that .debug_info chunk, not needing to
      consider comdat  (DWARFv5 type units or other creatures) chunks of
      .debug_info, etc)
      62a4c2c1
    • Craig Topper's avatar
      [X86] Add vcmpsh/vcmpph to X86InstrInfo::commuteInstructionImpl. · 786b8fcc
      Craig Topper authored
      They were already added to findCommuteOpIndices, but they also
      need to be in X86InstrInfo::commuteInstructionImpl in order
      to adjust the immediate control.
      786b8fcc
    • Craig Topper's avatar
    • Sanjay Patel's avatar
      [x86] split memcmp tests for 32/64-bit targets; NFC · 8721490d
      Sanjay Patel authored
      memcmp is defined as taking a size_t length arg,
      so that differs depending on pointer size of the
      target.
      
      We casually matched non-compliant function signatures
      as memcmp, but that can cause crashing as seen with
      PR50850.
      
      If we fix that bug, these tests would no longer be
      testing the expected behavior for a 32-bit target,
      so I have duplicated all tests and adjusted them
      to match the stricter definition of memcmp/bcmp
      by changing the length arg to i32 on a 32-bit target.
      8721490d
    • Paul Walker's avatar
      [DAGCombiner] Stop visitEXTRACT_SUBVECTOR creating illegal BITCASTs post legalisation. · cd0e1964
      Paul Walker authored
      visitEXTRACT_SUBVECTOR can sometimes create illegal BITCASTs when
      removing "redundant" INSERT_SUBVECTOR operations.  This patch adds
      an extra check to ensure such combines only occur after operation
      legalisation if any resulting BITBAST is itself legal.
      
      Differential Revision: https://reviews.llvm.org/D108086
      cd0e1964
    • Nico Weber's avatar
      [gn build] (manually) port 95733438 · 20170447
      Nico Weber authored
      20170447
    • Kazu Hirata's avatar
      [AsmParser] Remove MDSignedOrUnsignedField (NFC) · e6e687f2
      Kazu Hirata authored
      The last use was removed on Apr 18, 2020 in commit
      aad3d578.
      e6e687f2
    • David Green's avatar
      [InstCombine] Add call to matchSAddSubSat from min/max · c6b7db01
      David Green authored
      This adds a call to matchSAddSubSat from smin/smax instrinsics, allowing
      the same patterns to match if the canonical form of a min/max is an
      intrinsics, not a icmp/select.
      
      Differential Revision: https://reviews.llvm.org/D108077
      c6b7db01
    • Roman Lebedev's avatar
      Reland [SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA... · 3d9beefc
      Roman Lebedev authored
      Reland [SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before cloning instructions (PR51125)
      
      ... with test change this time.
      
      LLVM IR SSA form is "implicit" in `@pr51125`. While is a valid LLVM IR,
      and does not require any PHI nodes, that completely breaks the further logic
      in `CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses()`
      that updates the live-out uses of the bonus instructions.
      
      What i believe we need to do, is to first make the SSA form explicit,
      by inserting tautological PHI nodes, and rewriting the offending uses.
      
      ```
      $ /builddirs/llvm-project/build-Clang12/bin/opt -load /repositories/alive2/build-Clang-release/tv/tv.so -load-pass-plugin /repositories/alive2/build-Clang-release/tv/tv.so -tv -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=10 -tv -o /dev/null /tmp/test.ll
      
      ----------------------------------------
      @global_pr51125 = global 4 bytes, align 4
      
      define i32 @pr51125() {
      %entry:
        br label %L
      
      %L:
        %ld = load i32, * @global_pr51125, align 4
        %iszero = icmp eq i32 %ld, 0
        br i1 %iszero, label %exit, label %L2
      
      %L2:
        store i32 4294967295, * @global_pr51125, align 4
        %cmp = icmp eq i32 %ld, 4294967295
        br i1 %cmp, label %L, label %exit
      
      %exit:
        %r = phi i32 [ %ld, %L2 ], [ %ld, %L ]
        ret i32 %r
      }
      =>
      @global_pr51125 = global 4 bytes, align 4
      
      define i32 @pr51125() {
      %entry:
        %ld.old = load i32, * @global_pr51125, align 4
        %iszero.old = icmp eq i32 %ld.old, 0
        br i1 %iszero.old, label %exit, label %L2
      
      %L2:
        %ld2 = phi i32 [ %ld.old, %entry ], [ %ld, %L2 ]
        store i32 4294967295, * @global_pr51125, align 4
        %cmp = icmp ne i32 %ld2, 4294967295
        %ld = load i32, * @global_pr51125, align 4
        %iszero = icmp eq i32 %ld, 0
        %or.cond = select i1 %cmp, i1 1, i1 %iszero
        br i1 %or.cond, label %exit, label %L2
      
      %exit:
        %ld1 = phi i32 [ poison, %L2 ], [ %ld.old, %entry ]
        %r = phi i32 [ %ld2, %L2 ], [ %ld.old, %entry ]
        ret i32 %r
      }
      Transformation seems to be correct!
      
      ```
      
      Fixes https://bugs.llvm.org/show_bug.cgi?id=51125
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D106317
      3d9beefc
    • Roman Lebedev's avatar
      Revert "[SimplifyCFG] performBranchToCommonDestFolding(): form block-closed... · 60dd0121
      Roman Lebedev authored
      Revert "[SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before cloning instructions (PR51125)"
      
      Forgot to stage the test change.
      
      This reverts commit 78af5cb2.
      60dd0121
    • Roman Lebedev's avatar
      [SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form... · 78af5cb2
      Roman Lebedev authored
      [SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before cloning instructions (PR51125)
      
      LLVM IR SSA form is "implicit" in `@pr51125`. While is a valid LLVM IR,
      and does not require any PHI nodes, that completely breaks the further logic
      in `CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses()`
      that updates the live-out uses of the bonus instructions.
      
      What i believe we need to do, is to first make the SSA form explicit,
      by inserting tautological PHI nodes, and rewriting the offending uses.
      
      ```
      $ /builddirs/llvm-project/build-Clang12/bin/opt -load /repositories/alive2/build-Clang-release/tv/tv.so -load-pass-plugin /repositories/alive2/build-Clang-release/tv/tv.so -tv -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=10 -tv -o /dev/null /tmp/test.ll
      
      ----------------------------------------
      @global_pr51125 = global 4 bytes, align 4
      
      define i32 @pr51125() {
      %entry:
        br label %L
      
      %L:
        %ld = load i32, * @global_pr51125, align 4
        %iszero = icmp eq i32 %ld, 0
        br i1 %iszero, label %exit, label %L2
      
      %L2:
        store i32 4294967295, * @global_pr51125, align 4
        %cmp = icmp eq i32 %ld, 4294967295
        br i1 %cmp, label %L, label %exit
      
      %exit:
        %r = phi i32 [ %ld, %L2 ], [ %ld, %L ]
        ret i32 %r
      }
      =>
      @global_pr51125 = global 4 bytes, align 4
      
      define i32 @pr51125() {
      %entry:
        %ld.old = load i32, * @global_pr51125, align 4
        %iszero.old = icmp eq i32 %ld.old, 0
        br i1 %iszero.old, label %exit, label %L2
      
      %L2:
        %ld2 = phi i32 [ %ld.old, %entry ], [ %ld, %L2 ]
        store i32 4294967295, * @global_pr51125, align 4
        %cmp = icmp ne i32 %ld2, 4294967295
        %ld = load i32, * @global_pr51125, align 4
        %iszero = icmp eq i32 %ld, 0
        %or.cond = select i1 %cmp, i1 1, i1 %iszero
        br i1 %or.cond, label %exit, label %L2
      
      %exit:
        %ld1 = phi i32 [ poison, %L2 ], [ %ld.old, %entry ]
        %r = phi i32 [ %ld2, %L2 ], [ %ld.old, %entry ]
        ret i32 %r
      }
      Transformation seems to be correct!
      
      ```
      
      Fixes https://bugs.llvm.org/show_bug.cgi?id=51125
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D106317
      78af5cb2
    • Roman Lebedev's avatar
  2. Aug 15, 2021