Skip to content

Solve bad code gen with ICC, stack int[1] arrays, and loop unrolling.

This specialization is required to resolve a compiler optimization bug that was found inside ICC 15.X and 16.X

When the Intel compiler sees the following pattern: vtkm::Extent extent; for (vtkm::IdComponent i = 0; i < Dims; ++i) { extent.Min[dimIndex] = X; extent.Max[dimIndex] = Y; }

It optimizes the assignment of Min and Max into a single memcpy call. This optimization fails only if Dims is equal to 1 and vtkm::Id is 32bit since the compiler optimizes to a 4byte unaligned memcpy of a length of 8bytes that is broken ( drops the last 4 bytes ).

If the dimensions are greater than 1, the 'optimization' code path isn't hit. If vtkm::Id is 64bits, or if vtkm::Vec stack array is 8byte aligned the optimized aligned memcpy is used, which doesn't have this issue

Merge request reports