Add pr46591
MODIFY
BugList.md
BugList.md
@@ -127,6 +127,8 @@ NOTE: Alive2 can't find this bug anymore due to changes to reduce false-positive
17. X86InterleavedAccess introduces misaligned loads
(https://bugs.llvm.org/show_bug.cgi?id=45957)
+18. load-store-vectorizer cannot assume that an offset calculated from add nuw is fine in general
+(https://bugs.llvm.org/show_bug.cgi?id=46591)
### Bugs found in Z3
1. https://github.com/Z3Prover/z3/issues/2369 - bug in bitblast for FPA

ADD
tests/alive-tv/bugs/pr46591.srctgt.ll
+; https://bugs.llvm.org/show_bug.cgi?id=46591
+
+target triple = "x86_64--"
+
+define void @src(i32 %v0, i32 %v1, i8* %src, <4 x i8>* %dst) {
+bb:
+ %tmp = add nuw i32 %v0, -1
+ %tmp1 = add nuw i32 %v1, %tmp
+ %tmp2 = zext i32 %tmp1 to i64
+ %tmp3 = getelementptr inbounds i8, i8* %src, i64 %tmp2
+ %tmp4 = load i8, i8* %tmp3, align 1
+ %tmp5 = add nuw i32 %v1, %v0
+ %tmp6 = zext i32 %tmp5 to i64
+ %tmp7 = getelementptr inbounds i8, i8* %src, i64 %tmp6
+ %tmp8 = load i8, i8* %tmp7, align 1
+ %tmp9 = add nuw i32 %v0, 1
+ %tmp10 = add nuw i32 %v1, %tmp9
+ %tmp11 = zext i32 %tmp10 to i64
+ %tmp12 = getelementptr inbounds i8, i8* %src, i64 %tmp11
+ %tmp13 = load i8, i8* %tmp12, align 1
+ %tmp14 = add nuw i32 %v0, 2
+ %tmp15 = add nuw i32 %v1, %tmp14
+ %tmp16 = zext i32 %tmp15 to i64
+ %tmp17 = getelementptr inbounds i8, i8* %src, i64 %tmp16
+ %tmp18 = load i8, i8* %tmp17, align 1
+ %tmp19 = insertelement <4 x i8> undef, i8 %tmp4, i32 0
+ %tmp20 = insertelement <4 x i8> %tmp19, i8 %tmp8, i32 1
+ %tmp21 = insertelement <4 x i8> %tmp20, i8 %tmp13, i32 2
+ %tmp22 = insertelement <4 x i8> %tmp21, i8 %tmp18, i32 3
+ store <4 x i8> %tmp22, <4 x i8>* %dst
+ ret void
+}
+
+define void @tgt(i32 %v0, i32 %v1, i8* %src, <4 x i8>* %dst) {
+bb:
+ %tmp = add nuw i32 %v0, -1
+ %tmp1 = add nuw i32 %v1, %tmp
+ %tmp2 = zext i32 %tmp1 to i64
+ %tmp3 = getelementptr inbounds i8, i8* %src, i64 %tmp2
+ %0 = bitcast i8* %tmp3 to <4 x i8>*
+ %1 = load <4 x i8>, <4 x i8>* %0, align 1
+ %tmp41 = extractelement <4 x i8> %1, i32 0
+ %tmp82 = extractelement <4 x i8> %1, i32 1
+ %tmp133 = extractelement <4 x i8> %1, i32 2
+ %tmp184 = extractelement <4 x i8> %1, i32 3
+ %tmp19 = insertelement <4 x i8> undef, i8 %tmp41, i32 0
+ %tmp20 = insertelement <4 x i8> %tmp19, i8 %tmp82, i32 1
+ %tmp21 = insertelement <4 x i8> %tmp20, i8 %tmp133, i32 2
+ %tmp22 = insertelement <4 x i8> %tmp21, i8 %tmp184, i32 3
+ store <4 x i8> %tmp22, <4 x i8>* %dst, align 4
+ ret void
+}
+
+; ERROR: Source is more defined than target

Add pr46591 (#446)