[PATCH] D105020: [SLP]Improve graph reordering.

Mikhail Goncharov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 20 01:22:21 PDT 2021


goncharov added a comment.

Hi @ABataev ,

this time I've run creduce with asan and msan, so it should not do read out of bounds

  cat repro.cc
  #include <iostream>
  namespace a {
  __attribute__((noinline)) void b(uint8_t *c, float *d, uint16_t e, uint16_t f) {
    uint16_t g = f;
    uint16_t h = c[0] << 2 | (c[4] & 3);
    uint16_t m = c[1] << 2 | 2;
    uint16_t n = c[2] << 2 | 3;
    uint16_t j = c[3] << 2 | c[4] >> 6;
    *(d - 1) = float(m - e) / g;
    *(d - 2) = float(h - e) / g;
    *(d - 3) = float(j - e) / g;
    *(d - 4) = float(n - e) / g;
  }
  void bar(uint8_t *buffer, size_t k, size_t height, size_t l, uint16_t e,
           uint16_t f, float *output) {
    float *q = &output[4];
    uint16_t g = f;
    size_t r = k;
    for (size_t s = 0; s < height; s++) {
      uint8_t *o = buffer + l;
      uint8_t *t = o;
      float *p = &q[r];
      b(t, p, e, g);
    }
  }
  } // namespace a
  int main() {
    uint8_t u[]{5, 5, 0, 0, 0};
    float output[4 * 4];
    a::bar(u, 4, 4, 0, 0, 3, output);
    int *out = reinterpret_cast<int *>(output);
    int64_t sum;
    for (size_t i = 0; i < sizeof sizeof(int); i++)
      sum = out[i];
    printf("%ld\n", sum);
  }
  $ # on revision before: 8441a8eea8007b9eaaaabf76055949180a702d6d
  $ clang++ -Wall -Werror -Wextra -O2 -fno-exceptions  -stdlib=libc++ -std=gnu++17 repro.cc && ./a.out
  1089120939
  $ # revision 84cbd71c95923f9912512f3051c6ab548a99e016 
  $ clang++ -Wall -Werror -Wextra -O2 -fno-exceptions  -stdlib=libc++ -std=gnu++17 repro.cc && ./a.out
  1059760811




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105020



More information about the llvm-commits mailing list