================
@@ -2477,6 +2493,15 @@ void LoopAccessInfo::analyzeLoop(AAResults *AA, LoopInfo 
*LI,
 
       // Save 'store' instructions. Abort if other instructions write to 
memory.
       if (I.mayWriteToMemory()) {
+        // We can safety handle math functions that have vectorized
+        // counterparts and have the memory write-only attribute set.
----------------
mgabka wrote:

Hi @fhahn,
you are right.

The whole logic was based on checking later in the  
https://github.com/llvm/llvm-project/blob/332de4b2677ce7a95cc2df30d761fbb55376fe07/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp#L6659
 if the pointers are linear with the right step, but there is no checks for 
aliasing.
@paschalis-mpeis that means that there is an existing bug with sincos, as 
following code gets vectorised, without any checks:

```
double sin[N];
double cos[N];
sin[5] = M_PI;

for(int i=0; i<N; i++ ) {
 sincos(sin[5], sin+i, cos+i);
}

```

https://github.com/llvm/llvm-project/pull/78432
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to