[llvm] [VPlan] Hoist loads with invariant addresses using noalias metadata. (PR #166247)
Mikael Holmen via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 9 02:27:01 PST 2025
mikaelholmen wrote:
Hi @fhahn
I've seen a miscompile with this patch.
Reproduce with: ```opt -passes='loop-vectorize' bbi-113476_lv.ll -S -o - -vectorize-memory-check-threshold=0```
The input loop contains
```
store i16 0, ptr %p, align 1
%val = load i16, ptr @g_2938, align 1
```
where %p points to @g_2938, but in the output the load is hoisted before the store, so we read the old value.
(My original reproducer didn't use "-vectorize-memory-check-threshold=0", but then I had a lot of unrelated code in the loop, and I saw that if I decreased the threshold I could get rid of the unrelated stuff.)
[bbi-113476_lv.ll.gz](https://github.com/user-attachments/files/24052611/bbi-113476_lv.ll.gz)
https://godbolt.org/z/e5KM1cTGv
https://github.com/llvm/llvm-project/pull/166247
More information about the llvm-commits
mailing list