[llvm-bugs] [Bug 33368] New: DAGCombine incorrecly eliminates vector extension/truncation sequence

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 8 13:37:11 PDT 2017


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: unassignedbugs at nondot.org
          Reporter: Wolfgang_Pieb at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org

// 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170608/730ccad0/attachment-0001.html>


More information about the llvm-bugs mailing list