2 // { dg-options "-O2 -fstrict-aliasing -fdump-tree-pre-details" }
4 // Make sure we hoist invariants out of the loop even in the presence
5 // of placement new. This is similar to code in tramp3d.
7 typedef __SIZE_TYPE__ size_t;
9 inline void* operator new(size_t, void* __p) throw() { return __p; }
11 template <class T, int D>
17 for (int i = 0; i < D; ++i)
20 T& operator[](int i) { return x_m[i]; }
42 int foo(int, int, int);
47 extern void bar(Vector<float, 3>*, int);
48 int c::foo(int f1, int f2, int f3)
51 for (int i = 0; i < 3; ++i)
53 for (int j = 0; j < 3; ++j)
59 for (int k = 0; k < 3; ++k)
61 float f = (f1 * this->sm.asi[0].p->ai[0]
62 + f2 * this->sm.asi[1].p->ai[0]
63 + f3 * this->sm.asi[2].p->ai[0]);
72 // { dg-final { scan-tree-dump "Replaced.*->ai\\\[0\\\]" "pre" } }