[llvm] [SLP]Improve findReusedOrderedScalars and graph rotation. (PR #77529)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 29 05:37:25 PST 2024


eaeltsin wrote:

Heads-up - this causes a miscompile in our tests. 

We are still working on the reduced reproducer, but so far the only difference in the miscompiled function looks like:
```
 ; Function Attrs: mustprogress nounwind uwtable
 define void @foo(ptr dead_on_unwind noalias nonnull writable sret(%"class.foo") align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(40) %1) local_unnamed_addr #0 align 32 {
   tail call void @bar(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef null) #9
   %3 = getelementptr inbounds i8, ptr %1, i64 24
   %4 = getelementptr inbounds i8, ptr %0, i64 24
   %5 = getelementptr inbounds i8, ptr %0, i64 16
   %6 = load i32, ptr %5, align 8
   %7 = load <4 x float>, ptr %3, align 8
   %8 = shufflevector <4 x float> %7, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>
   %9 = fcmp olt <4 x float> %7, %8
   %10 = shufflevector <4 x float> %7, <4 x float> poison, <4 x i32> <i32 2, i32 3, i32 2, i32 3>
   %11 = shufflevector <4 x float> %7, <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
   %12 = select <4 x i1> %9, <4 x float> %10, <4 x float> %11
-  %13 = shufflevector <4 x float> %12, <4 x float> poison, <4 x i32> <i32 2, i32 0, i32 3, i32 1>
+  %13 = shufflevector <4 x float> %12, <4 x float> poison, <4 x i32> <i32 1, i32 2, i32 3, i32 0>
   store <4 x float> %13, ptr %4, align 8
   %14 = or i32 %6, 15
   store i32 %14, ptr %5, align 8
   ret void
 }
```


https://github.com/llvm/llvm-project/pull/77529


More information about the llvm-commits mailing list