1. Dec 02, 2020
  2. Dec 01, 2020
    • Clement Courbet's avatar
      [MergeICmps] Fix missing split. · 735e6c88
      Clement Courbet authored
      We were not correctly splitting a blocks for chains of length 1.
      
      Before that change, additional instructions for blocks in chains of
      length 1 were not split off from the block before removing (this was
      done correctly for chains of longer size).
      If this first block contained an instruction referenced elsewhere,
      deleting the block, would result in invalidation of the produced value.
      
      This caused a miscompile which motivated D92297 (before D17993,
      nonnull and dereferenceable attributed were not added so MergeICmps were
      not triggered.) The new test gep-references-bb.ll demonstrate the issue.
      
      The regression was introduced in
      rG0efadbbc.
      
      This supersedes D92364.
      
      Test case by MaskRay (Fangrui Song).
      
      Differential Revision: https://reviews.llvm.org/D92375
      735e6c88
    • Aaron En Ye Shi's avatar
      [HIP] Fix static-lib test CHECK bug · cd5897d5
      Aaron En Ye Shi authored
      Fix hip test failures that were introduced by
      previous changes to hip-toolchain-rdc-static-lib.hip
      test. The .*lld.* is matching a longer string than
      expected.
      
      Differential Revision: https://reviews.llvm.org/D92342
      cd5897d5
    • Sanjay Patel's avatar
      [x86] adjust cost model values for minnum/maxnum with fast-math-flags · 136f98e5
      Sanjay Patel authored
      Without FMF, we lower these intrinsics into something like this:
      
      vmaxsd	%xmm0, %xmm1, %xmm2
      vcmpunordsd	%xmm0, %xmm0, %xmm0
      vblendvpd	%xmm0, %xmm1, %xmm2, %xmm0
      
      But if we can ignore NANs, the single min/max instruction is enough
      because there is no need to fix up the x86 logic that corresponds to
      X > Y ? X : Y.
      
      We probably want to make other adjustments for FP intrinsics with FMF
      to account for specialized codegen (for example, FSQRT).
      
      Differential Revision: https://reviews.llvm.org/D92337
      136f98e5
    • Benjamin Kramer's avatar
      [DAG] Remove unused variable. NFC. · 107e92df
      Benjamin Kramer authored
      107e92df
    • David Green's avatar
      [ARM] Mark select and selectcc of MVE vector operations as expand. · eedf0ed6
      David Green authored
      We already expand select and select_cc in codegenprepare, but they can
      still be generated under some situations. Explicitly mark them as expand
      to ensure they are not produced, leading to a failure to select the
      nodes.
      
      Differential Revision: https://reviews.llvm.org/D92373
      eedf0ed6
    • Sanjay Patel's avatar
      [InstCombine] canonicalize sign-bit-shift of difference to ext(icmp) · 9f60b8b3
      Sanjay Patel authored
      icmp is the preferred spelling in IR because icmp analysis is
      expected to be better than any other analysis. This should
      lead to more follow-on folding potential.
      
      It's difficult to say exactly what we should do in codegen to
      compensate. For example on AArch64, which of these is preferred:
      	sub	w8, w0, w1
      	lsr	w0, w8, #31
      
      vs:
      	cmp	w0, w1
      	cset	w0, lt
      
      If there are perf regressions, then we should deal with those in
      codegen on a case-by-case basis.
      
      A possible motivating example for better optimization is shown in:
      https://llvm.org/PR43198 but that will require other transforms
      before anything changes there.
      
      Alive proof:
      https://rise4fun.com/Alive/o4E
      
        Name: sign-bit splat
        Pre: C1 == (width(%x) - 1)
        %s = sub nsw %x, %y
        %r = ashr %s, C1
        =>
        %c = icmp slt %x, %y
        %r = sext %c
      
        Name: sign-bit LSB
        Pre: C1 == (width(%x) - 1)
        %s = sub nsw %x, %y
        %r = lshr %s, C1
        =>
        %c = icmp slt %x, %y
        %r = zext %c
      9f60b8b3