https://bugs.llvm.org/show_bug.cgi?id=33368

            Bug ID: 33368
           Summary: DAGCombine incorrecly eliminates vector
                    extension/truncation sequence
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

// The following test case (derived from a randomly generated
// case) fails with -O2 (Linux):

typedef char __attribute__((ext_vector_type(2))) char2;
typedef char __attribute__((ext_vector_type(8))) char8;

extern "C" int printf(const char *, ...);

__attribute__((noinline)) void use(char2 c) {
  volatile char2 cc = c;
}

__attribute__((noinline)) void test(char8 vec) {
  char2 b2 = vec.zxxx.wx;
  volatile char2 c2 = b2;
  printf("c2:%x %x => ", c2[0], c2[1]);
  if (c2[1] == 3)
    printf("PASSED\n");
  else
    printf("FAILED\n");
  use(b2);
}

int main() {
  char8 vec = {1, 2, 3, 4, 5, 6, 7, 8};
  test(vec);
}
// ====== end here ==========

DAGcombine incorrectly eliminates a combination of vector extension/
vector truncation because it only examines the element sizes of the
respective source and target vectors without considering the scales
of extension and truncation. The failing case extends by 2 (i8->i16)
and subsequently truncates by 8 (i64->i8), so the intermediate 
operations cannot be eliminated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to