[PATCH] D99980: [SLP]Improve cost model for the vectorized extractelements.

Jorge Gorbe Moya via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 3 16:33:54 PDT 2021


jgorbe added a comment.

Hi, we're seeing some build failures after this patch. If you build the following reduced test case with `clang -cc1 -emit-obj -O3 -vectorize-slp reduced.cc`

  # 1 "" 3
  typedef int a __attribute__((__mode__(__DI__)));
  struct b {
    __attribute__((__vector_size__(4 * sizeof(long)))) long c;
    a operator[](int) const;
  };
  a b::operator[](int d) const {
    if (d)
      return c[d];
    return;
  }
  b e;
  a au[8];
  void __attribute__((target("avx"))) f() {
    for (int g = 0; g < 8; ++g) {
      long bc = e[g];
      au[g] = e[bc & 7];
    }
  }

it results in this error:

  fatal error: error in backend: Cannot select: 0x578dff9323a8: v2i64 = truncate 0x578dff926208
    0x578dff926208: v4i32 = and 0x578dff926750, 0x578dff926a90
      0x578dff926750: v4i32 = X86ISD::UNPCKL 0x578dff926958, 0x578dff926b60
        0x578dff926958: v4i32 = X86ISD::PSHUFD 0x578dff9322d8, TargetConstant:i8<-18>
          0x578dff9322d8: v4i32,ch = load<(dereferenceable load 16 from `<4 x i64>* getelementptr inbounds (%struct.b, %struct.b* @e, i64 0, i32 0)`, align 32)> 0x578dffc25c68, 0x578dff932b60, undef:i64
            0x578dff932b60: i64 = X86ISD::WrapperRIP TargetGlobalAddress:i64<%struct.b* @e> 0
              0x578dff932888: i64 = TargetGlobalAddress<%struct.b* @e> 0
            0x578dff9324e0: i64 = undef
          0x578dff9268f0: i8 = TargetConstant<-18>
        0x578dff926b60: v4i32 = bitcast 0x578dff932410
          0x578dff932410: v2i64,ch = load<(dereferenceable load 16 from `<4 x i64>* getelementptr inbounds (%struct.b, %struct.b* @e, i64 0, i32 0)` + 16, basealign 32)> 0x578dffc25c68, 0x578dff932068, undef:i64
            0x578dff932068: i64 = add 0x578dff932b60, Constant:i64<16>
              0x578dff932b60: i64 = X86ISD::WrapperRIP TargetGlobalAddress:i64<%struct.b* @e> 0
                0x578dff932888: i64 = TargetGlobalAddress<%struct.b* @e> 0
              0x578dff926548: i64 = Constant<16>
            0x578dff9324e0: i64 = undef
      0x578dff926a90: v4i32,ch = load<(load 16 from constant-pool)> 0x578dffc25c68, 0x578dff932820, undef:i64
        0x578dff932820: i64 = X86ISD::WrapperRIP TargetConstantPool:i64<<4 x i32> <i32 7, i32 7, i32 undef, i32 undef>> 0
          0x578dff932618: i64 = TargetConstantPool<<4 x i32> <i32 7, i32 7, i32 undef, i32 undef>> 0
        0x578dff9324e0: i64 = undef
  In function: _Z1fv

A debug build of clang hits this assertion instead:

  clang: /usr/local/google/home/jgorbe/code/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4842: llvm::SDValue llvm::SelectionDAG::getNode(unsigned int, const llvm::SDLoc &, llvm::EVT, llvm::SDValue, const llvm::SDNodeFlags): Assertion `(!VT.isVector() || VT.getVectorElementCount() == Operand.getValueType().getVectorElementCount()) && "Vector element count mismatch!"' failed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99980/new/

https://reviews.llvm.org/D99980



More information about the llvm-commits mailing list