-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[LV] Fix MinBWs in WidenIntrinsic case #137005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-vectorizers @llvm/pr-subscribers-llvm-transforms Author: Ramkumar Ramachandra (artagnon) ChangesThis bug is especially difficult to fix, since simplifyRecipes() simplifies the zext of 0 into the constant 0, removing an instruction and leaving a stale entry in the MinBWs map: a crash is subsequently observed in VPlanTransforms::truncateToMinimalBitwidths() due to a mismatch between the number of recipes processed and the number of entries in MinBWs. One possible way forward is to get simplifyRecipes() to erase entries from MinBWs when replacing Instructions with Constants. Check in the test to ease investigation, while we plan a way to fix the bug. Full diff: https://github.com/llvm/llvm-project/pull/137005.diff 1 Files Affected:
diff --git a/llvm/test/Transforms/LoopVectorize/pr87407.ll b/llvm/test/Transforms/LoopVectorize/pr87407.ll
new file mode 100644
index 0000000000000..0983f2571e0b0
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/pr87407.ll
@@ -0,0 +1,24 @@
+; REQUIRES: asserts
+; RUN: not --crash opt -passes=loop-vectorize -disable-output %s
+
+define void @pr87407(ptr %dst, i64 %n) {
+entry:
+ %zext.0 = zext i8 0 to i64
+ br label %loop
+
+loop:
+ %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ]
+ %max = tail call i64 @llvm.umax.i64(i64 %zext.0, i64 0)
+ %cmp.max.0 = icmp ne i64 %max, 0
+ %zext.cmp = zext i1 %cmp.max.0 to i64
+ %trunc = trunc i64 %zext.cmp to i32
+ %shl = shl i32 %trunc, 8
+ %res = trunc i32 %shl to i8
+ %iv.next = add i64 %iv, 1
+ %exit.cond = icmp ne i64 %iv.next, %n
+ br i1 %exit.cond, label %loop, label %exit
+
+exit:
+ store i8 %res, ptr %dst, align 1
+ ret void
+}
|
482c2b8
to
2856598
Compare
This bug is especially difficult to fix, since simplifyRecipes() simplifies the zext of 0 into the constant 0, removing an instruction and leaving a stale entry in the MinBWs map: a crash is subsequently observed in VPlanTransforms::truncateToMinimalBitwidths() due to a mismatch between the number of recipes processed and the number of entries in MinBWs. One possible way forward is to get simplifyRecipes() to erase entries from MinBWs when replacing Instructions with Constants. Check in the test to ease investigation, while we plan a way to fix the bug.
2856598
to
98388a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/16850 Here is the relevant piece of the build log for the reference
|
There is a bug in the computation and handling of MinBWs in the case of VPWidenIntrinsicRecipe: a crash is observed in VPlanTransforms::truncateToMinimalBitwidths due to a mismatch between the number of recipes processed and the number of entries in MinBWs. Fix handling of calls in llvm::computeMinimumValueSizes, and handle VPWidenIntrinsicRecipe in truncateToMinimalBitwidths, fixing the bug. Fixes llvm#87407.
There is a bug in the computation and handling of MinBWs in the case of VPWidenIntrinsicRecipe: a crash is observed in VPlanTransforms::truncateToMinimalBitwidths due to a mismatch between the number of recipes processed and the number of entries in MinBWs. Fix handling of calls in llvm::computeMinimumValueSizes, and handle VPWidenIntrinsicRecipe in truncateToMinimalBitwidths, fixing the bug. Fixes llvm#87407.
There is a bug in the computation and handling of MinBWs in the case of VPWidenIntrinsicRecipe: a crash is observed in VPlanTransforms::truncateToMinimalBitwidths due to a mismatch between the number of recipes processed and the number of entries in MinBWs. Fix handling of calls in llvm::computeMinimumValueSizes, and handle VPWidenIntrinsicRecipe in truncateToMinimalBitwidths, fixing the bug. Fixes llvm#87407.
There is a bug in the computation and handling of MinBWs in the case of VPWidenIntrinsicRecipe: a crash is observed in VPlanTransforms::truncateToMinimalBitwidths due to a mismatch between the number of recipes processed and the number of entries in MinBWs. Fix handling of calls in llvm::computeMinimumValueSizes, and handle VPWidenIntrinsicRecipe in truncateToMinimalBitwidths, fixing the bug. Fixes llvm#87407.
There is a bug in the computation and handling of MinBWs in the case of VPWidenIntrinsicRecipe: a crash is observed in VPlanTransforms::truncateToMinimalBitwidths due to a mismatch between the number of recipes processed and the number of entries in MinBWs. Fix handling of calls in llvm::computeMinimumValueSizes, and handle VPWidenIntrinsicRecipe in truncateToMinimalBitwidths, fixing the bug. Fixes llvm#87407.
There is a bug in the computation and handling of MinBWs in the case of VPWidenIntrinsicRecipe: a crash is observed in VPlanTransforms::truncateToMinimalBitwidths due to a mismatch between the number of recipes processed and the number of entries in MinBWs. Fix handling of calls in llvm::computeMinimumValueSizes, and handle VPWidenIntrinsicRecipe in truncateToMinimalBitwidths, fixing the bug. Fixes llvm#87407.
There is a bug in the computation and handling of MinBWs in the case of VPWidenIntrinsicRecipe: a crash is observed in VPlanTransforms::truncateToMinimalBitwidths due to a mismatch between the number of recipes processed and the number of entries in MinBWs. Fix handling of calls in llvm::computeMinimumValueSizes, and handle VPWidenIntrinsicRecipe in truncateToMinimalBitwidths, fixing the bug.
Fixes #87407.