Open wsmoses opened 1 year ago
@llvm/issue-subscribers-julialang
The good version is not vectorized because:
LAA: Runtime check would require comparison between different address spaces
LAA: We can't vectorize because we can't find the array bounds.
Yeah I minimized this one slightly too far, a moment.
In essence this code (https://godbolt.org/z/11drEMfjx) when run through Julia's LLVM pass pipeline creates a bug. It should print 1.0, but optimizes to 2.0
Here is it post vectorization (see it prints 2): https://godbolt.org/z/4vqzxMbd8 Here is it pre vectorization (see it prints 1): https://godbolt.org/z/aGM6Td4T6
Here is the vectorization itself as an llvm pass on trunc: https://godbolt.org/z/431xo6Tfc
@fhahn if you might have any insights here.
Hmm interesting, let me take a look in a bit
The issue seems to be fixed now. I ran the optimization pipeline you showed minus the -opaque-pointers=0
, since that option no longer exists, and got the same output of 1.
Edit: the bug is not related to address spaces, see later comments:
The following code examples are equivalent except for one having a non-zero address space for the first arg or not. The non-zero address space version is incorrectly marked as vectorizable whereas the second one is not.
Illegal case: https://godbolt.org/z/Wjodd6n5x Correct case: https://godbolt.org/z/svPhcT84x
cc @vchuravy @jdoerfert