[llvm] r289412 - [SCEVExpand] do not hoist divisions by zero (PR30935)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 10:06:26 PST 2016


Fully C-reduced, same flags:

$ cat t.cpp
struct a {
  static const bool b = b;
};
class c {
public:
  int *f();
  int operator[](unsigned d) { return f()[d]; }
};
template <typename, int> class e : public c {};
struct g {
  unsigned h();
  unsigned j();
};
class k {
  int m_fn4(int &) const;
};
bool ac(e<int, a::b> ad, g m) {
  int n = m.h(), o = m.j() / 8;
  if (n != 4)
    return false;
  int s = n / o;
  for (int l = 0; l < o; ++l)
    for (int i = l * s; i; ++i) {
      int p = ad[i];
      if (p)
        return false;
    }
  return true;
}
int k::m_fn4(int &q) const {
  g m;
  e<int, a::b> r;
  ac(r, m);
  return q;
}

$ clang -c t.cpp -O2 -fsanitize=address -std=c++11 -fno-exceptions


On Tue, Dec 13, 2016 at 6:57 AM, Sebastian Pop <sebpop.llvm at gmail.com>
wrote:

> On Mon, Dec 12, 2016 at 5:33 PM, Reid Kleckner via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > Reverted in r289453. This is still reducing
>
> Thanks Reid for taking care of reverting the patch.
> I will have a look at the partially reduced testcase.
>
> Sebastian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/0185cda9/attachment.html>


More information about the llvm-commits mailing list