<div dir="ltr">Hi,<div><br></div><div>I recently found that loops that operate on non-aliased SYCL buffers are not being vectorized. After a little digging the root cause reviewed to be the fact that there is a AddrSpaceCast instruction between a load and the respective GetElementPointer computing the access effective address.</div><div><br></div><div>From the LLVM IR language spec I learned that AddrSpaceCast *might* change the pointer value using a target specific function. But, not for all targets. In fact, in the TargetTransformationInfo there is a predicate method <font face="monospace">isNoopAddrSpaceCast(FromAS, ToAS)</font> that returns true if the cast is a noop depending on <font face="monospace">FromAS</font> and <font face="monospace">ToAS</font>.</div><div><br></div><div>I hacked the lib/Analysis/ScalarEvolution.cpp and lib/Transforms/Utils/ScalarEvolutionExpander.cpp files to handle AddrSpaceCasts. WIth these changes the compiler was able to vectorize the loop if it is annotated with <font face="monospace">#pragma clang loop vectorize(enable)...</font></div><div><br>My question is, would it be safe to allow such changes whenever the isNoopAddrSpaceCast() predicate evaluates to true? Or am I not considering something?</div><div><br></div><div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>João Paulo L. de Carvalho<br>Computer Science |  IC-UNICAMP | Campinas , SP - Brazil</div><div><a href="mailto:jaopaulolc@gmail.com" target="_blank">jaopaulolc@gmail.com</a></div><div><a href="mailto:joao.carvalho@ic.unicamp.br" target="_blank">joao.carvalho@ic.unicamp.br</a><br><a href="mailto:j160924@dac.unicamp.br" target="_blank">j160924@dac.unicamp.br</a></div></div></div></div></div></div></div>