Sync
Browse files- dataset.jsonl +0 -0
- dataset/115279.json +73 -0
- dataset/164254.json +103 -0
- dataset/165014.json +59 -0
- dataset/165031.json +156 -0
- dataset/165087.json +96 -0
- dataset/165252.json +69 -0
- dataset/166356.json +85 -0
- dataset/167243.json +77 -0
- dataset/167867.json +68 -0
- dataset/171890.json +68 -0
- dataset/174045.json +111 -0
- dataset/174599.json +59 -0
- dataset/174622.json +73 -0
- dataset/174760.json +68 -0
- dataset/174773.json +72 -0
- dataset/175058.json +59 -0
- dataset/175159.json +80 -0
- dataset/175229.json +64 -0
- dataset/175768.json +86 -0
- dataset/175949.json +92 -0
- dataset/175967.json +60 -0
- dataset/175990.json +68 -0
- dataset/176548.json +60 -0
- dataset/176658.json +71 -0
- dataset/176720.json +59 -0
- dataset/176780.json +59 -0
- dataset/177124.json +63 -0
- dataset/177144.json +74 -0
- dataset/178245.json +70 -0
- dataset/178884.json +65 -0
- dataset/178917.json +63 -0
- dataset/178954.json +59 -0
- dataset/179074.json +73 -0
- dataset/180361.json +59 -0
- dataset/180363.json +64 -0
- dataset/180780.json +68 -0
- dataset/181117.json +63 -0
- scripts/extract_from_issues.py +1 -1
- scripts/llvm_helper.py +1 -1
- scripts/postfix_extract.py +10 -1
dataset.jsonl
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dataset/115279.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "115279",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/115279",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "a24f6ce743cc2dd311e35894f386c05d0ead089c",
|
| 6 |
+
"knowledge_cutoff": "2024-11-07T08:44:28Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopFusion"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "599c2731b3bbe9add135558377dbee2e1fa24358",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopFuse"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Scalar/LoopFuse.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1702,
|
| 19 |
+
1707
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Scalar/LoopFuse.cpp": [
|
| 25 |
+
"performFusion"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 599c2731b3bbe9add135558377dbee2e1fa24358\nAuthor: Alireza Torabian <alireza.torabian@huawei.com>\nDate: Thu Jan 22 19:50:21 2026 -0500\n\n [LoopFusion] Forget cached SCEV values after the fusion (#177455)\n \n This patch fixes the issue #115279. After the fusion, some of the cached\n SCEV values such as the induction variable may not be valid anymore and\n need to be forgotten.\n\ndiff --git a/llvm/lib/Transforms/Scalar/LoopFuse.cpp b/llvm/lib/Transforms/Scalar/LoopFuse.cpp\nindex 9c86b73dfc8d..0deeb557ddab 100644\n--- a/llvm/lib/Transforms/Scalar/LoopFuse.cpp\n+++ b/llvm/lib/Transforms/Scalar/LoopFuse.cpp\n@@ -1702,6 +1702,10 @@ private:\n // since merging the latches may affect the dispositions.\n SE.forgetBlockAndLoopDispositions();\n \n+ // Forget the cached SCEV values including the induction variable that may\n+ // have changed after the fusion.\n+ SE.forgetLoop(FC0.L);\n+\n // Merge the loops.\n SmallVector<BasicBlock *, 8> Blocks(FC1.L->blocks());\n for (BasicBlock *BB : Blocks) {\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/LoopFusion/pr115279.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -passes=loop-fusion -disable-output -stats < %s 2>&1"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "; REQUIRES: asserts\n; STAT: 1 loop-fusion - Loops fused\n\n; C Code\n;\n;; for (i = 0; i < n; i++)\n;; array2[i] = array1[i] * 2;\n;; for (i = 0; i < n; i++)\n;; if (array1[i] % 2 == 0)\n;; array2[i] = array1[i] * array1[i];\n; Loop fusion should not crash due to incorrect cached SCEV values as now\n; forgetLoop() is used to reset them after the fusion.\n\ndefine dso_local noundef i32 @forget_induction_scev(ptr noalias %array1, ptr noalias %array2) {\nentry:\n br label %for.body\n\nfor.body:\n %indvars.iv54 = phi i64 [ %indvars.iv.next55, %for.body ], [ 0, %entry ]\n %arrayidx6 = getelementptr inbounds i32, ptr %array1, i64 %indvars.iv54\n %0 = load i32, ptr %arrayidx6, align 4\n %mul = shl nsw i32 %0, 1\n %arrayidx8 = getelementptr inbounds i32, ptr %array2, i64 %indvars.iv54\n store i32 %mul, ptr %arrayidx8, align 4\n %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1\n %exitcond57.not = icmp eq i64 %indvars.iv.next55, 1024\n br i1 %exitcond57.not, label %for.body14, label %for.body\n\nfor.body14:\n %indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.inc26 ], [ 0, %for.body ]\n %arrayidx16 = getelementptr inbounds i32, ptr %array1, i64 %indvars.iv58\n %1 = load i32, ptr %arrayidx16, align 4\n %2 = and i32 %1, 1\n %cmp18 = icmp eq i32 %2, 0\n br i1 %cmp18, label %if.then, label %for.inc26\n\nif.then:\n %mul23 = mul nsw i32 %1, %1\n %arrayidx25 = getelementptr inbounds i32, ptr %array2, i64 %indvars.iv58\n store i32 %mul23, ptr %arrayidx25, align 4\n br label %for.inc26\n\nfor.inc26:\n %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1\n %exitcond61.not = icmp eq i64 %indvars.iv.next59, 1024\n br i1 %exitcond61.not, label %for.end28, label %for.body14\n\nfor.end28:\n %arrayidx30 = getelementptr inbounds i8, ptr %array2, i64 4092\n %3 = load i32, ptr %arrayidx30, align 4\n ret i32 %3\n}"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[LoopFusion] Assert \"Fused candidate should be eligible for fusion\"",
|
| 46 |
+
"body": "To reproduce: https://compiler-explorer.com/z/oqacnTqoa\r\n```opt -S -passes=loop-fusion -debug-only=loop-fusion ``` crashes on the LLVMIR generated from ```clang -O1``` because of an assertion failure\r\nStack Dump:\r\n```\r\nopt: /root/llvm-project/llvm/lib/Transforms/Scalar/LoopFuse.cpp:1038: bool {anonymous}::LoopFuser::fuseCandidates(): Assertion `FusedCand.isEligibleForFusion(SE) && \"Fused candidate should be eligible for fusion!\"' failed.\r\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.\r\nStack dump:\r\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -S -passes=loop-fusion -debug-only=loop-fusion <source>\r\n1.\tRunning pass \"function(loop-fusion)\" on module \"<source>\"\r\n2.\tRunning pass \"loop-fusion\" on function \"main\"\r\n #0 0x000000000513f3c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x513f3c8)\r\n #1 0x000000000513cdbc SignalHandler(int) Signals.cpp:0:0\r\n #2 0x0000719331442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\r\n #3 0x00007193314969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\r\n #4 0x0000719331442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\r\n #5 0x00007193314287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\r\n #6 0x000071933142871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\r\n #7 0x0000719331439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\r\n #8 0x0000000003d8fdf8 (anonymous namespace)::LoopFuser::fuseCandidates() LoopFuse.cpp:0:0\r\n #9 0x0000000003d90d61 llvm::LoopFusePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3d90d61)\r\n#10 0x0000000002f9003e llvm::detail::PassModel<llvm::Function, llvm::LoopFusePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2f9003e)\r\n#11 0x0000000004f3cde8 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4f3cde8)\r\n#12 0x0000000000e3a56e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xe3a56e)\r\n#13 0x0000000004f3b80e llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4f3b80e)\r\n#14 0x0000000000e39c7e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xe39c7e)\r\n#15 0x0000000004f3b240 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4f3b240)\r\n#16 0x00000000009108ea llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9108ea)\r\n#17 0x000000000090324a optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x90324a)\r\n#18 0x0000719331429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\r\n#19 0x0000719331429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\r\n#20 0x00000000008facce _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8facce)\r\nProgram terminated with signal: SIGSEGV\r\nCompiler returned: 139\r\n```\r\nThe IR\r\n```\r\ndefine dso_local noundef i32 @main() local_unnamed_addr #0 {\r\nentry:\r\n %vla48 = alloca [1024 x i32], align 16\r\n %vla149 = alloca [1024 x i32], align 16\r\n br label %for.body\r\n\r\nfor.body:\r\n %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]\r\n %call = tail call i32 @rand() #2\r\n %rem = srem i32 %call, 100\r\n %add = add nsw i32 %rem, 1\r\n %arrayidx = getelementptr inbounds i32, ptr %vla48, i64 %indvars.iv\r\n store i32 %add, ptr %arrayidx, align 4\r\n %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1\r\n %exitcond.not = icmp eq i64 %indvars.iv.next, 1024\r\n br i1 %exitcond.not, label %for.body4, label %for.body\r\n\r\nfor.body4:\r\n %indvars.iv54 = phi i64 [ %indvars.iv.next55, %for.body4 ], [ 0, %for.body ]\r\n %arrayidx6 = getelementptr inbounds i32, ptr %vla48, i64 %indvars.iv54\r\n %0 = load i32, ptr %arrayidx6, align 4\r\n %mul = shl nsw i32 %0, 1\r\n %arrayidx8 = getelementptr inbounds i32, ptr %vla149, i64 %indvars.iv54\r\n store i32 %mul, ptr %arrayidx8, align 4\r\n %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1\r\n %exitcond57.not = icmp eq i64 %indvars.iv.next55, 1024\r\n br i1 %exitcond57.not, label %for.body14, label %for.body4\r\n\r\nfor.body14:\r\n %indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.inc26 ], [ 0, %for.body4 ]\r\n %arrayidx16 = getelementptr inbounds i32, ptr %vla48, i64 %indvars.iv58\r\n %1 = load i32, ptr %arrayidx16, align 4\r\n %2 = and i32 %1, 1\r\n %cmp18 = icmp eq i32 %2, 0\r\n br i1 %cmp18, label %if.then, label %for.inc26\r\n\r\nif.then:\r\n %mul23 = mul nsw i32 %1, %1\r\n %arrayidx25 = getelementptr inbounds i32, ptr %vla149, i64 %indvars.iv58\r\n store i32 %mul23, ptr %arrayidx25, align 4\r\n br label %for.inc26\r\n\r\nfor.inc26:\r\n %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1\r\n %exitcond61.not = icmp eq i64 %indvars.iv.next59, 1024\r\n br i1 %exitcond61.not, label %for.end28, label %for.body14\r\n\r\nfor.end28:\r\n %arrayidx30 = getelementptr inbounds i8, ptr %vla149, i64 4092\r\n %3 = load i32, ptr %arrayidx30, align 4\r\n ret i32 %3\r\n}\r\n\r\ndeclare i32 @rand() local_unnamed_addr #1\r\n\r\nattributes #0 = { mustprogress norecurse nounwind uwtable \"min-legal-vector-width\"=\"0\" \"no-trapping-math\"=\"true\" \"stack-protector-buffer-size\"=\"8\" \"target-cpu\"=\"x86-64\" \"target-features\"=\"+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87\" \"tune-cpu\"=\"generic\" }\r\nattributes #1 = { nounwind \"no-trapping-math\"=\"true\" \"stack-protector-buffer-size\"=\"8\" \"target-cpu\"=\"x86-64\" \"target-features\"=\"+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87\" \"tune-cpu\"=\"generic\" }\r\nattributes #2 = { nounwind }\r\n```\r\n\r\nThis is generated from the cpp program:\r\n```cpp\r\n#include <random>\r\n\r\nint main() {\r\n int n = 1024;\r\n int array1[n];\r\n int array2[n];\r\n int i;\r\n for (i = 0; i < n; i++) {\r\n array1[i] = std::rand() % 100 + 1;\r\n }\r\n for (i = 0; i < n; i++) {\r\n array2[i] = array1[i] * 2;\r\n }\r\n for (i = 0; i < n; i++) {\r\n if (array1[i] % 2 == 0) {\r\n array2[i] = array1[i] * array1[i];\r\n } \r\n }\r\n return array2[n-1];\r\n}\r\n```",
|
| 47 |
+
"author": "zitongzhoueric",
|
| 48 |
+
"labels": [
|
| 49 |
+
"loopoptim",
|
| 50 |
+
"crash",
|
| 51 |
+
"loop-fusion"
|
| 52 |
+
],
|
| 53 |
+
"comments": [
|
| 54 |
+
{
|
| 55 |
+
"author": "kasuga-fj",
|
| 56 |
+
"body": "I did a quick check and it looks like the SCEV cache is not invalidated properly. I added `SE.forgetLoop(FC0.L)` after `mergeLatch`, which resolved the problem. But I'm not sure if this is a proper fix, and I don't understand the comment `Note: Need to forget the loops before merging the loop latches, ...` in the code.\nhttps://github.com/llvm/llvm-project/blob/cb4ae35de0b4c19149379f16c7b279d80a669f9d/llvm/lib/Transforms/Scalar/LoopFuse.cpp#L1725-L1737"
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"author": "madhur13490",
|
| 60 |
+
"body": "Looking into this."
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"author": "1997alireza",
|
| 64 |
+
"body": "The issue is fixed by PR #177455. Close it now."
|
| 65 |
+
}
|
| 66 |
+
]
|
| 67 |
+
},
|
| 68 |
+
"properties": {
|
| 69 |
+
"is_single_file_fix": true,
|
| 70 |
+
"is_single_func_fix": true
|
| 71 |
+
},
|
| 72 |
+
"verified": true
|
| 73 |
+
}
|
dataset/164254.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "164254",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/164254",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "02c9e8987a22753417c721eba5e5848f3fe33a24",
|
| 6 |
+
"knowledge_cutoff": "2025-10-20T13:33:43Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize",
|
| 9 |
+
"llvm/test/Verifier"
|
| 10 |
+
],
|
| 11 |
+
"hints": {
|
| 12 |
+
"fix_commit": "b8ef25aa643761233dc5b74d9fb7c38a2064d9c7",
|
| 13 |
+
"components": [
|
| 14 |
+
"LoopUtils"
|
| 15 |
+
],
|
| 16 |
+
"bug_location_lineno": {
|
| 17 |
+
"llvm/include/llvm/Transforms/Utils/LoopUtils.h": [
|
| 18 |
+
[
|
| 19 |
+
326,
|
| 20 |
+
332
|
| 21 |
+
],
|
| 22 |
+
[
|
| 23 |
+
353,
|
| 24 |
+
362
|
| 25 |
+
]
|
| 26 |
+
],
|
| 27 |
+
"llvm/lib/Transforms/Utils/LoopUtils.cpp": [
|
| 28 |
+
[
|
| 29 |
+
913,
|
| 30 |
+
923
|
| 31 |
+
]
|
| 32 |
+
]
|
| 33 |
+
},
|
| 34 |
+
"bug_location_funcname": {
|
| 35 |
+
"llvm/lib/Transforms/Utils/LoopUtils.cpp": [
|
| 36 |
+
"llvm::getLoopEstimatedTripCount"
|
| 37 |
+
]
|
| 38 |
+
}
|
| 39 |
+
},
|
| 40 |
+
"patch": "commit b8ef25aa643761233dc5b74d9fb7c38a2064d9c7\nAuthor: Joel E. Denny <jdenny.ornl@gmail.com>\nDate: Tue Nov 25 11:05:13 2025 -0500\n\n [PGO] Fix zeroed estimated trip count (#167792)\n \n Before PR #152775, `llvm::getLoopEstimatedTripCount` never returned 0.\n If `llvm::setLoopEstimatedTripCount` were called with 0, it would zero\n branch weights, causing `llvm::getLoopEstimatedTripCount` to return\n `std::nullopt`.\n \n PR #152775 changed that behavior: if `llvm::setLoopEstimatedTripCount`\n is called with 0, it sets `llvm.loop.estimated_trip_count` to 0, causing\n `llvm::getLoopEstimatedTripCount` to return 0. However, it kept\n documentation saying `llvm::getLoopEstimatedTripCount` returns a\n positive count.\n \n Some passes continue to assume `llvm::getLoopEstimatedTripCount` never\n returns 0 and crash if it does, as reported in issue #164254. To restore\n the behavior they expect, this patch changes\n `llvm::getLoopEstimatedTripCount` to return `std::nullopt` when\n `llvm.loop.estimated_trip_count` is 0.\n\ndiff --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h b/llvm/include/llvm/Transforms/Utils/LoopUtils.h\nindex 86eb21389756..0afba21dfaf8 100644\n--- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h\n+++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h\n@@ -326,7 +326,10 @@ LLVM_ABI void addStringMetadataToLoop(Loop *TheLoop, const char *MDString,\n /// - \\c std::nullopt, if the implementation is unable to handle the loop form\n /// of \\p L (e.g., \\p L must have a latch block that controls the loop exit).\n /// - The value of \\c llvm.loop.estimated_trip_count from the loop metadata of\n-/// \\p L, if that metadata is present.\n+/// \\p L, if that metadata is present. In the special case that the value is\n+/// zero, return \\c std::nullopt instead as that is historically what callers\n+/// expect when a loop is estimated to execute no iterations (i.e., its header\n+/// is not reached).\n /// - Else, a new estimate of the trip count from the latch branch weights of\n /// \\p L.\n ///\n@@ -353,10 +356,11 @@ getLoopEstimatedTripCount(Loop *L,\n /// to handle the loop form of \\p L (e.g., \\p L must have a latch block that\n /// controls the loop exit). Otherwise, return true.\n ///\n-/// In addition, if \\p EstimatedLoopInvocationWeight, set the branch weight\n-/// metadata of \\p L to reflect that \\p L has an estimated\n-/// \\p EstimatedTripCount iterations and has \\c *EstimatedLoopInvocationWeight\n-/// exit weight through the loop's latch.\n+/// In addition, if \\p EstimatedLoopInvocationWeight:\n+/// - Set the branch weight metadata of \\p L to reflect that \\p L has an\n+/// estimated \\p EstimatedTripCount iterations and has\n+/// \\c *EstimatedLoopInvocationWeight exit weight through the loop's latch.\n+/// - If \\p EstimatedTripCount is zero, zero the branch weights.\n ///\n /// TODO: Eventually, once all passes have migrated away from setting branch\n /// weights to indicate estimated trip counts, this function will drop the\ndiff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp\nindex 6e60b94be78e..8e2a4f80fce1 100644\n--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp\n+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp\n@@ -913,11 +913,26 @@ llvm::getLoopEstimatedTripCount(Loop *L,\n \n // Return the estimated trip count from metadata unless the metadata is\n // missing or has no value.\n+ //\n+ // Some passes set llvm.loop.estimated_trip_count to 0. For example, after\n+ // peeling 10 or more iterations from a loop with an estimated trip count of\n+ // 10, llvm.loop.estimated_trip_count becomes 0 on the remaining loop. It\n+ // indicates that, each time execution reaches the peeled iterations,\n+ // execution is estimated to exit them without reaching the remaining loop's\n+ // header.\n+ //\n+ // Even if the probability of reaching a loop's header is low, if it is\n+ // reached, it is the start of an iteration. Consequently, some passes\n+ // historically assume that llvm::getLoopEstimatedTripCount always returns a\n+ // positive count or std::nullopt. Thus, return std::nullopt when\n+ // llvm.loop.estimated_trip_count is 0.\n if (auto TC = getOptionalIntLoopAttribute(L, LLVMLoopEstimatedTripCount)) {\n LLVM_DEBUG(dbgs() << \"getLoopEstimatedTripCount: \"\n << LLVMLoopEstimatedTripCount << \" metadata has trip \"\n- << \"count of \" << *TC << \" for \" << DbgLoop(L) << \"\\n\");\n- return TC;\n+ << \"count of \" << *TC\n+ << (*TC == 0 ? \" (returning std::nullopt)\" : \"\")\n+ << \" for \" << DbgLoop(L) << \"\\n\");\n+ return *TC == 0 ? std::nullopt : std::optional(*TC);\n }\n \n // Estimate the trip count from latch branch weights.\n",
|
| 41 |
+
"tests": [
|
| 42 |
+
{
|
| 43 |
+
"file": "llvm/test/Transforms/LoopVectorize/vectorize-zero-estimated-trip-count.ll",
|
| 44 |
+
"commands": [
|
| 45 |
+
"opt -passes=loop-vectorize -S %s"
|
| 46 |
+
],
|
| 47 |
+
"tests": [
|
| 48 |
+
{
|
| 49 |
+
"test_name": "<module>",
|
| 50 |
+
"test_body": "; Check that an estimated trip count of zero does not crash or otherwise break\n; LoopVectorize behavior while it tries to create runtime memory checks inside\n; an outer loop.\n\n\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\n; Look for basic signs that vectorization ran and produced memory checks.\n\ndefine void @test(ptr addrspace(1) %p, i32 %n) {\nentry:\n br label %outer\nouter:\n br label %inner\ninner:\n %i = phi i32 [ %inc, %inner ], [ 0, %outer ]\n store i32 0, ptr addrspace(1) %p\n %load = load i32, ptr addrspace(1) null\n %inc = add i32 %i, 1\n %cmp = icmp slt i32 %i, %n\n br i1 %cmp, label %inner, label %outer.latch\nouter.latch:\n br i1 %cmp, label %outer, label %exit, !llvm.loop !0\nexit:\n ret void\n}\n\n!0 = distinct !{!0, !1}\n!1 = !{!\"llvm.loop.estimated_trip_count\", i32 0}"
|
| 51 |
+
}
|
| 52 |
+
]
|
| 53 |
+
}
|
| 54 |
+
],
|
| 55 |
+
"issue": {
|
| 56 |
+
"title": "Crash at libc.so: (anonymous namespace)::GeneratedRTChecks::getCost() LoopVectorize.cpp:0:0",
|
| 57 |
+
"body": "To reproduce run opt using -passes=loop-vectorize with the test below:\n```\n; ModuleID = './reduced.ll'\nsource_filename = \"./reduced.ll\"\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2\"\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\ndefine void @wombat(ptr addrspace(1) %arg, i64 %arg1) gc \"statepoint-example\" {\nbb:\n br label %bb3\n\nbb2: ; preds = %bb7\n ret void\n\nbb3: ; preds = %bb7, %bb\n br label %bb4\n\nbb4: ; preds = %bb4, %bb3\n %phi = phi i64 [ %add6, %bb4 ], [ %arg1, %bb3 ]\n %phi5 = phi i64 [ %add, %bb4 ], [ 0, %bb3 ]\n %add = add i64 0, 0\n store i64 0, ptr addrspace(1) %arg, align 8\n %load = load i64, ptr addrspace(1) null, align 8\n %add6 = add i64 %phi, -3\n %icmp = icmp slt i64 0, %phi\n br i1 %icmp, label %bb4, label %bb7\n\nbb7: ; preds = %bb4\n br i1 %icmp, label %bb3, label %bb2, !llvm.loop !0\n}\n\n!0 = distinct !{!0, !1, !2, !3}\n!1 = !{!\"llvm.loop.peeled.count\", i32 1}\n!2 = !{!\"llvm.loop.estimated_trip_count\", i32 0}\n!3 = !{!\"llvm.loop.unroll.disable\"}\n```\nReproducer: https://godbolt.org/z/W5W91TEhM\n\nStack dump:\n```\n\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=loop-vectorize <source>\n1.\tRunning pass \"function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)\" on module \"<source>\"\n2.\tRunning pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"wombat\"\n #0 0x0000000005945ce8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5945ce8)\n #1 0x0000000005942b94 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x00007cec2dc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x0000000003670b82 (anonymous namespace)::GeneratedRTChecks::getCost() LoopVectorize.cpp:0:0\n #4 0x000000000369a7c0 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x369a7c0)\n #5 0x000000000369d130 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x369d130)\n #6 0x000000000369d85b llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x369d85b)\n #7 0x0000000002f8868e llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2f8868e)\n #8 0x00000000057202b1 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57202b1)\n #9 0x0000000000ef5fce llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xef5fce)\n#10 0x000000000571e81a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x571e81a)\n#11 0x000000000097887e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97887e)\n#12 0x000000000571e1d1 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x571e1d1)\n#13 0x000000000098298a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x98298a)\n#14 0x0000000000976c0e optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x976c0e)\n#15 0x00007cec2dc29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#16 0x00007cec2dc29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#17 0x000000000096df65 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96df65)\nProgram terminated with signal: SIGFPE\nCompiler returned: 136\n```",
|
| 58 |
+
"author": "TatyanaDoubts",
|
| 59 |
+
"labels": [
|
| 60 |
+
"crash",
|
| 61 |
+
"llvm:transforms"
|
| 62 |
+
],
|
| 63 |
+
"comments": [
|
| 64 |
+
{
|
| 65 |
+
"author": "TatyanaDoubts",
|
| 66 |
+
"body": "Fault commit for this bug is commit afb262855e755b499a733c2b84b6a1cb789b3b1f\n\nAuthor: Joel E. Denny <[jdenny.ornl@gmail.com](mailto:jdenny.ornl@gmail.com)>\n@jdenny-ornl \n\nDate: Thu Oct 2 12:07:55 2025 -0400\n\n \n\n [LoopPeel] Fix branch weights' effect on block frequencies (#128785)\n\n \n\n [LoopPeel] Fix branch weights' effect on block frequencies\n\n \n\n This patch implements the LoopPeel changes discussed in [[RFC] Fix Loop\n\n Transformations to Preserve Block\n\n Frequencies]([[RFC] Fix Loop Transformations to Preserve Block Frequencies](https://discourse.llvm.org/t/rfc-fix-loop-transformations-to-preserve-block-frequencies/85785) ).\n\n \n\n In summary, a loop's latch block can have branch weight metadata that\n\n encodes an estimated trip count that is derived from application profile\n\n data. Initially, the loop body's block frequencies agree with the\n\n estimated trip count, as expected. However, sometimes loop\n\n transformations adjust those branch weights in a way that correctly\n\n maintains the estimated trip count but that corrupts the block\n\n frequencies. This patch addresses that problem in LoopPeel, which it\n\n changes to:\n\n \n\nMaintain branch weights consistently with the original loop for the\n\n sake of preserving the total frequency of the original loop body.\n\nStore the new estimated trip count in the\n\n `llvm.loop.estimated_trip_count` metadata, introduced by PR #148758."
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"author": "jdenny-ornl",
|
| 70 |
+
"body": "> Fault commit for this bug is commit [afb2628](https://github.com/llvm/llvm-project/commit/afb262855e755b499a733c2b84b6a1cb789b3b1f)\n\nThanks for the report.\n\nFor me, the above reproducer still reproduces at 5bbf72400cfe, the immediately preceding commit.\n\nI think the problem is actually 0e3c5566c0c6, which changes getLoopEstimatedTripCount so it no longer guarantees its result is non-zero. I will work on a fix.\n\nThe reproducer above explicitly sets `llvm.loop.estimated_trip_count` to zero. Where did that reproducer come from?"
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"author": "TatyanaDoubts",
|
| 74 |
+
"body": "The reproducer was extracted from the crash dump of java test generated by Fuzzer."
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"author": "jdenny-ornl",
|
| 78 |
+
"body": "If possible, would you please try PR #167792? It will not fix the reproducer attached to this issue. Instead, it makes the `!{!\"llvm.loop.estimated_trip_count\", i32 0}` there invalid. However, my expectation is that it will fix your original java reproducer because the `!{!\"llvm.loop.estimated_trip_count\", i32 0}` will no longer be generated."
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"author": "jdenny-ornl",
|
| 82 |
+
"body": "> If possible, would you please try PR [#167792](https://github.com/llvm/llvm-project/pull/167792)?\n\nI've rewritten that PR. Please try it now. Sorry for the churn.\n\n> It will not fix the reproducer attached to this issue.\n\nIt does now, but please try your original java reproducer too.\n"
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"author": "jdenny-ornl",
|
| 86 |
+
"body": "@TatyanaDoubts PR #167792 has been merged into main. Let us know if it resolves the issue for you."
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"author": "TatyanaDoubts",
|
| 90 |
+
"body": "PR https://github.com/llvm/llvm-project/pull/167792 fixed the issue."
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"author": "jdenny-ornl",
|
| 94 |
+
"body": "Thanks for confirming."
|
| 95 |
+
}
|
| 96 |
+
]
|
| 97 |
+
},
|
| 98 |
+
"properties": {
|
| 99 |
+
"is_single_file_fix": true,
|
| 100 |
+
"is_single_func_fix": true
|
| 101 |
+
},
|
| 102 |
+
"verified": true
|
| 103 |
+
}
|
dataset/165014.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "165014",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/165014",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "90489adf7a9944f53e7be411bab92174d9e069d1",
|
| 6 |
+
"knowledge_cutoff": "2025-10-24T17:04:27Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Analysis/DependenceAnalysis"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "616f3b5aa118e95089679fd2a2b79fe769bbaf9a",
|
| 12 |
+
"components": [
|
| 13 |
+
"DependenceAnalysis"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Analysis/DependenceAnalysis.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1131,
|
| 19 |
+
1139
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Analysis/DependenceAnalysis.cpp": [
|
| 25 |
+
"DependenceInfo::haveSameSD"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 616f3b5aa118e95089679fd2a2b79fe769bbaf9a\nAuthor: Shimin Cui <scui@ca.ibm.com>\nDate: Mon Oct 27 15:17:51 2025 -0400\n\n [DA] Fix crash when two loops have different type sizes of becount (#165021)\n \n The type sizes of backedge taken counts for two loops can be different\n and this is to fix the crash in haveSameSD\n (https://github.com/llvm/llvm-project/issues/165014).\n \n ---------\n \n Co-authored-by: Shimin Cui <scui@xlperflep9.rtp.raleigh.ibm.com>\n\ndiff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp\nindex a572eefddd20..84ee8c0bf3e1 100644\n--- a/llvm/lib/Analysis/DependenceAnalysis.cpp\n+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp\n@@ -1131,9 +1131,14 @@ bool DependenceInfo::haveSameSD(const Loop *SrcLoop,\n if (SE->hasLoopInvariantBackedgeTakenCount(DstLoop))\n DstUP = SE->getBackedgeTakenCount(DstLoop);\n \n- if (SrcUB != nullptr && DstUP != nullptr &&\n- SE->isKnownPredicate(ICmpInst::ICMP_EQ, SrcUB, DstUP))\n- return true;\n+ if (SrcUB != nullptr && DstUP != nullptr) {\n+ Type *WiderType = SE->getWiderType(SrcUB->getType(), DstUP->getType());\n+ SrcUB = SE->getNoopOrZeroExtend(SrcUB, WiderType);\n+ DstUP = SE->getNoopOrZeroExtend(DstUP, WiderType);\n+\n+ if (SE->isKnownPredicate(ICmpInst::ICMP_EQ, SrcUB, DstUP))\n+ return true;\n+ }\n \n return false;\n }\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Analysis/DependenceAnalysis/same-sd-for-diff-becount-type-loops.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt < %s -disable-output \"-passes=print<da>\" -aa-pipeline=basic-aa 2>&1"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "\ndefine void @f1() {\n;\nentry:\n br label %for.1.header\n\nfor.1.header: ; preds = %for.2.end, %entry\n br label %for.1.body\n\nfor.1.body: ; preds = %for.1.body, %whiledo\n %0 = phi i32 [ 0, %for.1.header ], [ 1, %for.1.body ]\n store i32 0, ptr null, align 4\n %1 = icmp ult i32 %0, 1\n br i1 %1, label %for.1.body, label %for.1.end\n\nfor.1.end: ; preds = %for.1.body\n br label %for.2.body\n\nfor.2.body: ; preds = %for.2.body, %for.1.end\n %2 = load i32, ptr null, align 4\n br i1 false, label %for.2.body, label %exit\n\nexit: ; preds = %for.2.body\n ret void\n}\n\ndefine void @f2() {\n;\nentry:\n br label %for.1.header\n\nfor.1.header: ; preds = %for.2.end, %entry\n br label %for.1.body\n\nfor.1.body: ; preds = %for.1.body, %whiledo\n %0 = phi i32 [ 0, %for.1.header ], [ 1, %for.1.body ]\n store i32 0, ptr null, align 4\n %1 = icmp ult i32 %0, 1\n br i1 %1, label %for.1.body, label %for.1.end\n\nfor.1.end: ; preds = %for.1.body\n br label %for.2.body\n\nfor.2.body: ; preds = %for.2.body, %for.1.end\n %2 = phi i64 [ 0, %for.1.end ], [ %4, %for.2.body ]\n %3 = load i32, ptr null, align 4\n %4 = add nuw nsw i64 %2, 1\n %5 = icmp ult i64 %4, 2\n br i1 %5, label %for.2.body, label %exit\n\nexit: ; preds = %for.2.body\n ret void\n}"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[DA] Assertion `BitWidth == RHS.BitWidth && \"Comparison requires equal bit widths\"'",
|
| 46 |
+
"body": "test case:\n\n```\ndefine void @f1() {\nentry:\n br label %for.1.header\n\nfor.1.header: ; preds = %for.2.end, %entry\n br label %for.1.body\n\nfor.1.body: ; preds = %for.1.body, %whiledo\n %0 = phi i32 [ 0, %for.1.header ], [ 1, %for.1.body ]\n store i32 0, ptr null, align 4\n %1 = icmp ult i32 %0, 1\n br i1 %1, label %for.1.body, label %for.1.end\n\nfor.1.end: ; preds = %for.1.body\n br label %for.2.body\n\nfor.2.body: ; preds = %for.2.body, %for.1.end\n %2 = load i32, ptr null, align 4\n br i1 false, label %for.2.body, label %exit\n\nexit: ; preds = %for.2.body\n ret void\n}\n```\n\nCompiled with:\n\n`opt -disable-output \"-passes=print<da>\" -aa-pipeline=basic-aa`\n\nassertion:\n\n```\nopt: /home/scui/llvm/dev/llvm-project/llvm/include/llvm/ADT/APInt.h:1057: bool llvm::APInt::operator==(const APInt &) const: Assertion `BitWidth == RHS.BitWidth && \"Comparison requires equal bit widths\"' failed.\nPLEASE submit a bug report to https://ibm.biz/openxlcpp-support and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: opt -disable-output -passes=print<da> -aa-pipeline=basic-aa t.ll\n1.\tRunning pass \"function(print<da>)\" on module \"t.ll\"\n2.\tRunning pass \"print<da>\" on function \"f1\"\nStack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):\n0 opt 0x000015d26eb9268c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int, void*) + 124\n1 opt 0x000015d26eb92e34\n2 opt 0x000015d26eb8efbc llvm::sys::RunSignalHandlers() + 284\n3 opt 0x000015d26eb93b4c\n4 linux-vdso64.so.1 0x00007afbe77b0444 __kernel_sigtramp_rt64 + 0\n5 libc.so.6 0x00007afbe6f455fc pthread_kill + 396\n6 libc.so.6 0x00007afbe6edbd5c gsignal + 44\n7 libc.so.6 0x00007afbe6eb645c abort + 340\n8 libc.so.6 0x00007afbe6ecd824\n9 libc.so.6 0x00007afbe6ecd8c4 __assert_fail + 100\n10 opt 0x000015d26edf0ed8 llvm::ICmpInst::compare(llvm::APInt const&, llvm::APInt const&, llvm::CmpInst::Predicate) + 424\n11 opt 0x000015d26f59f858 llvm::ScalarEvolution::SimplifyICmpOperands(llvm::CmpPredicate&, llvm::SCEV const*&, llvm::SCEV const*&, unsigned int) + 1240\n12 opt 0x000015d26f5a8c00 llvm::ScalarEvolution::isKnownPredicate(llvm::CmpPredicate, llvm::SCEV const*, llvm::SCEV const*) + 80\n13 opt 0x000015d26fbdb8d0 llvm::DependenceInfo::haveSameSD(llvm::Loop const*, llvm::Loop const*) const + 336\n14 opt 0x000015d26fbdbbf0 llvm::DependenceInfo::establishNestingLevels(llvm::Instruction const*, llvm::Instruction const*) + 688\n15 opt 0x000015d26fbf4184 llvm::DependenceInfo::depends(llvm::Instruction*, llvm::Instruction*, bool) + 3236\n16 opt 0x000015d26fbd7130\n17 opt 0x000015d26fbd7940 llvm::DependenceAnalysisPrinterPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) + 576\n18 opt 0x000015d2711803cc\n19 opt 0x000015d26eebb360 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) + 480\n20 opt 0x000015d270653d7c\n21 opt 0x000015d26eec1084 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 580\n22 opt 0x000015d2705d79ac\n23 opt 0x000015d26eeb9b20 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 480\n24 opt 0x000015d2705cb81c llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) + 16892\n25 opt 0x000015d26eb52fc8 optMain + 8776\n26 opt 0x000015d26eb4b2c0 main + 32\n27 libc.so.6 0x00007afbe6eb6ca4\n28 libc.so.6 0x00007afbe6eb6eec __libc_start_main + 428\n```",
|
| 47 |
+
"author": "scui-ibm",
|
| 48 |
+
"labels": [
|
| 49 |
+
"crash",
|
| 50 |
+
"llvm:analysis"
|
| 51 |
+
],
|
| 52 |
+
"comments": []
|
| 53 |
+
},
|
| 54 |
+
"properties": {
|
| 55 |
+
"is_single_file_fix": true,
|
| 56 |
+
"is_single_func_fix": true
|
| 57 |
+
},
|
| 58 |
+
"verified": true
|
| 59 |
+
}
|
dataset/165031.json
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "165031",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/165031",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "0603d4af1d8fcd2ac4c08e39b128455ff728fee4",
|
| 6 |
+
"knowledge_cutoff": "2025-10-24T19:28:58Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopFusion"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "9bc38df587def5e88cfb18ec7f912c9a588c5d4b",
|
| 12 |
+
"components": [
|
| 13 |
+
"CodeMoverUtils",
|
| 14 |
+
"LoopFuse"
|
| 15 |
+
],
|
| 16 |
+
"bug_location_lineno": {
|
| 17 |
+
"llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h": [
|
| 18 |
+
[
|
| 19 |
+
27,
|
| 20 |
+
48
|
| 21 |
+
]
|
| 22 |
+
],
|
| 23 |
+
"llvm/lib/Transforms/Scalar/LoopFuse.cpp": [
|
| 24 |
+
[
|
| 25 |
+
64,
|
| 26 |
+
69
|
| 27 |
+
],
|
| 28 |
+
[
|
| 29 |
+
85,
|
| 30 |
+
91
|
| 31 |
+
],
|
| 32 |
+
[
|
| 33 |
+
174,
|
| 34 |
+
183
|
| 35 |
+
],
|
| 36 |
+
[
|
| 37 |
+
358,
|
| 38 |
+
367
|
| 39 |
+
],
|
| 40 |
+
[
|
| 41 |
+
381,
|
| 42 |
+
466
|
| 43 |
+
],
|
| 44 |
+
[
|
| 45 |
+
480,
|
| 46 |
+
487
|
| 47 |
+
],
|
| 48 |
+
[
|
| 49 |
+
490,
|
| 50 |
+
498
|
| 51 |
+
],
|
| 52 |
+
[
|
| 53 |
+
648,
|
| 54 |
+
667
|
| 55 |
+
],
|
| 56 |
+
[
|
| 57 |
+
673,
|
| 58 |
+
706
|
| 59 |
+
],
|
| 60 |
+
[
|
| 61 |
+
849,
|
| 62 |
+
1066
|
| 63 |
+
],
|
| 64 |
+
[
|
| 65 |
+
1488,
|
| 66 |
+
1494
|
| 67 |
+
],
|
| 68 |
+
[
|
| 69 |
+
1497,
|
| 70 |
+
1507
|
| 71 |
+
]
|
| 72 |
+
],
|
| 73 |
+
"llvm/lib/Transforms/Utils/CodeMoverUtils.cpp": [
|
| 74 |
+
[
|
| 75 |
+
25,
|
| 76 |
+
32
|
| 77 |
+
],
|
| 78 |
+
[
|
| 79 |
+
228,
|
| 80 |
+
271
|
| 81 |
+
],
|
| 82 |
+
[
|
| 83 |
+
330,
|
| 84 |
+
339
|
| 85 |
+
],
|
| 86 |
+
[
|
| 87 |
+
450,
|
| 88 |
+
457
|
| 89 |
+
]
|
| 90 |
+
]
|
| 91 |
+
},
|
| 92 |
+
"bug_location_funcname": {
|
| 93 |
+
"llvm/lib/Transforms/Scalar/LoopFuse.cpp": [
|
| 94 |
+
"collectFusionCandidates",
|
| 95 |
+
"dependencesAllowFusion",
|
| 96 |
+
"fuseCandidates",
|
| 97 |
+
"invalidate",
|
| 98 |
+
"isAdjacent",
|
| 99 |
+
"isControlFlowEquivalent",
|
| 100 |
+
"operator()",
|
| 101 |
+
"operator<<",
|
| 102 |
+
"peelFusionCandidate",
|
| 103 |
+
"printFusionCandidates",
|
| 104 |
+
"printLoopVector",
|
| 105 |
+
"reportInvalidCandidate"
|
| 106 |
+
],
|
| 107 |
+
"llvm/lib/Transforms/Utils/CodeMoverUtils.cpp": [
|
| 108 |
+
"ControlConditions::isInverse",
|
| 109 |
+
"llvm::isControlFlowEquivalent",
|
| 110 |
+
"llvm::isSafeToMoveBefore",
|
| 111 |
+
"llvm::nonStrictlyPostDominate",
|
| 112 |
+
"reportInvalidCandidate"
|
| 113 |
+
]
|
| 114 |
+
}
|
| 115 |
+
},
|
| 116 |
+
"patch": "commit 9bc38df587def5e88cfb18ec7f912c9a588c5d4b\nAuthor: Alireza Torabian <alireza.torabian@huawei.com>\nDate: Fri Dec 12 15:09:34 2025 -0500\n\n [LoopFusion] Simplifying the legality checks (#171889)\n \n Considering that the current loop fusion only supports adjacent loops,\n we are able to simplify the checks in this pass. By removing\n `isControlFlowEquivalent` check, this patch fixes multiple issues\n including #166560, #166535, #165031, #80301 and #168263.\n \n Now only the sequential/adjacent candidates are collected in the same\n list. This patch is the implementation of approach 2 discussed in post\n #171207.\n\ndiff --git a/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h b/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h\nindex 877872485ab5..d473f7092f62 100644\n--- a/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h\n+++ b/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h\n@@ -27,22 +27,6 @@ class DominatorTree;\n class Instruction;\n class PostDominatorTree;\n \n-/// Return true if \\p I0 and \\p I1 are control flow equivalent.\n-/// Two instructions are control flow equivalent if their basic blocks are\n-/// control flow equivalent.\n-LLVM_ABI bool isControlFlowEquivalent(const Instruction &I0,\n- const Instruction &I1,\n- const DominatorTree &DT,\n- const PostDominatorTree &PDT);\n-\n-/// Return true if \\p BB0 and \\p BB1 are control flow equivalent.\n-/// Two basic blocks are control flow equivalent if when one executes, the other\n-/// is guaranteed to execute.\n-LLVM_ABI bool isControlFlowEquivalent(const BasicBlock &BB0,\n- const BasicBlock &BB1,\n- const DominatorTree &DT,\n- const PostDominatorTree &PDT);\n-\n /// Return true if \\p I can be safely moved before \\p InsertPoint.\n LLVM_ABI bool isSafeToMoveBefore(Instruction &I, Instruction &InsertPoint,\n DominatorTree &DT,\ndiff --git a/llvm/lib/Transforms/Scalar/LoopFuse.cpp b/llvm/lib/Transforms/Scalar/LoopFuse.cpp\nindex 9ffa602416b0..3a06c3f00fa0 100644\n--- a/llvm/lib/Transforms/Scalar/LoopFuse.cpp\n+++ b/llvm/lib/Transforms/Scalar/LoopFuse.cpp\n@@ -64,6 +64,7 @@\n #include \"llvm/Transforms/Utils/CodeMoverUtils.h\"\n #include \"llvm/Transforms/Utils/LoopPeel.h\"\n #include \"llvm/Transforms/Utils/LoopSimplify.h\"\n+#include <list>\n \n using namespace llvm;\n \n@@ -85,7 +86,6 @@ STATISTIC(InvalidDependencies, \"Dependencies prevent fusion\");\n STATISTIC(UnknownTripCount, \"Loop has unknown trip count\");\n STATISTIC(UncomputableTripCount, \"SCEV cannot compute trip count of loop\");\n STATISTIC(NonEqualTripCount, \"Loop trip counts are not the same\");\n-STATISTIC(NonAdjacent, \"Loops are not adjacent\");\n STATISTIC(\n NonEmptyPreheader,\n \"Loop has a non-empty preheader with instructions that cannot be moved\");\n@@ -174,10 +174,6 @@ struct FusionCandidate {\n /// Has this loop been Peeled\n bool Peeled;\n \n- /// Dominator and PostDominator trees are needed for the\n- /// FusionCandidateCompare function, required by FusionCandidateSet to\n- /// determine where the FusionCandidate should be inserted into the set. These\n- /// are used to establish ordering of the FusionCandidates based on dominance.\n DominatorTree &DT;\n const PostDominatorTree *PDT;\n \n@@ -358,10 +354,10 @@ struct FusionCandidate {\n private:\n // This is only used internally for now, to clear the MemWrites and MemReads\n // list and setting Valid to false. I can't envision other uses of this right\n- // now, since once FusionCandidates are put into the FusionCandidateSet they\n+ // now, since once FusionCandidates are put into the FusionCandidateList they\n // are immutable. Thus, any time we need to change/update a FusionCandidate,\n- // we must create a new one and insert it into the FusionCandidateSet to\n- // ensure the FusionCandidateSet remains ordered correctly.\n+ // we must create a new one and insert it into the FusionCandidateList to\n+ // ensure the FusionCandidateList remains ordered correctly.\n void invalidate() {\n MemWrites.clear();\n MemReads.clear();\n@@ -381,86 +377,15 @@ private:\n return false;\n }\n };\n-\n-struct FusionCandidateCompare {\n- /// Comparison functor to sort two Control Flow Equivalent fusion candidates\n- /// into dominance order.\n- /// If LHS dominates RHS and RHS post-dominates LHS, return true;\n- /// If RHS dominates LHS and LHS post-dominates RHS, return false;\n- /// If both LHS and RHS are not dominating each other then, non-strictly\n- /// post dominate check will decide the order of candidates. If RHS\n- /// non-strictly post dominates LHS then, return true. If LHS non-strictly\n- /// post dominates RHS then, return false. If both are non-strictly post\n- /// dominate each other then, level in the post dominator tree will decide\n- /// the order of candidates.\n- bool operator()(const FusionCandidate &LHS,\n- const FusionCandidate &RHS) const {\n- const DominatorTree *DT = &(LHS.DT);\n-\n- BasicBlock *LHSEntryBlock = LHS.getEntryBlock();\n- BasicBlock *RHSEntryBlock = RHS.getEntryBlock();\n-\n- // Do not save PDT to local variable as it is only used in asserts and thus\n- // will trigger an unused variable warning if building without asserts.\n- assert(DT && LHS.PDT && \"Expecting valid dominator tree\");\n-\n- // Do this compare first so if LHS == RHS, function returns false.\n- if (DT->dominates(RHSEntryBlock, LHSEntryBlock)) {\n- // RHS dominates LHS\n- // Verify LHS post-dominates RHS\n- assert(LHS.PDT->dominates(LHSEntryBlock, RHSEntryBlock));\n- return false;\n- }\n-\n- if (DT->dominates(LHSEntryBlock, RHSEntryBlock)) {\n- // Verify RHS Postdominates LHS\n- assert(LHS.PDT->dominates(RHSEntryBlock, LHSEntryBlock));\n- return true;\n- }\n-\n- // If two FusionCandidates are in the same level of dominator tree,\n- // they will not dominate each other, but may still be control flow\n- // equivalent. To sort those FusionCandidates, nonStrictlyPostDominate()\n- // function is needed.\n- bool WrongOrder =\n- nonStrictlyPostDominate(LHSEntryBlock, RHSEntryBlock, DT, LHS.PDT);\n- bool RightOrder =\n- nonStrictlyPostDominate(RHSEntryBlock, LHSEntryBlock, DT, LHS.PDT);\n- if (WrongOrder && RightOrder) {\n- // If common predecessor of LHS and RHS post dominates both\n- // FusionCandidates then, Order of FusionCandidate can be\n- // identified by its level in post dominator tree.\n- DomTreeNode *LNode = LHS.PDT->getNode(LHSEntryBlock);\n- DomTreeNode *RNode = LHS.PDT->getNode(RHSEntryBlock);\n- return LNode->getLevel() > RNode->getLevel();\n- } else if (WrongOrder)\n- return false;\n- else if (RightOrder)\n- return true;\n-\n- // If LHS does not non-strict Postdominate RHS and RHS does not non-strict\n- // Postdominate LHS then, there is no dominance relationship between the\n- // two FusionCandidates. Thus, they should not be in the same set together.\n- llvm_unreachable(\n- \"No dominance relationship between these fusion candidates!\");\n- }\n-};\n } // namespace\n \n using LoopVector = SmallVector<Loop *, 4>;\n \n-// Set of Control Flow Equivalent (CFE) Fusion Candidates, sorted in dominance\n-// order. Thus, if FC0 comes *before* FC1 in a FusionCandidateSet, then FC0\n-// dominates FC1 and FC1 post-dominates FC0.\n-// std::set was chosen because we want a sorted data structure with stable\n-// iterators. A subsequent patch to loop fusion will enable fusing non-adjacent\n-// loops by moving intervening code around. When this intervening code contains\n-// loops, those loops will be moved also. The corresponding FusionCandidates\n-// will also need to be moved accordingly. As this is done, having stable\n-// iterators will simplify the logic. Similarly, having an efficient insert that\n-// keeps the FusionCandidateSet sorted will also simplify the implementation.\n-using FusionCandidateSet = std::set<FusionCandidate, FusionCandidateCompare>;\n-using FusionCandidateCollection = SmallVector<FusionCandidateSet, 4>;\n+// List of adjacent fusion candidates in order. Thus, if FC0 comes *before* FC1\n+// in a FusionCandidateList, then FC0 dominates FC1, FC1 post-dominates FC0,\n+// and they are adjacent.\n+using FusionCandidateList = std::list<FusionCandidate>;\n+using FusionCandidateCollection = SmallVector<FusionCandidateList, 4>;\n \n #ifndef NDEBUG\n static void printLoopVector(const LoopVector &LV) {\n@@ -480,8 +405,8 @@ static raw_ostream &operator<<(raw_ostream &OS, const FusionCandidate &FC) {\n }\n \n static raw_ostream &operator<<(raw_ostream &OS,\n- const FusionCandidateSet &CandSet) {\n- for (const FusionCandidate &FC : CandSet)\n+ const FusionCandidateList &CandList) {\n+ for (const FusionCandidate &FC : CandList)\n OS << FC << '\\n';\n \n return OS;\n@@ -490,9 +415,9 @@ static raw_ostream &operator<<(raw_ostream &OS,\n static void\n printFusionCandidates(const FusionCandidateCollection &FusionCandidates) {\n dbgs() << \"Fusion Candidates: \\n\";\n- for (const auto &CandidateSet : FusionCandidates) {\n- dbgs() << \"*** Fusion Candidate Set ***\\n\";\n- dbgs() << CandidateSet;\n+ for (const auto &CandidateList : FusionCandidates) {\n+ dbgs() << \"*** Fusion Candidate List ***\\n\";\n+ dbgs() << CandidateList;\n dbgs() << \"****************************\\n\";\n }\n }\n@@ -648,20 +573,6 @@ public:\n }\n \n private:\n- /// Determine if two fusion candidates are control flow equivalent.\n- ///\n- /// Two fusion candidates are control flow equivalent if when one executes,\n- /// the other is guaranteed to execute. This is determined using dominators\n- /// and post-dominators: if A dominates B and B post-dominates A then A and B\n- /// are control-flow equivalent.\n- bool isControlFlowEquivalent(const FusionCandidate &FC0,\n- const FusionCandidate &FC1) const {\n- assert(FC0.Preheader && FC1.Preheader && \"Expecting valid preheaders\");\n-\n- return ::isControlFlowEquivalent(*FC0.getEntryBlock(), *FC1.getEntryBlock(),\n- DT, PDT);\n- }\n-\n /// Iterate over all loops in the given loop set and identify the loops that\n /// are eligible for fusion. Place all eligible fusion candidates into Control\n /// Flow Equivalent sets, sorted by dominance.\n@@ -673,34 +584,42 @@ private:\n if (!CurrCand.isEligibleForFusion(SE))\n continue;\n \n- // Go through each list in FusionCandidates and determine if L is control\n- // flow equivalent with the first loop in that list. If it is, append LV.\n+ // Go through each list in FusionCandidates and determine if the first or\n+ // last loop in the list is strictly adjacent to L. If it is, append L.\n // If not, go to the next list.\n // If no suitable list is found, start another list and add it to\n // FusionCandidates.\n- bool FoundSet = false;\n-\n- for (auto &CurrCandSet : FusionCandidates) {\n- if (isControlFlowEquivalent(*CurrCandSet.begin(), CurrCand)) {\n- CurrCandSet.insert(CurrCand);\n- FoundSet = true;\n+ bool FoundAdjacent = false;\n+ for (auto &CurrCandList : FusionCandidates) {\n+ if (isStrictlyAdjacent(CurrCand, CurrCandList.front())) {\n+ CurrCandList.push_front(CurrCand);\n+ FoundAdjacent = true;\n #ifndef NDEBUG\n if (VerboseFusionDebugging)\n LLVM_DEBUG(dbgs() << \"Adding \" << CurrCand\n- << \" to existing candidate set\\n\");\n+ << \" to existing candidate list\\n\");\n+#endif\n+ break;\n+ } else if (isStrictlyAdjacent(CurrCandList.back(), CurrCand)) {\n+ CurrCandList.push_back(CurrCand);\n+ FoundAdjacent = true;\n+#ifndef NDEBUG\n+ if (VerboseFusionDebugging)\n+ LLVM_DEBUG(dbgs() << \"Adding \" << CurrCand\n+ << \" to existing candidate list\\n\");\n #endif\n break;\n }\n }\n- if (!FoundSet) {\n- // No set was found. Create a new set and add to FusionCandidates\n+ if (!FoundAdjacent) {\n+ // No list was found. Create a new list and add to FusionCandidates\n #ifndef NDEBUG\n if (VerboseFusionDebugging)\n- LLVM_DEBUG(dbgs() << \"Adding \" << CurrCand << \" to new set\\n\");\n+ LLVM_DEBUG(dbgs() << \"Adding \" << CurrCand << \" to new list\\n\");\n #endif\n- FusionCandidateSet NewCandSet;\n- NewCandSet.insert(CurrCand);\n- FusionCandidates.push_back(NewCandSet);\n+ FusionCandidateList NewCandList;\n+ NewCandList.push_back(CurrCand);\n+ FusionCandidates.push_back(NewCandList);\n }\n NumFusionCandidates++;\n }\n@@ -849,218 +768,205 @@ private:\n }\n }\n \n- /// Walk each set of control flow equivalent fusion candidates and attempt to\n- /// fuse them. This does a single linear traversal of all candidates in the\n- /// set. The conditions for legal fusion are checked at this point. If a pair\n- /// of fusion candidates passes all legality checks, they are fused together\n- /// and a new fusion candidate is created and added to the FusionCandidateSet.\n+ /// Walk each set of strictly adjacent fusion candidates and attempt to fuse\n+ /// them. This does a single linear traversal of all candidates in the list.\n+ /// The conditions for legal fusion are checked at this point. If a pair of\n+ /// fusion candidates passes all legality checks, they are fused together and\n+ /// a new fusion candidate is created and added to the FusionCandidateList.\n /// The original fusion candidates are then removed, as they are no longer\n /// valid.\n bool fuseCandidates() {\n bool Fused = false;\n LLVM_DEBUG(printFusionCandidates(FusionCandidates));\n- for (auto &CandidateSet : FusionCandidates) {\n- if (CandidateSet.size() < 2)\n+ for (auto &CandidateList : FusionCandidates) {\n+ if (CandidateList.size() < 2)\n continue;\n \n- LLVM_DEBUG(dbgs() << \"Attempting fusion on Candidate Set:\\n\"\n- << CandidateSet << \"\\n\");\n-\n- for (auto FC0 = CandidateSet.begin(); FC0 != CandidateSet.end(); ++FC0) {\n- assert(!LDT.isRemovedLoop(FC0->L) &&\n- \"Should not have removed loops in CandidateSet!\");\n- auto FC1 = FC0;\n- for (++FC1; FC1 != CandidateSet.end(); ++FC1) {\n- assert(!LDT.isRemovedLoop(FC1->L) &&\n- \"Should not have removed loops in CandidateSet!\");\n-\n- LLVM_DEBUG(dbgs() << \"Attempting to fuse candidate \\n\"; FC0->dump();\n- dbgs() << \" with\\n\"; FC1->dump(); dbgs() << \"\\n\");\n-\n- FC0->verify();\n- FC1->verify();\n-\n- // Check if the candidates have identical tripcounts (first value of\n- // pair), and if not check the difference in the tripcounts between\n- // the loops (second value of pair). The difference is not equal to\n- // std::nullopt iff the loops iterate a constant number of times, and\n- // have a single exit.\n- std::pair<bool, std::optional<unsigned>> IdenticalTripCountRes =\n- haveIdenticalTripCounts(*FC0, *FC1);\n- bool SameTripCount = IdenticalTripCountRes.first;\n- std::optional<unsigned> TCDifference = IdenticalTripCountRes.second;\n-\n- // Here we are checking that FC0 (the first loop) can be peeled, and\n- // both loops have different tripcounts.\n- if (FC0->AbleToPeel && !SameTripCount && TCDifference) {\n- if (*TCDifference > FusionPeelMaxCount) {\n- LLVM_DEBUG(dbgs()\n- << \"Difference in loop trip counts: \" << *TCDifference\n- << \" is greater than maximum peel count specificed: \"\n- << FusionPeelMaxCount << \"\\n\");\n- } else {\n- // Dependent on peeling being performed on the first loop, and\n- // assuming all other conditions for fusion return true.\n- SameTripCount = true;\n- }\n- }\n+ LLVM_DEBUG(dbgs() << \"Attempting fusion on Candidate List:\\n\"\n+ << CandidateList << \"\\n\");\n \n- if (!SameTripCount) {\n- LLVM_DEBUG(dbgs() << \"Fusion candidates do not have identical trip \"\n- \"counts. Not fusing.\\n\");\n- reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1,\n- NonEqualTripCount);\n- continue;\n- }\n+ for (auto It = CandidateList.begin(), NextIt = std::next(It);\n+ NextIt != CandidateList.end(); It = NextIt, NextIt = std::next(It)) {\n \n- if (!isAdjacent(*FC0, *FC1)) {\n- LLVM_DEBUG(dbgs()\n- << \"Fusion candidates are not adjacent. Not fusing.\\n\");\n- reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1, NonAdjacent);\n- continue;\n- }\n+ auto FC0 = *It;\n+ auto FC1 = *NextIt;\n \n- if ((!FC0->GuardBranch && FC1->GuardBranch) ||\n- (FC0->GuardBranch && !FC1->GuardBranch)) {\n- LLVM_DEBUG(dbgs() << \"The one of candidate is guarded while the \"\n- \"another one is not. Not fusing.\\n\");\n- reportLoopFusion<OptimizationRemarkMissed>(\n- *FC0, *FC1, OnlySecondCandidateIsGuarded);\n- continue;\n- }\n+ assert(!LDT.isRemovedLoop(FC0.L) &&\n+ \"Should not have removed loops in CandidateList!\");\n+ assert(!LDT.isRemovedLoop(FC1.L) &&\n+ \"Should not have removed loops in CandidateList!\");\n \n- // Ensure that FC0 and FC1 have identical guards.\n- // If one (or both) are not guarded, this check is not necessary.\n- if (FC0->GuardBranch && FC1->GuardBranch &&\n- !haveIdenticalGuards(*FC0, *FC1) && !TCDifference) {\n- LLVM_DEBUG(dbgs() << \"Fusion candidates do not have identical \"\n- \"guards. Not Fusing.\\n\");\n- reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1,\n- NonIdenticalGuards);\n- continue;\n- }\n+ LLVM_DEBUG(dbgs() << \"Attempting to fuse candidate \\n\"; FC0.dump();\n+ dbgs() << \" with\\n\"; FC1.dump(); dbgs() << \"\\n\");\n \n- if (FC0->GuardBranch) {\n- assert(FC1->GuardBranch && \"Expecting valid FC1 guard branch\");\n-\n- if (!isSafeToMoveBefore(*FC0->ExitBlock,\n- *FC1->ExitBlock->getFirstNonPHIOrDbg(), DT,\n- &PDT, &DI)) {\n- LLVM_DEBUG(dbgs() << \"Fusion candidate contains unsafe \"\n- \"instructions in exit block. Not fusing.\\n\");\n- reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1,\n- NonEmptyExitBlock);\n- continue;\n- }\n+ FC0.verify();\n+ FC1.verify();\n \n- if (!isSafeToMoveBefore(\n- *FC1->GuardBranch->getParent(),\n- *FC0->GuardBranch->getParent()->getTerminator(), DT, &PDT,\n- &DI)) {\n- LLVM_DEBUG(dbgs()\n- << \"Fusion candidate contains unsafe \"\n- \"instructions in guard block. Not fusing.\\n\");\n- reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1,\n- NonEmptyGuardBlock);\n- continue;\n- }\n- }\n-\n- // Check the dependencies across the loops and do not fuse if it would\n- // violate them.\n- if (!dependencesAllowFusion(*FC0, *FC1)) {\n- LLVM_DEBUG(dbgs() << \"Memory dependencies do not allow fusion!\\n\");\n- reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1,\n- InvalidDependencies);\n- continue;\n- }\n+ // Check if the candidates have identical tripcounts (first value of\n+ // pair), and if not check the difference in the tripcounts between\n+ // the loops (second value of pair). The difference is not equal to\n+ // std::nullopt iff the loops iterate a constant number of times, and\n+ // have a single exit.\n+ std::pair<bool, std::optional<unsigned>> IdenticalTripCountRes =\n+ haveIdenticalTripCounts(FC0, FC1);\n+ bool SameTripCount = IdenticalTripCountRes.first;\n+ std::optional<unsigned> TCDifference = IdenticalTripCountRes.second;\n \n- // If the second loop has instructions in the pre-header, attempt to\n- // hoist them up to the first loop's pre-header or sink them into the\n- // body of the second loop.\n- SmallVector<Instruction *, 4> SafeToHoist;\n- SmallVector<Instruction *, 4> SafeToSink;\n- // At this point, this is the last remaining legality check.\n- // Which means if we can make this pre-header empty, we can fuse\n- // these loops\n- if (!isEmptyPreheader(*FC1)) {\n- LLVM_DEBUG(dbgs() << \"Fusion candidate does not have empty \"\n- \"preheader.\\n\");\n-\n- // If it is not safe to hoist/sink all instructions in the\n- // pre-header, we cannot fuse these loops.\n- if (!collectMovablePreheaderInsts(*FC0, *FC1, SafeToHoist,\n- SafeToSink)) {\n- LLVM_DEBUG(dbgs() << \"Could not hoist/sink all instructions in \"\n- \"Fusion Candidate Pre-header.\\n\"\n- << \"Not Fusing.\\n\");\n- reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1,\n- NonEmptyPreheader);\n- continue;\n- }\n+ // Here we are checking that FC0 (the first loop) can be peeled, and\n+ // both loops have different tripcounts.\n+ if (FC0.AbleToPeel && !SameTripCount && TCDifference) {\n+ if (*TCDifference > FusionPeelMaxCount) {\n+ LLVM_DEBUG(dbgs()\n+ << \"Difference in loop trip counts: \" << *TCDifference\n+ << \" is greater than maximum peel count specificed: \"\n+ << FusionPeelMaxCount << \"\\n\");\n+ } else {\n+ // Dependent on peeling being performed on the first loop, and\n+ // assuming all other conditions for fusion return true.\n+ SameTripCount = true;\n }\n+ }\n \n- bool BeneficialToFuse = isBeneficialFusion(*FC0, *FC1);\n- LLVM_DEBUG(dbgs()\n- << \"\\tFusion appears to be \"\n- << (BeneficialToFuse ? \"\" : \"un\") << \"profitable!\\n\");\n- if (!BeneficialToFuse) {\n- reportLoopFusion<OptimizationRemarkMissed>(*FC0, *FC1,\n- FusionNotBeneficial);\n- continue;\n- }\n- // All analysis has completed and has determined that fusion is legal\n- // and profitable. At this point, start transforming the code and\n- // perform fusion.\n+ if (!SameTripCount) {\n+ LLVM_DEBUG(dbgs() << \"Fusion candidates do not have identical trip \"\n+ \"counts. Not fusing.\\n\");\n+ reportLoopFusion<OptimizationRemarkMissed>(FC0, FC1,\n+ NonEqualTripCount);\n+ continue;\n+ }\n \n- // Execute the hoist/sink operations on preheader instructions\n- movePreheaderInsts(*FC0, *FC1, SafeToHoist, SafeToSink);\n+ if ((!FC0.GuardBranch && FC1.GuardBranch) ||\n+ (FC0.GuardBranch && !FC1.GuardBranch)) {\n+ LLVM_DEBUG(dbgs() << \"The one of candidate is guarded while the \"\n+ \"another one is not. Not fusing.\\n\");\n+ reportLoopFusion<OptimizationRemarkMissed>(\n+ FC0, FC1, OnlySecondCandidateIsGuarded);\n+ continue;\n+ }\n \n- LLVM_DEBUG(dbgs() << \"\\tFusion is performed: \" << *FC0 << \" and \"\n- << *FC1 << \"\\n\");\n+ // Ensure that FC0 and FC1 have identical guards.\n+ // If one (or both) are not guarded, this check is not necessary.\n+ if (FC0.GuardBranch && FC1.GuardBranch &&\n+ !haveIdenticalGuards(FC0, FC1) && !TCDifference) {\n+ LLVM_DEBUG(dbgs() << \"Fusion candidates do not have identical \"\n+ \"guards. Not Fusing.\\n\");\n+ reportLoopFusion<OptimizationRemarkMissed>(FC0, FC1,\n+ NonIdenticalGuards);\n+ continue;\n+ }\n \n- FusionCandidate FC0Copy = *FC0;\n- // Peel the loop after determining that fusion is legal. The Loops\n- // will still be safe to fuse after the peeling is performed.\n- bool Peel = TCDifference && *TCDifference > 0;\n- if (Peel)\n- peelFusionCandidate(FC0Copy, *FC1, *TCDifference);\n+ if (FC0.GuardBranch) {\n+ assert(FC1.GuardBranch && \"Expecting valid FC1 guard branch\");\n \n- // Report fusion to the Optimization Remarks.\n- // Note this needs to be done *before* performFusion because\n- // performFusion will change the original loops, making it not\n- // possible to identify them after fusion is complete.\n- reportLoopFusion<OptimizationRemark>((Peel ? FC0Copy : *FC0), *FC1,\n- FuseCounter);\n+ if (!isSafeToMoveBefore(*FC0.ExitBlock,\n+ *FC1.ExitBlock->getFirstNonPHIOrDbg(), DT,\n+ &PDT, &DI)) {\n+ LLVM_DEBUG(dbgs() << \"Fusion candidate contains unsafe \"\n+ \"instructions in exit block. Not fusing.\\n\");\n+ reportLoopFusion<OptimizationRemarkMissed>(FC0, FC1,\n+ NonEmptyExitBlock);\n+ continue;\n+ }\n \n- FusionCandidate FusedCand(\n- performFusion((Peel ? FC0Copy : *FC0), *FC1), DT, &PDT, ORE,\n- FC0Copy.PP);\n- FusedCand.verify();\n- assert(FusedCand.isEligibleForFusion(SE) &&\n- \"Fused candidate should be eligible for fusion!\");\n+ if (!isSafeToMoveBefore(\n+ *FC1.GuardBranch->getParent(),\n+ *FC0.GuardBranch->getParent()->getTerminator(), DT, &PDT,\n+ &DI)) {\n+ LLVM_DEBUG(dbgs() << \"Fusion candidate contains unsafe \"\n+ \"instructions in guard block. Not fusing.\\n\");\n+ reportLoopFusion<OptimizationRemarkMissed>(FC0, FC1,\n+ NonEmptyGuardBlock);\n+ continue;\n+ }\n+ }\n \n- // Notify the loop-depth-tree that these loops are not valid objects\n- LDT.removeLoop(FC1->L);\n+ // Check the dependencies across the loops and do not fuse if it would\n+ // violate them.\n+ if (!dependencesAllowFusion(FC0, FC1)) {\n+ LLVM_DEBUG(dbgs() << \"Memory dependencies do not allow fusion!\\n\");\n+ reportLoopFusion<OptimizationRemarkMissed>(FC0, FC1,\n+ InvalidDependencies);\n+ continue;\n+ }\n \n- CandidateSet.erase(FC0);\n- CandidateSet.erase(FC1);\n+ // If the second loop has instructions in the pre-header, attempt to\n+ // hoist them up to the first loop's pre-header or sink them into the\n+ // body of the second loop.\n+ SmallVector<Instruction *, 4> SafeToHoist;\n+ SmallVector<Instruction *, 4> SafeToSink;\n+ // At this point, this is the last remaining legality check.\n+ // Which means if we can make this pre-header empty, we can fuse\n+ // these loops\n+ if (!isEmptyPreheader(FC1)) {\n+ LLVM_DEBUG(dbgs() << \"Fusion candidate does not have empty \"\n+ \"preheader.\\n\");\n+\n+ // If it is not safe to hoist/sink all instructions in the\n+ // pre-header, we cannot fuse these loops.\n+ if (!collectMovablePreheaderInsts(FC0, FC1, SafeToHoist,\n+ SafeToSink)) {\n+ LLVM_DEBUG(dbgs() << \"Could not hoist/sink all instructions in \"\n+ \"Fusion Candidate Pre-header.\\n\"\n+ << \"Not Fusing.\\n\");\n+ reportLoopFusion<OptimizationRemarkMissed>(FC0, FC1,\n+ NonEmptyPreheader);\n+ continue;\n+ }\n+ }\n \n- auto InsertPos = CandidateSet.insert(FusedCand);\n+ bool BeneficialToFuse = isBeneficialFusion(FC0, FC1);\n+ LLVM_DEBUG(dbgs() << \"\\tFusion appears to be \"\n+ << (BeneficialToFuse ? \"\" : \"un\") << \"profitable!\\n\");\n+ if (!BeneficialToFuse) {\n+ reportLoopFusion<OptimizationRemarkMissed>(FC0, FC1,\n+ FusionNotBeneficial);\n+ continue;\n+ }\n+ // All analysis has completed and has determined that fusion is legal\n+ // and profitable. At this point, start transforming the code and\n+ // perform fusion.\n \n- assert(InsertPos.second &&\n- \"Unable to insert TargetCandidate in CandidateSet!\");\n+ // Execute the hoist/sink operations on preheader instructions\n+ movePreheaderInsts(FC0, FC1, SafeToHoist, SafeToSink);\n \n- // Reset FC0 and FC1 the new (fused) candidate. Subsequent iterations\n- // of the FC1 loop will attempt to fuse the new (fused) loop with the\n- // remaining candidates in the current candidate set.\n- FC0 = FC1 = InsertPos.first;\n+ LLVM_DEBUG(dbgs() << \"\\tFusion is performed: \" << FC0 << \" and \" << FC1\n+ << \"\\n\");\n \n- LLVM_DEBUG(dbgs() << \"Candidate Set (after fusion): \" << CandidateSet\n- << \"\\n\");\n+ FusionCandidate FC0Copy = FC0;\n+ // Peel the loop after determining that fusion is legal. The Loops\n+ // will still be safe to fuse after the peeling is performed.\n+ bool Peel = TCDifference && *TCDifference > 0;\n+ if (Peel)\n+ peelFusionCandidate(FC0Copy, FC1, *TCDifference);\n+\n+ // Report fusion to the Optimization Remarks.\n+ // Note this needs to be done *before* performFusion because\n+ // performFusion will change the original loops, making it not\n+ // possible to identify them after fusion is complete.\n+ reportLoopFusion<OptimizationRemark>((Peel ? FC0Copy : FC0), FC1,\n+ FuseCounter);\n+\n+ FusionCandidate FusedCand(performFusion((Peel ? FC0Copy : FC0), FC1),\n+ DT, &PDT, ORE, FC0Copy.PP);\n+ FusedCand.verify();\n+ assert(FusedCand.isEligibleForFusion(SE) &&\n+ \"Fused candidate should be eligible for fusion!\");\n+\n+ // Notify the loop-depth-tree that these loops are not valid objects\n+ LDT.removeLoop(FC1.L);\n+\n+ // Replace FC0 and FC1 with their fused loop\n+ It = CandidateList.erase(It);\n+ It = CandidateList.erase(It);\n+ It = CandidateList.insert(It, FusedCand);\n+\n+ // Start from FusedCand in the next iteration\n+ NextIt = It;\n+\n+ LLVM_DEBUG(dbgs() << \"Candidate List (after fusion): \" << CandidateList\n+ << \"\\n\");\n \n- Fused = true;\n- }\n+ Fused = true;\n }\n }\n return Fused;\n@@ -1488,7 +1394,7 @@ private:\n return true;\n }\n \n- /// Determine if two fusion candidates are adjacent in the CFG.\n+ /// Determine if two fusion candidates are strictly adjacent in the CFG.\n ///\n /// This method will determine if there are additional basic blocks in the CFG\n /// between the exit of \\p FC0 and the entry of \\p FC1.\n@@ -1497,11 +1403,14 @@ private:\n /// FC1. If not, then the loops are not adjacent. If the two candidates are\n /// not guarded loops, then it checks whether the exit block of \\p FC0 is the\n /// preheader of \\p FC1.\n- bool isAdjacent(const FusionCandidate &FC0,\n- const FusionCandidate &FC1) const {\n+ /// Strictly means there is no predecessor for FC1 unless it is from FC0,\n+ /// i.e., FC0 dominates FC1.\n+ bool isStrictlyAdjacent(const FusionCandidate &FC0,\n+ const FusionCandidate &FC1) const {\n // If the successor of the guard branch is FC1, then the loops are adjacent\n if (FC0.GuardBranch)\n- return FC0.getNonLoopBlock() == FC1.getEntryBlock();\n+ return DT.dominates(FC0.getEntryBlock(), FC1.getEntryBlock()) &&\n+ FC0.getNonLoopBlock() == FC1.getEntryBlock();\n else\n return FC0.ExitBlock == FC1.getEntryBlock();\n }\ndiff --git a/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp b/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp\nindex 0e076c60d608..8384d46837a7 100644\n--- a/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp\n+++ b/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp\n@@ -25,8 +25,6 @@ using namespace llvm;\n STATISTIC(HasDependences,\n \"Cannot move across instructions that has memory dependences\");\n STATISTIC(MayThrowException, \"Cannot move across instructions that may throw\");\n-STATISTIC(NotControlFlowEquivalent,\n- \"Instructions are not control flow equivalent\");\n STATISTIC(NotMovedPHINode, \"Movement of PHINodes are not supported\");\n STATISTIC(NotMovedTerminator, \"Movement of Terminator are not supported\");\n \n@@ -228,44 +226,6 @@ bool ControlConditions::isInverse(const Value &V1, const Value &V2) {\n return false;\n }\n \n-bool llvm::isControlFlowEquivalent(const Instruction &I0, const Instruction &I1,\n- const DominatorTree &DT,\n- const PostDominatorTree &PDT) {\n- return isControlFlowEquivalent(*I0.getParent(), *I1.getParent(), DT, PDT);\n-}\n-\n-bool llvm::isControlFlowEquivalent(const BasicBlock &BB0, const BasicBlock &BB1,\n- const DominatorTree &DT,\n- const PostDominatorTree &PDT) {\n- if (&BB0 == &BB1)\n- return true;\n-\n- if ((DT.dominates(&BB0, &BB1) && PDT.dominates(&BB1, &BB0)) ||\n- (PDT.dominates(&BB0, &BB1) && DT.dominates(&BB1, &BB0)))\n- return true;\n-\n- // If the set of conditions required to execute BB0 and BB1 from their common\n- // dominator are the same, then BB0 and BB1 are control flow equivalent.\n- const BasicBlock *CommonDominator = DT.findNearestCommonDominator(&BB0, &BB1);\n- LLVM_DEBUG(dbgs() << \"The nearest common dominator of \" << BB0.getName()\n- << \" and \" << BB1.getName() << \" is \"\n- << CommonDominator->getName() << \"\\n\");\n-\n- const std::optional<ControlConditions> BB0Conditions =\n- ControlConditions::collectControlConditions(BB0, *CommonDominator, DT,\n- PDT);\n- if (BB0Conditions == std::nullopt)\n- return false;\n-\n- const std::optional<ControlConditions> BB1Conditions =\n- ControlConditions::collectControlConditions(BB1, *CommonDominator, DT,\n- PDT);\n- if (BB1Conditions == std::nullopt)\n- return false;\n-\n- return BB0Conditions->isEquivalent(*BB1Conditions);\n-}\n-\n static bool reportInvalidCandidate(const Instruction &I,\n llvm::Statistic &Stat) {\n ++Stat;\n@@ -330,10 +290,6 @@ bool llvm::isSafeToMoveBefore(Instruction &I, Instruction &InsertPoint,\n if (I.isTerminator())\n return reportInvalidCandidate(I, NotMovedTerminator);\n \n- // TODO remove this limitation.\n- if (!isControlFlowEquivalent(I, InsertPoint, DT, *PDT))\n- return reportInvalidCandidate(I, NotControlFlowEquivalent);\n-\n if (isReachedBefore(&I, &InsertPoint, &DT, PDT))\n for (const Use &U : I.uses())\n if (auto *UserInst = dyn_cast<Instruction>(U.getUser())) {\n@@ -450,8 +406,6 @@ bool llvm::nonStrictlyPostDominate(const BasicBlock *ThisBlock,\n const BasicBlock *OtherBlock,\n const DominatorTree *DT,\n const PostDominatorTree *PDT) {\n- assert(isControlFlowEquivalent(*ThisBlock, *OtherBlock, *DT, *PDT) &&\n- \"ThisBlock and OtherBlock must be CFG equivalent!\");\n const BasicBlock *CommonDominator =\n DT->findNearestCommonDominator(ThisBlock, OtherBlock);\n if (CommonDominator == nullptr)\n",
|
| 117 |
+
"tests": [
|
| 118 |
+
{
|
| 119 |
+
"file": "<module>",
|
| 120 |
+
"commands": [
|
| 121 |
+
"opt -S -passes=loop-fusion -disable-output < %s 2>&1"
|
| 122 |
+
],
|
| 123 |
+
"tests": [
|
| 124 |
+
{
|
| 125 |
+
"test_name": "<module>",
|
| 126 |
+
"test_body": "target datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32\"\ntarget triple = \"aarch64-unknown-linux-gnu\"\n\ndefine void @_Z3fn1bis() {\nentry:\n br i1 true, label %for.inc68, label %for.cond8thread-pre-split\n\nfor.cond8thread-pre-split: ; preds = %entry\n br i1 false, label %for.inc68, label %for.inc33\n\nfor.inc33: ; preds = %for.inc33, %for.cond8thread-pre-split\n br i1 false, label %for.inc33, label %for.cond52.preheader\n\nfor.cond52.preheader: ; preds = %for.cond52.preheader, %for.inc33\n br i1 false, label %for.cond52.preheader, label %for.inc68\n\nfor.inc68: ; preds = %for.cond52.preheader, %for.cond8thread-pre-split, %entry\n br i1 true, label %for.inc68.2, label %for.cond8thread-pre-split.1\n\nfor.cond8thread-pre-split.1: ; preds = %for.inc68\n br i1 false, label %for.inc68.2, label %for.inc33.1\n\nfor.inc33.1: ; preds = %for.inc33.1, %for.cond8thread-pre-split.1\n br i1 false, label %for.inc33.1, label %for.cond52.preheader.1.preheader\n\nfor.cond52.preheader.1.preheader: ; preds = %for.inc33.1\n ret void\n\nfor.inc68.2: ; preds = %for.cond8thread-pre-split.1, %for.inc68\n ret void\n}"
|
| 127 |
+
}
|
| 128 |
+
]
|
| 129 |
+
}
|
| 130 |
+
],
|
| 131 |
+
"issue": {
|
| 132 |
+
"title": "[LoopFusion] Assert \"ThisBlock and OtherBlock must be CFG equivalent\"",
|
| 133 |
+
"body": "Compilation of this:\n\n```\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32\"\ntarget triple = \"aarch64-unknown-linux-gnu\"\n\ndefine void @_Z3fn1bis() {\nentry:\n br i1 true, label %for.inc68, label %for.cond8thread-pre-split\n\nfor.cond8thread-pre-split: ; preds = %entry\n br i1 false, label %for.inc68, label %for.inc33\n\nfor.inc33: ; preds = %for.inc33, %for.cond8thread-pre-split\n br i1 false, label %for.inc33, label %for.cond52.preheader\n\nfor.cond52.preheader: ; preds = %for.cond52.preheader, %for.inc33\n br i1 false, label %for.cond52.preheader, label %for.inc68\n\nfor.inc68: ; preds = %for.cond52.preheader, %for.cond8thread-pre-split, %entry\n br i1 true, label %for.inc68.2, label %for.cond8thread-pre-split.1\n\nfor.cond8thread-pre-split.1: ; preds = %for.inc68\n br i1 false, label %for.inc68.2, label %for.inc33.1\n\nfor.inc33.1: ; preds = %for.inc33.1, %for.cond8thread-pre-split.1\n br i1 false, label %for.inc33.1, label %for.cond52.preheader.1.preheader\n\nfor.cond52.preheader.1.preheader: ; preds = %for.inc33.1\n ret void\n\nfor.inc68.2: ; preds = %for.cond8thread-pre-split.1, %for.inc68\n ret void\n}\n```\n\nwith `-S -passes=loop-fusion ` results in this crash:\n\n```\nopt: /root/llvm-project/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp:453: bool llvm::nonStrictlyPostDominate(const llvm::BasicBlock*, const llvm::BasicBlock*, const llvm::DominatorTree*, const llvm::PostDominatorTree*): Assertion `isControlFlowEquivalent(*ThisBlock, *OtherBlock, *DT, *PDT) && \"ThisBlock and OtherBlock must be CFG equivalent!\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -S -passes=loop-fusion <source>\n1.\tRunning pass \"function(loop-fusion)\" on module \"<source>\"\n2.\tRunning pass \"loop-fusion\" on function \"_Z3fn1bis\"\n #0 0x0000000005965e58 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5965e58)\n #1 0x0000000005962d04 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x0000723070842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x00007230708969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x0000723070842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x00007230708287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x000072307082871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x0000723070839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x0000000004a9c0b8 llvm::nonStrictlyPostDominate(llvm::BasicBlock const*, llvm::BasicBlock const*, llvm::DominatorTree const*, llvm::PostDominatorTree const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4a9c0b8)\n #9 0x0000000004686775 std::pair<std::_Rb_tree_iterator<(anonymous namespace)::FusionCandidate>, bool> std::_Rb_tree<(anonymous namespace)::FusionCandidate, (anonymous namespace)::FusionCandidate, std::_Identity<(anonymous namespace)::FusionCandidate>, (anonymous namespace)::FusionCandidateCompare, std::allocator<(anonymous namespace)::FusionCandidate>>::_M_insert_unique<(anonymous namespace)::FusionCandidate const&>((anonymous namespace)::FusionCandidate const&) LoopFuse.cpp:0:0\n#10 0x000000000468fe41 (anonymous namespace)::LoopFuser::fuseCandidates() LoopFuse.cpp:0:0\n#11 0x0000000004691861 llvm::LoopFusePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4691861)\n```\n\nSee also https://godbolt.org/z/999r9Ksez\n\nLLVM IR reduced test came from this C code reproducer:\n\n```\n#include <algorithm>\nint a;\nshort c, b;\nlong f, g;\nchar i;\nvoid fn1(bool d, int e, short h) {\n for (int j = 0; j < 10; j += 4) {\n for (char k; k < i; k += 0301)\n ;\n if (g) {\n for (; f;)\n ;\n for (bool l = 0; l < (bool)b; l = 1) {\n for (long m = 4;\n m < std::max(~d, int((signed char)std::max(h, (short)255))) -\n 18446744073709551608;\n m += 2)\n if (e)\n a = 0;\n for (long n = 4;\n n < std::max(~d, int((signed char)std::max(h, (short)255))) -\n 18446744073709551608;\n n += 2)\n for (short o; o < short(); o += 4)\n c = 0;\n }\n }\n }\n}\n```\n",
|
| 134 |
+
"author": "sjoerdmeijer",
|
| 135 |
+
"labels": [
|
| 136 |
+
"loopoptim",
|
| 137 |
+
"crash-on-valid",
|
| 138 |
+
"loop-fusion"
|
| 139 |
+
],
|
| 140 |
+
"comments": [
|
| 141 |
+
{
|
| 142 |
+
"author": "sjoerdmeijer",
|
| 143 |
+
"body": "CC: @madhur13490 "
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"author": "amehsan",
|
| 147 |
+
"body": "I took the liberty of taking a look at this even though it is assigned to @madhur13490 . The reason is that I analyzed a few loop fusion issues yesterday and all of them were CFG related and three of them related to extra flexible `isControlFlowEquivalent`. So did a quick check and this is also related to `isControlFlowEquivalent`.\n\nIt is just another instance that we have relaxed control flow condition in one part of the code but not consistently everywhere and so we hit assertions here and there that requires domination, while `isControlFlowEquivalent` is more flexible than that.\n\nI believe fixing `isControlFlowEquivalent` as discussed in https://github.com/llvm/llvm-project/issues/166560 will fix this issue."
|
| 148 |
+
}
|
| 149 |
+
]
|
| 150 |
+
},
|
| 151 |
+
"properties": {
|
| 152 |
+
"is_single_file_fix": false,
|
| 153 |
+
"is_single_func_fix": false
|
| 154 |
+
},
|
| 155 |
+
"verified": true
|
| 156 |
+
}
|
dataset/165087.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "165087",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/165087",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "3d3dd559a0830ea9048cbbc92b0f7b762c5dd0e3",
|
| 6 |
+
"knowledge_cutoff": "2025-10-25T08:30:57Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopFusion"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "1286de408cc4a3ba1bd6cb6fed7d9517c0429462",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopFuse"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Scalar/LoopFuse.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1083,
|
| 19 |
+
1110
|
| 20 |
+
],
|
| 21 |
+
[
|
| 22 |
+
1453,
|
| 23 |
+
1463
|
| 24 |
+
]
|
| 25 |
+
]
|
| 26 |
+
},
|
| 27 |
+
"bug_location_funcname": {
|
| 28 |
+
"llvm/lib/Transforms/Scalar/LoopFuse.cpp": [
|
| 29 |
+
"canSinkInst",
|
| 30 |
+
"collectMovablePreheaderInsts",
|
| 31 |
+
"fixPHINodes",
|
| 32 |
+
"movePreheaderInsts"
|
| 33 |
+
]
|
| 34 |
+
}
|
| 35 |
+
},
|
| 36 |
+
"patch": "commit 1286de408cc4a3ba1bd6cb6fed7d9517c0429462\nAuthor: Congzhe <congzhe.cao@huawei.com>\nDate: Thu Jan 22 16:12:12 2026 -0500\n\n [LoopFusion] Optimize away Phi nodes that are sunk from the 2nd loop preheader (#176503)\n \n Fixed issue #165087.\n \n When we sink phis from the 2nd loop preheader to the exit block, we\n optimize it a bit further, i.e., propagate the uses of each phi node with\n its incoming value and optimize away the phis. Deleted `fixPHINodes()`\n too because the phis are already optimized away and there is no point\n processing `fixPHINodes()`.\n\ndiff --git a/llvm/lib/Transforms/Scalar/LoopFuse.cpp b/llvm/lib/Transforms/Scalar/LoopFuse.cpp\nindex d7284c98b48c..9c86b73dfc8d 100644\n--- a/llvm/lib/Transforms/Scalar/LoopFuse.cpp\n+++ b/llvm/lib/Transforms/Scalar/LoopFuse.cpp\n@@ -1083,28 +1083,6 @@ private:\n return true;\n }\n \n- /// This function fixes PHI nodes after fusion in \\p SafeToSink.\n- /// \\p SafeToSink instructions are the instructions that are to be moved past\n- /// the fused loop. Thus, the PHI nodes in \\p SafeToSink should be updated to\n- /// receive values from the fused loop if they are currently taking values\n- /// from the first loop (i.e. FC0)'s latch.\n- void fixPHINodes(ArrayRef<Instruction *> SafeToSink,\n- const FusionCandidate &FC0,\n- const FusionCandidate &FC1) const {\n- for (Instruction *Inst : SafeToSink) {\n- // No update needed for non-PHI nodes.\n- PHINode *Phi = dyn_cast<PHINode>(Inst);\n- if (!Phi)\n- continue;\n- for (unsigned I = 0; I < Phi->getNumIncomingValues(); I++) {\n- if (Phi->getIncomingBlock(I) != FC0.Latch)\n- continue;\n- assert(FC1.Latch && \"FC1 latch is not set\");\n- Phi->setIncomingBlock(I, FC1.Latch);\n- }\n- }\n- }\n-\n /// Collect instructions in the \\p FC1 Preheader that can be hoisted\n /// to the \\p FC0 Preheader or sunk into the \\p FC1 Body\n bool collectMovablePreheaderInsts(\n@@ -1453,11 +1431,19 @@ private:\n // insert instructions in reverse order to maintain dominance relationship\n for (Instruction *I : reverse(SinkInsts)) {\n assert(I->getParent() == FC1.Preheader);\n- I->moveBefore(*FC1.ExitBlock, FC1.ExitBlock->getFirstInsertionPt());\n+ if (isa<PHINode>(I)) {\n+ // The Phis to be sunk should have only one incoming value, as is\n+ // assured by the condition that the second loop is dominated by the\n+ // first one which is enforced by isStrictlyAdjacent().\n+ // Replace the phi uses with the corresponding incoming value to clean\n+ // up the code.\n+ assert(cast<PHINode>(I)->getNumIncomingValues() == 1 &&\n+ \"Expected the sunk PHI node to have 1 incoming value.\");\n+ I->replaceAllUsesWith(I->getOperand(0));\n+ I->eraseFromParent();\n+ } else\n+ I->moveBefore(*FC1.ExitBlock, FC1.ExitBlock->getFirstInsertionPt());\n }\n- // PHI nodes in SinkInsts need to be updated to receive values from the\n- // fused loop.\n- fixPHINodes(SinkInsts, FC0, FC1);\n }\n \n /// Determine if two fusion candidates have identical guards\n",
|
| 37 |
+
"tests": [
|
| 38 |
+
{
|
| 39 |
+
"file": "llvm/test/Transforms/LoopFusion/lcssa.ll",
|
| 40 |
+
"commands": [
|
| 41 |
+
"opt -S -passes=loop-fusion < %s 2>&1"
|
| 42 |
+
],
|
| 43 |
+
"tests": [
|
| 44 |
+
{
|
| 45 |
+
"test_name": "test1",
|
| 46 |
+
"test_body": "define void @test1() {\nentry:\n br label %vector.ph\n\nvector.ph: ; preds = %middle.block, %entry\n br label %middle.block\n\nmiddle.block: ; preds = %vector.ph\n br i1 true, label %for.cond17.preheader, label %vector.ph\n\nfor.cond17.preheader: ; preds = %middle.block\n %.lcssa92 = phi i16 [ 1, %middle.block ]\n br label %vector.ph61\n\nvector.ph61: ; preds = %vector.ph61, %for.cond17.preheader\n br i1 true, label %for.end41, label %vector.ph61\n\nfor.end41: ; preds = %vector.ph61\n ret void\n}\n"
|
| 47 |
+
}
|
| 48 |
+
]
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"file": "llvm/test/Transforms/LoopFusion/pr165087.ll",
|
| 52 |
+
"commands": [
|
| 53 |
+
"opt -S -passes=loop-fusion < %s 2>&1"
|
| 54 |
+
],
|
| 55 |
+
"tests": [
|
| 56 |
+
{
|
| 57 |
+
"test_name": "<module>",
|
| 58 |
+
"test_body": "\n; When the two loops are legal to get fused, and when there are phi nodes in the second loop preheader\n; that will be sunk to the exit block, replace the phi uses with the corresponding incoming value.\n; This fixes llvm issue 165087.\n\ndefine i8 @_Z3fn1ssb() {\n;\nentry:\n br label %for.body11.1\n\nfor.body11.1: ; preds = %for.body11.1, %entry\n %indvars.iv.1 = phi i64 [ %indvars.iv.next.1, %for.body11.1 ], [ 2, %entry ]\n %indvars.iv.next.1 = add i64 %indvars.iv.1, 1\n %exitcond.1.not = icmp eq i64 %indvars.iv.next.1, 0\n br i1 %exitcond.1.not, label %for.body11.2.preheader, label %for.body11.1\n\nfor.body11.2.preheader: ; preds = %for.body11.1\n %.sroa.speculated.1.lcssa = phi i8 [ 0, %for.body11.1 ]\n br label %for.body11.2\n\nfor.body11.2: ; preds = %for.body11.2, %for.body11.2.preheader\n %indvars.iv.2 = phi i64 [ %indvars.iv.next.2, %for.body11.2 ], [ 2, %for.body11.2.preheader ]\n %indvars.iv.next.2 = add i64 %indvars.iv.2, 1\n %exitcond.2.not = icmp eq i64 %indvars.iv.next.2, 0\n br i1 %exitcond.2.not, label %for.cond.cleanup6.2.loopexit, label %for.body11.2\n\nfor.cond.cleanup6.2.loopexit: ; preds = %for.body11.2\n %.sroa.speculated.2.lcssa = phi i8 [ %.sroa.speculated.1.lcssa, %for.body11.2 ]\n ret i8 %.sroa.speculated.2.lcssa\n}\n"
|
| 59 |
+
}
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"file": "llvm/test/Transforms/LoopFusion/sunk-phi-nodes.ll",
|
| 64 |
+
"commands": [
|
| 65 |
+
"opt -passes=loop-fusion -S < %s 2>&1"
|
| 66 |
+
],
|
| 67 |
+
"tests": [
|
| 68 |
+
{
|
| 69 |
+
"test_name": "check_sunk_phi_nodes",
|
| 70 |
+
"test_body": "define dso_local i32 @check_sunk_phi_nodes() {\nentry:\n br label %for.body\n\nfor.body: ; preds = %for.inc, %entry\n %sum1.02 = phi i32 [ 0, %entry ], [ %add, %for.inc ]\n %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]\n %add = add nsw i32 %sum1.02, %i.01\n br label %for.inc\n\nfor.inc: ; preds = %for.body\n %inc = add nsw i32 %i.01, 1\n %cmp = icmp slt i32 %inc, 10\n br i1 %cmp, label %for.body, label %for.end\n\nfor.end: ; preds = %for.inc\n %sum1.0.lcssa = phi i32 [ %add, %for.inc ]\n br label %for.body4\n\nfor.body4: ; preds = %for.inc6, %for.end\n %i1.04 = phi i32 [ 0, %for.end ], [ %inc7, %for.inc6 ]\n %sum2.03 = phi i32 [ 0, %for.end ], [ %add5, %for.inc6 ]\n %mul = mul nsw i32 %i1.04, %i1.04\n %add5 = add nsw i32 %sum2.03, %mul\n br label %for.inc6\n\nfor.inc6: ; preds = %for.body4\n %inc7 = add nsw i32 %i1.04, 1\n %cmp3 = icmp slt i32 %inc7, 10\n br i1 %cmp3, label %for.body4, label %for.end8\n\nfor.end8: ; preds = %for.inc6\n %sum2.0.lcssa = phi i32 [ %add5, %for.inc6 ]\n %0 = add i32 %sum1.0.lcssa, %sum2.0.lcssa\n ret i32 %0\n}\n"
|
| 71 |
+
}
|
| 72 |
+
]
|
| 73 |
+
}
|
| 74 |
+
],
|
| 75 |
+
"issue": {
|
| 76 |
+
"title": "[LoopFusion] Assert \"Instruction does not dominate all uses\"",
|
| 77 |
+
"body": "This IR:\n\n```\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32\"\ntarget triple = \"aarch64-unknown-linux-gnu\"\n\ndefine i8 @_Z3fn1ssb() {\nentry:\n br label %for.body11.1\n\nfor.body11.1: ; preds = %for.body11.1, %entry\n %indvars.iv.1 = phi i64 [ %indvars.iv.next.1, %for.body11.1 ], [ 2, %entry ]\n %indvars.iv.next.1 = add i64 %indvars.iv.1, 1\n %exitcond.1.not = icmp eq i64 %indvars.iv.next.1, 0\n br i1 %exitcond.1.not, label %for.body11.2.preheader, label %for.body11.1\n\nfor.body11.2.preheader: ; preds = %for.body11.1\n %.sroa.speculated.1.lcssa = phi i8 [ 0, %for.body11.1 ]\n br label %for.body11.2\n\nfor.body11.2: ; preds = %for.body11.2, %for.body11.2.preheader\n %indvars.iv.2 = phi i64 [ %indvars.iv.next.2, %for.body11.2 ], [ 2, %for.body11.2.preheader ]\n %indvars.iv.next.2 = add i64 %indvars.iv.2, 1\n %exitcond.2.not = icmp eq i64 %indvars.iv.next.2, 0\n br i1 %exitcond.2.not, label %for.cond.cleanup6.2.loopexit, label %for.body11.2\n\nfor.cond.cleanup6.2.loopexit: ; preds = %for.body11.2\n %.sroa.speculated.2.lcssa = phi i8 [ %.sroa.speculated.1.lcssa, %for.body11.2 ]\n ret i8 %.sroa.speculated.2.lcssa\n}\n```\n\ncompiled with `opt -S -passes=loop-fusion `, triggers this assert:\n\n```\nInstruction does not dominate all uses!\n %.sroa.speculated.1.lcssa = phi i8 [ 0, %for.body11.1 ]\n %.sroa.speculated.2.lcssa = phi i8 [ %.sroa.speculated.1.lcssa, %for.body11.1 ]\nopt: /root/llvm-project/llvm/lib/Transforms/Scalar/LoopFuse.cpp:1827: llvm::Loop* {anonymous}::LoopFuser::performFusion(const {anonymous}::FusionCandidate&, const {anonymous}::FusionCandidate&): Assertion `!verifyFunction(*FC0.Header->getParent(), &errs())' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -S -passes=loop-fusion <source>\n1.\tRunning pass \"function(loop-fusion)\" on module \"<source>\"\n2.\tRunning pass \"loop-fusion\" on function \"_Z3fn1ssb\"\n #0 0x0000000005965e58 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5965e58)\n #1 0x0000000005962d04 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x0000785d49242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x0000785d492969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x0000785d49242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x0000785d492287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x0000785d4922871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x0000785d49239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x000000000468b1fc (anonymous namespace)::LoopFuser::performFusion((anonymous namespace)::FusionCandidate const&, (anonymous namespace)::FusionCandidate const&) LoopFuse.cpp:0:0\n #9 0x000000000468fcfe (anonymous namespace)::LoopFuser::fuseCandidates() LoopFuse.cpp:0:0\n#10 0x0000000004691861 llvm::LoopFusePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4691861)\n#11 0x0000000002f977be llvm::detail::PassModel<llvm::Function, llvm::LoopFusePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2f977be)\n\n```\n\nSee also: https://godbolt.org/z/bW9rMf7dj\n\nIR was reproduced from this C reproducer:\n\n```\n#include <algorithm>\nunsigned char a;\nextern int d[][1][1];\nchar b;\nint c;\nvoid fn1(short e, short f, bool g) {\n for (; b;)\n for (short h = 0; h < 011; h += 3)\n for (short i = 0; i < 2; i = 0201)\n for (int j = 2; j < c; j += 0 >= 0) {\n d[i][i][j] = std::max((long long)4, (long long)0);\n a = std::max(a, (unsigned char)(f && (e || g)));\n }\n}\n```",
|
| 78 |
+
"author": "sjoerdmeijer",
|
| 79 |
+
"labels": [
|
| 80 |
+
"loopoptim",
|
| 81 |
+
"crash-on-valid",
|
| 82 |
+
"loop-fusion"
|
| 83 |
+
],
|
| 84 |
+
"comments": [
|
| 85 |
+
{
|
| 86 |
+
"author": "sjoerdmeijer",
|
| 87 |
+
"body": "CC: @madhur13490 "
|
| 88 |
+
}
|
| 89 |
+
]
|
| 90 |
+
},
|
| 91 |
+
"properties": {
|
| 92 |
+
"is_single_file_fix": true,
|
| 93 |
+
"is_single_func_fix": false
|
| 94 |
+
},
|
| 95 |
+
"verified": true
|
| 96 |
+
}
|
dataset/165252.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "165252",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/165252",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "c03d0fe672b2506d22d101cb7704996f4ffda3e4",
|
| 6 |
+
"knowledge_cutoff": "2025-10-27T13:57:20Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/UnifyLoopExits"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "2c7cf896be28febcd2f9af1b0dfdb5dfc6b97583",
|
| 12 |
+
"components": [
|
| 13 |
+
"ControlFlowUtils",
|
| 14 |
+
"UnifyLoopExits"
|
| 15 |
+
],
|
| 16 |
+
"bug_location_lineno": {
|
| 17 |
+
"llvm/lib/Transforms/Utils/ControlFlowUtils.cpp": [
|
| 18 |
+
[
|
| 19 |
+
299,
|
| 20 |
+
304
|
| 21 |
+
]
|
| 22 |
+
],
|
| 23 |
+
"llvm/lib/Transforms/Utils/UnifyLoopExits.cpp": [
|
| 24 |
+
[
|
| 25 |
+
154,
|
| 26 |
+
161
|
| 27 |
+
]
|
| 28 |
+
]
|
| 29 |
+
},
|
| 30 |
+
"bug_location_funcname": {
|
| 31 |
+
"llvm/lib/Transforms/Utils/ControlFlowUtils.cpp": [
|
| 32 |
+
"ControlFlowHub::finalize"
|
| 33 |
+
],
|
| 34 |
+
"llvm/lib/Transforms/Utils/UnifyLoopExits.cpp": [
|
| 35 |
+
"unifyLoopExits"
|
| 36 |
+
]
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
"patch": "commit 2c7cf896be28febcd2f9af1b0dfdb5dfc6b97583\nAuthor: Miguel Saldivar <saldivarcher@gmail.com>\nDate: Sun Jan 25 16:31:28 2026 -0800\n\n [llvm][UnifyLoopExits] Avoid optimization if no exit block is found (#165343)\n \n If there is not an exit block, we should not try unify the loops.\n Instead we should just return.\n \n Fixes #165252\n\ndiff --git a/llvm/lib/Transforms/Utils/ControlFlowUtils.cpp b/llvm/lib/Transforms/Utils/ControlFlowUtils.cpp\nindex f728e9f18af5..8de83cc3700c 100644\n--- a/llvm/lib/Transforms/Utils/ControlFlowUtils.cpp\n+++ b/llvm/lib/Transforms/Utils/ControlFlowUtils.cpp\n@@ -299,6 +299,8 @@ std::pair<BasicBlock *, bool> ControlFlowHub::finalize(\n Outgoing.insert(Succ1);\n }\n \n+ assert(Outgoing.size() && \"No outgoing edges\");\n+\n if (Outgoing.size() < 2)\n return {Outgoing.front(), false};\n \ndiff --git a/llvm/lib/Transforms/Utils/UnifyLoopExits.cpp b/llvm/lib/Transforms/Utils/UnifyLoopExits.cpp\nindex e86ab13094b1..21baf4ec1d03 100644\n--- a/llvm/lib/Transforms/Utils/UnifyLoopExits.cpp\n+++ b/llvm/lib/Transforms/Utils/UnifyLoopExits.cpp\n@@ -154,8 +154,13 @@ static bool unifyLoopExits(DominatorTree &DT, LoopInfo &LI, Loop *L) {\n SmallVector<BasicBlock *, 8> ExitingBlocks;\n L->getExitingBlocks(ExitingBlocks);\n \n+ // No exit blocks, so nothing to do. Just return.\n+ if (ExitingBlocks.empty())\n+ return false;\n+\n DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager);\n SmallVector<BasicBlock *, 8> CallBrTargetBlocksToFix;\n+\n // Redirect exiting edges through a control flow hub.\n ControlFlowHub CHub;\n bool Changed = false;\n",
|
| 40 |
+
"tests": [
|
| 41 |
+
{
|
| 42 |
+
"file": "llvm/test/Transforms/UnifyLoopExits/no-exit-blocks.ll",
|
| 43 |
+
"commands": [
|
| 44 |
+
"opt -passes=unify-loop-exits %s -S 2>&1"
|
| 45 |
+
],
|
| 46 |
+
"tests": [
|
| 47 |
+
{
|
| 48 |
+
"test_name": "<module>",
|
| 49 |
+
"test_body": "; Based from this issue: https://github.com/llvm/llvm-project/issues/165252\n\ndefine void @test() {\nentry:\n br i1 true, label %end, label %Loop\n\nLoop:\n %V = phi i32 [0, %entry], [%V1, %Loop]\n %V1 = add i32 %V, 1\n br label %Loop\n\nend:\n ret void\n}"
|
| 50 |
+
}
|
| 51 |
+
]
|
| 52 |
+
}
|
| 53 |
+
],
|
| 54 |
+
"issue": {
|
| 55 |
+
"title": "unify-loop-exits pass: Assertion `!empty() && \"Cannot call front() on empty SetVector!\"' failed.",
|
| 56 |
+
"body": "Reproducer:\nhttps://godbolt.org/z/GET14Pbb8\n\nBacktrace:\n```console\nopt: /root/llvm-project/llvm/include/llvm/ADT/SetVector.h:132: const value_type& llvm::SetVector<T, Vector, Set, N>::front() const [with T = llvm::BasicBlock*; Vector = llvm::SmallVector<llvm::BasicBlock*, 0>; Set = llvm::DenseSet<llvm::BasicBlock*, llvm::DenseMapInfo<llvm::BasicBlock*, void> >; unsigned int N = 0; llvm::SetVector<T, Vector, Set, N>::value_type = llvm::BasicBlock*]: Assertion `!empty() && \"Cannot call front() on empty SetVector!\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=unify-loop-exits <source>\n1.\tRunning pass \"function(unify-loop-exits)\" on module \"<source>\"\n2.\tRunning pass \"unify-loop-exits\" on function \"test\"\n #0 0x0000000005975828 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5975828)\n #1 0x00000000059726d4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x00007d1723c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x00007d1723c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x00007d1723c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x00007d1723c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x00007d1723c2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x00007d1723c39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x0000000004c99174 llvm::ControlFlowHub::finalize(llvm::DomTreeUpdater*, llvm::SmallVectorImpl<llvm::BasicBlock*>&, llvm::StringRef, std::optional<unsigned int>) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c99174)\n #9 0x0000000004c81693 unifyLoopExits(llvm::DominatorTree&, llvm::LoopInfo&, llvm::Loop*) UnifyLoopExits.cpp:0:0\n#10 0x0000000004c83a12 runImpl(llvm::LoopInfo&, llvm::DominatorTree&) UnifyLoopExits.cpp:0:0\n#11 0x0000000004c83f79 llvm::UnifyLoopExitsPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4c83f79)\n#12 0x0000000000efc39e llvm::detail::PassModel<llvm::Function, llvm::UnifyLoopExitsPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xefc39e)\n#13 0x000000000574f081 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x574f081)\n#14 0x0000000000efc57e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xefc57e)\n#15 0x000000000574d6fa llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x574d6fa)\n#16 0x000000000097bade llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97bade)\n#17 0x000000000574d0b1 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x574d0b1)\n#18 0x0000000000985c7a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x985c7a)\n#19 0x0000000000979ef1 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x979ef1)\n#20 0x00007d1723c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#21 0x00007d1723c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#22 0x0000000000971305 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x971305)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```",
|
| 57 |
+
"author": "k-arrows",
|
| 58 |
+
"labels": [
|
| 59 |
+
"crash",
|
| 60 |
+
"llvm:transforms"
|
| 61 |
+
],
|
| 62 |
+
"comments": []
|
| 63 |
+
},
|
| 64 |
+
"properties": {
|
| 65 |
+
"is_single_file_fix": false,
|
| 66 |
+
"is_single_func_fix": false
|
| 67 |
+
},
|
| 68 |
+
"verified": true
|
| 69 |
+
}
|
dataset/166356.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "166356",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/166356",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "5cf92086b78c6797647aaf351f4dd26fbf2244c4",
|
| 6 |
+
"knowledge_cutoff": "2025-11-04T11:54:33Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopFusion"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "5ab966aacbd8bbe95bf858110569a8205b7f8c79",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopFuse"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Scalar/LoopFuse.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1399,
|
| 19 |
+
1408
|
| 20 |
+
],
|
| 21 |
+
[
|
| 22 |
+
1410,
|
| 23 |
+
1416
|
| 24 |
+
]
|
| 25 |
+
]
|
| 26 |
+
},
|
| 27 |
+
"bug_location_funcname": {
|
| 28 |
+
"llvm/lib/Transforms/Scalar/LoopFuse.cpp": [
|
| 29 |
+
"isStrictlyAdjacent"
|
| 30 |
+
]
|
| 31 |
+
}
|
| 32 |
+
},
|
| 33 |
+
"patch": "commit 5ab966aacbd8bbe95bf858110569a8205b7f8c79\nAuthor: Alireza Torabian <alireza.torabian@huawei.com>\nDate: Thu Jan 8 17:07:15 2026 -0500\n\n [LoopFusion] Non-loop block must be the immediate successor of exit (#175034)\n \n Loop fusion assumes the non-loop block of a guarded adjacent loop is the\n immediate successor of its exit block. This patch ensures this condition\n is hold and fixes the crash #166356.\n\ndiff --git a/llvm/lib/Transforms/Scalar/LoopFuse.cpp b/llvm/lib/Transforms/Scalar/LoopFuse.cpp\nindex 3a06c3f00fa0..d7284c98b48c 100644\n--- a/llvm/lib/Transforms/Scalar/LoopFuse.cpp\n+++ b/llvm/lib/Transforms/Scalar/LoopFuse.cpp\n@@ -1399,10 +1399,11 @@ private:\n /// This method will determine if there are additional basic blocks in the CFG\n /// between the exit of \\p FC0 and the entry of \\p FC1.\n /// If the two candidates are guarded loops, then it checks whether the\n- /// non-loop successor of the \\p FC0 guard branch is the entry block of \\p\n- /// FC1. If not, then the loops are not adjacent. If the two candidates are\n- /// not guarded loops, then it checks whether the exit block of \\p FC0 is the\n- /// preheader of \\p FC1.\n+ /// exit block of the \\p FC0 is the predecessor of the \\p FC1 preheader. This\n+ /// implicitly ensures that the non-loop successor of the \\p FC0 guard branch\n+ /// is the entry block of \\p FC1. If not, then the loops are not adjacent. If\n+ /// the two candidates are not guarded loops, then it checks whether the exit\n+ /// block of \\p FC0 is the preheader of \\p FC1.\n /// Strictly means there is no predecessor for FC1 unless it is from FC0,\n /// i.e., FC0 dominates FC1.\n bool isStrictlyAdjacent(const FusionCandidate &FC0,\n@@ -1410,7 +1411,7 @@ private:\n // If the successor of the guard branch is FC1, then the loops are adjacent\n if (FC0.GuardBranch)\n return DT.dominates(FC0.getEntryBlock(), FC1.getEntryBlock()) &&\n- FC0.getNonLoopBlock() == FC1.getEntryBlock();\n+ FC0.ExitBlock->getSingleSuccessor() == FC1.getEntryBlock();\n else\n return FC0.ExitBlock == FC1.getEntryBlock();\n }\n",
|
| 34 |
+
"tests": [
|
| 35 |
+
{
|
| 36 |
+
"file": "llvm/test/Transforms/LoopFusion/pr166356.ll",
|
| 37 |
+
"commands": [
|
| 38 |
+
"opt -passes=loop-fusion -S < %s 2>&1"
|
| 39 |
+
],
|
| 40 |
+
"tests": [
|
| 41 |
+
{
|
| 42 |
+
"test_name": "<module>",
|
| 43 |
+
"test_body": "\n; The non-loop block of loop for.cond.cleanup13 is not the immediate successor\n; of its exit block, then it should not be eligible for fusion.\n\ndefine void @non_immediate_exit() {\n;\nentry:\n br i1 false, label %if.else.1, label %for.cond.cleanup13\n\nfor.cond.cleanup13: ; preds = %for.cond.cleanup13, %entry\n br i1 true, label %for.inc21, label %for.cond.cleanup13\n\nfor.inc21: ; preds = %for.cond.cleanup13\n br label %if.then.1\n\nif.then.1: ; preds = %for.inc21\n br label %if.else.1\n\nif.else.1: ; preds = %if.then.1, %entry\n br i1 false, label %if.else.2, label %for.cond.cleanup13.1\n\nfor.cond.cleanup13.1: ; preds = %for.cond.cleanup13.1, %if.else.1\n br i1 true, label %if.else.2, label %for.cond.cleanup13.1\n\nif.else.2: ; preds = %for.cond.cleanup13.1, %if.else.1\n ret void\n}"
|
| 44 |
+
}
|
| 45 |
+
]
|
| 46 |
+
}
|
| 47 |
+
],
|
| 48 |
+
"issue": {
|
| 49 |
+
"title": "[LoopFusion] Assert \"Expecting guard block to have no predecessors\"",
|
| 50 |
+
"body": "This IR:\n\n```\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32\"\ntarget triple = \"aarch64-unknown-linux-gnu\"\n\ndefine void @_Z1gb() {\nentry:\n br i1 false, label %if.else.1, label %for.cond.cleanup13\n\nfor.cond.cleanup13: ; preds = %for.cond.cleanup13, %entry\n br i1 true, label %for.inc21, label %for.cond.cleanup13\n\nfor.inc21: ; preds = %for.cond.cleanup13\n br label %if.then.1\n\nif.then.1: ; preds = %for.inc21\n br label %if.else.1\n\nif.else.1: ; preds = %if.then.1, %entry\n br i1 false, label %if.else.2, label %for.cond.cleanup13.1\n\nfor.cond.cleanup13.1: ; preds = %for.cond.cleanup13.1, %if.else.1\n br i1 true, label %if.else.2, label %for.cond.cleanup13.1\n\nif.else.2: ; preds = %for.cond.cleanup13.1, %if.else.1\n ret void\n}\n```\n\ntriggers this assert:\n\n```\nopt: /root/llvm-project/llvm/lib/Transforms/Scalar/LoopFuse.cpp:1945: llvm::Loop* {anonymous}::LoopFuser::fuseGuardedLoops(const {anonymous}::FusionCandidate&, const {anonymous}::FusionCandidate&): Assertion `pred_empty(FC1GuardBlock) && \"Expecting guard block to have no predecessors\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -S -passes=loop-fusion <source>\n1.\tRunning pass \"function(loop-fusion)\" on module \"<source>\"\n2.\tRunning pass \"loop-fusion\" on function \"_Z1gb\"\n #0 0x0000000005989ef8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5989ef8)\n #1 0x0000000005986da4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x00007f6389e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x00007f6389e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x00007f6389e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x00007f6389e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x00007f6389e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x00007f6389e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x00000000046a310b (anonymous namespace)::LoopFuser::fuseGuardedLoops((anonymous namespace)::FusionCandidate const&, (anonymous namespace)::FusionCandidate const&) LoopFuse.cpp:0:0\n #9 0x00000000046a329a (anonymous namespace)::LoopFuser::performFusion((anonymous namespace)::FusionCandidate const&, (anonymous namespace)::FusionCandidate const&) LoopFuse.cpp:0:0\n#10 0x00000000046a938e (anonymous namespace)::LoopFuser::fuseCandidates() LoopFuse.cpp:0:0\n#11 0x00000000046aaef1 llvm::LoopFusePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x46aaef1)\n```\n\nwhen compiled with `-S -passes=loop-fusion`, see also: https://godbolt.org/z/v9ddvW1T6\n\n\nThe IR reproducer comes from this C reproducer:\n\n```\nint a;\nshort b;\nchar c, e, f;\nlong d;\nvoid g(bool h) {\n for (int i; i < 20ULL; i += 4ULL)\n if (h)\n if (c)\n a = f;\n else if (e)\n for (int j(d); j; j++)\n for (int k(f); k; k += 4073709530269)\n b = 0;\n}\n```",
|
| 51 |
+
"author": "sjoerdmeijer",
|
| 52 |
+
"labels": [
|
| 53 |
+
"loopoptim",
|
| 54 |
+
"crash-on-valid",
|
| 55 |
+
"loop-fusion"
|
| 56 |
+
],
|
| 57 |
+
"comments": [
|
| 58 |
+
{
|
| 59 |
+
"author": "amehsan",
|
| 60 |
+
"body": "@1997alireza could you look into this issue?"
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"author": "1997alireza",
|
| 64 |
+
"body": "> [@1997alireza](https://github.com/1997alireza) could you look into this issue?\n\nYes. On it."
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"author": "madhur13490",
|
| 68 |
+
"body": "Hi @1997alireza, since you're looking at it, I have assigned it to you. I am using the filter below to manage all loop-fusion crashes. \nhttps://github.com/llvm/llvm-project/issues?q=state%3Aopen%20label%3A%22loop-fusion%22"
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"author": "amehsan",
|
| 72 |
+
"body": "The issue is the following: LoopFusion implicitly expects that if `FC0` is not peeled then the successor of exit block of `FC0` is the same as entry block of `FC1`. This is not true for the test case above, \n\n```\nfor.inc21: <------------- EXIT BLOCK OF FC0\n br label %if.then.1\n\nif.then.1: <---------- INTERVENING BLOCK THAT LOOP FUSION IS UNAWARE OF \n br label %if.else.1\n\nif.else.1: <------------- ENTRY BLOCK OF FC1\n br i1 false, label %if.else.2, label %for.cond.cleanup13.1\n```\n\n\nThe testcase passes `isAdjacent` because loop guard of `FC0` branches to entry block of `FC1` \n\n```\nentry: <------------------ LOOP GUARD OF FC0\n br i1 false, label %if.else.1, label %for.cond.cleanup13\n```\n\nThis is the relevant code in `isAdjacent`\n\n```\n if (FC0.GuardBranch)\n return FC0.getNonLoopBlock() == FC1.getEntryBlock();\n```\n\n\nHowever later we have this code:\n```\n BasicBlock *BBToUpdate = FC0.Peeled ? FC0ExitBlockSuccessor : FC0.ExitBlock;\n BBToUpdate->getTerminator()->replaceUsesOfWith(FC1GuardBlock, FC1.Header);\n```\n\nSo if `FC0` is not peeled we replace all uses of `FC1GuardBlock` with `FC1.Header` in `FC0.ExitBlock`. In our case terminator of `FC0.ExitBlock` has no use of `FC1GuardBlock` . So our expectation that one of the predecessors of `FC1GuardBlock` will be removed at this point is not satisfied and at the time of assertion the block has an unexpected predecessor.\n\nLooks like we have a missing test in legality check (possibly in `isAdjacent`). But a little more investigation is needed to figure out how this interacts with peeling\n\n"
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"author": "1997alireza",
|
| 76 |
+
"body": "The issue is fixed by PR #175034. I close the issue."
|
| 77 |
+
}
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
+
"properties": {
|
| 81 |
+
"is_single_file_fix": true,
|
| 82 |
+
"is_single_func_fix": true
|
| 83 |
+
},
|
| 84 |
+
"verified": true
|
| 85 |
+
}
|
dataset/167243.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "167243",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/167243",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "b725bdba1faf256c725f5fd12c581acb381bf0d3",
|
| 6 |
+
"knowledge_cutoff": "2025-11-09T20:06:36Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "67e35bbebbed5e33a173751d019c22e4effa65fd",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopVectorize"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/LoopVectorize.cpp": [
|
| 17 |
+
[
|
| 18 |
+
7992,
|
| 19 |
+
8004
|
| 20 |
+
],
|
| 21 |
+
[
|
| 22 |
+
8006,
|
| 23 |
+
8013
|
| 24 |
+
],
|
| 25 |
+
[
|
| 26 |
+
8018,
|
| 27 |
+
8048
|
| 28 |
+
]
|
| 29 |
+
]
|
| 30 |
+
},
|
| 31 |
+
"bug_location_funcname": {
|
| 32 |
+
"llvm/lib/Transforms/Vectorize/LoopVectorize.cpp": [
|
| 33 |
+
"VPRecipeBuilder::collectScaledReductions",
|
| 34 |
+
"VPRecipeBuilder::getScaledReductions"
|
| 35 |
+
]
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
"patch": "commit 67e35bbebbed5e33a173751d019c22e4effa65fd\nAuthor: Florian Hahn <flo@fhahn.com>\nDate: Thu Nov 20 15:54:57 2025 +0000\n\n [LV] Check full partial reduction chains in order. (#168036)\n \n https://github.com/llvm/llvm-project/pull/162822 added another\n validation step to check if entries in a partial reduction chain have\n the same scale factor. But the validation was still dependent on the\n order of entries in PartialReductionChains, and would fail to reject\n some cases (e.g. if the first first link matched the scale of the second\n link, but the second link is invalidated later).\n \n To fix that, group chains by their starting phi nodes, then perform the\n validation for each chain, and if it fails, invalidate the whole chain\n for the phi.\n \n Fixes https://github.com/llvm/llvm-project/issues/167243.\n Fixes https://github.com/llvm/llvm-project/issues/167867.\n \n PR: https://github.com/llvm/llvm-project/pull/168036\n\ndiff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\nindex 8013c47f53db..741caab1fe58 100644\n--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\n+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\n@@ -7992,13 +7992,15 @@ VPReplicateRecipe *VPRecipeBuilder::handleReplication(VPInstruction *VPI,\n /// Find all possible partial reductions in the loop and track all of those that\n /// are valid so recipes can be formed later.\n void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {\n- // Find all possible partial reductions.\n- SmallVector<std::pair<PartialReductionChain, unsigned>>\n- PartialReductionChains;\n- for (const auto &[Phi, RdxDesc] : Legal->getReductionVars()) {\n+ // Find all possible partial reductions, grouping chains by their PHI. This\n+ // grouping allows invalidating the whole chain, if any link is not a valid\n+ // partial reduction.\n+ MapVector<Instruction *,\n+ SmallVector<std::pair<PartialReductionChain, unsigned>>>\n+ ChainsByPhi;\n+ for (const auto &[Phi, RdxDesc] : Legal->getReductionVars())\n getScaledReductions(Phi, RdxDesc.getLoopExitInstr(), Range,\n- PartialReductionChains);\n- }\n+ ChainsByPhi[Phi]);\n \n // A partial reduction is invalid if any of its extends are used by\n // something that isn't another partial reduction. This is because the\n@@ -8006,8 +8008,9 @@ void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {\n \n // Build up a set of partial reduction ops for efficient use checking.\n SmallPtrSet<User *, 4> PartialReductionOps;\n- for (const auto &[PartialRdx, _] : PartialReductionChains)\n- PartialReductionOps.insert(PartialRdx.ExtendUser);\n+ for (const auto &[_, Chains] : ChainsByPhi)\n+ for (const auto &[PartialRdx, _] : Chains)\n+ PartialReductionOps.insert(PartialRdx.ExtendUser);\n \n auto ExtendIsOnlyUsedByPartialReductions =\n [&PartialReductionOps](Instruction *Extend) {\n@@ -8018,31 +8021,38 @@ void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {\n \n // Check if each use of a chain's two extends is a partial reduction\n // and only add those that don't have non-partial reduction users.\n- for (auto Pair : PartialReductionChains) {\n- PartialReductionChain Chain = Pair.first;\n- if (ExtendIsOnlyUsedByPartialReductions(Chain.ExtendA) &&\n- (!Chain.ExtendB || ExtendIsOnlyUsedByPartialReductions(Chain.ExtendB)))\n- ScaledReductionMap.try_emplace(Chain.Reduction, Pair.second);\n+ for (const auto &[_, Chains] : ChainsByPhi) {\n+ for (const auto &[Chain, Scale] : Chains) {\n+ if (ExtendIsOnlyUsedByPartialReductions(Chain.ExtendA) &&\n+ (!Chain.ExtendB ||\n+ ExtendIsOnlyUsedByPartialReductions(Chain.ExtendB)))\n+ ScaledReductionMap.try_emplace(Chain.Reduction, Scale);\n+ }\n }\n \n // Check that all partial reductions in a chain are only used by other\n // partial reductions with the same scale factor. Otherwise we end up creating\n // users of scaled reductions where the types of the other operands don't\n // match.\n- for (const auto &[Chain, Scale] : PartialReductionChains) {\n- auto AllUsersPartialRdx = [ScaleVal = Scale, this](const User *U) {\n- auto *UI = cast<Instruction>(U);\n- if (isa<PHINode>(UI) && UI->getParent() == OrigLoop->getHeader()) {\n- return all_of(UI->users(), [ScaleVal, this](const User *U) {\n- auto *UI = cast<Instruction>(U);\n- return ScaledReductionMap.lookup_or(UI, 0) == ScaleVal;\n- });\n+ for (const auto &[Phi, Chains] : ChainsByPhi) {\n+ for (const auto &[Chain, Scale] : Chains) {\n+ auto AllUsersPartialRdx = [ScaleVal = Scale, RdxPhi = Phi,\n+ this](const User *U) {\n+ auto *UI = cast<Instruction>(U);\n+ if (isa<PHINode>(UI) && UI->getParent() == OrigLoop->getHeader())\n+ return UI == RdxPhi;\n+ return ScaledReductionMap.lookup_or(UI, 0) == ScaleVal ||\n+ !OrigLoop->contains(UI->getParent());\n+ };\n+\n+ // If any partial reduction entry for the phi is invalid, invalidate the\n+ // whole chain.\n+ if (!all_of(Chain.Reduction->users(), AllUsersPartialRdx)) {\n+ for (const auto &[Chain, _] : Chains)\n+ ScaledReductionMap.erase(Chain.Reduction);\n+ break;\n }\n- return ScaledReductionMap.lookup_or(UI, 0) == ScaleVal ||\n- !OrigLoop->contains(UI->getParent());\n- };\n- if (!all_of(Chain.Reduction->users(), AllUsersPartialRdx))\n- ScaledReductionMap.erase(Chain.Reduction);\n+ }\n }\n }\n \n",
|
| 39 |
+
"tests": [
|
| 40 |
+
{
|
| 41 |
+
"file": "llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-incomplete-chains.ll",
|
| 42 |
+
"commands": [
|
| 43 |
+
"opt --mattr=+neon,+dotprod -passes=loop-vectorize -force-vector-interleave=1 -enable-epilogue-vectorization=false -S %s"
|
| 44 |
+
],
|
| 45 |
+
"tests": [
|
| 46 |
+
{
|
| 47 |
+
"test_name": "chained_sext_adds",
|
| 48 |
+
"test_body": "target triple = \"arm64-apple-macosx\"\n\ndefine void @chained_sext_adds(ptr noalias %src, ptr noalias %dst) #0 {\nentry:\n br label %loop\n\nexit: ; preds = %loop\n ret void\n\nloop: ; preds = %loop, %entry\n %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]\n %red = phi i32 [ 0, %entry ], [ %add.1, %loop ]\n %gep.src = getelementptr i8, ptr %src, i64 %iv\n %l = load i8, ptr %gep.src, align 1\n %conv8 = sext i8 %l to i32\n %add = add i32 %red, %conv8\n %conv8.1 = sext i8 %l to i32\n %add.1 = add i32 %add, %conv8.1\n %gep.dst = getelementptr i8, ptr %dst, i64 %iv\n store i32 %add.1, ptr %dst, align 4\n %iv.next = add i64 %iv, 1\n %exitcond = icmp eq i64 %iv.next, 1000\n br i1 %exitcond, label %exit, label %loop\n}\n\nattributes #0 = { \"target-cpu\"=\"grace\" }\n"
|
| 49 |
+
}
|
| 50 |
+
]
|
| 51 |
+
}
|
| 52 |
+
],
|
| 53 |
+
"issue": {
|
| 54 |
+
"title": "[LV] Assert \"all accumulators in chain must have same scale factor\"",
|
| 55 |
+
"body": "This IR:\n\n```\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32\"\ntarget triple = \"aarch64-unknown-linux-gnu\"\n\ndefine void @_Z1fv() #0 {\nentry:\n br label %for.body\n\nfor.cond.loopexit.loopexit: ; preds = %for.body\n ret void\n\nfor.body: ; preds = %for.body, %entry\n %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]\n %add15.lcssa1921 = phi i32 [ 0, %entry ], [ %add.1, %for.body ]\n %conv8 = sext i16 0 to i32\n %add = add i32 %add15.lcssa1921, %conv8\n %conv8.1 = sext i16 0 to i32\n %add.1 = add i32 %add, %conv8.1\n store i32 %add.1, ptr null, align 4\n %indvars.iv.next = add i64 %indvars.iv, 1\n %0 = and i64 %indvars.iv.next, 255\n %exitcond.not = icmp eq i64 %0, 0\n br i1 %exitcond.not, label %for.cond.loopexit.loopexit, label %for.body\n}\n\nattributes #0 = { \"target-cpu\"=\"grace\" }\n```\n\nTriggers this assert:\n\n```\nopt: /root/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8181: llvm::VPRecipeBase* llvm::VPRecipeBuilder::tryToCreatePartialReduction(llvm::VPInstruction*, unsigned int): Assertion `ScaleFactor == vputils::getVFScaleFactor(Accumulator->getDefiningRecipe()) && \"all accumulators in chain must have same scale factor\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -S -passes=loop-vectorize <source>\n1.\tRunning pass \"function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)\" on module \"<source>\"\n2.\tRunning pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"_Z1fv\"\n #0 0x00000000059ad0e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59ad0e8)\n #1 0x00000000059a9f94 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x00007efe89442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x00007efe894969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x00007efe89442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x00007efe894287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x00007efe8942871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x00007efe89439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x00000000036b2f1b llvm::VPRecipeBuilder::tryToCreatePartialReduction(llvm::VPInstruction*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36b2f1b)\n #9 0x00000000036b599f llvm::VPRecipeBuilder::tryToCreateWidenRecipe(llvm::VPSingleDefRecipe*, llvm::VFRange&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36b599f)\n#10 0x00000000036d4e5e llvm::LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(std::unique_ptr<llvm::VPlan, std::default_delete<llvm::VPlan>>, llvm::VFRange&, llvm::LoopVersioning*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36d4e5e)\n#11 0x00000000036d63a8 llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36d63a8)\n```\n\nCompile with: `opt -S -passes=loop-vectorize`, see also: https://godbolt.org/z/7oedf34Pq\n\nReproduced from this C reproducer:\n\n```\nint a, b;\nextern char e;\nint *c;\nshort *d;\nvoid f() {\n for (int g;;)\n for (char h; h < 20; h++) {\n a = c[h];\n for (int i = 0; i < 22; i += 3) {\n e = 0;\n b += d[g];\n }\n }\n}\n```",
|
| 56 |
+
"author": "sjoerdmeijer",
|
| 57 |
+
"labels": [
|
| 58 |
+
"vectorizers",
|
| 59 |
+
"crash-on-valid"
|
| 60 |
+
],
|
| 61 |
+
"comments": [
|
| 62 |
+
{
|
| 63 |
+
"author": "sjoerdmeijer",
|
| 64 |
+
"body": "CC: @sdesmalen-arm , @SamTebbs33\n\nWas wondering if this is more fall out from the partial reductions work? "
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"author": "sjoerdmeijer",
|
| 68 |
+
"body": "This assert was introduced in 3ad5765e2341b by @fhahn "
|
| 69 |
+
}
|
| 70 |
+
]
|
| 71 |
+
},
|
| 72 |
+
"properties": {
|
| 73 |
+
"is_single_file_fix": true,
|
| 74 |
+
"is_single_func_fix": false
|
| 75 |
+
},
|
| 76 |
+
"verified": true
|
| 77 |
+
}
|
dataset/167867.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "167867",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/167867",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "b725bdba1faf256c725f5fd12c581acb381bf0d3",
|
| 6 |
+
"knowledge_cutoff": "2025-11-13T11:25:23Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "67e35bbebbed5e33a173751d019c22e4effa65fd",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopVectorize"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/LoopVectorize.cpp": [
|
| 17 |
+
[
|
| 18 |
+
7992,
|
| 19 |
+
8004
|
| 20 |
+
],
|
| 21 |
+
[
|
| 22 |
+
8006,
|
| 23 |
+
8013
|
| 24 |
+
],
|
| 25 |
+
[
|
| 26 |
+
8018,
|
| 27 |
+
8048
|
| 28 |
+
]
|
| 29 |
+
]
|
| 30 |
+
},
|
| 31 |
+
"bug_location_funcname": {
|
| 32 |
+
"llvm/lib/Transforms/Vectorize/LoopVectorize.cpp": [
|
| 33 |
+
"VPRecipeBuilder::collectScaledReductions",
|
| 34 |
+
"VPRecipeBuilder::getScaledReductions"
|
| 35 |
+
]
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
"patch": "commit 67e35bbebbed5e33a173751d019c22e4effa65fd\nAuthor: Florian Hahn <flo@fhahn.com>\nDate: Thu Nov 20 15:54:57 2025 +0000\n\n [LV] Check full partial reduction chains in order. (#168036)\n \n https://github.com/llvm/llvm-project/pull/162822 added another\n validation step to check if entries in a partial reduction chain have\n the same scale factor. But the validation was still dependent on the\n order of entries in PartialReductionChains, and would fail to reject\n some cases (e.g. if the first first link matched the scale of the second\n link, but the second link is invalidated later).\n \n To fix that, group chains by their starting phi nodes, then perform the\n validation for each chain, and if it fails, invalidate the whole chain\n for the phi.\n \n Fixes https://github.com/llvm/llvm-project/issues/167243.\n Fixes https://github.com/llvm/llvm-project/issues/167867.\n \n PR: https://github.com/llvm/llvm-project/pull/168036\n\ndiff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\nindex 8013c47f53db..741caab1fe58 100644\n--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\n+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\n@@ -7992,13 +7992,15 @@ VPReplicateRecipe *VPRecipeBuilder::handleReplication(VPInstruction *VPI,\n /// Find all possible partial reductions in the loop and track all of those that\n /// are valid so recipes can be formed later.\n void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {\n- // Find all possible partial reductions.\n- SmallVector<std::pair<PartialReductionChain, unsigned>>\n- PartialReductionChains;\n- for (const auto &[Phi, RdxDesc] : Legal->getReductionVars()) {\n+ // Find all possible partial reductions, grouping chains by their PHI. This\n+ // grouping allows invalidating the whole chain, if any link is not a valid\n+ // partial reduction.\n+ MapVector<Instruction *,\n+ SmallVector<std::pair<PartialReductionChain, unsigned>>>\n+ ChainsByPhi;\n+ for (const auto &[Phi, RdxDesc] : Legal->getReductionVars())\n getScaledReductions(Phi, RdxDesc.getLoopExitInstr(), Range,\n- PartialReductionChains);\n- }\n+ ChainsByPhi[Phi]);\n \n // A partial reduction is invalid if any of its extends are used by\n // something that isn't another partial reduction. This is because the\n@@ -8006,8 +8008,9 @@ void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {\n \n // Build up a set of partial reduction ops for efficient use checking.\n SmallPtrSet<User *, 4> PartialReductionOps;\n- for (const auto &[PartialRdx, _] : PartialReductionChains)\n- PartialReductionOps.insert(PartialRdx.ExtendUser);\n+ for (const auto &[_, Chains] : ChainsByPhi)\n+ for (const auto &[PartialRdx, _] : Chains)\n+ PartialReductionOps.insert(PartialRdx.ExtendUser);\n \n auto ExtendIsOnlyUsedByPartialReductions =\n [&PartialReductionOps](Instruction *Extend) {\n@@ -8018,31 +8021,38 @@ void VPRecipeBuilder::collectScaledReductions(VFRange &Range) {\n \n // Check if each use of a chain's two extends is a partial reduction\n // and only add those that don't have non-partial reduction users.\n- for (auto Pair : PartialReductionChains) {\n- PartialReductionChain Chain = Pair.first;\n- if (ExtendIsOnlyUsedByPartialReductions(Chain.ExtendA) &&\n- (!Chain.ExtendB || ExtendIsOnlyUsedByPartialReductions(Chain.ExtendB)))\n- ScaledReductionMap.try_emplace(Chain.Reduction, Pair.second);\n+ for (const auto &[_, Chains] : ChainsByPhi) {\n+ for (const auto &[Chain, Scale] : Chains) {\n+ if (ExtendIsOnlyUsedByPartialReductions(Chain.ExtendA) &&\n+ (!Chain.ExtendB ||\n+ ExtendIsOnlyUsedByPartialReductions(Chain.ExtendB)))\n+ ScaledReductionMap.try_emplace(Chain.Reduction, Scale);\n+ }\n }\n \n // Check that all partial reductions in a chain are only used by other\n // partial reductions with the same scale factor. Otherwise we end up creating\n // users of scaled reductions where the types of the other operands don't\n // match.\n- for (const auto &[Chain, Scale] : PartialReductionChains) {\n- auto AllUsersPartialRdx = [ScaleVal = Scale, this](const User *U) {\n- auto *UI = cast<Instruction>(U);\n- if (isa<PHINode>(UI) && UI->getParent() == OrigLoop->getHeader()) {\n- return all_of(UI->users(), [ScaleVal, this](const User *U) {\n- auto *UI = cast<Instruction>(U);\n- return ScaledReductionMap.lookup_or(UI, 0) == ScaleVal;\n- });\n+ for (const auto &[Phi, Chains] : ChainsByPhi) {\n+ for (const auto &[Chain, Scale] : Chains) {\n+ auto AllUsersPartialRdx = [ScaleVal = Scale, RdxPhi = Phi,\n+ this](const User *U) {\n+ auto *UI = cast<Instruction>(U);\n+ if (isa<PHINode>(UI) && UI->getParent() == OrigLoop->getHeader())\n+ return UI == RdxPhi;\n+ return ScaledReductionMap.lookup_or(UI, 0) == ScaleVal ||\n+ !OrigLoop->contains(UI->getParent());\n+ };\n+\n+ // If any partial reduction entry for the phi is invalid, invalidate the\n+ // whole chain.\n+ if (!all_of(Chain.Reduction->users(), AllUsersPartialRdx)) {\n+ for (const auto &[Chain, _] : Chains)\n+ ScaledReductionMap.erase(Chain.Reduction);\n+ break;\n }\n- return ScaledReductionMap.lookup_or(UI, 0) == ScaleVal ||\n- !OrigLoop->contains(UI->getParent());\n- };\n- if (!all_of(Chain.Reduction->users(), AllUsersPartialRdx))\n- ScaledReductionMap.erase(Chain.Reduction);\n+ }\n }\n }\n \n",
|
| 39 |
+
"tests": [
|
| 40 |
+
{
|
| 41 |
+
"file": "llvm/test/Transforms/LoopVectorize/AArch64/partial-reduce-incomplete-chains.ll",
|
| 42 |
+
"commands": [
|
| 43 |
+
"opt --mattr=+neon,+dotprod -passes=loop-vectorize -force-vector-interleave=1 -enable-epilogue-vectorization=false -S %s"
|
| 44 |
+
],
|
| 45 |
+
"tests": [
|
| 46 |
+
{
|
| 47 |
+
"test_name": "chained_sext_adds",
|
| 48 |
+
"test_body": "target triple = \"arm64-apple-macosx\"\n\ndefine void @chained_sext_adds(ptr noalias %src, ptr noalias %dst) #0 {\nentry:\n br label %loop\n\nexit: ; preds = %loop\n ret void\n\nloop: ; preds = %loop, %entry\n %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]\n %red = phi i32 [ 0, %entry ], [ %add.1, %loop ]\n %gep.src = getelementptr i8, ptr %src, i64 %iv\n %l = load i8, ptr %gep.src, align 1\n %conv8 = sext i8 %l to i32\n %add = add i32 %red, %conv8\n %conv8.1 = sext i8 %l to i32\n %add.1 = add i32 %add, %conv8.1\n %gep.dst = getelementptr i8, ptr %dst, i64 %iv\n store i32 %add.1, ptr %dst, align 4\n %iv.next = add i64 %iv, 1\n %exitcond = icmp eq i64 %iv.next, 1000\n br i1 %exitcond, label %exit, label %loop\n}\n\nattributes #0 = { \"target-cpu\"=\"grace\" }\n"
|
| 49 |
+
}
|
| 50 |
+
]
|
| 51 |
+
}
|
| 52 |
+
],
|
| 53 |
+
"issue": {
|
| 54 |
+
"title": "Assertion `ScaleFactor == vputils::getVFScaleFactor(Accumulator->getDefiningRecipe()) && \"all accumulators in chain must have same scale factor\"' failed.",
|
| 55 |
+
"body": "Most likely this issue duplicates https://github.com/llvm/llvm-project/issues/167243\n\nTo reproduce run opt with -S -passes=loop-vectorize and the test below:\n```\n; ModuleID = './reduced.ll'\nsource_filename = \"./reduced.ll\"\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32-ni:1-p2:32:8:8:32-ni:2\"\ntarget triple = \"aarch64-none-linux-gnu\"\n\ndefine i64 @wombat(ptr addrspace(1) %arg) #0 gc \"statepoint-example\" {\nbb:\n br label %bb1\n\nbb1: ; preds = %bb1, %bb\n %phi = phi i64 [ 0, %bb ], [ %add3, %bb1 ]\n %phi2 = phi i32 [ 729, %bb ], [ %add4, %bb1 ]\n %load = load i32, ptr addrspace(1) null, align 4\n %sext = sext i32 %load to i64\n %mul = mul i64 %sext, 0\n %add = add i64 %sext, %phi\n %add3 = add i64 %add, %mul\n store i64 %add3, ptr addrspace(1) %arg, align 8\n %add4 = add i32 %phi2, 1\n %icmp = icmp ult i32 %phi2, 1\n br i1 %icmp, label %bb5, label %bb1\n\nbb5: ; preds = %bb1\n ret i64 0\n}\n\nattributes #0 = { \"target-cpu\"=\"neoverse-n1\" }\n```\nReproducer: https://godbolt.org/z/d5jGn6P6f\n\nStack dump:\n```\nopt: /root/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8234: llvm::VPRecipeBase* llvm::VPRecipeBuilder::tryToCreatePartialReduction(llvm::VPInstruction*, unsigned int): Assertion `ScaleFactor == vputils::getVFScaleFactor(Accumulator->getDefiningRecipe()) && \"all accumulators in chain must have same scale factor\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -S -passes=loop-vectorize <source>\n1.\tRunning pass \"function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)\" on module \"<source>\"\n2.\tRunning pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"wombat\"\n #0 0x00000000059c2018 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59c2018)\n #1 0x00000000059beec4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x000072eee7e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x000072eee7e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x000072eee7e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x000072eee7e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x000072eee7e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x000072eee7e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x00000000036c4de0 llvm::VPRecipeBuilder::tryToCreatePartialReduction(llvm::VPInstruction*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36c4de0)\n #9 0x00000000036c779f llvm::VPRecipeBuilder::tryToCreateWidenRecipe(llvm::VPSingleDefRecipe*, llvm::VFRange&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36c779f)\n#10 0x00000000036e69b7 llvm::LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(std::unique_ptr<llvm::VPlan, std::default_delete<llvm::VPlan>>, llvm::VFRange&, llvm::LoopVersioning*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36e69b7)\n#11 0x00000000036e7fb8 llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36e7fb8)\n#12 0x00000000036e8935 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36e8935)\n#13 0x00000000036ec5b6 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36ec5b6)\n#14 0x00000000036ef4d0 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36ef4d0)\n#15 0x00000000036efbb5 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x36efbb5)\n#16 0x0000000002fd72be llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2fd72be)\n#17 0x0000000005799e01 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5799e01)\n#18 0x0000000000f035fe llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf035fe)\n#19 0x000000000579847a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x579847a)\n#20 0x000000000097defe llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97defe)\n#21 0x0000000005797e31 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5797e31)\n#22 0x000000000098809a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x98809a)\n#23 0x000000000097c311 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97c311)\n#24 0x000072eee7e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#25 0x000072eee7e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#26 0x0000000000973725 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x973725)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```\n",
|
| 56 |
+
"author": "TatyanaDoubts",
|
| 57 |
+
"labels": [
|
| 58 |
+
"vectorizers",
|
| 59 |
+
"crash"
|
| 60 |
+
],
|
| 61 |
+
"comments": []
|
| 62 |
+
},
|
| 63 |
+
"properties": {
|
| 64 |
+
"is_single_file_fix": true,
|
| 65 |
+
"is_single_func_fix": false
|
| 66 |
+
},
|
| 67 |
+
"verified": true
|
| 68 |
+
}
|
dataset/171890.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "171890",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/171890",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "8bced611727da116641b329250a33c1871f8474c",
|
| 6 |
+
"knowledge_cutoff": "2025-12-11T20:00:33Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/InferAddressSpaces/NVPTX"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "8b5e95b1fd2fa49a7c1607e294659f2c0ec12d69",
|
| 12 |
+
"components": [
|
| 13 |
+
"InferAddressSpaces"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1102,
|
| 19 |
+
1108
|
| 20 |
+
],
|
| 21 |
+
[
|
| 22 |
+
1133,
|
| 23 |
+
1144
|
| 24 |
+
]
|
| 25 |
+
]
|
| 26 |
+
},
|
| 27 |
+
"bug_location_funcname": {
|
| 28 |
+
"llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp": [
|
| 29 |
+
"InferAddressSpacesImpl::updateAddressSpace"
|
| 30 |
+
]
|
| 31 |
+
}
|
| 32 |
+
},
|
| 33 |
+
"patch": "commit 8b5e95b1fd2fa49a7c1607e294659f2c0ec12d69\nAuthor: Hongyu Chen <xxs_chy@outlook.com>\nDate: Sun Feb 8 01:20:19 2026 +0800\n\n [InferAddressSpaces] Initialize op(generic const, generic const, ...) -> generic (#172143)\n \n Fixes #171890\n If the pointer operands of an instruction are all constants with generic\n AS, we always infer the AS of the instruction as uninitialized finally.\n And the rewrite process will skip cloning the instruction, producing\n invalid IR.\n This patch fixes it by inferring the AS of this kind of instruction as\n flat. Maybe we can fold the operator with all constants to get better\n performance, but I think this case is rare in the real world.\n\ndiff --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp\nindex 03efc156df1e..93da510c5fbc 100644\n--- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp\n+++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp\n@@ -1102,7 +1102,8 @@ bool InferAddressSpacesImpl::updateAddressSpace(\n } else {\n // Otherwise, infer the address space from its pointer operands.\n SmallVector<Constant *, 2> ConstantPtrOps;\n- for (Value *PtrOperand : getPointerOperands(V, *DL, TTI)) {\n+ SmallVector<Value *, 2> PtrOps = getPointerOperands(V, *DL, TTI);\n+ for (Value *PtrOperand : PtrOps) {\n auto I = InferredAddrSpace.find(PtrOperand);\n unsigned OperandAS;\n if (I == InferredAddrSpace.end()) {\n@@ -1133,12 +1134,18 @@ bool InferAddressSpacesImpl::updateAddressSpace(\n if (NewAS == FlatAddrSpace)\n break;\n }\n+\n if (NewAS != FlatAddrSpace && NewAS != UninitializedAddressSpace) {\n if (any_of(ConstantPtrOps, [=](Constant *C) {\n return !isSafeToCastConstAddrSpace(C, NewAS);\n }))\n NewAS = FlatAddrSpace;\n }\n+\n+ // operator(flat const, flat const, ...) -> flat\n+ if (NewAS == UninitializedAddressSpace &&\n+ PtrOps.size() == ConstantPtrOps.size())\n+ NewAS = FlatAddrSpace;\n }\n \n unsigned OldAS = InferredAddrSpace.lookup(&V);\n",
|
| 34 |
+
"tests": [
|
| 35 |
+
{
|
| 36 |
+
"file": "llvm/test/Transforms/InferAddressSpaces/NVPTX/nullptr.ll",
|
| 37 |
+
"commands": [
|
| 38 |
+
"opt -S -passes=infer-address-spaces %s"
|
| 39 |
+
],
|
| 40 |
+
"tests": [
|
| 41 |
+
{
|
| 42 |
+
"test_name": "<module>",
|
| 43 |
+
"test_body": "\ntarget triple = \"nvptx64--\"\n\ndefine ptr @pr171890(i1 %c) {\n;\nentry:\n %stack = alloca i16, align 2\n %const = getelementptr i8, ptr null, i64 1\n %sel = select i1 %c, ptr %stack, ptr %const\n ret ptr %sel\n}"
|
| 44 |
+
}
|
| 45 |
+
]
|
| 46 |
+
}
|
| 47 |
+
],
|
| 48 |
+
"issue": {
|
| 49 |
+
"title": "[NVPTX][InferAddressSpaces] Assertion `Val && \"isa<> used on a null pointer\"' failed.",
|
| 50 |
+
"body": "Reproducer: https://godbolt.org/z/P3exKvMsT\nTestcase:\n```llvm\ntarget datalayout = \"e-p6:32:32-i64:64-i128:128-i256:256-v16:16-v32:32-n16:32:64\"\ntarget triple = \"nvptx64-unknown-nvidiacl\"\n\ndefine ptr @func_64() {\nentry:\n %p_1027_1 = alloca i16, align 2\n br label %for.cond2.3\n\nfor.cond2.3: ; preds = %entry\n %l_171.1.3 = phi ptr [ null, %entry ]\n br i1 false, label %for.cond2.4, label %BS_LABEL_0.preheader.4\n\nBS_LABEL_0.preheader.4: ; preds = %for.cond2.3\n br label %for.cond2.4\n\nfor.cond2.4: ; preds = %BS_LABEL_0.preheader.4, %for.cond2.3\n %l_171.1.4 = phi ptr [ %p_1027_1, %BS_LABEL_0.preheader.4 ], [ %l_171.1.3, %for.cond2.3 ]\n ret ptr %l_171.1.4\n}\n```\n\nDump:\n```\nllc: /root/llvm-project/llvm/include/llvm/Support/Casting.h:109: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::PoisonValue; From = llvm::Value]: Assertion `Val && \"isa<> used on a null pointer\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -O1 <source>\n1.\tRunning pass 'Function Pass Manager' on module '<source>'.\n2.\tRunning pass 'Early CSE' on function '@func_64'\n #0 0x000000000421f3e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x421f3e8)\n #1 0x000000000421c294 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x0000712cf8642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x0000712cf86969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x0000712cf8642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x0000712cf86287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x0000712cf862871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x0000712cf8639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x0000000002ba36a3 (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2ba36a3)\n #9 0x0000000002bc87ab simplifyInstructionWithOperands(llvm::Instruction*, llvm::ArrayRef<llvm::Value*>, llvm::SimplifyQuery const&, unsigned int) InstructionSimplify.cpp:0:0\n#10 0x0000000002bc89cb llvm::simplifyInstruction(llvm::Instruction*, llvm::SimplifyQuery const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2bc89cb)\n#11 0x0000000003aba91f (anonymous namespace)::EarlyCSE::processNode(llvm::DomTreeNodeBase<llvm::BasicBlock>*) EarlyCSE.cpp:0:0\n#12 0x0000000003abcdc6 (anonymous namespace)::EarlyCSE::run() EarlyCSE.cpp:0:0\n#13 0x0000000003abf7cb (anonymous namespace)::EarlyCSELegacyCommonPass<false>::runOnFunction(llvm::Function&) (.part.0) EarlyCSE.cpp:0:0\n#14 0x00000000037503d6 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37503d6)\n#15 0x0000000003750781 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3750781)\n#16 0x0000000003750fef llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3750fef)\n#17 0x00000000008fdcc4 compileModule(char**, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0\n#18 0x00000000007c8139 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c8139)\n#19 0x0000712cf8629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#20 0x0000712cf8629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#21 0x00000000008f2ec5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8f2ec5)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```",
|
| 51 |
+
"author": "XChy",
|
| 52 |
+
"labels": [
|
| 53 |
+
"crash-on-valid",
|
| 54 |
+
"llvm:transforms"
|
| 55 |
+
],
|
| 56 |
+
"comments": [
|
| 57 |
+
{
|
| 58 |
+
"author": "XChy",
|
| 59 |
+
"body": "The problem is in InferAddressSpace:\n```llvm\n*** IR Dump Before Infer address spaces (infer-address-spaces) ***\ndefine ptr @func_64() {\nentry:\n %p_1027_1 = alloca i16, align 2\n %0 = addrspacecast ptr %p_1027_1 to ptr addrspace(5)\n %1 = addrspacecast ptr addrspace(5) %0 to ptr\n br label %for.cond2.3\n\nfor.cond2.3: ; preds = %entry\n %l_171.1.3 = phi ptr [ null, %entry ]\n br i1 false, label %for.cond2.4, label %BS_LABEL_0.preheader.4\n\nBS_LABEL_0.preheader.4: ; preds = %for.cond2.3\n br label %for.cond2.4\n\nfor.cond2.4: ; preds = %BS_LABEL_0.preheader.4, %for.cond2.3\n %l_171.1.4 = phi ptr [ %p_1027_1, %BS_LABEL_0.preheader.4 ], [ %l_171.1.3, %for.cond2.3 ]\n ret ptr %l_171.1.4\n}\n*** IR Dump Before NVPTX lower atomics of local memory (nvptx-atomic-lower) ***\ndefine ptr @func_64() {\nentry:\n %p_1027_1 = alloca i16, align 2\n %0 = addrspacecast ptr %p_1027_1 to ptr addrspace(5)\n %1 = addrspacecast ptr addrspace(5) %0 to ptr\n br label %for.cond2.3\n\nfor.cond2.3: ; preds = %entry\n br i1 false, label %for.cond2.4, label %BS_LABEL_0.preheader.4\n\nBS_LABEL_0.preheader.4: ; preds = %for.cond2.3\n br label %for.cond2.4\n\nfor.cond2.4: ; preds = %BS_LABEL_0.preheader.4, %for.cond2.3\n %l_171.1.4 = phi ptr addrspace(5) [ %0, %BS_LABEL_0.preheader.4 ], [ <null operand!>, %for.cond2.3 ]\n %2 = addrspacecast ptr addrspace(5) %l_171.1.4 to ptr\n ret ptr %2\n}\n```"
|
| 60 |
+
}
|
| 61 |
+
]
|
| 62 |
+
},
|
| 63 |
+
"properties": {
|
| 64 |
+
"is_single_file_fix": true,
|
| 65 |
+
"is_single_func_fix": true
|
| 66 |
+
},
|
| 67 |
+
"verified": true
|
| 68 |
+
}
|
dataset/174045.json
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "174045",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/174045",
|
| 4 |
+
"bug_type": "miscompilation",
|
| 5 |
+
"base_commit": "1171e30cb01c00a048ec0d82f20e57213842f505",
|
| 6 |
+
"knowledge_cutoff": "2025-12-31T00:32:28Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/GVN",
|
| 9 |
+
"llvm/test/Transforms/InstSimplify"
|
| 10 |
+
],
|
| 11 |
+
"hints": {
|
| 12 |
+
"fix_commit": "a3c9b72651178e7903c9c4db791b676ab91442a9",
|
| 13 |
+
"components": [
|
| 14 |
+
"Loads"
|
| 15 |
+
],
|
| 16 |
+
"bug_location_lineno": {
|
| 17 |
+
"llvm/lib/Analysis/Loads.cpp": [
|
| 18 |
+
[
|
| 19 |
+
835,
|
| 20 |
+
841
|
| 21 |
+
],
|
| 22 |
+
[
|
| 23 |
+
847,
|
| 24 |
+
853
|
| 25 |
+
],
|
| 26 |
+
[
|
| 27 |
+
866,
|
| 28 |
+
872
|
| 29 |
+
]
|
| 30 |
+
]
|
| 31 |
+
},
|
| 32 |
+
"bug_location_funcname": {
|
| 33 |
+
"llvm/lib/Analysis/Loads.cpp": [
|
| 34 |
+
"isPointerAlwaysReplaceable",
|
| 35 |
+
"llvm::canReplacePointersIfEqual",
|
| 36 |
+
"llvm::canReplacePointersInUseIfEqual"
|
| 37 |
+
]
|
| 38 |
+
}
|
| 39 |
+
},
|
| 40 |
+
"patch": "commit a3c9b72651178e7903c9c4db791b676ab91442a9\nAuthor: hanbeom <kese111@gmail.com>\nDate: Thu Jan 8 09:30:11 2026 +0900\n\n [IR] Fix canReplacePointersIfEqual to properly validate vector pointers (#174142)\n \n Previously, `canReplacePointersIfEqual` unconditionally returned\n `true` for vectors of pointers (e.g., `<2 x ptr>`) because it only\n checked for scalar pointer types.\n \n This resulted in a failure to perform appropriate verification for\n these types. This patch fixes the logic to ensure they are properly\n validated.\n \n Fixes https://github.com/llvm/llvm-project/issues/174045\n\ndiff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp\nindex 73f40f13a262..2e855f918c91 100644\n--- a/llvm/lib/Analysis/Loads.cpp\n+++ b/llvm/lib/Analysis/Loads.cpp\n@@ -835,7 +835,7 @@ static bool isPointerAlwaysReplaceable(const Value *From, const Value *To,\n // optimizations.\n if (isa<ConstantPointerNull>(To))\n return true;\n- if (isa<Constant>(To) &&\n+ if (isa<Constant>(To) && To->getType()->isPointerTy() &&\n isDereferenceablePointer(To, Type::getInt8Ty(To->getContext()), DL))\n return true;\n return getUnderlyingObjectAggressive(From) ==\n@@ -847,7 +847,7 @@ bool llvm::canReplacePointersInUseIfEqual(const Use &U, const Value *To,\n Type *Ty = To->getType();\n assert(U->getType() == Ty && \"values must have matching types\");\n // Not a pointer, just return true.\n- if (!Ty->isPointerTy())\n+ if (!Ty->isPtrOrPtrVectorTy())\n return true;\n \n // Do not perform replacements in lifetime intrinsic arguments.\n@@ -866,7 +866,7 @@ bool llvm::canReplacePointersIfEqual(const Value *From, const Value *To,\n const DataLayout &DL) {\n assert(From->getType() == To->getType() && \"values must have matching types\");\n // Not a pointer, just return true.\n- if (!From->getType()->isPointerTy())\n+ if (!From->getType()->isPtrOrPtrVectorTy())\n return true;\n \n return isPointerAlwaysReplaceable(From, To, DL);\n",
|
| 41 |
+
"tests": [
|
| 42 |
+
{
|
| 43 |
+
"file": "llvm/test/Transforms/GVN/condprop.ll",
|
| 44 |
+
"commands": [
|
| 45 |
+
"opt < %s -passes=gvn -S"
|
| 46 |
+
],
|
| 47 |
+
"tests": [
|
| 48 |
+
{
|
| 49 |
+
"test_name": "select_same_obj",
|
| 50 |
+
"test_body": "define void @select_same_obj(i1 %c, ptr %p, i64 %x) {\nentry:\n %p2 = getelementptr i8, ptr %p, i64 %x\n %p3 = select i1 %c, ptr %p, ptr %p2\n %cmp = icmp eq ptr %p, %p3\n br i1 %cmp, label %if, label %exit\n\nif: ; preds = %entry\n call void @use_ptr(ptr %p)\n call void @use_ptr(ptr %p3)\n ret void\n\nexit: ; preds = %entry\n ret void\n}\n\ndeclare void @use_ptr(ptr)\n"
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"test_name": "select_vector_eq",
|
| 54 |
+
"test_body": "define <2 x ptr> @select_vector_eq(<2 x ptr> %a, <2 x ptr> %b) {\n %cmp = icmp eq <2 x ptr> %a, %b\n %sel = select <2 x i1> %cmp, <2 x ptr> %a, <2 x ptr> %b\n ret <2 x ptr> %sel\n}\n"
|
| 55 |
+
}
|
| 56 |
+
]
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"file": "llvm/test/Transforms/InstSimplify/select-icmp.ll",
|
| 60 |
+
"commands": [
|
| 61 |
+
"opt < %s -passes=instsimplify -S"
|
| 62 |
+
],
|
| 63 |
+
"tests": [
|
| 64 |
+
{
|
| 65 |
+
"test_name": "ptr_eq_replace_same_underlying_object",
|
| 66 |
+
"test_body": "define ptr @ptr_eq_replace_same_underlying_object(ptr %st, i64 %i, i64 %j) {\n %a = getelementptr inbounds i8, ptr %st, i64 %i\n %b = getelementptr inbounds i8, ptr %st, i64 %j\n %cmp = icmp eq ptr %a, %b\n %sel = select i1 %cmp, ptr %a, ptr %b\n ret ptr %sel\n}\n"
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"test_name": "icmp_ptr_eq_replace",
|
| 70 |
+
"test_body": "define ptr @icmp_ptr_eq_replace(ptr %a, ptr %b) {\n %cmp = icmp eq ptr %a, %b\n %sel = select i1 %cmp, ptr %a, ptr %b\n ret ptr %sel\n}\n"
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"test_name": "ptr_eq_replace_vector_constant",
|
| 74 |
+
"test_body": "define <2 x ptr> @ptr_eq_replace_vector_constant(<2 x ptr> %a) {\n %cmp = icmp eq <2 x ptr> %a, <ptr inttoptr (i64 42 to ptr), ptr inttoptr (i64 88 to ptr)>\n %sel = select <2 x i1> %cmp, <2 x ptr> %a, <2 x ptr> <ptr inttoptr (i64 42 to ptr), ptr inttoptr (i64 88 to ptr)>\n ret <2 x ptr> %sel\n}\n"
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"test_name": "icmp_vector_ptr_eq_replace",
|
| 78 |
+
"test_body": "define <2 x ptr> @icmp_vector_ptr_eq_replace(<2 x ptr> %a, <2 x ptr> %b) {\n %cmp = icmp eq <2 x ptr> %a, %b\n %sel = select <2 x i1> %cmp, <2 x ptr> %a, <2 x ptr> %b\n ret <2 x ptr> %sel\n}\n"
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"test_name": "icmp_ptr_eq_replace_null",
|
| 82 |
+
"test_body": "define ptr @icmp_ptr_eq_replace_null(ptr %a) {\n %cmp = icmp eq ptr %a, null\n %sel = select i1 %cmp, ptr null, ptr %a\n ret ptr %sel\n}\n"
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"test_name": "ptr_eq_replace_constant",
|
| 86 |
+
"test_body": "define ptr @ptr_eq_replace_constant(ptr %a) {\n %cmp = icmp eq ptr %a, inttoptr (i64 42 to ptr)\n %sel = select i1 %cmp, ptr inttoptr (i64 42 to ptr), ptr %a\n ret ptr %sel\n}\n"
|
| 87 |
+
}
|
| 88 |
+
]
|
| 89 |
+
}
|
| 90 |
+
],
|
| 91 |
+
"issue": {
|
| 92 |
+
"title": "[InstSimplify] Folds vector pointer `select (icmp eq <N x ptr>)` to operand and loses provenance",
|
| 93 |
+
"body": "Instsimplify can fold:\n\n```llvm\n%cmp = icmp eq <2 x ptr> %a, %b\n%sel = select <2 x i1> %cmp, <2 x ptr> %a, %b\n```\n\nto `ret <2 x ptr> %b`, which is not always valid for pointers. Even if `%a[0]` and `%b[0]` have the same address , they might have different provenance, so selecting `%a[0]` is not equivalent to returning `%b[0]`.\n\nAlive2 proof: https://alive2.llvm.org/ce/z/JxDjAx\n\nExposed from https://github.com/llvm/llvm-project/commit/1af627b592dd15bbe58136f902ced46251fc344d, cc @dtcxzyw ",
|
| 94 |
+
"author": "cardigan1008",
|
| 95 |
+
"labels": [
|
| 96 |
+
"miscompilation",
|
| 97 |
+
"llvm:analysis"
|
| 98 |
+
],
|
| 99 |
+
"comments": [
|
| 100 |
+
{
|
| 101 |
+
"author": "nikic",
|
| 102 |
+
"body": "In https://github.com/llvm/llvm-project/blob/393783fff844d8919a090f74e641d78c50bcc7f4/llvm/lib/Analysis/Loads.cpp#L845-L873 we should replace the pointer checks with pointer or vector of pointer checks."
|
| 103 |
+
}
|
| 104 |
+
]
|
| 105 |
+
},
|
| 106 |
+
"properties": {
|
| 107 |
+
"is_single_file_fix": true,
|
| 108 |
+
"is_single_func_fix": false
|
| 109 |
+
},
|
| 110 |
+
"verified": true
|
| 111 |
+
}
|
dataset/174599.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "174599",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/174599",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "d64ecd163f731c98f3c3e0c29b2c9173f58060b8",
|
| 6 |
+
"knowledge_cutoff": "2026-01-06T14:42:55Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/SLPVectorizer"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "39456e4226f41213a603f75a363b6bad9f7caf39",
|
| 12 |
+
"components": [
|
| 13 |
+
"SLPVectorizer"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 17 |
+
[
|
| 18 |
+
21808,
|
| 19 |
+
21815
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 25 |
+
"BoUpSLP::BlockScheduling::tryScheduleBundle"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 39456e4226f41213a603f75a363b6bad9f7caf39\nAuthor: Alexey Bataev <a.bataev@outlook.com>\nDate: Wed Jan 7 08:57:02 2026 -0800\n\n [SLP]Do not increment dep count for non-schedulable nodes with non-schedulable parents\n \n If the node is non-scedulable, all instructions are used outside only\n and parent is non-schedulable non-phi node, the dependency count should be\n increased for such nodes\n \n Fixes #174599\n\ndiff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\nindex 5bd274a27549..cc78d0189066 100644\n--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n@@ -21808,8 +21808,15 @@ BoUpSLP::BlockScheduling::tryScheduleBundle(ArrayRef<Value *> VL, BoUpSLP *SLP,\n }\n if (!ControlDependentMembers.empty()) {\n ScheduleBundle Invalid = ScheduleBundle::invalid();\n+ bool IsNonSchedulableWithParentPhiNode =\n+ EI.UserTE->hasState() &&\n+ EI.UserTE->State != TreeEntry::SplitVectorize &&\n+ EI.UserTE->getOpcode() == Instruction::PHI;\n calculateDependencies(Invalid, /*InsertInReadyList=*/true, SLP,\n- ControlDependentMembers, /*NonSchedulable=*/true);\n+ ControlDependentMembers,\n+ /*NonSchedulable=*/HasCopyables ||\n+ IsNonSchedulableWithParentPhiNode ||\n+ !all_of(VL, isUsedOutsideBlock));\n }\n return nullptr;\n }\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/SLPVectorizer/X86/non-schedulable-node-with-non-schedulable-parent.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -passes=slp-vectorizer -S -mtriple=x86_64 < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "\ndefine float @test() {\n;\nbb:\n %fadd = fadd float 0.000000e+00, 0.000000e+00\n %load = load float, ptr null, align 4\n %fadd1 = fadd float %fadd, %load\n %fadd2 = fadd float 0.000000e+00, 0.000000e+00\n %fmul = fmul float 0.000000e+00, 0.000000e+00\n %fmul3 = fmul float 0.000000e+00, 0.000000e+00\n %fadd4 = fadd float %fmul3, 0.000000e+00\n br i1 false, label %bb5, label %bb6\n\nbb5:\n br label %bb8\n\nbb6:\n %fdiv = fdiv float %fadd1, 0.000000e+00\n %fdiv7 = fdiv float %fadd2, 0.000000e+00\n br label %bb8\n\nbb8:\n %phi = phi float [ 0.000000e+00, %bb5 ], [ %fdiv7, %bb6 ]\n %phi9 = phi float [ %fmul, %bb5 ], [ 0.000000e+00, %bb6 ]\n %phi10 = phi float [ %fadd4, %bb5 ], [ %load, %bb6 ]\n %phi11 = phi float [ %fadd1, %bb5 ], [ %fdiv, %bb6 ]\n ret float %phi11\n}"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "Assertion `all_of(Bundles, [](const ScheduleBundle *Bundle) { return Bundle->isScheduled(); }) && \"must be scheduled at this point\"' failed.",
|
| 46 |
+
"body": "Not bisected yet, but a recent regression (at least in terms of the full C++ level test-case that the following is reduced from):\n\nhttps://godbolt.org/z/qcMY4W9PP\n\n```\ndefine float @widget() {\nbb:\n %fadd = fadd float 0.000000e+00, 0.000000e+00\n %load = load float, ptr null, align 4\n %fadd1 = fadd float %fadd, %load\n %fadd2 = fadd float 0.000000e+00, 0.000000e+00\n %fmul = fmul float 0.000000e+00, 0.000000e+00\n %fmul3 = fmul float 0.000000e+00, 0.000000e+00\n %fadd4 = fadd float %fmul3, 0.000000e+00\n br i1 false, label %bb5, label %bb6\n\nbb5: ; preds = %bb\n br label %bb8\n\nbb6: ; preds = %bb\n %fdiv = fdiv float %fadd1, 0.000000e+00\n %fdiv7 = fdiv float %fadd2, 0.000000e+00\n br label %bb8\n\nbb8: ; preds = %bb6, %bb5\n %phi = phi float [ 0.000000e+00, %bb5 ], [ %fdiv7, %bb6 ]\n %phi9 = phi float [ %fmul, %bb5 ], [ 0.000000e+00, %bb6 ]\n %phi10 = phi float [ %fadd4, %bb5 ], [ %load, %bb6 ]\n %phi11 = phi float [ %fadd1, %bb5 ], [ %fdiv, %bb6 ]\n ret float %phi11\n}\n```\n\n\n```\nopt: /root/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:22650: void llvm::slpvectorizer::BoUpSLP::scheduleBlock(const llvm::slpvectorizer::BoUpSLP&, llvm::slpvectorizer::BoUpSLP::BlockScheduling*): Assertion `all_of(Bundles, [](const ScheduleBundle *Bundle) { return Bundle->isScheduled(); }) && \"must be scheduled at this point\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S --passes=slp-vectorizer <source>\n1.\tRunning pass \"function(slp-vectorizer)\" on module \"<source>\"\n2.\tRunning pass \"slp-vectorizer\" on function \"widget\"\n #0 0x0000000005a7a2e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a7a2e8)\n #1 0x0000000005a77194 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x000070bc0b842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x000070bc0b8969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x000070bc0b842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x000070bc0b8287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x000070bc0b82871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x000070bc0b839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x000000000380c32a llvm::slpvectorizer::BoUpSLP::scheduleBlock(llvm::slpvectorizer::BoUpSLP const&, llvm::slpvectorizer::BoUpSLP::BlockScheduling*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x380c32a)\n #9 0x000000000386090a llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::SmallDenseSet<llvm::Value*, 4u, llvm::DenseMapInfo<llvm::Value*, void>> const&, llvm::Instruction*, llvm::ArrayRef<std::tuple<llvm::Value*, unsigned int, bool>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x386090a)\n#10 0x0000000003864e34 llvm::slpvectorizer::BoUpSLP::vectorizeTree() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3864e34)\n#11 0x0000000003885b24 llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3885b24)\n#12 0x000000000388a41c bool tryToVectorizeSequence<llvm::Value>(llvm::SmallVectorImpl<llvm::Value*>&, llvm::function_ref<bool (llvm::Value*, llvm::Value*)>, llvm::function_ref<bool (llvm::ArrayRef<llvm::Value*>, llvm::Value*)>, llvm::function_ref<bool (llvm::ArrayRef<llvm::Value*>, bool)>, bool, llvm::slpvectorizer::BoUpSLP&) (.constprop.0) SLPVectorizer.cpp:0:0\n#13 0x000000000388b6ac llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x388b6ac)\n#14 0x00000000038935b6 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (.part.0) SLPVectorizer.cpp:0:0\n#15 0x00000000038941cb llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x38941cb)\n#16 0x000000000304051e llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x304051e)\n#17 0x0000000005854c81 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5854c81)\n#18 0x0000000000f1b1de llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf1b1de)\n#19 0x000000000585323a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x585323a)\n#20 0x000000000097edfe llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97edfe)\n#21 0x0000000005852bf1 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5852bf1)\n#22 0x00000000009890b0 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9890b0)\n#23 0x000000000097cfd8 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97cfd8)\n#24 0x000070bc0b829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#25 0x000070bc0b829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#26 0x00000000009739d5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9739d5)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```",
|
| 47 |
+
"author": "gregbedwell",
|
| 48 |
+
"labels": [
|
| 49 |
+
"llvm:SLPVectorizer",
|
| 50 |
+
"crash-on-valid"
|
| 51 |
+
],
|
| 52 |
+
"comments": []
|
| 53 |
+
},
|
| 54 |
+
"properties": {
|
| 55 |
+
"is_single_file_fix": true,
|
| 56 |
+
"is_single_func_fix": true
|
| 57 |
+
},
|
| 58 |
+
"verified": true
|
| 59 |
+
}
|
dataset/174622.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "174622",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/174622",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "c6db8f4229d70169949430185e156fb2e6e4150e",
|
| 6 |
+
"knowledge_cutoff": "2026-01-06T16:57:34Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "2f7e218017db69454ea84e1849fcb9a11b1f7fef",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopVectorize"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/VPlanUtils.cpp": [
|
| 17 |
+
[
|
| 18 |
+
82,
|
| 19 |
+
87
|
| 20 |
+
],
|
| 21 |
+
[
|
| 22 |
+
140,
|
| 23 |
+
145
|
| 24 |
+
]
|
| 25 |
+
]
|
| 26 |
+
},
|
| 27 |
+
"bug_location_funcname": {
|
| 28 |
+
"llvm/lib/Transforms/Vectorize/VPlanUtils.cpp": [
|
| 29 |
+
"vputils::getSCEVExprForVPValue",
|
| 30 |
+
"vputils::isHeaderMask"
|
| 31 |
+
]
|
| 32 |
+
}
|
| 33 |
+
},
|
| 34 |
+
"patch": "commit 2f7e218017db69454ea84e1849fcb9a11b1f7fef\nAuthor: Florian Hahn <flo@fhahn.com>\nDate: Sun Jan 11 20:51:12 2026 +0000\n\n [VPlan] Add missing sext(sub) SCEV fold to getSCEVExprForVPValue.\n \n SCEV has a manual fold when doing SCEV construction from IR, that is not\n integrated in the regular SCEV construction functions. Mirror the\n behavior in getSCEVExprForVPValue, to match results when constructing\n SCEVs from IR.\n \n Fixes https://github.com/llvm/llvm-project/issues/174622.\n\ndiff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp\nindex ae36df06bb81..09b77297a151 100644\n--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp\n+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp\n@@ -82,6 +82,61 @@ bool vputils::isHeaderMask(const VPValue *V, const VPlan &Plan) {\n B == Plan.getBackedgeTakenCount();\n }\n \n+/// Returns true if \\p R propagates poison from any operand to its result.\n+static bool propagatesPoisonFromRecipeOp(const VPRecipeBase *R) {\n+ return TypeSwitch<const VPRecipeBase *, bool>(R)\n+ .Case<VPWidenGEPRecipe, VPWidenCastRecipe>(\n+ [](const VPRecipeBase *) { return true; })\n+ .Case<VPReplicateRecipe>([](const VPReplicateRecipe *Rep) {\n+ // GEP and casts propagate poison from all operands.\n+ unsigned Opcode = Rep->getOpcode();\n+ return Opcode == Instruction::GetElementPtr ||\n+ Instruction::isCast(Opcode);\n+ })\n+ .Default([](const VPRecipeBase *) { return false; });\n+}\n+\n+/// Returns true if \\p V being poison is guaranteed to trigger UB because it\n+/// propagates to the address of a memory recipe.\n+static bool poisonGuaranteesUB(const VPValue *V) {\n+ SmallPtrSet<const VPValue *, 8> Visited;\n+ SmallVector<const VPValue *, 16> Worklist;\n+\n+ Worklist.push_back(V);\n+\n+ while (!Worklist.empty()) {\n+ const VPValue *Current = Worklist.pop_back_val();\n+ if (!Visited.insert(Current).second)\n+ continue;\n+\n+ for (VPUser *U : Current->users()) {\n+ // Check if Current is used as an address operand for load/store.\n+ if (auto *MemR = dyn_cast<VPWidenMemoryRecipe>(U)) {\n+ if (MemR->getAddr() == Current)\n+ return true;\n+ continue;\n+ }\n+ if (auto *Rep = dyn_cast<VPReplicateRecipe>(U)) {\n+ unsigned Opcode = Rep->getOpcode();\n+ if ((Opcode == Instruction::Load && Rep->getOperand(0) == Current) ||\n+ (Opcode == Instruction::Store && Rep->getOperand(1) == Current))\n+ return true;\n+ }\n+\n+ // Check if poison propagates through this recipe to any of its users.\n+ auto *R = cast<VPRecipeBase>(U);\n+ for (const VPValue *Op : R->operands()) {\n+ if (Op == Current && propagatesPoisonFromRecipeOp(R)) {\n+ Worklist.push_back(R->getVPSingleValue());\n+ break;\n+ }\n+ }\n+ }\n+ }\n+\n+ return false;\n+}\n+\n const SCEV *vputils::getSCEVExprForVPValue(const VPValue *V,\n PredicatedScalarEvolution &PSE,\n const Loop *L) {\n@@ -140,6 +195,20 @@ const SCEV *vputils::getSCEVExprForVPValue(const VPValue *V,\n if (match(V, m_SExt(m_VPValue(LHSVal)))) {\n const VPlan *Plan = V->getDefiningRecipe()->getParent()->getPlan();\n Type *DestTy = VPTypeAnalysis(*Plan).inferScalarType(V);\n+\n+ // Mirror SCEV's createSCEV handling for sext(sub nsw): push sign extension\n+ // onto the operands before computing the subtraction.\n+ VPValue *SubLHS, *SubRHS;\n+ auto *SubR = dyn_cast<VPRecipeWithIRFlags>(LHSVal);\n+ if (match(LHSVal, m_Sub(m_VPValue(SubLHS), m_VPValue(SubRHS))) && SubR &&\n+ SubR->hasNoSignedWrap() && poisonGuaranteesUB(LHSVal)) {\n+ const SCEV *V1 = getSCEVExprForVPValue(SubLHS, PSE, L);\n+ const SCEV *V2 = getSCEVExprForVPValue(SubRHS, PSE, L);\n+ if (!isa<SCEVCouldNotCompute>(V1) && !isa<SCEVCouldNotCompute>(V2))\n+ return SE.getMinusSCEV(SE.getSignExtendExpr(V1, DestTy),\n+ SE.getSignExtendExpr(V2, DestTy), SCEV::FlagNSW);\n+ }\n+\n return CreateSCEV({LHSVal}, [&](ArrayRef<const SCEV *> Ops) {\n return SE.getSignExtendExpr(Ops[0], DestTy);\n });\n",
|
| 35 |
+
"tests": [
|
| 36 |
+
{
|
| 37 |
+
"file": "llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll",
|
| 38 |
+
"commands": [
|
| 39 |
+
"opt -p loop-vectorize -mtriple=arm64-apple-macosx -S %s"
|
| 40 |
+
],
|
| 41 |
+
"tests": [
|
| 42 |
+
{
|
| 43 |
+
"test_name": "sext_sub_nsw_for_address",
|
| 44 |
+
"test_body": "target datalayout = \"e-m:o-i64:64-i128:128-n32:64-S128\"\n\ndefine void @sext_sub_nsw_for_address(ptr %base, i64 %n, ptr %src) #0 {\nentry:\n br label %loop\n\nloop: ; preds = %loop, %entry\n %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]\n %count = phi i64 [ %n, %entry ], [ %count.next, %loop ]\n %iv.i32 = phi i32 [ 0, %entry ], [ %iv.i32.next, %loop ]\n %gep.1 = getelementptr double, ptr %src, i64 %iv\n %gep.2 = getelementptr i8, ptr %gep.1, i64 -8\n store double 0.000000e+00, ptr %gep.2, align 8\n %neg = sub nsw i32 0, %iv.i32\n %neg.ext = sext i32 %neg to i64\n %gep.3 = getelementptr double, ptr %base, i64 %neg.ext\n %l = load double, ptr %gep.3, align 8\n store double %l, ptr %gep.1, align 8\n %iv.i32.next = add i32 %iv.i32, 2\n %iv.next = add i64 %iv, 2\n %count.next = add i64 %count, -1\n %ec = icmp sgt i64 %count, 0\n br i1 %ec, label %loop, label %exit\n\nexit: ; preds = %loop\n ret void\n}\n\nattributes #0 = { \"target-cpu\"=\"neoverse-v2\" }\n"
|
| 45 |
+
}
|
| 46 |
+
]
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
"issue": {
|
| 50 |
+
"title": "[LV]VPlan cost model and legacy cost model disagreed",
|
| 51 |
+
"body": "https://godbolt.org/z/Gr8nEMWK9\n\nLooks like it started crashing after `Fri Dec 26 13:38:14 2025 | LLVM | 60e5b86052ca1103499e87ee32c8228c71b6c753 | [VPlan] Support extends and truncs in getSCEVExprForVPValue. (NFCI)`\n@fhahn ",
|
| 52 |
+
"author": "alexey-bataev",
|
| 53 |
+
"labels": [
|
| 54 |
+
"vectorizers",
|
| 55 |
+
"crash-on-valid"
|
| 56 |
+
],
|
| 57 |
+
"comments": [
|
| 58 |
+
{
|
| 59 |
+
"author": "alexey-bataev",
|
| 60 |
+
"body": "Ping"
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"author": "fhahn",
|
| 64 |
+
"body": "Thanks will take a look"
|
| 65 |
+
}
|
| 66 |
+
]
|
| 67 |
+
},
|
| 68 |
+
"properties": {
|
| 69 |
+
"is_single_file_fix": true,
|
| 70 |
+
"is_single_func_fix": false
|
| 71 |
+
},
|
| 72 |
+
"verified": true
|
| 73 |
+
}
|
dataset/174760.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "174760",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/174760",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "985d75a57abaabbd4de3aafd42145068d6bedd13",
|
| 6 |
+
"knowledge_cutoff": "2026-01-07T12:31:55Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Analysis/LoopAccessAnalysis"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "9aadbb716d1173d3a50d85e2fb17483604ab689a",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopAccessAnalysis"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Analysis/LoopAccessAnalysis.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1042,
|
| 19 |
+
1047
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Analysis/LoopAccessAnalysis.cpp": [
|
| 25 |
+
"isNoWrap"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 9aadbb716d1173d3a50d85e2fb17483604ab689a\nAuthor: Florian Hahn <flo@fhahn.com>\nDate: Mon Jan 19 11:15:20 2026 +0000\n\n [LAA] Check if access is part of loop in isNoWrap.\n \n blockNeedsPredication does not support blocks outside of the loop. Bail\n out for users outside the loop.\n \n Fixes https://github.com/llvm/llvm-project/issues/174760.\n\ndiff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp\nindex a5f47d88430e..2fc724970747 100644\n--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp\n+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp\n@@ -1042,6 +1042,8 @@ static bool isNoWrap(PredicatedScalarEvolution &PSE, const SCEVAddRecExpr *AR,\n if (getLoadStorePointerOperand(U) != GEP)\n return false;\n BasicBlock *UserBB = cast<Instruction>(U)->getParent();\n+ if (!L->contains(UserBB))\n+ return false;\n return !LoopAccessInfo::blockNeedsPredication(UserBB, L, &DT);\n }))\n return true;\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -passes='print<access-info>' -disable-output %s 2>&1"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "test_nusw_gep_with_load_user_outside_loop",
|
| 39 |
+
"test_body": "define i32 @test_nusw_gep_with_load_user_outside_loop(ptr %A) {\nentry:\n br label %loop.header\n\nloop.header: ; preds = %loop.latch, %entry\n %iv = phi i64 [ 1, %entry ], [ %iv.next, %loop.latch ]\n %and = and i64 %iv, 1\n %cond = icmp eq i64 %and, 0\n br i1 %cond, label %if.then, label %loop.latch\n\nif.then: ; preds = %loop.header\n store i32 0, ptr %A, align 4\n br label %loop.latch\n\nloop.latch: ; preds = %if.then, %loop.header\n %gep = getelementptr nusw i32, ptr %A, i64 %and\n store i32 0, ptr %gep, align 4\n %iv.next = add i64 %iv, 1\n %cmp = icmp ult i64 %iv, 100\n br i1 %cmp, label %loop.header, label %exit\n\nexit: ; preds = %loop.latch\n %l = load i32, ptr %gep, align 4\n ret i32 %l\n}\n"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"test_name": "test_header_existing",
|
| 43 |
+
"test_body": "define void @test_header_existing(ptr %src, ptr %dst, i64 %start) {\nentry:\n br label %loop.header\n\nloop.header: ; preds = %loop.latch, %entry\n %iv = phi i64 [ %start, %entry ], [ %iv.next, %loop.latch ]\n %ec = icmp eq i64 %iv, 100\n br i1 %ec, label %exit, label %loop.latch\n\nloop.latch: ; preds = %loop.header\n %iv.next = add i64 %iv, 1\n %gep.src = getelementptr nusw { i8, i8, i32 }, ptr %src, i64 %iv.next\n %l = load i8, ptr %gep.src, align 1\n store i8 %l, ptr %dst, align 1\n br label %loop.header\n\nexit: ; preds = %loop.header\n ret void\n}\n"
|
| 44 |
+
}
|
| 45 |
+
]
|
| 46 |
+
}
|
| 47 |
+
],
|
| 48 |
+
"issue": {
|
| 49 |
+
"title": "Assertion `TheLoop->contains(BB) && \"Unknown block used\"' failed.",
|
| 50 |
+
"body": "To reproduce run opt with the test below (-passes=loop-load-elim)\n```\n; ModuleID = './reduced.ll'\nsource_filename = \"./reduced.ll\"\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2\"\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\ndefine i32 @wombat() gc \"statepoint-example\" {\nbb:\n br label %bb1\n\nbb1: ; preds = %bb2, %bb\n %phi = phi i64 [ 1, %bb ], [ %add, %bb2 ]\n br label %bb2\n\nbb2: ; preds = %bb1\n %and = and i64 %phi, 1\n %getelementptr = getelementptr nusw i32, ptr addrspace(1) null, i64 %and\n store i32 0, ptr addrspace(1) %getelementptr, align 4\n store i32 0, ptr addrspace(1) null, align 4\n %add = add i64 %phi, 1\n %icmp = icmp ult i64 %phi, 1\n br i1 %icmp, label %bb3, label %bb1\n\nbb3: ; preds = %bb2\n %load = load i32, ptr addrspace(1) %getelementptr, align 4\n ret i32 0\n}\n```\nReproducer: https://godbolt.org/z/dfa7ar8dx\nStack dump:\n```\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=loop-load-elim <source>\n1.\tRunning pass \"function(loop-load-elim)\" on module \"<source>\"\n2.\tRunning pass \"loop-load-elim\" on function \"wombat\"\n #0 0x0000000005a7f2e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a7f2e8)\n #1 0x0000000005a7c194 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x000074b4a6642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x000074b4a66969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x000074b4a6642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x000074b4a66287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x000074b4a662871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x000074b4a6639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x0000000004f74f5f llvm::LoopAccessInfo::blockNeedsPredication(llvm::BasicBlock const*, llvm::Loop const*, llvm::DominatorTree const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4f74f5f)\n #9 0x0000000004f7522a isNoWrap(llvm::PredicatedScalarEvolution&, llvm::SCEVAddRecExpr const*, llvm::Value*, llvm::Type*, llvm::Loop const*, bool, llvm::DominatorTree const&, std::optional<long>) LoopAccessAnalysis.cpp:0:0\n#10 0x0000000004f7dd6b (anonymous namespace)::AccessAnalysis::createCheckForAccess(llvm::RuntimePointerChecking&, llvm::PointerIntPair<llvm::Value*, 1u, bool, llvm::PointerLikeTypeTraits<llvm::Value*>, llvm::PointerIntPairInfo<llvm::Value*, 1u, llvm::PointerLikeTypeTraits<llvm::Value*>>>, llvm::Type*, llvm::DenseMap<llvm::Value*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*, void>, llvm::detail::DenseMapPair<llvm::Value*, llvm::SCEV const*>> const&, llvm::DenseMap<llvm::Value*, unsigned int, llvm::DenseMapInfo<llvm::Value*, void>, llvm::detail::DenseMapPair<llvm::Value*, unsigned int>>&, llvm::Loop*, unsigned int&, unsigned int, bool) LoopAccessAnalysis.cpp:0:0\n#11 0x0000000004f85566 (anonymous namespace)::AccessAnalysis::canCheckPtrAtRT(llvm::RuntimePointerChecking&, llvm::Loop*, llvm::DenseMap<llvm::Value*, llvm::SCEV const*, llvm::DenseMapInfo<llvm::Value*, void>, llvm::detail::DenseMapPair<llvm::Value*, llvm::SCEV const*>> const&, llvm::Value*&, bool) (.part.0) LoopAccessAnalysis.cpp:0:0\n#12 0x0000000004f8a01e llvm::LoopAccessInfo::analyzeLoop(llvm::AAResults*, llvm::LoopInfo const*, llvm::TargetLibraryInfo const*, llvm::DominatorTree*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4f8a01e)\n#13 0x0000000004f8ab82 llvm::LoopAccessInfo::LoopAccessInfo(llvm::Loop*, llvm::ScalarEvolution*, llvm::TargetTransformInfo const*, llvm::TargetLibraryInfo const*, llvm::AAResults*, llvm::DominatorTree*, llvm::LoopInfo*, llvm::AssumptionCache*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4f8ab82)\n#14 0x0000000004f8aeba llvm::LoopAccessInfoManager::getInfo(llvm::Loop&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4f8aeba)\n#15 0x00000000047bcc79 llvm::LoopLoadEliminationPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x47bcc79)\n#16 0x0000000003043cae llvm::detail::PassModel<llvm::Function, llvm::LoopLoadEliminationPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3043cae)\n#17 0x0000000005859c61 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5859c61)\n#18 0x0000000000f1ba3e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf1ba3e)\n#19 0x000000000585821a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x585821a)\n#20 0x000000000097ee5e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97ee5e)\n#21 0x0000000005857bd1 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5857bd1)\n#22 0x0000000000989110 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x989110)\n#23 0x000000000097d038 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97d038)\n#24 0x000074b4a6629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#25 0x000074b4a6629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#26 0x0000000000973a35 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x973a35)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```",
|
| 51 |
+
"author": "TatyanaDoubts",
|
| 52 |
+
"labels": [
|
| 53 |
+
"loopoptim",
|
| 54 |
+
"crash"
|
| 55 |
+
],
|
| 56 |
+
"comments": [
|
| 57 |
+
{
|
| 58 |
+
"author": "TatyanaDoubts",
|
| 59 |
+
"body": "Hi Florian @fhahn \nIt looks like the fault commit for this crash is\ncommit af9a4263a1a209953a1d339ef781a954e31268ff\n\nAuthor: Florian Hahn <[flo@fhahn.com](mailto:flo@fhahn.com)>\n\nDate: Tue Nov 4 17:08:12 2025 +0000\n\n \n\n [LAA] Only use inbounds/nusw in isNoWrap if the GEP is dereferenced. (#161445)\n\n \n\n Update isNoWrap to only use the inbounds/nusw flags from GEPs that are\n\n guaranteed to be dereferenced on every iteration. This fixes a case\n\n where we incorrectly determine no dependence.\n\n \n\n I think the issue is isolated to code that evaluates the resulting\n\n AddRec at BTC, just using it to compute the distance between accesses\n\n should still be fine; if the access does not execute in a given\n\n iteration, there's no dependence in that iteration. But isolating the\n\n code is not straight-forward, so be conservative for now. The practical\n\n impact should be very minor (only one loop changed across a corpus with\n\n 27k modules from large C/C++ workloads.\n\n \n\n Fixes [[LAA] Missing dependence due to AddRec wrap \u00b7 Issue #160912 \u00b7 llvm/llvm-project](https://github.com/llvm/llvm-project/issues/160912) .\n\n \n\n PR: [[LAA] Only use inbounds/nusw in isNoWrap if the GEP is dereferenced. by fhahn \u00b7 Pull Request #161445 \u00b7 llvm/llvm-project](https://github.com/llvm/llvm-project/pull/161445)"
|
| 60 |
+
}
|
| 61 |
+
]
|
| 62 |
+
},
|
| 63 |
+
"properties": {
|
| 64 |
+
"is_single_file_fix": true,
|
| 65 |
+
"is_single_func_fix": true
|
| 66 |
+
},
|
| 67 |
+
"verified": true
|
| 68 |
+
}
|
dataset/174773.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "174773",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/174773",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "79fd11c9bbeb423b8d2eb5b2fb832f25ef9e080b",
|
| 6 |
+
"knowledge_cutoff": "2026-01-07T14:15:09Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/SLPVectorizer"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "9fb45c5959fdbf1f63babd1f32ad298cab9e27af",
|
| 12 |
+
"components": [
|
| 13 |
+
"SLPVectorizer"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 17 |
+
[
|
| 18 |
+
13445,
|
| 19 |
+
13450
|
| 20 |
+
],
|
| 21 |
+
[
|
| 22 |
+
13457,
|
| 23 |
+
13463
|
| 24 |
+
],
|
| 25 |
+
[
|
| 26 |
+
13543,
|
| 27 |
+
13548
|
| 28 |
+
]
|
| 29 |
+
]
|
| 30 |
+
},
|
| 31 |
+
"bug_location_funcname": {
|
| 32 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 33 |
+
"BoUpSLP::transformNodes"
|
| 34 |
+
]
|
| 35 |
+
}
|
| 36 |
+
},
|
| 37 |
+
"patch": "commit 9fb45c5959fdbf1f63babd1f32ad298cab9e27af\nAuthor: Alexey Bataev <a.bataev@outlook.com>\nDate: Thu Jan 8 06:13:44 2026 -0800\n\n [SLP]Do not generate extractelement subnodes with the same indeces\n \n The compiler should not generate subvectors with the same extractelement\n instructions, it may cause a crash and leads to inefficient\n vectorization.\n \n Fixes #174773\n\ndiff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\nindex cc78d0189066..a5117f09a778 100644\n--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n@@ -13445,6 +13445,7 @@ void BoUpSLP::transformNodes() {\n // insertvector instructions.\n unsigned StartIdx = 0;\n unsigned End = VL.size();\n+ SmallBitVector Processed(End);\n for (unsigned VF = getFloorFullVectorNumberOfElements(\n *TTI, VL.front()->getType(), VL.size() - 1);\n VF >= MinVF; VF = getFloorFullVectorNumberOfElements(\n@@ -13457,7 +13458,7 @@ void BoUpSLP::transformNodes() {\n ArrayRef<Value *> Slice = VL.slice(Cnt, VF);\n // If any instruction is vectorized already - do not try again.\n // Reuse the existing node, if it fully matches the slice.\n- if (isVectorized(Slice.front()) &&\n+ if ((Processed.test(Cnt) || isVectorized(Slice.front())) &&\n !getSameValuesTreeEntry(Slice.front(), Slice, /*SameVF=*/true))\n continue;\n // Constant already handled effectively - skip.\n@@ -13543,6 +13544,7 @@ void BoUpSLP::transformNodes() {\n continue;\n auto AddCombinedNode = [&](unsigned Idx, unsigned Cnt, unsigned Sz) {\n E.CombinedEntriesWithIndices.emplace_back(Idx, Cnt);\n+ Processed.set(Cnt, Cnt + Sz);\n if (StartIdx == Cnt)\n StartIdx = Cnt + Sz;\n if (End == Cnt + Sz)\n",
|
| 38 |
+
"tests": [
|
| 39 |
+
{
|
| 40 |
+
"file": "llvm/test/Transforms/SLPVectorizer/X86/extractelements-subnodes-same-index.ll",
|
| 41 |
+
"commands": [
|
| 42 |
+
"opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu -slp-threshold=-99999 -mattr=+avx < %s"
|
| 43 |
+
],
|
| 44 |
+
"tests": [
|
| 45 |
+
{
|
| 46 |
+
"test_name": "<module>",
|
| 47 |
+
"test_body": "\ndefine i32 @test() {\n;\nbb:\n %call = call i32 @llvm.ctpop.i32(i32 0)\n %call1 = call i32 @llvm.ctpop.i32(i32 0)\n %load = load i32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 32), align 4\n store i32 %load, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 32), align 4\n %or = or i32 %call, %call1\n %call2 = call i32 @llvm.ctpop.i32(i32 0)\n %or3 = or i32 %or, %call2\n %call4 = call i32 @llvm.ctpop.i32(i32 0)\n %load9 = load i32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 28), align 4\n store i32 %load9, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 28), align 4\n %or5 = or i32 %or3, %call4\n %call6 = call i32 @llvm.ctpop.i32(i32 0)\n %or7 = or i32 %or5, %call6\n %call8 = call i32 @llvm.ctpop.i32(i32 0)\n %load14 = load i32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 28), align 4\n store i32 %load14, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 28), align 4\n %load15 = load i32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 24), align 4\n store i32 %load15, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 24), align 4\n %or10 = or i32 %or7, %call8\n %call11 = call i32 @llvm.ctpop.i32(i32 %load)\n %or12 = or i32 %or10, %call11\n %call13 = call i32 @llvm.ctpop.i32(i32 0)\n %load20 = load i32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 24), align 4\n store i32 %load20, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 24), align 4\n %load21 = load i32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 20), align 4\n store i32 %load21, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 20), align 4\n %or16 = or i32 %or12, %call13\n %call17 = call i32 @llvm.ctpop.i32(i32 %load9)\n %or18 = or i32 %or16, %call17\n %call19 = call i32 @llvm.ctpop.i32(i32 %load14)\n %load26 = load i32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 20), align 4\n store i32 %load26, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 20), align 4\n %load27 = load i32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 16), align 4\n store i32 %load27, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 16), align 4\n %or22 = or i32 %or18, %call19\n %call23 = call i32 @llvm.ctpop.i32(i32 %load15)\n %or24 = or i32 %or22, %call23\n %call25 = call i32 @llvm.ctpop.i32(i32 %load20)\n %load32 = load i32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 16), align 4\n store i32 %load32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 16), align 4\n %load33 = load i32, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 12), align 4\n store i32 %load33, ptr addrspace(1) getelementptr inbounds nuw (i8, ptr addrspace(1) null, i64 12), align 4\n %or28 = or i32 %or24, %call25\n %call29 = call i32 @llvm.ctpop.i32(i32 %load21)\n %or30 = or i32 %or28, %call29\n %call31 = call i32 @llvm.ctpop.i32(i32 %load26)\n %or34 = or i32 %or30, %call31\n %call35 = call i32 @llvm.ctpop.i32(i32 %load27)\n %or36 = or i32 %or34, %call35\n %call37 = call i32 @llvm.ctpop.i32(i32 %load32)\n %or38 = or i32 %or36, %call37\n %call39 = call i32 @llvm.ctpop.i32(i32 %load33)\n %or40 = or i32 %or38, %call39\n %call41 = call i32 @llvm.ctpop.i32(i32 0)\n %or42 = or i32 %or40, %call41\n %call43 = call i32 @llvm.ctpop.i32(i32 0)\n %or44 = or i32 %or42, %call43\n %call45 = call i32 @llvm.ctpop.i32(i32 0)\n %or46 = or i32 %or44, %call45\n %call47 = call i32 @llvm.ctpop.i32(i32 0)\n %or48 = or i32 %or46, %call47\n %call49 = call i32 @llvm.ctpop.i32(i32 0)\n %or50 = or i32 %or48, %call49\n %call51 = call i32 @llvm.ctpop.i32(i32 0)\n %or52 = or i32 %or50, %call51\n %call53 = call i32 @llvm.ctpop.i32(i32 0)\n %or54 = or i32 %or52, %call53\n ret i32 %or54\n}\n\ndeclare i32 @llvm.ctpop.i32(i32)"
|
| 48 |
+
}
|
| 49 |
+
]
|
| 50 |
+
}
|
| 51 |
+
],
|
| 52 |
+
"issue": {
|
| 53 |
+
"title": "Assertion `I->use_empty() && \"trying to erase instruction with users.\"' failed.",
|
| 54 |
+
"body": "To reproduce run opt with the test below (-passes=slp-vectorizer -slp-threshold=-99999)\n\n[reduced-stripped.ll.zip](https://github.com/user-attachments/files/24473473/reduced-stripped.ll.zip)\n\nReproducer: https://godbolt.org/z/c8rcjzPdr\n\nStack dump:\n```\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=slp-vectorizer -slp-threshold=-99999 <source>\n1.\tRunning pass \"function(slp-vectorizer)\" on module \"<source>\"\n2.\tRunning pass \"slp-vectorizer\" on function \"wombat\"\n #0 0x0000000005a7f2e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a7f2e8)\n #1 0x0000000005a7c194 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x000072441c042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x000072441c0969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x000072441c042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x000072441c0287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x000072441c02871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x000072441c039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x000000000379becf llvm::slpvectorizer::BoUpSLP::~BoUpSLP() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x379becf)\n #9 0x0000000003896946 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (.part.0) SLPVectorizer.cpp:0:0\n#10 0x00000000038973cb llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x38973cb)\n#11 0x000000000304364e llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x304364e)\n#12 0x0000000005859c61 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5859c61)\n#13 0x0000000000f1ba3e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf1ba3e)\n#14 0x000000000585821a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x585821a)\n#15 0x000000000097ee5e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97ee5e)\n#16 0x0000000005857bd1 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5857bd1)\n#17 0x0000000000989110 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x989110)\n#18 0x000000000097d038 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97d038)\n#19 0x000072441c029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#20 0x000072441c029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#21 0x0000000000973a35 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x973a35)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```",
|
| 55 |
+
"author": "TatyanaDoubts",
|
| 56 |
+
"labels": [
|
| 57 |
+
"llvm:SLPVectorizer",
|
| 58 |
+
"crash"
|
| 59 |
+
],
|
| 60 |
+
"comments": [
|
| 61 |
+
{
|
| 62 |
+
"author": "EugeneZelenko",
|
| 63 |
+
"body": "@TatyanaDoubts: If you plan to file more issues in future, it'll be good idea to request triage role ([examples](https://github.com/llvm/llvm-project/issues/?q=is%3Aissue%20label%3Ainfra%3Acommit-access-request%20Triage)), so you'll be able to label issues yourself, preferably at creation.\n"
|
| 64 |
+
}
|
| 65 |
+
]
|
| 66 |
+
},
|
| 67 |
+
"properties": {
|
| 68 |
+
"is_single_file_fix": true,
|
| 69 |
+
"is_single_func_fix": true
|
| 70 |
+
},
|
| 71 |
+
"verified": true
|
| 72 |
+
}
|
dataset/175058.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "175058",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/175058",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "afd7d13d147d3ac92c987cb2d1d27fb6ee9b9dad",
|
| 6 |
+
"knowledge_cutoff": "2026-01-08T19:40:24Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "e9f758a59b2f887acb07e26e2d480c7369a72009",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopVectorize"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp": [
|
| 17 |
+
[
|
| 18 |
+
191,
|
| 19 |
+
196
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp": [
|
| 25 |
+
"VPlanVerifier::verifyEVLRecipe"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit e9f758a59b2f887acb07e26e2d480c7369a72009\nAuthor: Luke Lau <luke@igalia.com>\nDate: Tue Jan 13 15:55:15 2026 +0800\n\n [VPlan] Allow VPInstruction::PtrAdd as a user of EVL (#175506)\n \n Fixes #175058\n \n Similar to #175028, on RV64 we insert a zext in between most uses of EVL\n so most of the VPlanVerifier EVL checks don't fire unless we're\n compiling for RV32.\n In this case, we're experiencing a crash because we can have a PtrAdd\n that uses EVL. This fixes it by adding PtrAdd to the list of allowed\n instructions\n\ndiff --git a/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp b/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp\nindex c1a65fc4fc7d..2d6809d6f344 100644\n--- a/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp\n+++ b/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp\n@@ -191,6 +191,7 @@ bool VPlanVerifier::verifyEVLRecipe(const VPInstruction &EVL) const {\n case Instruction::Shl:\n case Instruction::FMul:\n case VPInstruction::Broadcast:\n+ case VPInstruction::PtrAdd:\n // Opcodes above can only use EVL after wide inductions have been\n // expanded.\n if (!VerifyLate) {\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/LoopVectorize/RISCV/pointer-induction-rv32.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt < %s -S -p loop-vectorize -mtriple riscv32 -mattr=+v"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "\n; The VPWidenPointerInductionRecipe is expanded into a ptradd that uses EVL,\n; make sure we allow it in VPlanVerifier\ndefine i32 @widenpointerinduction_evl(ptr noalias %p) {\n;\nentry:\n br label %loop\n\nloop:\n %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]\n %x = phi ptr [ %p, %entry ], [ %x.next, %loop ]\n\n store ptr %x, ptr %p\n\n %iv.next = add i32 %iv, 1\n %x.next = getelementptr i8, ptr %x, i32 1\n %ec = icmp eq i32 %iv.next, 1024\n br i1 %ec, label %exit, label %loop\n\nexit:\n ret i32 0\n}"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "\"EVL used by unexpected VPInstruction\" error from VPlanVerifier for RV32",
|
| 46 |
+
"body": "This is a separate issue to #175028\n\nGiven this test case:\n```llvm\ndefine void @buf2img(ptr %imgX, i32 %size_x) {\nentry:\n br label %for.cond70\n\nfor.cond70: ; preds = %for.cond74, %entry\n %buf.addr.0 = phi ptr [ null, %entry ], [ %buf.addr.1, %for.cond74 ]\n br label %for.cond74\n\nfor.cond74: ; preds = %for.body77, %for.cond70\n %buf.addr.1 = phi ptr [ %buf.addr.0, %for.cond70 ], [ %incdec.ptr, %for.body77 ]\n %i.1 = phi i32 [ 0, %for.cond70 ], [ %inc82, %for.body77 ]\n %cmp75 = icmp slt i32 %i.1, %size_x\n br i1 %cmp75, label %for.body77, label %for.cond70\n\nfor.body77: ; preds = %for.cond74\n %incdec.ptr = getelementptr i8, ptr %buf.addr.1, i32 1\n %0 = load i8, ptr %buf.addr.1, align 1\n %conv78 = zext i8 %0 to i16\n store i16 %conv78, ptr %imgX, align 2\n %inc82 = add i32 %i.1, 1\n br label %for.cond74\n}\n```\n\nWe get (on HEAD):\n```\n$ ./build/rvdev/bin/clang --target=riscv32-linux-gnu -c -march=rv32gcv -O3 tc2.ll \nwarning: overriding the module target triple with riscv32-unknown-linux-gnu\n [-Woverride-module]\nEVL used by unexpected VPInstruction\nEVL VPValue is not used correctly\nclang: ../../llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7476: DenseMap<const SCEV *, Value *> llvm::LoopVectorizationPlanner::executePlan(ElementCount, unsigned int, VPlan &, InnerLoopVectorizer &, DominatorTree *, bool): Assertion `verifyVPlanIsValid(BestVPlan, true ) && \"final VPlan is invalid\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.\nStack dump:\n0.\tProgram arguments: ./build/rvdev/bin/clang --target=riscv32-linux-gnu -c -march=rv32gcv -O3 tc2.ll\n1.\tOptimizer\n2.\tRunning pass \"function<eager-inv>(drop-unnecessary-assumes,float2int,lower-constant-intrinsics,chr,loop(loop-rotate<header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,drop-unnecessary-assumes,infer-alignment,loop-load-elim,instcombine<max-iterations=1;no-verify-fixpoint>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,slp-vectorizer,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop-unroll<O3>,transform-warning,sroa<preserve-cfg>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)\" on module \"tc2.ll\"\n3.\tRunning pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"buf2img\"\n #0 0x00007e01b0aa7579 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) build/rvdev/../../llvm/lib/Support/Unix/Signals.inc:842:11\n #1 0x00007e01b0aa7b9b PrintStackTraceSignalHandler(void*) build/rvdev/../../llvm/lib/Support/Unix/Signals.inc:924:1\n #2 0x00007e01b0aa5631 llvm::sys::RunSignalHandlers() build/rvdev/../../llvm/lib/Support/Signals.cpp:108:5\n #3 0x00007e01b0aa6d0b llvm::sys::CleanupOnSignal(unsigned long) build/rvdev/../../llvm/lib/Support/Unix/Signals.inc:377:1\n #4 0x00007e01b08ec062 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) build/rvdev/../../llvm/lib/Support/CrashRecoveryContext.cpp:0:7\n #5 0x00007e01b08ec4c1 CrashRecoverySignalHandler(int) build/rvdev/../../llvm/lib/Support/CrashRecoveryContext.cpp:391:1\n #6 0x00007e01afe3e4d0 (/usr/lib/libc.so.6+0x3e4d0)\n #7 0x00007e01afe9890c (/usr/lib/libc.so.6+0x9890c)\n #8 0x00007e01afe3e3a0 raise (/usr/lib/libc.so.6+0x3e3a0)\n #9 0x00007e01afe2557a abort (/usr/lib/libc.so.6+0x2557a)\n#10 0x00007e01afe254e3 __assert_perror_fail (/usr/lib/libc.so.6+0x254e3)\n#11 0x00007e01b6987dc8 llvm::LoopVectorizationPlanner::executePlan(llvm::ElementCount, unsigned int, llvm::VPlan&, llvm::InnerLoopVectorizer&, llvm::DominatorTree*, bool) build/rvdev/../../llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:0:3\n#12 0x00007e01b69939e0 llvm::LoopVectorizePass::processLoop(llvm::Loop*) build/rvdev/../../llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10090:5\n#13 0x00007e01b69988fc llvm::LoopVectorizePass::runImpl(llvm::Function&) build/rvdev/../../llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10143:30\n#14 0x00007e01b6998d7e llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) build/rvdev/../../llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:10181:32\n#15 0x00007e01ae25a8d4 llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) build/rvdev/../../llvm/include/llvm/IR/PassManagerInternal.h:91:17\n...\n```\nI can add `VPInstruction::PtrAdd` to the list of explicitly allowed instructions at around line 182 in VPlanVerifier.cpp, compilation works and and llvm-test-suite builds and runs for rv32v with evl tail folding (if the verifier workaround suggested in #175028 is also applied). I am not familiar enough with VPlan to know if this is a reasonable fix though, hence the issue rather than a patch.\n\nCC @lukel97 ",
|
| 47 |
+
"author": "asb",
|
| 48 |
+
"labels": [
|
| 49 |
+
"vectorizers",
|
| 50 |
+
"crash"
|
| 51 |
+
],
|
| 52 |
+
"comments": []
|
| 53 |
+
},
|
| 54 |
+
"properties": {
|
| 55 |
+
"is_single_file_fix": true,
|
| 56 |
+
"is_single_func_fix": true
|
| 57 |
+
},
|
| 58 |
+
"verified": true
|
| 59 |
+
}
|
dataset/175159.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "175159",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/175159",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "c722ef4874a569de8fd2dc53aaf3e367fa65e05c",
|
| 6 |
+
"knowledge_cutoff": "2026-01-09T12:10:54Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "4996e3be341af782b856597023c83ee3ef9b5094",
|
| 12 |
+
"components": [
|
| 13 |
+
"ConstantFold"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Analysis/ConstantFolding.cpp": [
|
| 17 |
+
[
|
| 18 |
+
4288,
|
| 19 |
+
4294
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Analysis/ConstantFolding.cpp": [
|
| 25 |
+
"ConstantFoldFixedVectorCall"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 4996e3be341af782b856597023c83ee3ef9b5094\nAuthor: Nikita Popov <npopov@redhat.com>\nDate: Fri Jan 9 17:13:21 2026 +0100\n\n [ConstantFolding] Allow truncation when folding wasm.dot\n \n Changes this to getSigned() to match the signedness of the calculation.\n However, we still need to allow truncation because the addition\n result may overflow, and the operation is specified to truncate\n in that case.\n \n Fixes https://github.com/llvm/llvm-project/issues/175159.\n\ndiff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp\nindex c3a3035fcaa9..eaf4eb445423 100644\n--- a/llvm/lib/Analysis/ConstantFolding.cpp\n+++ b/llvm/lib/Analysis/ConstantFolding.cpp\n@@ -4288,7 +4288,7 @@ static Constant *ConstantFoldFixedVectorCall(\n }\n for (unsigned I = 0; I < Result.size(); I++) {\n int64_t IAdd = (int64_t)MulVector[I * 2] + (int64_t)MulVector[I * 2 + 1];\n- Result[I] = ConstantInt::get(Ty, IAdd);\n+ Result[I] = ConstantInt::getSigned(Ty, IAdd, /*ImplicitTrunc=*/true);\n }\n \n return ConstantVector::get(Result);\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/dot.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -passes=instsimplify -S < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "dot_one_negative",
|
| 39 |
+
"test_body": "target triple = \"wasm32-unknown-unknown\"\n\ndefine <4 x i32> @dot_one_negative() {\n %res = tail call <4 x i32> @llvm.wasm.dot(<8 x i16> splat (i16 1), <8 x i16> splat (i16 -1))\n ret <4 x i32> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)\ndeclare <4 x i32> @llvm.wasm.dot(<8 x i16>, <8 x i16>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }\n"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"test_name": "dot_doubly_negative",
|
| 43 |
+
"test_body": "target triple = \"wasm32-unknown-unknown\"\n\ndefine <4 x i32> @dot_doubly_negative() {\n %res = tail call <4 x i32> @llvm.wasm.dot(<8 x i16> splat (i16 -1), <8 x i16> splat (i16 -1))\n ret <4 x i32> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)\ndeclare <4 x i32> @llvm.wasm.dot(<8 x i16>, <8 x i16>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }\n"
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"test_name": "dot_nonzero",
|
| 47 |
+
"test_body": "target triple = \"wasm32-unknown-unknown\"\n\ndefine <4 x i32> @dot_nonzero() {\n %res = tail call <4 x i32> @llvm.wasm.dot(<8 x i16> <i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>, <8 x i16> <i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8>)\n ret <4 x i32> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)\ndeclare <4 x i32> @llvm.wasm.dot(<8 x i16>, <8 x i16>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }\n"
|
| 48 |
+
}
|
| 49 |
+
]
|
| 50 |
+
}
|
| 51 |
+
],
|
| 52 |
+
"issue": {
|
| 53 |
+
"title": "[WebAssembly] Assertion `llvm::isUIntN(BitWidth, val) && \"Value is not an N-bit unsigned value\"' failed",
|
| 54 |
+
"body": "Reproduced using 804aa88317ddbdb6e713306d48dbee0443b252b1\n\ngit-bisecting from the emscripten side narrowed down the introduction of the crash to https://github.com/llvm/llvm-project/compare/55eaa6c27b36...88b77d5eaa66\n\n\n[26060.zip](https://github.com/user-attachments/files/24526777/26060.zip)\n\nEmscripten issue: https://github.com/emscripten-core/emscripten/issues/26060#issue-3795333593",
|
| 55 |
+
"author": "mr-c",
|
| 56 |
+
"labels": [
|
| 57 |
+
"crash",
|
| 58 |
+
"constant-folding"
|
| 59 |
+
],
|
| 60 |
+
"comments": [
|
| 61 |
+
{
|
| 62 |
+
"author": "mr-c",
|
| 63 |
+
"body": "I've git-bisected this to a83c89495ba6fe0134dcaa02372c320cc7ff0dbf\nTagging @nikic "
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"author": "nikic",
|
| 67 |
+
"body": "Reduced:\n```llvm\n; RUN: opt -S -passes=instsimplify < %s\ntarget triple = \"wasm32-unknown-emscripten\"\n\ndefine <4 x i32> @test() {\n %dot = tail call <4 x i32> @llvm.wasm.dot(<8 x i16> <i16 19733, i16 18694, i16 -2158, i16 -12949, i16 -22664, i16 -3805, i16 30779, i16 1600>, <8 x i16> <i16 11918, i16 7268, i16 32199, i16 14806, i16 -14152, i16 -23986, i16 16941, i16 17135>)\n ret <4 x i32> %dot\n}\n```"
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"author": "mr-c",
|
| 71 |
+
"body": "Thank you for the quick fix @nikic ! I can confirm it from my end using emscripten + https://github.com/llvm/llvm-project/commit/4996e3be341af782b856597023c83ee3ef9b5094 and the entire SIMDe test suite"
|
| 72 |
+
}
|
| 73 |
+
]
|
| 74 |
+
},
|
| 75 |
+
"properties": {
|
| 76 |
+
"is_single_file_fix": true,
|
| 77 |
+
"is_single_func_fix": true
|
| 78 |
+
},
|
| 79 |
+
"verified": true
|
| 80 |
+
}
|
dataset/175229.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "175229",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/175229",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "12cccb96de36bdef7bbdd7b77543a9063f7c0ecc",
|
| 6 |
+
"knowledge_cutoff": "2026-01-09T19:45:23Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "d620ea7657814943748e2368004fad2be44c7272",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopVectorize"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/LoopVectorize.cpp": [
|
| 17 |
+
[
|
| 18 |
+
7286,
|
| 19 |
+
7292
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/LoopVectorize.cpp": [
|
| 25 |
+
"findRecipe"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit d620ea7657814943748e2368004fad2be44c7272\nAuthor: Florian Hahn <flo@fhahn.com>\nDate: Sun Jan 11 11:19:30 2026 +0000\n\n [LV] Handle live-ins in findRecipe.\n \n Skip live-ins in findRecipe to prevent a crash for cases with degenerate\n reductions (where the backedge value is a live-in). Such reductions\n should be removed, but this requires further changes.\n \n Fixes https://github.com/llvm/llvm-project/issues/175229.\n\ndiff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\nindex 95fbfddffb29..cdc6ecfa21bc 100644\n--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\n+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\n@@ -7286,7 +7286,9 @@ static VPRecipeBase *findRecipe(VPValue *Start, PredT Pred) {\n for (unsigned I = 0; I != Worklist.size(); ++I) {\n VPValue *Cur = Worklist[I];\n auto *R = Cur->getDefiningRecipe();\n- if (Pred(R))\n+ // TODO: Skip live-ins once no degenerate reductions (ones with constant\n+ // backedge values) are generated.\n+ if (R && Pred(R))\n return R;\n for (VPUser *U : Cur->users()) {\n for (VPValue *V : cast<VPRecipeBase>(U)->definedValues())\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/LoopVectorize/epilog-vectorization-reductions.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -passes=loop-vectorize -force-vector-width=4 -enable-epilogue-vectorization -epilogue-vectorization-force-VF=4 -S %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "reduction_with_const_or",
|
| 39 |
+
"test_body": "define i1 @reduction_with_const_or(ptr %A, i8 %n) {\nentry:\n br label %loop\n\nloop: ; preds = %loop, %entry\n %or.red = phi i1 [ false, %entry ], [ %or.next, %loop ]\n %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]\n %iv.ext = zext i8 %iv to i64\n %gep = getelementptr inbounds i64, ptr %A, i64 %iv.ext\n store i64 %iv.ext, ptr %gep, align 8\n %or.next = or i1 %or.red, true\n %iv.next = add i8 %iv, 1\n %exitcond = icmp eq i8 %iv, %n\n br i1 %exitcond, label %exit, label %loop\n\nexit: ; preds = %loop\n ret i1 %or.next\n}\n"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[LoopVectorizePass] Assertion `detail::isPresent(Val) && \"dyn_cast on a non-existent value\"' failed.",
|
| 46 |
+
"body": "Very recent regression. Not bisected yet.\n\nhttps://godbolt.org/z/eMaroco7z\n\n```\ntarget triple = \"x86_64-unknown-unknown\"\n\ndefine i1 @_Z1nv(i8 %0) {\nentry:\n br label %for.body4\n\nfor.cond.cleanup.loopexit: ; preds = %for.body4\n ret i1 %tobool8\n\nfor.body4: ; preds = %for.body4, %entry\n %h.028 = phi i1 [ %tobool8, %for.body4 ], [ false, %entry ]\n %i.027 = phi i8 [ %inc, %for.body4 ], [ 0, %entry ]\n %tobool8 = or i1 %h.028, true\n %inc = add i8 %i.027, 1\n %exitcond.not = icmp eq i8 %i.027, %0\n br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body4\n\n; uselistorder directives\n uselistorder i1 %tobool8, { 1, 0 }\n}\n```\n\n```\nopt: /root/llvm-project/llvm/include/llvm/Support/Casting.h:656: decltype(auto) llvm::dyn_cast(From*) [with To = llvm::VPInstruction; From = llvm::VPRecipeBase]: Assertion `detail::isPresent(Val) && \"dyn_cast on a non-existent value\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S --passes=loop-vectorize <source>\n1.\tRunning pass \"function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)\" on module \"<source>\"\n2.\tRunning pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"_Z1nv\"\n #0 0x0000000005a74d58 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a74d58)\n #1 0x0000000005a71c04 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x00007def0e042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x00007def0e0969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x00007def0e042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x00007def0e0287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x00007def0e02871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x00007def0e039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x00000000037526f4 preparePlanForEpilogueVectorLoop(llvm::VPlan&, llvm::Loop*, llvm::DenseMap<llvm::SCEV const*, llvm::Value*, llvm::DenseMapInfo<llvm::SCEV const*, void>, llvm::detail::DenseMapPair<llvm::SCEV const*, llvm::Value*>> const&, llvm::EpilogueLoopVectorizationInfo&, llvm::LoopVectorizationCostModel&, llvm::ScalarEvolution&) LoopVectorize.cpp:0:0\n #9 0x000000000375aefa llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x375aefa)\n#10 0x000000000375bd20 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x375bd20)\n#11 0x000000000375c4ad llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x375c4ad)\n#12 0x000000000303396e llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x303396e)\n#13 0x000000000584ee81 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x584ee81)\n#14 0x0000000000f1e11e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf1e11e)\n#15 0x000000000584d43a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x584d43a)\n#16 0x000000000097f47e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97f47e)\n#17 0x000000000584cdf1 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x584cdf1)\n#18 0x0000000000989730 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x989730)\n#19 0x000000000097d658 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x97d658)\n#20 0x00007def0e029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#21 0x00007def0e029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#22 0x0000000000974055 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x974055)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```\n",
|
| 47 |
+
"author": "gregbedwell",
|
| 48 |
+
"labels": [
|
| 49 |
+
"vectorizers",
|
| 50 |
+
"crash-on-valid"
|
| 51 |
+
],
|
| 52 |
+
"comments": [
|
| 53 |
+
{
|
| 54 |
+
"author": "gregbedwell",
|
| 55 |
+
"body": "Bisects to 4998280c3f112facece8a7ce10f2788c800b7cba"
|
| 56 |
+
}
|
| 57 |
+
]
|
| 58 |
+
},
|
| 59 |
+
"properties": {
|
| 60 |
+
"is_single_file_fix": true,
|
| 61 |
+
"is_single_func_fix": true
|
| 62 |
+
},
|
| 63 |
+
"verified": true
|
| 64 |
+
}
|
dataset/175768.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "175768",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/175768",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "6fd8c36417709118e154d83559c08ce829bfe17d",
|
| 6 |
+
"knowledge_cutoff": "2026-01-13T14:45:47Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/SLPVectorizer"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "72a20b8e29876106aa918d03ef95f27a6bf0fa0d",
|
| 12 |
+
"components": [
|
| 13 |
+
"SLPVectorizer"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 17 |
+
[
|
| 18 |
+
7082,
|
| 19 |
+
7093
|
| 20 |
+
],
|
| 21 |
+
[
|
| 22 |
+
7436,
|
| 23 |
+
7445
|
| 24 |
+
],
|
| 25 |
+
[
|
| 26 |
+
7451,
|
| 27 |
+
7457
|
| 28 |
+
]
|
| 29 |
+
]
|
| 30 |
+
},
|
| 31 |
+
"bug_location_funcname": {
|
| 32 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 33 |
+
"BoUpSLP::analyzeConstantStrideCandidate",
|
| 34 |
+
"BoUpSLP::canVectorizeLoads"
|
| 35 |
+
]
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
"patch": "commit 72a20b8e29876106aa918d03ef95f27a6bf0fa0d\nAuthor: Gabriel Baraldi <baraldigabriel@gmail.com>\nDate: Thu Jan 15 12:07:13 2026 -0300\n\n [SLPVectorizer] Check std::optional coming out of getPointersDiff (#175784)\n \n Fixes https://github.com/llvm/llvm-project/issues/175768\n There are other unchecked uses std::optional in this pass but I couldn't\n figure out a test that triggers them\n\ndiff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\nindex 8611d4023866..b7ab056ef436 100644\n--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n@@ -7082,12 +7082,17 @@ bool BoUpSLP::analyzeConstantStrideCandidate(\n Value *Ptr0, Value *PtrN, StridedPtrInfo &SPtrInfo) const {\n const size_t Sz = PointerOps.size();\n SmallVector<int64_t> SortedOffsetsFromBase(Sz);\n- // Go through `PointerOps` in sorted order and record offsets from `Ptr0`.\n+ // Go through `PointerOps` in sorted order and record offsets from\n+ // PointerOps[0]. We use PointerOps[0] rather than Ptr0 because\n+ // sortPtrAccesses only validates getPointersDiff for pairs relative to\n+ // PointerOps[0]. This is safe since only offset differences are used below.\n for (unsigned I : seq<unsigned>(Sz)) {\n Value *Ptr =\n SortedIndices.empty() ? PointerOps[I] : PointerOps[SortedIndices[I]];\n- SortedOffsetsFromBase[I] =\n- *getPointersDiff(ScalarTy, Ptr0, ScalarTy, Ptr, *DL, *SE);\n+ std::optional<int64_t> Offset =\n+ getPointersDiff(ScalarTy, PointerOps[0], ScalarTy, Ptr, *DL, *SE);\n+ assert(Offset && \"sortPtrAccesses should have validated this pointer\");\n+ SortedOffsetsFromBase[I] = *Offset;\n }\n \n // The code below checks that `SortedOffsetsFromBase` looks as follows:\n@@ -7436,10 +7441,18 @@ BoUpSLP::LoadsState BoUpSLP::canVectorizeLoads(\n Ptr0 = PointerOps[Order.front()];\n PtrN = PointerOps[Order.back()];\n }\n- std::optional<int64_t> Diff =\n- getPointersDiff(ScalarTy, Ptr0, ScalarTy, PtrN, *DL, *SE);\n+ // sortPtrAccesses validates getPointersDiff for all pointers relative to\n+ // PointerOps[0], so compute the span using PointerOps[0] as intermediate:\n+ // Diff = offset(PtrN) - offset(Ptr0) relative to PointerOps[0]\n+ std::optional<int64_t> Diff0 =\n+ getPointersDiff(ScalarTy, PointerOps[0], ScalarTy, Ptr0, *DL, *SE);\n+ std::optional<int64_t> DiffN =\n+ getPointersDiff(ScalarTy, PointerOps[0], ScalarTy, PtrN, *DL, *SE);\n+ assert(Diff0 && DiffN &&\n+ \"sortPtrAccesses should have validated these pointers\");\n+ int64_t Diff = *DiffN - *Diff0;\n // Check that the sorted loads are consecutive.\n- if (static_cast<uint64_t>(*Diff) == Sz - 1)\n+ if (static_cast<uint64_t>(Diff) == Sz - 1)\n return LoadsState::Vectorize;\n if (isMaskedLoadCompress(VL, PointerOps, Order, *TTI, *DL, *SE, *AC, *DT,\n *TLI, [&](Value *V) {\n@@ -7451,7 +7464,7 @@ BoUpSLP::LoadsState BoUpSLP::canVectorizeLoads(\n cast<LoadInst>(Order.empty() ? VL.front() : VL[Order.front()])\n ->getAlign();\n if (analyzeConstantStrideCandidate(PointerOps, ScalarTy, Alignment, Order,\n- *Diff, Ptr0, PtrN, SPtrInfo))\n+ Diff, Ptr0, PtrN, SPtrInfo))\n return LoadsState::StridedVectorize;\n }\n if (!TTI->isLegalMaskedGather(VecTy, CommonAlignment) ||\n",
|
| 39 |
+
"tests": [
|
| 40 |
+
{
|
| 41 |
+
"file": "llvm/test/Transforms/SLPVectorizer/X86/crash_getpointersdiff-nullopt.ll",
|
| 42 |
+
"commands": [
|
| 43 |
+
"opt < %s -passes=slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu"
|
| 44 |
+
],
|
| 45 |
+
"tests": [
|
| 46 |
+
{
|
| 47 |
+
"test_name": "<module>",
|
| 48 |
+
"test_body": "\n; Test that SLP vectorizer doesn't crash when getPointersDiff returns\n; std::nullopt for pointers that can't be compared.\n\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128\"\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\ndefine void @test(i64 %arg0, i64 %arg1) {\n;\nentry:\n %init = add i64 %arg0, 1\n br label %loop\n\nloop:\n %iv = phi i64 [ %init, %entry ], [ %iv.next, %reduce ]\n %counter = phi i64 [ 1, %entry ], [ %counter.next, %reduce ]\n %off0 = add i64 %iv, -4\n %off1 = add i64 %iv, -3\n %off2 = add i64 %iv, -2\n %off3 = add i64 %iv, -1\n %ptr = call ptr null(ptr null, ptr null)\n %idx0 = add i64 %arg1, %off0\n %idx0.scaled = shl i64 %idx0, 3\n %gep0 = getelementptr i8, ptr %ptr, i64 %idx0.scaled\n %gep0.off = getelementptr i8, ptr %gep0, i64 -8\n %load0 = load double, ptr %gep0.off, align 8\n %idx1 = add i64 %arg1, %off1\n %idx1.scaled = shl i64 %idx1, 3\n %gep1 = getelementptr i8, ptr %ptr, i64 %idx1.scaled\n %gep1.off = getelementptr i8, ptr %gep1, i64 -8\n %load1 = load double, ptr %gep1.off, align 8\n %idx2 = add i64 %arg1, %off2\n %idx2.scaled = shl i64 %idx2, 3\n %gep2 = getelementptr i8, ptr %ptr, i64 %idx2.scaled\n %gep2.off = getelementptr i8, ptr %gep2, i64 -8\n %load2 = load double, ptr %gep2.off, align 8\n %idx3 = add i64 %arg1, %off3\n %idx3.scaled = shl i64 %idx3, 3\n %gep3 = getelementptr i8, ptr %ptr, i64 %idx3.scaled\n %gep3.off = getelementptr i8, ptr %gep3, i64 -8\n %load3 = load double, ptr %gep3.off, align 8\n %idx4 = add i64 %arg1, %iv\n %idx4.scaled = shl i64 %idx4, 3\n %gep4 = getelementptr i8, ptr %ptr, i64 %idx4.scaled\n %gep4.off = getelementptr i8, ptr %gep4, i64 -8\n %load4 = load double, ptr %gep4.off, align 8\n %load5 = load double, ptr %gep4, align 8\n br label %reduce\n\ndead:\n br label %reduce\n\nreduce:\n %phi0 = phi double [ %load0, %loop ], [ 0.000000e+00, %dead ]\n %phi1 = phi double [ %load1, %loop ], [ 0.000000e+00, %dead ]\n %phi2 = phi double [ %load2, %loop ], [ 0.000000e+00, %dead ]\n %phi3 = phi double [ %load3, %loop ], [ 0.000000e+00, %dead ]\n %phi4 = phi double [ %load4, %loop ], [ 0.000000e+00, %dead ]\n %phi5 = phi double [ %load5, %loop ], [ 0.000000e+00, %dead ]\n %min0 = call double @llvm.minimum.f64(double 0.000000e+00, double %phi0)\n %min1 = call double @llvm.minimum.f64(double %min0, double %phi1)\n %min2 = call double @llvm.minimum.f64(double %min1, double %phi2)\n %min3 = call double @llvm.minimum.f64(double %min2, double %phi3)\n %min4 = call double @llvm.minimum.f64(double %min3, double %phi4)\n %min5 = call double @llvm.minimum.f64(double %min4, double %phi5)\n %min6 = call double @llvm.minimum.f64(double %min5, double 0.000000e+00)\n %counter.next = add i64 %counter, 1\n %iv.next = add i64 %counter, %init\n br label %loop\n}\n\ndeclare double @llvm.minimum.f64(double, double)"
|
| 49 |
+
}
|
| 50 |
+
]
|
| 51 |
+
}
|
| 52 |
+
],
|
| 53 |
+
"issue": {
|
| 54 |
+
"title": "SLP vectorizer crashes with assertions on",
|
| 55 |
+
"body": "This is the repro in godbold\nhttps://godbolt.org/z/c3nzMcrGs\n\n```llvm\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\ndefine void @test(i64 %arg0, i64 %arg1) {\nentry:\n %init = add i64 %arg0, 1\n br label %loop\n\nloop:\n %iv = phi i64 [ %init, %entry ], [ %iv.next, %reduce ]\n %counter = phi i64 [ 1, %entry ], [ %counter.next, %reduce ]\n %off0 = add i64 %iv, -4\n %off1 = add i64 %iv, -3\n %off2 = add i64 %iv, -2\n %off3 = add i64 %iv, -1\n %ptr = call ptr null(ptr null, ptr null)\n %idx0 = add i64 %arg1, %off0\n %idx0.scaled = shl i64 %idx0, 3\n %gep0 = getelementptr i8, ptr %ptr, i64 %idx0.scaled\n %gep0.off = getelementptr i8, ptr %gep0, i64 -8\n %load0 = load double, ptr %gep0.off, align 8\n %idx1 = add i64 %arg1, %off1\n %idx1.scaled = shl i64 %idx1, 3\n %gep1 = getelementptr i8, ptr %ptr, i64 %idx1.scaled\n %gep1.off = getelementptr i8, ptr %gep1, i64 -8\n %load1 = load double, ptr %gep1.off, align 8\n %idx2 = add i64 %arg1, %off2\n %idx2.scaled = shl i64 %idx2, 3\n %gep2 = getelementptr i8, ptr %ptr, i64 %idx2.scaled\n %gep2.off = getelementptr i8, ptr %gep2, i64 -8\n %load2 = load double, ptr %gep2.off, align 8\n %idx3 = add i64 %arg1, %off3\n %idx3.scaled = shl i64 %idx3, 3\n %gep3 = getelementptr i8, ptr %ptr, i64 %idx3.scaled\n %gep3.off = getelementptr i8, ptr %gep3, i64 -8\n %load3 = load double, ptr %gep3.off, align 8\n %idx4 = add i64 %arg1, %iv\n %idx4.scaled = shl i64 %idx4, 3\n %gep4 = getelementptr i8, ptr %ptr, i64 %idx4.scaled\n %gep4.off = getelementptr i8, ptr %gep4, i64 -8\n %load4 = load double, ptr %gep4.off, align 8\n %load5 = load double, ptr %gep4, align 8\n br label %reduce\n\ndead:\n br label %reduce\n\nreduce:\n %phi0 = phi double [ %load0, %loop ], [ 0.000000e+00, %dead ]\n %phi1 = phi double [ %load1, %loop ], [ 0.000000e+00, %dead ]\n %phi2 = phi double [ %load2, %loop ], [ 0.000000e+00, %dead ]\n %phi3 = phi double [ %load3, %loop ], [ 0.000000e+00, %dead ]\n %phi4 = phi double [ %load4, %loop ], [ 0.000000e+00, %dead ]\n %phi5 = phi double [ %load5, %loop ], [ 0.000000e+00, %dead ]\n %min0 = call double @llvm.minimum.f64(double 0.000000e+00, double %phi0)\n %min1 = call double @llvm.minimum.f64(double %min0, double %phi1)\n %min2 = call double @llvm.minimum.f64(double %min1, double %phi2)\n %min3 = call double @llvm.minimum.f64(double %min2, double %phi3)\n %min4 = call double @llvm.minimum.f64(double %min3, double %phi4)\n %min5 = call double @llvm.minimum.f64(double %min4, double %phi5)\n %min6 = call double @llvm.minimum.f64(double %min5, double 0.000000e+00)\n %counter.next = add i64 %counter, 1\n %iv.next = add i64 %counter, %init\n br label %loop\n}\n\ndeclare double @llvm.minimum.f64(double, double)\n\n```",
|
| 56 |
+
"author": "gbaraldi",
|
| 57 |
+
"labels": [
|
| 58 |
+
"release:backport",
|
| 59 |
+
"llvm:SLPVectorizer",
|
| 60 |
+
"crash"
|
| 61 |
+
],
|
| 62 |
+
"comments": [
|
| 63 |
+
{
|
| 64 |
+
"author": "RKSimon",
|
| 65 |
+
"body": "22.x regression - tentatively tagging this for cherry picking "
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"author": "gbaraldi",
|
| 69 |
+
"body": "This broke between 18 and 20 (this was found in Julia when we did that bump) "
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"author": "RKSimon",
|
| 73 |
+
"body": "> This broke between 18 and 20 (this was found in Julia when we did that bump)\n\n@alexey-bataev if it is this old, should we get it fixed in 22.x? is there a higher chance of it occurring with more recent slp features?"
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"author": "alexey-bataev",
|
| 77 |
+
"body": "Potentially yes, so it would be good to port it to 22"
|
| 78 |
+
}
|
| 79 |
+
]
|
| 80 |
+
},
|
| 81 |
+
"properties": {
|
| 82 |
+
"is_single_file_fix": true,
|
| 83 |
+
"is_single_func_fix": false
|
| 84 |
+
},
|
| 85 |
+
"verified": true
|
| 86 |
+
}
|
dataset/175949.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "175949",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/175949",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "3e286c20ae9fc09715a41e0d3d4ce322218ee7f5",
|
| 6 |
+
"knowledge_cutoff": "2026-01-14T13:25:14Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/InstSimplify"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "295256f59aaff7e6d502fab4a0675c7c482e2740",
|
| 12 |
+
"components": [
|
| 13 |
+
"InstructionSimplify"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Analysis/InstructionSimplify.cpp": [
|
| 17 |
+
[
|
| 18 |
+
4108,
|
| 19 |
+
4120
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Analysis/InstructionSimplify.cpp": [
|
| 25 |
+
"simplifyFCmpInst"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 295256f59aaff7e6d502fab4a0675c7c482e2740\nAuthor: Karol Zwolak <karolzwolak7@gmail.com>\nDate: Fri Jan 16 12:59:12 2026 +0100\n\n [InstSimplify] Fall back to the rest of the logic if folding of the consts isn't successfull when simplifying fcmp (#176159)\n \n Fixes #175949.\n\ndiff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp\nindex 17c3b7773ced..a393286da7b7 100644\n--- a/llvm/lib/Analysis/InstructionSimplify.cpp\n+++ b/llvm/lib/Analysis/InstructionSimplify.cpp\n@@ -4108,13 +4108,16 @@ static Value *simplifyFCmpInst(CmpPredicate Pred, Value *LHS, Value *RHS,\n assert(CmpInst::isFPPredicate(Pred) && \"Not an FP compare!\");\n \n if (Constant *CLHS = dyn_cast<Constant>(LHS)) {\n- if (Constant *CRHS = dyn_cast<Constant>(RHS))\n- return ConstantFoldCompareInstOperands(Pred, CLHS, CRHS, Q.DL, Q.TLI,\n- Q.CxtI);\n-\n- // If we have a constant, make sure it is on the RHS.\n- std::swap(LHS, RHS);\n- Pred = CmpInst::getSwappedPredicate(Pred);\n+ if (Constant *CRHS = dyn_cast<Constant>(RHS)) {\n+ // if the folding isn't successfull, fall back to the rest of the logic\n+ if (auto *Result = ConstantFoldCompareInstOperands(Pred, CLHS, CRHS, Q.DL,\n+ Q.TLI, Q.CxtI))\n+ return Result;\n+ } else {\n+ // If we have a constant, make sure it is on the RHS.\n+ std::swap(LHS, RHS);\n+ Pred = CmpInst::getSwappedPredicate(Pred);\n+ }\n }\n \n // Fold trivial predicates.\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/InstSimplify/fcmp.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt < %s -passes=instsimplify,instcombine -S"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "direct_bitcast_uge",
|
| 39 |
+
"test_body": "define i1 @direct_bitcast_uge() {\n %cmp = fcmp uge bfloat bitcast (half 0xH7C00 to bfloat), 0xRFF80\n ret i1 %cmp\n}\n"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"test_name": "bitcast_cannot_be_folded",
|
| 43 |
+
"test_body": "@g = external global i8\n\ndefine i1 @bitcast_cannot_be_folded() {\n %cmp = fcmp ogt bfloat bitcast (i16 ptrtoint (ptr @g to i16) to bfloat), 0xR7F80\n ret i1 %cmp\n}\n"
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"test_name": "bitcast_first",
|
| 47 |
+
"test_body": "define i1 @bitcast_first() {\n %lhs = bitcast half 0xH7C00 to bfloat\n %cmp = fcmp ogt bfloat %lhs, 0xR7F80\n ret i1 %cmp\n}\n"
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"test_name": "direct_bitcast",
|
| 51 |
+
"test_body": "define i1 @direct_bitcast() {\n %cmp = fcmp ogt bfloat bitcast (half 0xH7C00 to bfloat), 0xR7F80\n ret i1 %cmp\n}\n"
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"test_name": "pr130408",
|
| 55 |
+
"test_body": "define i1 @pr130408(x86_fp80 %x) {\n %bits = bitcast x86_fp80 %x to i80\n %masked = and i80 %bits, -604444463063240877801473\n %or = or i80 %masked, 302194561415509874573312\n %fp = bitcast i80 %or to x86_fp80\n %res = fcmp uno x86_fp80 %fp, 0xK00000000000000000000\n ret i1 %res\n}\n"
|
| 56 |
+
}
|
| 57 |
+
]
|
| 58 |
+
}
|
| 59 |
+
],
|
| 60 |
+
"issue": {
|
| 61 |
+
"title": "`fcmp` on bitcasted constant and inf isn't simplified which triggers unreachable",
|
| 62 |
+
"body": "https://godbolt.org/z/MEeGGj7eT\n```llvm\ndefine i1 @crashes() {\n %cmp = fcmp ogt bfloat bitcast (half 0xH7C00 to bfloat), 0xR7F80 ; rhs is +inf\n ret i1 %cmp\n}\n```\nwhen run\n```sh\nopt -passes=instsimplify,instcombine\n```\nShould be canonicalized to just return `i1 0`, but the bitcasted constant seems to confuse LLVM, which then triggers unreachable here\nhttps://github.com/llvm/llvm-project/blob/7d5fe7e1949321060395e1f4667cae83d6c012d1/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp#L8833-L8839\n\nSimilar examples with `uge` and `-inf` are also affected: https://godbolt.org/z/xPKoEb7Mv.\nThe relevant code was introduced in #80986.",
|
| 63 |
+
"author": "karolzwolak",
|
| 64 |
+
"labels": [
|
| 65 |
+
"llvm:instcombine",
|
| 66 |
+
"crash-on-valid"
|
| 67 |
+
],
|
| 68 |
+
"comments": [
|
| 69 |
+
{
|
| 70 |
+
"author": "karolzwolak",
|
| 71 |
+
"body": "When both operands of the fcmp are float literals, this is reached, and the whole thing is folded into true or false.\nhttps://github.com/llvm/llvm-project/blob/2a8bb5b74923cd3a39f803e91fe36acd0c4bd30d/llvm/lib/IR/ConstantFold.cpp#L1163-L1166\nHowever, in this case, `LHS` is `bfloat bitcast (half 0xH7C00 to bfloat)`, which doesn't isn't a ConstantFP directly. The fix would probably be to just fold the operands first if they are an constant expression. Not sure why this isn't done now."
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"author": "nikic",
|
| 75 |
+
"body": "The problem here specifically is that we're missing support for FP to FP bitcasts (which can only occur for the specific combination of half and bfloat) in ConstantFold.\n\nBut more generally this can also happen with other constant expressions that cannot be folded, for example:\n```\n@g = external global i8\ndefine i1 @crashes() {\n %cmp = fcmp ogt bfloat bitcast (i16 ptrtoint (ptr @g to i16) to bfloat), 0xR7F80 ; rhs is +inf\n ret i1 %cmp\n}\n```\n\nFor constant operands, InstSimplify calls into ConstantFolding, and skips the rest of the logic (which would handle this). So possible fixes here are a) fall back to rest of logic after ConstantFolding, b) handle inf comparison in ConstantFolding, c) make InstCombine not assert this.\n\nI think a) is probably the best way to handle it."
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"author": "karolzwolak",
|
| 79 |
+
"body": "Hm you're right, I didn't think about the case in which the expr isn't foldable. I was working on folding float to float bitcasts, which fixes the foldable cases. Do you think such a change would still be useful on it's own?"
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"author": "nikic",
|
| 83 |
+
"body": "> Hm you're right, I didn't think about the case in which the expr isn't foldable. I was working on folding float to float bitcasts, which fixes the foldable cases. Do you think such a change would still be useful on it's own?\n\nYes, definitely."
|
| 84 |
+
}
|
| 85 |
+
]
|
| 86 |
+
},
|
| 87 |
+
"properties": {
|
| 88 |
+
"is_single_file_fix": true,
|
| 89 |
+
"is_single_func_fix": true
|
| 90 |
+
},
|
| 91 |
+
"verified": true
|
| 92 |
+
}
|
dataset/175967.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "175967",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/175967",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "b2828bdf809828346ca628de9091c1a269364743",
|
| 6 |
+
"knowledge_cutoff": "2026-01-14T15:46:29Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/SLPVectorizer"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "c322a0c462b1b277e5862aeae2e95a40f7b130d4",
|
| 12 |
+
"components": [
|
| 13 |
+
"SLPVectorizer"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 17 |
+
[
|
| 18 |
+
16573,
|
| 19 |
+
16579
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 25 |
+
"BoUpSLP::calculateTreeCostAndTrimNonProfitable"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit c322a0c462b1b277e5862aeae2e95a40f7b130d4\nAuthor: Alexey Bataev <a.bataev@outlook.com>\nDate: Wed Jan 14 11:56:17 2026 -0800\n\n [SLP]Do not throttle nodes with split parents, if any of scalars is used in more than one split nodes\n \n If the the node to throttle is a vector node, which is used in split\n node, and at least one scalar of such a node is used in many split\n nodes, such vector node should be throttled. otherise there might be\n wrong def-use chain, which crashes the compiler.\n \n Fixes #175967\n\ndiff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\nindex 5a6c56573512..8611d4023866 100644\n--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n@@ -16573,7 +16573,15 @@ InstructionCost BoUpSLP::calculateTreeCostAndTrimNonProfitable(\n bool Changed = false;\n while (!Worklist.empty() && Worklist.top().second.first > 0) {\n TreeEntry *TE = Worklist.top().first;\n- if (TE->isGather() || TE->Idx == 0 || DeletedNodes.contains(TE)) {\n+ if (TE->isGather() || TE->Idx == 0 || DeletedNodes.contains(TE) ||\n+ // Exit early if the parent node is split node and any of scalars is\n+ // used in other split nodes.\n+ (TE->UserTreeIndex &&\n+ TE->UserTreeIndex.UserTE->State == TreeEntry::SplitVectorize &&\n+ any_of(TE->Scalars, [&](Value *V) {\n+ ArrayRef<TreeEntry *> Entries = getSplitTreeEntries(V);\n+ return Entries.size() > 1;\n+ }))) {\n Worklist.pop();\n continue;\n }\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/SLPVectorizer/X86/split-node-throttled.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -S --passes=slp-vectorizer -mtriple=x86_64-grtev4-linux-gnu -mcpu=haswell < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "\ndefine fastcc void @test(i32 %arg) {\n;\nbb:\n %zext = zext i32 %arg to i64\n %sext = sext i32 0 to i64\n %select = select i1 false, i32 0, i32 0\n %zext1 = zext i32 %select to i64\n %mul = mul i64 0, %zext1\n %or = or i64 0, %mul\n %or2 = or i64 %or, 0\n %zext3 = zext i32 0 to i64\n %mul4 = mul i64 0, %zext3\n %or5 = or i64 %or2, %mul4\n %lshr = lshr i64 %or5, 0\n %trunc = trunc i64 %lshr to i32\n %call = tail call i32 @llvm.smax.i32(i32 %trunc, i32 0)\n %call6 = tail call i32 @llvm.smin.i32(i32 %call, i32 0)\n %trunc7 = trunc i32 %call6 to i16\n %getelementptr = getelementptr i8, ptr poison, i64 16\n store i16 %trunc7, ptr %getelementptr, align 2\n %mul8 = mul i64 0, %zext\n %or9 = or i64 0, %mul8\n %or10 = or i64 %or9, 0\n %sext11 = sext i32 0 to i64\n %mul12 = mul i64 0, %sext11\n %or13 = or i64 %or10, %mul12\n %lshr14 = lshr i64 %or13, 0\n %trunc15 = trunc i64 %lshr14 to i32\n %call16 = tail call i32 @llvm.smax.i32(i32 %trunc15, i32 0)\n %call17 = tail call i32 @llvm.smin.i32(i32 %call16, i32 0)\n %trunc18 = trunc i32 %call17 to i16\n %getelementptr19 = getelementptr i8, ptr poison, i64 18\n store i16 %trunc18, ptr %getelementptr19, align 2\n %sext20 = sext i32 0 to i64\n %mul21 = mul i64 0, %sext20\n %or22 = or i64 %zext3, %mul21\n %or23 = or i64 %or22, 0\n %mul24 = mul i64 0, %zext1\n %or25 = or i64 %or23, %mul24\n %lshr26 = lshr i64 %or25, 0\n %trunc27 = trunc i64 %lshr26 to i32\n %call28 = tail call i32 @llvm.smax.i32(i32 %trunc27, i32 0)\n %call29 = tail call i32 @llvm.smin.i32(i32 %call28, i32 0)\n %trunc30 = trunc i32 %call29 to i16\n %getelementptr31 = getelementptr i8, ptr poison, i64 20\n store i16 %trunc30, ptr %getelementptr31, align 2\n %sext32 = sext i32 0 to i64\n %mul33 = mul i64 0, %sext32\n %or34 = or i64 0, %mul33\n %or35 = or i64 %or34, 0\n %mul36 = mul i64 0, %sext\n %or37 = or i64 %or35, %mul36\n %lshr38 = lshr i64 %or37, 0\n %trunc39 = trunc i64 %lshr38 to i32\n %call40 = tail call i32 @llvm.smax.i32(i32 %trunc39, i32 0)\n %call41 = tail call i32 @llvm.smin.i32(i32 %call40, i32 0)\n %trunc42 = trunc i32 %call41 to i16\n %getelementptr43 = getelementptr i8, ptr poison, i64 22\n store i16 %trunc42, ptr %getelementptr43, align 2\n %mul44 = mul i64 0, %zext1\n %or45 = or i64 0, %mul44\n %or46 = or i64 %or45, 0\n %mul47 = mul i64 0, %zext3\n %or48 = or i64 %or46, %mul47\n %lshr49 = lshr i64 %or48, 0\n %trunc50 = trunc i64 %lshr49 to i32\n %call51 = tail call i32 @llvm.smax.i32(i32 %trunc50, i32 0)\n %call52 = tail call i32 @llvm.smin.i32(i32 %call51, i32 0)\n %trunc53 = trunc i32 %call52 to i16\n %getelementptr54 = getelementptr i8, ptr poison, i64 24\n store i16 %trunc53, ptr %getelementptr54, align 2\n %mul55 = mul i64 0, %zext\n %or56 = or i64 0, %mul55\n %or57 = or i64 %or56, 0\n %mul58 = mul i64 0, %sext11\n %or59 = or i64 %or57, %mul58\n %lshr60 = lshr i64 %or59, 0\n %trunc61 = trunc i64 %lshr60 to i32\n %call62 = tail call i32 @llvm.smax.i32(i32 %trunc61, i32 0)\n %call63 = tail call i32 @llvm.smin.i32(i32 %call62, i32 0)\n %trunc64 = trunc i32 %call63 to i16\n %getelementptr65 = getelementptr i8, ptr poison, i64 26\n store i16 %trunc64, ptr %getelementptr65, align 2\n %mul66 = mul i64 0, %sext20\n %or67 = or i64 0, %mul66\n %or68 = or i64 %or67, 0\n %mul69 = mul i64 0, %zext1\n %or70 = or i64 %or68, %mul69\n %lshr71 = lshr i64 %or70, 0\n %trunc72 = trunc i64 %lshr71 to i32\n %call73 = tail call i32 @llvm.smax.i32(i32 %trunc72, i32 0)\n %call74 = tail call i32 @llvm.smin.i32(i32 %call73, i32 0)\n %trunc75 = trunc i32 %call74 to i16\n %getelementptr76 = getelementptr i8, ptr poison, i64 28\n store i16 %trunc75, ptr %getelementptr76, align 2\n %mul77 = mul i64 0, %sext32\n %or78 = or i64 0, %mul77\n %or79 = or i64 %or78, 0\n %mul80 = mul i64 0, %sext\n %or81 = or i64 %or79, %mul80\n %lshr82 = lshr i64 %or81, 0\n %trunc83 = trunc i64 %lshr82 to i32\n %call84 = tail call i32 @llvm.smax.i32(i32 %trunc83, i32 0)\n %call85 = tail call i32 @llvm.smin.i32(i32 %call84, i32 0)\n %trunc86 = trunc i32 %call85 to i16\n %getelementptr87 = getelementptr i8, ptr poison, i64 30\n store i16 %trunc86, ptr %getelementptr87, align 2\n ret void\n}\n\ndeclare i32 @llvm.smin.i32(i32, i32)\ndeclare i32 @llvm.smax.i32(i32, i32)"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[SLPVectorizer] Crash after 1a8f5fa823a55bce9be368097d2ac7e137fe5d17",
|
| 46 |
+
"body": "Looking at the following IR:\n```\n; ModuleID = './reduced.ll'\nsource_filename = \"./reduced.ll\"\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128\"\ntarget triple = \"x86_64-grtev4-linux-gnu\"\n\ndefine fastcc void @wombat(i32 %arg) #0 {\nbb:\n %zext = zext i32 %arg to i64\n %sext = sext i32 0 to i64\n %select = select i1 false, i32 0, i32 0\n %zext1 = zext i32 %select to i64\n %mul = mul i64 0, %zext1\n %or = or i64 0, %mul\n %or2 = or i64 %or, 0\n %zext3 = zext i32 0 to i64\n %mul4 = mul i64 0, %zext3\n %or5 = or i64 %or2, %mul4\n %lshr = lshr i64 %or5, 0\n %trunc = trunc i64 %lshr to i32\n %call = tail call i32 @llvm.smax.i32(i32 %trunc, i32 0)\n %call6 = tail call i32 @llvm.smin.i32(i32 %call, i32 0)\n %trunc7 = trunc i32 %call6 to i16\n %getelementptr = getelementptr i8, ptr poison, i64 16\n store i16 %trunc7, ptr %getelementptr, align 2\n %mul8 = mul i64 0, %zext\n %or9 = or i64 0, %mul8\n %or10 = or i64 %or9, 0\n %sext11 = sext i32 0 to i64\n %mul12 = mul i64 0, %sext11\n %or13 = or i64 %or10, %mul12\n %lshr14 = lshr i64 %or13, 0\n %trunc15 = trunc i64 %lshr14 to i32\n %call16 = tail call i32 @llvm.smax.i32(i32 %trunc15, i32 0)\n %call17 = tail call i32 @llvm.smin.i32(i32 %call16, i32 0)\n %trunc18 = trunc i32 %call17 to i16\n %getelementptr19 = getelementptr i8, ptr poison, i64 18\n store i16 %trunc18, ptr %getelementptr19, align 2\n %sext20 = sext i32 0 to i64\n %mul21 = mul i64 0, %sext20\n %or22 = or i64 %zext3, %mul21\n %or23 = or i64 %or22, 0\n %mul24 = mul i64 0, %zext1\n %or25 = or i64 %or23, %mul24\n %lshr26 = lshr i64 %or25, 0\n %trunc27 = trunc i64 %lshr26 to i32\n %call28 = tail call i32 @llvm.smax.i32(i32 %trunc27, i32 0)\n %call29 = tail call i32 @llvm.smin.i32(i32 %call28, i32 0)\n %trunc30 = trunc i32 %call29 to i16\n %getelementptr31 = getelementptr i8, ptr poison, i64 20\n store i16 %trunc30, ptr %getelementptr31, align 2\n %sext32 = sext i32 0 to i64\n %mul33 = mul i64 0, %sext32\n %or34 = or i64 0, %mul33\n %or35 = or i64 %or34, 0\n %mul36 = mul i64 0, %sext\n %or37 = or i64 %or35, %mul36\n %lshr38 = lshr i64 %or37, 0\n %trunc39 = trunc i64 %lshr38 to i32\n %call40 = tail call i32 @llvm.smax.i32(i32 %trunc39, i32 0)\n %call41 = tail call i32 @llvm.smin.i32(i32 %call40, i32 0)\n %trunc42 = trunc i32 %call41 to i16\n %getelementptr43 = getelementptr i8, ptr poison, i64 22\n store i16 %trunc42, ptr %getelementptr43, align 2\n %mul44 = mul i64 0, %zext1\n %or45 = or i64 0, %mul44\n %or46 = or i64 %or45, 0\n %mul47 = mul i64 0, %zext3\n %or48 = or i64 %or46, %mul47\n %lshr49 = lshr i64 %or48, 0\n %trunc50 = trunc i64 %lshr49 to i32\n %call51 = tail call i32 @llvm.smax.i32(i32 %trunc50, i32 0)\n %call52 = tail call i32 @llvm.smin.i32(i32 %call51, i32 0)\n %trunc53 = trunc i32 %call52 to i16\n %getelementptr54 = getelementptr i8, ptr poison, i64 24\n store i16 %trunc53, ptr %getelementptr54, align 2\n %mul55 = mul i64 0, %zext\n %or56 = or i64 0, %mul55\n %or57 = or i64 %or56, 0\n %mul58 = mul i64 0, %sext11\n %or59 = or i64 %or57, %mul58\n %lshr60 = lshr i64 %or59, 0\n %trunc61 = trunc i64 %lshr60 to i32\n %call62 = tail call i32 @llvm.smax.i32(i32 %trunc61, i32 0)\n %call63 = tail call i32 @llvm.smin.i32(i32 %call62, i32 0)\n %trunc64 = trunc i32 %call63 to i16\n %getelementptr65 = getelementptr i8, ptr poison, i64 26\n store i16 %trunc64, ptr %getelementptr65, align 2\n %mul66 = mul i64 0, %sext20\n %or67 = or i64 0, %mul66\n %or68 = or i64 %or67, 0\n %mul69 = mul i64 0, %zext1\n %or70 = or i64 %or68, %mul69\n %lshr71 = lshr i64 %or70, 0\n %trunc72 = trunc i64 %lshr71 to i32\n %call73 = tail call i32 @llvm.smax.i32(i32 %trunc72, i32 0)\n %call74 = tail call i32 @llvm.smin.i32(i32 %call73, i32 0)\n %trunc75 = trunc i32 %call74 to i16\n %getelementptr76 = getelementptr i8, ptr poison, i64 28\n store i16 %trunc75, ptr %getelementptr76, align 2\n %mul77 = mul i64 0, %sext32\n %or78 = or i64 0, %mul77\n %or79 = or i64 %or78, 0\n %mul80 = mul i64 0, %sext\n %or81 = or i64 %or79, %mul80\n %lshr82 = lshr i64 %or81, 0\n %trunc83 = trunc i64 %lshr82 to i32\n %call84 = tail call i32 @llvm.smax.i32(i32 %trunc83, i32 0)\n %call85 = tail call i32 @llvm.smin.i32(i32 %call84, i32 0)\n %trunc86 = trunc i32 %call85 to i16\n %getelementptr87 = getelementptr i8, ptr poison, i64 30\n store i16 %trunc86, ptr %getelementptr87, align 2\n ret void\n}\n\n; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none)\ndeclare i32 @llvm.smin.i32(i32, i32) #1\n\n; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none)\ndeclare i32 @llvm.smax.i32(i32, i32) #1\n\nattributes #0 = { \"target-cpu\"=\"haswell\" }\nattributes #1 = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }\n```\n\nand running `opt`:\n```\n./bin/opt -passes=\"slp-vectorizer,verify\" ./reduced.ll -disable-output\n```\n\nwe're seeing the following error after the commit in the title:\n```\nInstruction does not dominate all uses!\n %6 = zext <2 x i32> %5 to <2 x i64>\n %0 = shufflevector <2 x i64> %6, <2 x i64> poison, <4 x i32> <i32 1, i32 poison, i32 poison, i32 poison>\nLLVM ERROR: Broken function found, compilation aborted!\n```",
|
| 47 |
+
"author": "boomanaiden154",
|
| 48 |
+
"labels": [
|
| 49 |
+
"release:backport",
|
| 50 |
+
"llvm:SLPVectorizer",
|
| 51 |
+
"crash"
|
| 52 |
+
],
|
| 53 |
+
"comments": []
|
| 54 |
+
},
|
| 55 |
+
"properties": {
|
| 56 |
+
"is_single_file_fix": true,
|
| 57 |
+
"is_single_func_fix": true
|
| 58 |
+
},
|
| 59 |
+
"verified": true
|
| 60 |
+
}
|
dataset/175990.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "175990",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/175990",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "b84ffe040babfd8541613e41dd394a1baa9404fb",
|
| 6 |
+
"knowledge_cutoff": "2026-01-14T16:49:12Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "808a6ba345ce6e898e9acc4c5eda60165806e967",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopVectorize"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1361,
|
| 19 |
+
1367
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp": [
|
| 25 |
+
"VPlanTransforms::handleFindLastReductions"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 808a6ba345ce6e898e9acc4c5eda60165806e967\nAuthor: Florian Hahn <flo@fhahn.com>\nDate: Thu Jan 15 09:06:49 2026 +0000\n\n [VPlan] Bail out when rdx result cannot be found in handleFindLast.\n \n Turn assertion from 2abd6d6d7ac\n (https://github.com/llvm/llvm-project/pull/158088) into a bail\n out to prevent crash when tail-folding.\n \n Fixes https://github.com/llvm/llvm-project/issues/175990.\n\ndiff --git a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp\nindex 7ee133545eeb..aa3437dfb8a9 100644\n--- a/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp\n+++ b/llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp\n@@ -1361,7 +1361,9 @@ bool VPlanTransforms::handleFindLastReductions(VPlan &Plan) {\n // extract.last.active intrinsic.\n auto *RdxResult =\n findUserOf<VPInstruction::ComputeReductionResult>(DataSelect);\n- assert(RdxResult && \"Unable to find reduction result recipe\");\n+ // TODO: Handle tail-folding.\n+ if (!RdxResult)\n+ return false;\n Builder.setInsertPoint(RdxResult);\n auto *ExtractLastActive =\n Builder.createNaryOp(VPInstruction::ExtractLastActive,\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/LoopVectorize/iv-select-cmp-fold-tail.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -p loop-vectorize -prefer-predicate-over-epilogue=predicate-dont-vectorize -force-vector-width=4 -S %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "\ndefine i32 @find_last_trunc_iv(ptr %src, i64 %n) {\n;\nentry:\n br label %loop\n\nloop:\n %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]\n %rdx = phi i32 [ 0, %entry ], [ %rdx.next, %loop ]\n %gep.src = getelementptr inbounds i32, ptr %src, i64 %iv\n %l = load i32, ptr %gep.src\n %cmp103 = icmp eq i32 %l, 0\n %0 = trunc i64 %iv to i32\n %rdx.next = select i1 %cmp103, i32 %0, i32 %rdx\n %iv.next = add i64 %iv, 1\n %ec = icmp eq i64 %iv, %n\n br i1 %ec, label %exit, label %loop\n\nexit:\n ret i32 %rdx.next\n}"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[LV] crash with PGO",
|
| 46 |
+
"body": "[test.zip](https://github.com/user-attachments/files/24619392/test.zip)\n\n```\nclang -O3 -c mov.i -fprofile-use=pgo.profdata \nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.\nStack dump:\n0. Program arguments: /build/install/llvmbin/clang -O3 -c mov.i -fprofile-use=pgo.profdata\n1. <eof> parser at end of file\n2. Optimizer\n3. Running pass \"function<eager-inv>(drop-unnecessary-assumes,float2int,lower-constant-intrinsics,chr,loop(loop-rotate<header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,drop-unnecessary-assumes,infer-alignment,loop-load-elim,instcombine<max-iterations=1;no-verify-fixpoint>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,slp-vectorizer,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop-unroll<O3>,transform-warning,sroa<preserve-cfg>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)\" on module \"src/libavformat/mov.c\"\n4. Running pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"mov_read_header\"\n#0 0x00005ce47e8a4eee PrintStackTraceSignalHandler(void*) (.llvm.14462126317361604948) Signals.cpp:0:0\n```",
|
| 47 |
+
"author": "Andarwinux",
|
| 48 |
+
"labels": [
|
| 49 |
+
"vectorizers",
|
| 50 |
+
"crash"
|
| 51 |
+
],
|
| 52 |
+
"comments": [
|
| 53 |
+
{
|
| 54 |
+
"author": "Andarwinux",
|
| 55 |
+
"body": "[mov.ll.txt](https://github.com/user-attachments/files/24631971/mov.ll.txt)\n\n```\nclang -c -O3 -x ir mov.ll.txt\n\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.\nStack dump:\n0. Program arguments: /build/install/llvmbin/clang -c -O3 -x ir mov.ll.txt\n1. Optimizer\n2. Running pass \"function<eager-inv>(drop-unnecessary-assumes,float2int,lower-constant-intrinsics,chr,loop(loop-rotate<header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,drop-unnecessary-assumes,infer-alignment,loop-load-elim,instcombine<max-iterations=1;no-verify-fixpoint>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,slp-vectorizer,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop-unroll<O3>,transform-warning,sroa<preserve-cfg>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)\" on module \"mov.ll.txt\"\n3. Running pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"mov_read_header\"\n#0 0x00005d671aee592e PrintStackTraceSignalHandler(void*) (.llvm.14462126317361604948) Signals.cpp:0:0\n```"
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"author": "Andarwinux",
|
| 59 |
+
"body": "2abd6d6d7ac54d40302dfc946d01572a12963ee5 @huntergr-arm"
|
| 60 |
+
}
|
| 61 |
+
]
|
| 62 |
+
},
|
| 63 |
+
"properties": {
|
| 64 |
+
"is_single_file_fix": true,
|
| 65 |
+
"is_single_func_fix": true
|
| 66 |
+
},
|
| 67 |
+
"verified": true
|
| 68 |
+
}
|
dataset/176548.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "176548",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/176548",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "6b86e24ec1785ab13bbc1e136a85537460b15fb2",
|
| 6 |
+
"knowledge_cutoff": "2026-01-17T09:19:57Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/InstCombine"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "9696c8bd620890387b258a116b9f244d91454627",
|
| 12 |
+
"components": [
|
| 13 |
+
"InstCombine"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1486,
|
| 19 |
+
1492
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp": [
|
| 25 |
+
"InstCombinerImpl::foldShuffledIntrinsicOperands"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 9696c8bd620890387b258a116b9f244d91454627\nAuthor: Yingwei Zheng <dtcxzyw2333@gmail.com>\nDate: Sat Jan 17 20:04:37 2026 +0800\n\n [InstCombine] Bail out on intrinsics with struct return types (#176556)\n \n After https://github.com/llvm/llvm-project/pull/174835, overflow\n intrinsics can be vectorized. But `foldShuffledIntrinsicOperands`\n doesn't support shuffling vectors inside the struct return value.\n \n Closes https://github.com/llvm/llvm-project/issues/176548.\n\ndiff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp\nindex eee3d0f6f3e1..b870ac259d3b 100644\n--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp\n+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp\n@@ -1486,7 +1486,8 @@ static Instruction *factorizeMinMaxTree(IntrinsicInst *II) {\n /// try to shuffle after the intrinsic.\n Instruction *\n InstCombinerImpl::foldShuffledIntrinsicOperands(IntrinsicInst *II) {\n- if (!isTriviallyVectorizable(II->getIntrinsicID()) ||\n+ if (!II->getType()->isVectorTy() ||\n+ !isTriviallyVectorizable(II->getIntrinsicID()) ||\n !II->getCalledFunction()->isSpeculatable())\n return nullptr;\n \n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/InstCombine/pr176548.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -S -passes=instcombine < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "\n; Make sure we don't pull shufflevector through an intrinsic that returns a struct.\n\ndefine { <4 x i32>, <4 x i1> } @sadd_ov_shuffle_ops(<4 x i32> %x) {\n;\nentry:\n %splat = shufflevector <4 x i32> %x, <4 x i32> poison, <4 x i32> zeroinitializer\n %ov = call { <4 x i32>, <4 x i1> } @llvm.sadd.with.overflow.v4i32(<4 x i32> %splat, <4 x i32> splat (i32 1))\n ret { <4 x i32>, <4 x i1> } %ov\n}\n\ndefine { <4 x float>, <4 x i32> } @frexp_ov_shuffle_ops(<4 x float> %x) {\n;\nentry:\n %splat = shufflevector <4 x float> %x, <4 x float> poison, <4 x i32> zeroinitializer\n %ov = call { <4 x float>, <4 x i32> } @llvm.frexp(<4 x float> %splat)\n ret { <4 x float>, <4 x i32> } %ov\n}"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[InstCombine] Assertion `isValidElementType(ElementType) && \"Element type of a VectorType must be an integer...\"' failed.",
|
| 46 |
+
"body": "Reproducer: https://godbolt.org/z/bfdeaYxYh\n```\n; bin/opt -passes=instcombine test.ll -S\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128\"\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\ndefine { <4 x i32>, <4 x i1> } @main(<4 x i32> %broadcast.splatinsert2504) {\nentry:\n %broadcast.splat2505 = shufflevector <4 x i32> %broadcast.splatinsert2504, <4 x i32> poison, <4 x i32> zeroinitializer\n %0 = call { <4 x i32>, <4 x i1> } @llvm.sadd.with.overflow.v4i32(<4 x i32> %broadcast.splat2505, <4 x i32> splat (i32 1))\n ret { <4 x i32>, <4 x i1> } %0\n}\n\n```\n```\nopt: /root/llvm-project/llvm/lib/IR/Type.cpp:804: static llvm::FixedVectorType* llvm::FixedVectorType::get(llvm::Type*, unsigned int): Assertion `isValidElementType(ElementType) && \"Element type of a VectorType must \" \"be an integer, floating point, \" \"pointer type, or a valid target \" \"extension type.\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=instcombine <source>\n1.\tRunning pass \"function(instcombine<max-iterations=1;verify-fixpoint>)\" on module \"<source>\"\n2.\tRunning pass \"instcombine<max-iterations=1;verify-fixpoint>\" on function \"main\"\n #0 0x0000000005a781a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a781a8)\n #1 0x0000000005a75084 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x00007ea91d642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x00007ea91d6969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x00007ea91d642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x00007ea91d6287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x00007ea91d62871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x00007ea91d639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x0000000005812467 llvm::FixedVectorType::get(llvm::Type*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5812467)\n #9 0x00000000049ed31e llvm::InstCombinerImpl::foldShuffledIntrinsicOperands(llvm::IntrinsicInst*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x49ed31e)\n#10 0x00000000049f7ba1 llvm::InstCombinerImpl::visitCallInst(llvm::CallInst&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x49f7ba1)\n#11 0x0000000004994d43 llvm::InstCombinerImpl::run() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4994d43)\n#12 0x0000000004996c26 combineInstructionsOverFunction(llvm::Function&, llvm::InstructionWorklist&, llvm::AAResults*, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::OptimizationRemarkEmitter&, llvm::BlockFrequencyInfo*, llvm::BranchProbabilityInfo*, llvm::ProfileSummaryInfo*, llvm::InstCombineOptions const&) (.isra.0) InstructionCombining.cpp:0:0\n#13 0x0000000004998194 llvm::InstCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4998194)\n#14 0x0000000002cd254e llvm::detail::PassModel<llvm::Function, llvm::InstCombinePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2cd254e)\n#15 0x00000000057ebf01 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57ebf01)\n#16 0x0000000000f07dee llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf07dee)\n#17 0x00000000057ea4ba llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57ea4ba)\n#18 0x000000000096468e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96468e)\n#19 0x00000000057e9e71 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57e9e71)\n#20 0x000000000096e84a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96e84a)\n#21 0x00000000009628f8 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9628f8)\n#22 0x00007ea91d629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#23 0x00007ea91d629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#24 0x0000000000959575 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x959575)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```\n\nIt was caused by recent changes allowing the vectorization of overflow intrinsics: https://github.com/llvm/llvm-project/pull/174835\n",
|
| 47 |
+
"author": "dtcxzyw",
|
| 48 |
+
"labels": [
|
| 49 |
+
"llvm:instcombine",
|
| 50 |
+
"crash-on-valid",
|
| 51 |
+
"generated by fuzzer"
|
| 52 |
+
],
|
| 53 |
+
"comments": []
|
| 54 |
+
},
|
| 55 |
+
"properties": {
|
| 56 |
+
"is_single_file_fix": true,
|
| 57 |
+
"is_single_func_fix": true
|
| 58 |
+
},
|
| 59 |
+
"verified": true
|
| 60 |
+
}
|
dataset/176658.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "176658",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/176658",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "c7af813b5213ccf4d1fbe42c2bffbde8de5ffd75",
|
| 6 |
+
"knowledge_cutoff": "2026-01-18T17:08:47Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/SLPVectorizer"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "3dc5259bc8908a516ea3c90278339d5d40e397d5",
|
| 12 |
+
"components": [
|
| 13 |
+
"SLPVectorizer"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 17 |
+
[
|
| 18 |
+
21794,
|
| 19 |
+
21799
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 25 |
+
"BoUpSLP::BlockScheduling::tryScheduleBundle"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 3dc5259bc8908a516ea3c90278339d5d40e397d5\nAuthor: Alexey Bataev <a.bataev@outlook.com>\nDate: Sun Jan 18 12:41:04 2026 -0800\n\n [SLP]Do not build bundle for copyables, with parents used in PHI node\n \n If the copyables have parents, used in PHI nodes, this causes complex\n schedulable/non-schedulable dependecies, which require complex\n processing, but with small profitability. Cut such case early for now to\n prevent compiler crashes and compile time blow up.\n \n Fixes #176658\n\ndiff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\nindex 4c4901c31440..762b394f8ea8 100644\n--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n@@ -21794,6 +21794,23 @@ BoUpSLP::BlockScheduling::tryScheduleBundle(ArrayRef<Value *> VL, BoUpSLP *SLP,\n if (!Values.insert(std::make_pair(V, Op)).second)\n return std::nullopt;\n }\n+ } else {\n+ // If any of the parent requires scheduling - exit, complex dep between\n+ // schedulable/non-schedulable parents.\n+ if (any_of(EI.UserTE->Scalars, [&](Value *V) {\n+ if (EI.UserTE->hasCopyableElements() &&\n+ EI.UserTE->isCopyableElement(V))\n+ return false;\n+ ArrayRef<TreeEntry *> Entries = SLP->getTreeEntries(V);\n+ return any_of(Entries, [](const TreeEntry *TE) {\n+ return TE->doesNotNeedToSchedule() && TE->UserTreeIndex &&\n+ TE->UserTreeIndex.UserTE->hasState() &&\n+ TE->UserTreeIndex.UserTE->State !=\n+ TreeEntry::SplitVectorize &&\n+ TE->UserTreeIndex.UserTE->getOpcode() == Instruction::PHI;\n+ });\n+ }))\n+ return std::nullopt;\n }\n }\n bool HasCopyables = S.areInstructionsWithCopyableElements();\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/SLPVectorizer/X86/copyables-with-parent-scalars-in-phis.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -S -passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu -slp-threshold=-99999 < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "\ndefine i32 @test() {\n;\nbb:\n br label %bb3\n\nbb1:\n %phi = phi i32 [ %or, %bb3 ]\n %phi2 = phi i32 [ %ashr7, %bb3 ]\n ret i32 0\n\nbb3:\n %phi4 = phi i32 [ 0, %bb ], [ %or, %bb3 ]\n %phi5 = phi i32 [ 0, %bb ], [ %or8, %bb3 ]\n %load = load i64, ptr null, align 8\n %trunc = trunc i64 %load to i32\n %or = or i32 %phi4, %trunc\n %trunc6 = trunc i64 0 to i32\n %and = and i32 %trunc6, 0\n %ashr = ashr i32 0, %and\n %ashr7 = ashr i32 %phi5, %and\n %or8 = or i32 %ashr7, 0\n br i1 false, label %bb1, label %bb3\n}\n"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"file": "llvm/test/Transforms/SLPVectorizer/X86/matching-insert-point-for-nodes.ll",
|
| 45 |
+
"commands": [
|
| 46 |
+
"opt -passes=slp-vectorizer -S -slp-threshold=-99999 -mtriple=x86_64-unknown-linux-gnu < %s"
|
| 47 |
+
],
|
| 48 |
+
"tests": [
|
| 49 |
+
{
|
| 50 |
+
"test_name": "test",
|
| 51 |
+
"test_body": "define i32 @test() {\nbb:\n br label %bb1\n\nbb1: ; preds = %bb24, %bb\n %phi = phi i32 [ %lshr25, %bb24 ], [ 0, %bb ]\n %phi2 = phi i32 [ %or26, %bb24 ], [ 0, %bb ]\n %phi3 = phi i32 [ 0, %bb24 ], [ 0, %bb ]\n br i1 false, label %bb4, label %bb11\n\nbb4: ; preds = %bb1\n %phi6 = phi i32 [ poison, %bb1 ]\n %phi7 = phi i32 [ poison, %bb1 ]\n %phi9 = phi i32 [ %phi2, %bb1 ]\n %phi10 = phi i32 [ %phi, %bb1 ]\n %0 = phi <2 x double> [ zeroinitializer, %bb1 ]\n br label %bb19\n\nbb11: ; preds = %bb1\n br i1 false, label %bb12, label %bb16\n\nbb12: ; preds = %bb11\n %or = or i32 0, %phi3\n br label %bb13\n\nbb13: ; preds = %bb12\n %phi14 = phi i32 [ %phi, %bb12 ]\n %phi15 = phi i32 [ %or, %bb12 ]\n br label %bb16\n\nbb16: ; preds = %bb13, %bb11\n %phi17 = phi i32 [ 0, %bb11 ], [ %phi14, %bb13 ]\n %phi18 = phi i32 [ 0, %bb11 ], [ %phi15, %bb13 ]\n br label %bb19\n\nbb19: ; preds = %bb16, %bb4\n %phi20 = phi i32 [ 0, %bb4 ], [ %phi17, %bb16 ]\n %phi21 = phi i32 [ 0, %bb4 ], [ %phi18, %bb16 ]\n %phi22 = phi double [ 0.000000e+00, %bb4 ], [ 0.000000e+00, %bb16 ]\n %or23 = or i32 %phi21, 0\n br label %bb24\n\nbb24: ; preds = %bb19\n %lshr = lshr i32 %phi20, 0\n %and = and i32 %lshr, 0\n %lshr25 = lshr i32 %phi, %and\n %or26 = or i32 0, %or23\n br label %bb1\n}\n"
|
| 52 |
+
}
|
| 53 |
+
]
|
| 54 |
+
}
|
| 55 |
+
],
|
| 56 |
+
"issue": {
|
| 57 |
+
"title": "Assertion `all_of(Bundles, [](const ScheduleBundle *Bundle) { return Bundle->isScheduled(); }) && \"must be scheduled at this point\"' failed.",
|
| 58 |
+
"body": "To reproduce run opt with the test below (-passes=slp-vectorizer -slp-threshold=-99999).\n```\n; ModuleID = './reduced.ll'\nsource_filename = \"./reduced.ll\"\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2\"\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\ndefine i32 @wombat() #0 gc \"statepoint-example\" {\nbb:\n br label %bb3\n\nbb1: ; preds = %bb3\n %phi = phi i32 [ %or, %bb3 ]\n %phi2 = phi i32 [ %ashr7, %bb3 ]\n ret i32 0\n\nbb3: ; preds = %bb3, %bb\n %phi4 = phi i32 [ 0, %bb ], [ %or, %bb3 ]\n %phi5 = phi i32 [ 0, %bb ], [ %or8, %bb3 ]\n %load = load i64, ptr addrspace(1) null, align 8\n %trunc = trunc i64 %load to i32\n %or = or i32 %phi4, %trunc\n %trunc6 = trunc i64 0 to i32\n %and = and i32 %trunc6, 0\n %ashr = ashr i32 0, %and\n %ashr7 = ashr i32 %phi5, %and\n %or8 = or i32 %ashr7, 0\n br i1 false, label %bb1, label %bb3\n}\n\nattributes #0 = { \"target-features\"=\"+prfchw,-cldemote,+avx,+aes,+sahf,+pclmul,-xop,+crc32,-amx-fp8,+xsaves,-avx512fp16,-usermsr,-sm4,-egpr,+sse4.1,-avx10.1,-avx512ifma,+xsave,+sse4.2,-tsxldtrk,-sm3,-ptwrite,-widekl,-movrs,+invpcid,+64bit,+xsavec,-avx512vpopcntdq,+cmov,-avx512vp2intersect,+avx512cd,+movbe,-avxvnniint8,-ccmp,-amx-int8,-kl,-sha512,-avxvnni,+rtm,+adx,+avx2,-hreset,-movdiri,-serialize,-vpclmulqdq,+avx512vl,-uintr,-cf,+clflushopt,-raoint,-cmpccxadd,+bmi,-amx-tile,+sse,-gfni,-avxvnniint16,-amx-fp16,-zu,-ndd,+xsaveopt,+rdrnd,+avx512f,-amx-bf16,-avx512bf16,-avx512vnni,-push2pop2,+cx8,+avx512bw,+sse3,+pku,-nf,-amx-tf32,-amx-avx512,+fsgsbase,-clzero,-mwaitx,-lwp,+lzcnt,-sha,-movdir64b,-ppx,-wbnoinvd,-enqcmd,-avxneconvert,-tbm,-pconfig,-amx-complex,+ssse3,+cx16,-avx10.2,+bmi2,+fma,+popcnt,-avxifma,+f16c,-avx512bitalg,-rdpru,+clwb,+mmx,+sse2,+rdseed,-avx512vbmi2,-prefetchi,-amx-movrs,-rdpid,-fma4,-avx512vbmi,-shstk,-vaes,-waitpkg,-sgx,+fxsr,+avx512dq,-sse4a,-avx512f\" }\n```\nReproducer: https://godbolt.org/z/EsrKx1G99\n\nStack dump:\n```\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=slp-vectorizer -slp-threshold=-99999 <source>\n1.\tRunning pass \"function(slp-vectorizer)\" on module \"<source>\"\n2.\tRunning pass \"slp-vectorizer\" on function \"wombat\"\n #0 0x0000000005a776e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a776e8)\n #1 0x0000000005a745c4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x000077e368c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x000077e368c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x000077e368c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x000077e368c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x000077e368c2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x000077e368c39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x00000000037f427a llvm::slpvectorizer::BoUpSLP::scheduleBlock(llvm::slpvectorizer::BoUpSLP const&, llvm::slpvectorizer::BoUpSLP::BlockScheduling*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x37f427a)\n #9 0x000000000384885a llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::SmallDenseSet<llvm::Value*, 4u, llvm::DenseMapInfo<llvm::Value*, void>> const&, llvm::Instruction*, llvm::ArrayRef<std::tuple<llvm::Value*, unsigned int, bool>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x384885a)\n#10 0x000000000384ce24 llvm::slpvectorizer::BoUpSLP::vectorizeTree() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x384ce24)\n#11 0x000000000386dbb3 llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x386dbb3)\n#12 0x000000000387247c bool tryToVectorizeSequence<llvm::Value>(llvm::SmallVectorImpl<llvm::Value*>&, llvm::function_ref<bool (llvm::Value*, llvm::Value*)>, llvm::function_ref<bool (llvm::ArrayRef<llvm::Value*>, llvm::Value*)>, llvm::function_ref<bool (llvm::ArrayRef<llvm::Value*>, bool)>, bool, llvm::slpvectorizer::BoUpSLP&) (.constprop.0) SLPVectorizer.cpp:0:0\n#13 0x000000000387370c llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x387370c)\n#14 0x000000000387b626 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (.part.0) SLPVectorizer.cpp:0:0\n#15 0x000000000387c17b llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x387c17b)\n#16 0x00000000030232ee llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x30232ee)\n#17 0x00000000057eb4e1 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57eb4e1)\n#18 0x0000000000f07e1e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf07e1e)\n#19 0x00000000057e9a9a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57e9a9a)\n#20 0x000000000096469e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96469e)\n#21 0x00000000057e9451 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57e9451)\n#22 0x000000000096e85a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96e85a)\n#23 0x0000000000962908 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x962908)\n#24 0x000077e368c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#25 0x000077e368c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#26 0x0000000000959585 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x959585)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```",
|
| 59 |
+
"author": "TatyanaDoubts",
|
| 60 |
+
"labels": [
|
| 61 |
+
"llvm:SLPVectorizer",
|
| 62 |
+
"crash"
|
| 63 |
+
],
|
| 64 |
+
"comments": []
|
| 65 |
+
},
|
| 66 |
+
"properties": {
|
| 67 |
+
"is_single_file_fix": true,
|
| 68 |
+
"is_single_func_fix": true
|
| 69 |
+
},
|
| 70 |
+
"verified": true
|
| 71 |
+
}
|
dataset/176720.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "176720",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/176720",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "ca51c973b5feb0b7e9c798316b03d66d9ab338cf",
|
| 6 |
+
"knowledge_cutoff": "2026-01-19T10:04:55Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "69fbab2b72b1c9d5678ba6a6ad234e689ed9bce9",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopVectorize"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp": [
|
| 17 |
+
[
|
| 18 |
+
3420,
|
| 19 |
+
3425
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp": [
|
| 25 |
+
"VPReplicateRecipe::computeCost"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 69fbab2b72b1c9d5678ba6a6ad234e689ed9bce9\nAuthor: Florian Hahn <flo@fhahn.com>\nDate: Mon Jan 19 21:25:52 2026 +0000\n\n [VPlan] Fall back to legacy cost if operands may be force-scalarized.\n \n If any of the operands of a VPReplicateRecipe have been\n force-scalarized, then the legacy cost model skips the scalarization\n overhead, but we cannot match this in the VPlan cost model.\n \n Bail out for now in those very rare cases.\n \n Fixes https://github.com/llvm/llvm-project/issues/176720.\n\ndiff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp\nindex 5ef0c0d195eb..64890ac9e9b9 100644\n--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp\n+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp\n@@ -3420,6 +3420,20 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,\n if (isSingleScalar())\n return ScalarCost;\n \n+ // If any of the operands is from a different replicate region and has its\n+ // cost skipped, it may have been forced to scalar. Fall back to legacy cost\n+ // model to avoid cost mis-match.\n+ if (any_of(operands(), [&Ctx, VF](VPValue *Op) {\n+ auto *PredR = dyn_cast<VPPredInstPHIRecipe>(Op);\n+ if (!PredR)\n+ return false;\n+ return Ctx.skipCostComputation(\n+ dyn_cast_or_null<Instruction>(\n+ PredR->getOperand(0)->getUnderlyingValue()),\n+ VF.isVector());\n+ }))\n+ break;\n+\n ScalarCost = ScalarCost * VF.getFixedValue() +\n Ctx.getScalarizationOverhead(Ctx.Types.inferScalarType(this),\n to_vector(operands()), VF);\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/LoopVectorize/X86/cost-model.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt < %s -passes=loop-vectorize -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx -S"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "replicating_sdiv_operand_profitable_to_scalarize",
|
| 39 |
+
"test_body": "target datalayout = \"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128\"\ntarget triple = \"x86_64-apple-macosx10.8.0\"\n\ndefine void @replicating_sdiv_operand_profitable_to_scalarize(i32 %x) #0 {\nentry:\n br label %loop\n\nloop: ; preds = %loop, %entry\n %iv = phi i32 [ 0, %entry ], [ %div1, %loop ]\n %accum = phi i32 [ 0, %entry ], [ %next, %loop ]\n %div1 = sdiv i32 2, %x\n %sub = sub i32 %x, %div1\n %or1 = or i32 %sub, %iv\n %or2 = or i32 %div1, 3\n %div2 = sdiv i32 %div1, %or2\n %or3 = or i32 %or1, %div2\n %next = add i32 %accum, 3\n %cond = icmp ugt i32 %accum, 35\n br i1 %cond, label %exit, label %loop\n\nexit: ; preds = %loop\n %result = phi i32 [ %or3, %loop ]\n ret void\n}\n\nattributes #0 = { \"target-cpu\"=\"skylake-avx512\" }\n"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "Assertion `(BestFactor.Width == LegacyVF.Width || BestPlan.hasEarlyExit() || ... || planContainsAdditionalSimplifications( getPlanFor(LegacyVF.Width), CostCtx, OrigLoop, LegacyVF.Width)) && \" VPlan cost model and legacy cost model disagreed\"' failed.",
|
| 46 |
+
"body": "```\nopt: /root/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7269: llvm::VectorizationFactor llvm::LoopVectorizationPlanner::computeBestVF(): Assertion `(BestFactor.Width == LegacyVF.Width || BestPlan.hasEarlyExit() || !Legal->getLAI()->getSymbolicStrides().empty() || UsesEVLGatherScatter || planContainsAdditionalSimplifications( getPlanFor(BestFactor.Width), CostCtx, OrigLoop, BestFactor.Width) || planContainsAdditionalSimplifications( getPlanFor(LegacyVF.Width), CostCtx, OrigLoop, LegacyVF.Width)) && \" VPlan cost model and legacy cost model disagreed\"' failed.\n```\n\nTo reproduce run opt with the test below (-passes=loop-vectorize).\n```\n; ModuleID = './reduced.ll'\nsource_filename = \"./reduced.ll\"\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2\"\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\ndefine void @wombat() #0 gc \"statepoint-example\" {\nbb:\n br label %bb2\n\nbb1: ; preds = %bb2\n %phi = phi i32 [ %or8, %bb2 ]\n ret void\n\nbb2: ; preds = %bb2, %bb\n %phi3 = phi i32 [ 0, %bb ], [ %sdiv, %bb2 ]\n %phi4 = phi i32 [ 0, %bb ], [ %add, %bb2 ]\n %or = or i32 0, 0\n %sdiv = sdiv i32 0, %or\n %sub = sub i32 0, %sdiv\n %or5 = or i32 %sub, %phi3\n %or6 = or i32 %sdiv, 1\n %sdiv7 = sdiv i32 %sdiv, %or6\n %or8 = or i32 %or5, %sdiv7\n %add = add i32 %phi4, 3\n %icmp = icmp ugt i32 %phi4, 35\n br i1 %icmp, label %bb1, label %bb2\n}\n\nattributes #0 = { \"target-cpu\"=\"skylake-avx512\" }\n```\nReproducer: https://godbolt.org/z/rzsds3acz\n\nStack dump:\n```\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=loop-vectorize <source>\n1.\tRunning pass \"function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)\" on module \"<source>\"\n2.\tRunning pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"wombat\"\n #0 0x0000000005a80c68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a80c68)\n #1 0x0000000005a7db44 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x00007d0067042520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x00007d00670969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x00007d0067042476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x00007d00670287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x00007d006702871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x00007d0067039e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x0000000003749648 llvm::LoopVectorizationPlanner::computeBestVF() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3749648)\n #9 0x000000000374b5d2 llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x374b5d2)\n#10 0x000000000374e770 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x374e770)\n#11 0x000000000374eefd llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x374eefd)\n#12 0x000000000302291e llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x302291e)\n#13 0x00000000057f51c1 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57f51c1)\n#14 0x0000000000f07e1e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf07e1e)\n#15 0x00000000057f377a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57f377a)\n#16 0x000000000096470e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96470e)\n#17 0x00000000057f3131 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x57f3131)\n#18 0x000000000096e8ca llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96e8ca)\n#19 0x0000000000962978 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x962978)\n#20 0x00007d0067029d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#21 0x00007d0067029e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#22 0x00000000009595f5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9595f5)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```",
|
| 47 |
+
"author": "TatyanaDoubts",
|
| 48 |
+
"labels": [
|
| 49 |
+
"vectorizers",
|
| 50 |
+
"crash-on-valid"
|
| 51 |
+
],
|
| 52 |
+
"comments": []
|
| 53 |
+
},
|
| 54 |
+
"properties": {
|
| 55 |
+
"is_single_file_fix": true,
|
| 56 |
+
"is_single_func_fix": true
|
| 57 |
+
},
|
| 58 |
+
"verified": true
|
| 59 |
+
}
|
dataset/176780.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "176780",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/176780",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "24bf018be2055e131c440ffd1b8251e660d3d226",
|
| 6 |
+
"knowledge_cutoff": "2026-01-19T17:28:38Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/SLPVectorizer"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "51845a53fd2e2f6b0a18dfad3f912e9f676a5fc9",
|
| 12 |
+
"components": [
|
| 13 |
+
"SLPVectorizer"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 17 |
+
[
|
| 18 |
+
902,
|
| 19 |
+
908
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 25 |
+
"getExtractIndex"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 51845a53fd2e2f6b0a18dfad3f912e9f676a5fc9\nAuthor: Soumik15630m <soumik15630m@gmail.com>\nDate: Wed Jan 28 16:38:03 2026 +0530\n\n [SLP] Fix crash on extractelement with out-of-bounds index.....Fixes \u2026 (#176918)\n \n \u2026The cose modeling logic was attempting to set a bit in APInt for an\n out-of-bounds index, causing an assertion failure. This patch ignores\n OOB indices as they produce poison- which is already handled.\n Fixes #176780\n \n this is the same test result which produces this bug\n \n <img width=\"1600\" height=\"964\" alt=\"image\"\n src=\"https://github.com/user-attachments/assets/80593902-9d15-4e18-850b-a558bca8518e\"\n />\n\ndiff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\nindex 3034e94b5997..ce4786802388 100644\n--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n@@ -902,7 +902,14 @@ static std::optional<unsigned> getExtractIndex(const Instruction *E) {\n auto *CI = dyn_cast<ConstantInt>(E->getOperand(1));\n if (!CI)\n return std::nullopt;\n- return CI->getZExtValue();\n+ // Check if the index is out of bound - we can get the source vector from\n+ // operand 0\n+ unsigned Idx = CI->getZExtValue();\n+ auto *EE = cast<ExtractElementInst>(E);\n+ const unsigned VF = ::getNumElements(EE->getVectorOperandType());\n+ if (Idx >= VF)\n+ return std::nullopt;\n+ return Idx;\n }\n auto *EI = cast<ExtractValueInst>(E);\n if (EI->getNumIndices() != 1)\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/SLPVectorizer/X86/crash-on-out-of-bound-extract.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -passes=slp-vectorizer -S < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "\n\n\ndefine <4 x i32> @test(<4 x i32> %A){\n;\nentry:\n %e0 = extractelement <4 x i32> %A, i64 0\n %e1 = extractelement <4 x i32> %A, i64 1\n %e2 = extractelement <4 x i32> %A, i64 2\n %e3 = extractelement <4 x i32> %A, i64 3\n %oob = extractelement <4 x i32> %A, i64 4\n %d0 = sdiv i32 %e0, %e0\n %d1 = sdiv i32 %oob, %e1\n %d2 = sdiv i32 %e2, %e3\n %d3 = sdiv i32 %oob, %e1\n %v0 = insertelement <4 x i32> poison, i32 %d0, i64 0\n %v1 = insertelement <4 x i32> %v0, i32 %d1, i64 1\n %v2 = insertelement <4 x i32> %v1, i32 %d2, i64 2\n %v3 = insertelement <4 x i32> %v2, i32 %d3, i64 3\n ret <4 x i32> %v3\n\n}"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[LLVM] SLP Vectorizer crashes with APInt setBit assertion on out-of-bounds extractelement",
|
| 46 |
+
"body": "**Fuzzer Generated Test** \n**Reproducer**\nhttps://godbolt.org/z/rxrEYrj1v\n\n**Test Commit**\n[0b2f3cfb72a76fa90f3ec2a234caabe0d0712590](https://github.com/llvm/llvm-project/commit/0b2f3cfb72a76fa90f3ec2a234caabe0d0712590)\n\n**Description**\nThe SLP Vectorizer crashes when processing IR containing an out-of-bounds `extractelement` index. While `extractelement` with an out-of-bounds index is valid IR (it produces poison), the SLP Vectorizer's cost calculation logic uses an APInt bitmask to track vector lanes and attempts to set a bit beyond the APInt's width, triggering an assertion failure.\n\nRelated: https://github.com/llvm/llvm-project/issues/58054\n\n**Steps to reproduce**\n- Minimized test case, `input.ll`\n```\ndefine <4 x i32> @test(<4 x i32> %A) {\nentry:\n %e0 = extractelement <4 x i32> %A, i64 0\n %e1 = extractelement <4 x i32> %A, i64 1\n %e2 = extractelement <4 x i32> %A, i64 2\n %e3 = extractelement <4 x i32> %A, i64 3\n %oob = extractelement <4 x i32> %A, i64 4\n %d0 = sdiv i32 %e0, %e0\n %d1 = sdiv i32 %oob, %e1\n %d2 = sdiv i32 %e2, %e3\n %d3 = sdiv i32 %oob, %e1\n %v0 = insertelement <4 x i32> poison, i32 %d0, i64 0\n %v1 = insertelement <4 x i32> %v0, i32 %d1, i64 1\n %v2 = insertelement <4 x i32> %v1, i32 %d2, i64 2\n %v3 = insertelement <4 x i32> %v2, i32 %d3, i64 3\n ret <4 x i32> %v3\n}\n```\n\n**Command**\n```\nopt -passes=slp-vectorizer -S input.ll\n```\n\n**Output**\n```\nopt: /workdir/llvm-project/llvm/include/llvm/ADT/APInt.h:1332: void llvm::APInt::setBit(unsigned int): Assertion `BitPosition < BitWidth && \"BitPosition out of range\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: opt -passes=slp-vectorizer -S /input.ll\n1.\tRunning pass \"function(slp-vectorizer)\" on module \"input.ll\"\n2.\tRunning pass \"slp-vectorizer\" on function \"test\"\n #0 0x00007f726e5ac728 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMSupport.so.22.0git+0x1d3728)\n #1 0x00007f726e5a99d5 llvm::sys::RunSignalHandlers() (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMSupport.so.22.0git+0x1d09d5)\n #2 0x00007f726e5ad3c6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x00007f72786d5420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)\n #4 0x00007f726e0c000b raise /build/glibc-B3wQXB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1\n #5 0x00007f726e09f859 abort /build/glibc-B3wQXB/glibc-2.31/stdlib/abort.c:81:7\n #6 0x00007f726e09f729 get_sysdep_segment_value /build/glibc-B3wQXB/glibc-2.31/intl/loadmsgcat.c:509:8\n #7 0x00007f726e09f729 _nl_load_domain /build/glibc-B3wQXB/glibc-2.31/intl/loadmsgcat.c:970:34\n #8 0x00007f726e0b0fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)\n #9 0x00007f7270fce24d llvm::InstructionCost llvm::function_ref<llvm::InstructionCost (unsigned int)>::callback_fn<llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallPtrSetImpl<llvm::Value*>&)::$_6>(long, unsigned int) SLPVectorizer.cpp:0:0\n#10 0x00007f7270f12f56 llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallPtrSetImpl<llvm::Value*>&)::$_2::operator()(llvm::function_ref<llvm::InstructionCost (unsigned int)>, llvm::function_ref<llvm::InstructionCost (llvm::InstructionCost)>) const SLPVectorizer.cpp:0:0\n#11 0x00007f7270f0d5fc llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallPtrSetImpl<llvm::Value*>&) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMVectorize.so.22.0git+0x1665fc)\n#12 0x00007f7270f19404 llvm::slpvectorizer::BoUpSLP::calculateTreeCostAndTrimNonProfitable(llvm::ArrayRef<llvm::Value*>) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMVectorize.so.22.0git+0x172404)\n#13 0x00007f7270f540e4 llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMVectorize.so.22.0git+0x1ad0e4)\n#14 0x00007f7270f5a075 llvm::SLPVectorizerPass::vectorizeInsertElementInst(llvm::InsertElementInst*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, bool) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMVectorize.so.22.0git+0x1b3075)\n#15 0x00007f7270f5a279 llvm::SLPVectorizerPass::vectorizeInserts(llvm::SmallSetVector<llvm::Instruction*, 8u>&, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMVectorize.so.22.0git+0x1b3279)\n#16 0x00007f7270f5b359 llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&)::$_4::operator()(bool) const SLPVectorizer.cpp:0:0\n#17 0x00007f7270f4e4a4 llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMVectorize.so.22.0git+0x1a74a4)\n#18 0x00007f7270f4ac94 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMVectorize.so.22.0git+0x1a3c94)\n#19 0x00007f7270f49fe5 llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMVectorize.so.22.0git+0x1a2fe5)\n#20 0x00007f726ea41f6b llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMCore.so.22.0git+0x2e3f6b)\n#21 0x00007f726ea46f9f llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMCore.so.22.0git+0x2e8f9f)\n#22 0x00007f726ea40d4b llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMCore.so.22.0git+0x2e2d4b)\n#23 0x00007f727868a9fd llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::__1::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMOptDriver.so.22.0git+0x269fd)\n#24 0x00007f727869bae4 optMain (/workdir/llvm-project/build-libcxx/bin/../lib/libLLVMOptDriver.so.22.0git+0x37ae4)\n#25 0x00007f726e0a1083 __libc_start_main /build/glibc-B3wQXB/glibc-2.31/csu/../csu/libc-start.c:342:3\n#26 0x000055c43c38e07e _start (/workdir/llvm-project/build-libcxx/bin/opt+0x207e)\n```\n",
|
| 47 |
+
"author": "sairam2661",
|
| 48 |
+
"labels": [
|
| 49 |
+
"llvm:SLPVectorizer",
|
| 50 |
+
"crash"
|
| 51 |
+
],
|
| 52 |
+
"comments": []
|
| 53 |
+
},
|
| 54 |
+
"properties": {
|
| 55 |
+
"is_single_file_fix": true,
|
| 56 |
+
"is_single_func_fix": true
|
| 57 |
+
},
|
| 58 |
+
"verified": true
|
| 59 |
+
}
|
dataset/177124.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "177124",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/177124",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "795d940254aa357cb5095ad776c04e72ced08b9d",
|
| 6 |
+
"knowledge_cutoff": "2026-01-21T09:20:08Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/SLPVectorizer"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "d64d3735ab06cd1304fb383543312c355c45eeb8",
|
| 12 |
+
"components": [
|
| 13 |
+
"SLPVectorizer"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 17 |
+
[
|
| 18 |
+
19965,
|
| 19 |
+
19972
|
| 20 |
+
],
|
| 21 |
+
[
|
| 22 |
+
19976,
|
| 23 |
+
19988
|
| 24 |
+
]
|
| 25 |
+
]
|
| 26 |
+
},
|
| 27 |
+
"bug_location_funcname": {
|
| 28 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 29 |
+
"BoUpSLP::vectorizeTree"
|
| 30 |
+
]
|
| 31 |
+
}
|
| 32 |
+
},
|
| 33 |
+
"patch": "commit d64d3735ab06cd1304fb383543312c355c45eeb8\nAuthor: Alexey Bataev <a.bataev@outlook.com>\nDate: Wed Jan 21 09:10:46 2026 -0800\n\n [SLP]Correctly handle vector nodes, coming from same incoming blocks in PHI nodes\n \n If multiple nodes are generated from same PHI node for the same block,\n still need to vectorize vector nodes, even if the value for the incoming block was already emitted.\n \n Fixes #177124\n\ndiff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\nindex f696d2021457..22b8ea481f2c 100644\n--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n@@ -19965,8 +19965,7 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {\n \n // PHINodes may have multiple entries from the same block. We want to\n // visit every block once.\n- SmallPtrSet<BasicBlock *, 4> VisitedBBs;\n-\n+ SmallDenseMap<BasicBlock *, unsigned, 4> VisitedBBs;\n for (unsigned I : seq<unsigned>(PH->getNumIncomingValues())) {\n BasicBlock *IBB = PH->getIncomingBlock(I);\n \n@@ -19976,13 +19975,17 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {\n return NewPhi;\n }\n \n- if (!VisitedBBs.insert(IBB).second) {\n- Value *VecOp = NewPhi->getIncomingValueForBlock(IBB);\n- NewPhi->addIncoming(VecOp, IBB);\n+ auto Res = VisitedBBs.try_emplace(IBB, I);\n+ if (!Res.second) {\n TreeEntry *OpTE = getOperandEntry(E, I);\n- assert(!OpTE->VectorizedValue && \"Expected no vectorized value.\");\n- OpTE->VectorizedValue = VecOp;\n- continue;\n+ if (OpTE->isGather() || DeletedNodes.contains(OpTE) ||\n+ TransformedToGatherNodes.contains(OpTE)) {\n+ Value *VecOp = NewPhi->getIncomingValue(Res.first->getSecond());\n+ NewPhi->addIncoming(VecOp, IBB);\n+ assert(!OpTE->VectorizedValue && \"Expected no vectorized value.\");\n+ OpTE->VectorizedValue = VecOp;\n+ continue;\n+ }\n }\n \n Builder.SetInsertPoint(IBB->getTerminator());\n",
|
| 34 |
+
"tests": [
|
| 35 |
+
{
|
| 36 |
+
"file": "llvm/test/Transforms/SLPVectorizer/X86/phi-multi-same-nodes.ll",
|
| 37 |
+
"commands": [
|
| 38 |
+
"opt -passes=slp-vectorizer -S -slp-threshold=-99999 -mtriple=x86_64-unknown-linux-gnu < %s"
|
| 39 |
+
],
|
| 40 |
+
"tests": [
|
| 41 |
+
{
|
| 42 |
+
"test_name": "<module>",
|
| 43 |
+
"test_body": "\ndefine void @test() {\n;\nbb:\n %ashr = ashr i32 0, 0\n %add = add i32 0, 0\n switch i32 0, label %bb1 [\n i32 -4, label %bb4\n i32 -1, label %bb4\n i32 1, label %bb4\n i32 2, label %bb4\n i32 5, label %bb4\n i32 7, label %bb4\n i32 8, label %bb4\n i32 11, label %bb4\n i32 13, label %bb4\n i32 21, label %bb4\n i32 17, label %bb4\n i32 19, label %bb4\n ]\n\nbb1:\n %add2 = add i32 0, 0\n %ashr3 = ashr i32 %add2, 1\n %xor = xor i32 0, 0\n %or = or i32 %xor, %ashr\n switch i32 0, label %bb4 [\n i32 -4, label %bb4\n i32 -1, label %bb4\n i32 1, label %bb4\n i32 2, label %bb4\n i32 5, label %bb4\n i32 7, label %bb4\n i32 8, label %bb4\n i32 11, label %bb4\n i32 13, label %bb4\n i32 21, label %bb4\n i32 17, label %bb4\n i32 19, label %bb4\n ]\n\nbb4:\n %phi = phi i32 [ %ashr3, %bb1 ], [ %ashr3, %bb1 ], [ %ashr3, %bb1 ], [ %ashr3, %bb1 ], [ %ashr3, %bb1 ], [ %ashr3, %bb1 ], [ %ashr3, %bb1 ], [ %ashr3, %bb1 ], [ %ashr3, %bb1 ], [ %ashr3, %bb1 ], [ %ashr3, %bb1 ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr, %bb ], [ %ashr3, %bb1 ], [ %ashr3, %bb1 ]\n %phi5 = phi i32 [ %or, %bb1 ], [ %or, %bb1 ], [ %or, %bb1 ], [ %or, %bb1 ], [ %or, %bb1 ], [ %or, %bb1 ], [ %or, %bb1 ], [ %or, %bb1 ], [ %or, %bb1 ], [ %or, %bb1 ], [ %or, %bb1 ], [ %add, %bb ], [ %add, %bb ], [ %add, %bb ], [ %add, %bb ], [ %add, %bb ], [ %add, %bb ], [ %add, %bb ], [ %add, %bb ], [ %add, %bb ], [ %add, %bb ], [ %add, %bb ], [ %add, %bb ], [ %or, %bb1 ], [ %or, %bb1 ]\n ret void\n}\n"
|
| 44 |
+
}
|
| 45 |
+
]
|
| 46 |
+
}
|
| 47 |
+
],
|
| 48 |
+
"issue": {
|
| 49 |
+
"title": "Assertion `!contains(New, this) && \"this->replaceAllUsesWith(expr(this)) is NOT valid!\"' failed.",
|
| 50 |
+
"body": "To reproduce run opt with the test below, -passes=slp-vectorizer -slp-threshold=-99999\n\n[reduced-stripped.ll.zip](https://github.com/user-attachments/files/24762079/reduced-stripped.ll.zip)\n\nReproducer: https://godbolt.org/z/Ys1hj3M6K\n\nStack dump:\n```\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=slp-vectorizer -slp-threshold=-99999 <source>\n1.\tRunning pass \"function(slp-vectorizer)\" on module \"<source>\"\n2.\tRunning pass \"slp-vectorizer\" on function \"wombat\"\n #0 0x0000000005a91978 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a91978)\n #1 0x0000000005a8e854 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x0000751bd4242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x0000751bd42969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x0000751bd4242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x0000751bd42287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x0000751bd422871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x0000751bd4239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x000000000583d2a6 llvm::Value::doRAUW(llvm::Value*, llvm::Value::ReplaceMetadataUses) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x583d2a6)\n #9 0x0000000003854ef1 llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::SmallDenseSet<llvm::Value*, 4u, llvm::DenseMapInfo<llvm::Value*, void>> const&, llvm::Instruction*, llvm::ArrayRef<std::tuple<llvm::Value*, unsigned int, bool>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3854ef1)\n#10 0x0000000003858ca4 llvm::slpvectorizer::BoUpSLP::vectorizeTree() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3858ca4)\n#11 0x0000000003879873 llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3879873)\n#12 0x000000000387e13c bool tryToVectorizeSequence<llvm::Value>(llvm::SmallVectorImpl<llvm::Value*>&, llvm::function_ref<bool (llvm::Value*, llvm::Value*)>, llvm::function_ref<bool (llvm::ArrayRef<llvm::Value*>, llvm::Value*)>, llvm::function_ref<bool (llvm::ArrayRef<llvm::Value*>, bool)>, bool, llvm::slpvectorizer::BoUpSLP&) (.constprop.0) SLPVectorizer.cpp:0:0\n#13 0x000000000387f3cc llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x387f3cc)\n#14 0x0000000003887306 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (.part.0) SLPVectorizer.cpp:0:0\n#15 0x0000000003887e5b llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3887e5b)\n#16 0x000000000302d3ce llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x302d3ce)\n#17 0x0000000005805671 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5805671)\n#18 0x0000000000f0620e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf0620e)\n#19 0x0000000005803c2a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5803c2a)\n#20 0x000000000096300e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96300e)\n#21 0x00000000058035e1 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x58035e1)\n#22 0x000000000096d1ca llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96d1ca)\n#23 0x0000000000961278 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x961278)\n#24 0x0000751bd4229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#25 0x0000751bd4229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#26 0x0000000000957ef5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x957ef5)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```",
|
| 51 |
+
"author": "TatyanaDoubts",
|
| 52 |
+
"labels": [
|
| 53 |
+
"llvm:SLPVectorizer",
|
| 54 |
+
"crash-on-valid"
|
| 55 |
+
],
|
| 56 |
+
"comments": []
|
| 57 |
+
},
|
| 58 |
+
"properties": {
|
| 59 |
+
"is_single_file_fix": true,
|
| 60 |
+
"is_single_func_fix": true
|
| 61 |
+
},
|
| 62 |
+
"verified": true
|
| 63 |
+
}
|
dataset/177144.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "177144",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/177144",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "8e362e10c79a73438a8678dbb1f9be29b3c01cae",
|
| 6 |
+
"knowledge_cutoff": "2026-01-21T11:27:54Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/VectorCombine"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "4ec35a0b0e13f15ad38a2fa668004c892a365795",
|
| 12 |
+
"components": [
|
| 13 |
+
"VectorCombine"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/VectorCombine.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1655,
|
| 19 |
+
1661
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/VectorCombine.cpp": [
|
| 25 |
+
"VectorCombine::foldSelectsFromBitcast"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 4ec35a0b0e13f15ad38a2fa668004c892a365795\nAuthor: Mitch Briles <mitchbriles@gmail.com>\nDate: Wed Jan 28 08:13:50 2026 -0700\n\n [VectorCombine] Fix crash when folding select of bitcast (#177183)\n \n Fixes #177144. Nits appreciated.\n \n The fold in question does the following transformation:\n Before\n ```\n %bc = bitcast <4 x i32> %src to <16 x i8>\n %e0 = extractelement <16 x i8> %bc, i32 0\n %s0 = select i1 %cond, i8 %e0, i8 0\n %e1 = extractelement <16 x i8> %bc, i32 1\n %s1 = select i1 %cond, i8 %e1, i8 0\n ...\n ```\n \n After\n ```\n %sel = select i1 %cond, <4 x i32> %src, <4 x i32> zeroinitializer\n %bc = bitcast <4 x i32> %sel to <16 x i8>\n %e0 = extractelement <16 x i8> %bc, i32 0\n %e1 = extractelement <16 x i8> %bc, i32 1\n ...\n ```\n If every select shares the condition and has 0 in the false branch, the\n bitcast can be replaced with a select between the original vector and\n `zeroinitializer`, followed by a bitcast. Then each `select(cond,\n extelt(...), 0)` can be replaced with `extelt(...)`.\n The crash happens when the condition is defined after the original\n bitcast, because the bitcast is replaced with the select + bitcast, and\n now the select references a condition not yet defined.\n\ndiff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\nindex fbb3b820c4f0..fb6fa247038a 100644\n--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\n+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\n@@ -1655,7 +1655,13 @@ bool VectorCombine::foldSelectsFromBitcast(Instruction &I) {\n }\n \n // Create the vector select and bitcast once for this condition.\n- Builder.SetInsertPoint(BC->getNextNode());\n+ auto InsertPt = std::next(BC->getIterator());\n+\n+ if (auto *CondInst = dyn_cast<Instruction>(Cond))\n+ if (DT.dominates(BC, CondInst))\n+ InsertPt = std::next(CondInst->getIterator());\n+\n+ Builder.SetInsertPoint(InsertPt);\n Value *VecSel =\n Builder.CreateSelect(Cond, SrcVec, Constant::getNullValue(SrcVecTy));\n Value *NewBC = Builder.CreateBitCast(VecSel, DstVecTy);\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/VectorCombine/AMDGPU/combine-scalar-selects.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -passes=vector-combine -S %s",
|
| 35 |
+
"opt -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 -S %s"
|
| 36 |
+
],
|
| 37 |
+
"tests": [
|
| 38 |
+
{
|
| 39 |
+
"test_name": "fold_selects_from_bitcast_dominance_multiblock2",
|
| 40 |
+
"test_body": "define i8 @fold_selects_from_bitcast_dominance_multiblock2(<4 x i64> %v, i8 %a, i1 %flag) {\nentry:\n %0 = bitcast <4 x i64> %v to <32 x i8>\n br label %first\n\nfirst: ; preds = %entry\n %vecext1 = extractelement <32 x i8> %0, i64 0\n %vecext2 = extractelement <32 x i8> %0, i64 7\n %vecext3 = extractelement <32 x i8> %0, i64 1\n %vecext4 = extractelement <32 x i8> %0, i64 8\n %vecext5 = extractelement <32 x i8> %0, i64 9\n br label %second\n\nsecond: ; preds = %first\n %cond = icmp eq i8 %a, 0\n br i1 %flag, label %then, label %else\n\nthen: ; preds = %second\n %s1 = select i1 %cond, i8 %vecext1, i8 0\n br label %combine\n\nelse: ; preds = %second\n %s2 = select i1 %cond, i8 %vecext2, i8 0\n br label %combine\n\ncombine: ; preds = %else, %then\n %r1 = phi i8 [ %s1, %then ], [ %s2, %else ]\n %s3 = select i1 %cond, i8 %vecext3, i8 0\n %s4 = select i1 %cond, i8 %vecext4, i8 0\n %s5 = select i1 %cond, i8 %vecext5, i8 0\n %r2 = add i8 %r1, %s3\n %r3 = add i8 %r2, %s4\n %r4 = add i8 %r3, %s5\n ret i8 %r4\n}\n"
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"test_name": "fold_selects_from_bitcast_dominance_multiblock3",
|
| 44 |
+
"test_body": "define i8 @fold_selects_from_bitcast_dominance_multiblock3(<4 x i64> %v1, <4 x i64> %v2, i8 %a, i1 %flag1, i1 %flag2, i1 %flag3, i1 %flag4, i1 %cond2) {\nentry:\n %0 = bitcast <4 x i64> %v1 to <32 x i8>\n %1 = bitcast <4 x i64> %v2 to <32 x i8>\n br label %first\n\nfirst: ; preds = %entry\n %vecext00 = extractelement <32 x i8> %0, i64 0\n %vecext02 = extractelement <32 x i8> %0, i64 2\n %vecext04 = extractelement <32 x i8> %0, i64 4\n %vecext06 = extractelement <32 x i8> %0, i64 6\n %vecext08 = extractelement <32 x i8> %0, i64 8\n %vecext11 = extractelement <32 x i8> %1, i64 1\n %vecext13 = extractelement <32 x i8> %1, i64 3\n %vecext15 = extractelement <32 x i8> %1, i64 5\n %vecext17 = extractelement <32 x i8> %1, i64 7\n %vecext19 = extractelement <32 x i8> %1, i64 9\n br label %t0\n\nt0: ; preds = %first\n %cond1 = icmp eq i8 %a, 0\n br i1 %flag1, label %r0, label %t1\n\nt1: ; preds = %t0\n br i1 %flag2, label %r1, label %t2\n\nt2: ; preds = %t1\n br i1 %flag3, label %r2, label %t3\n\nt3: ; preds = %t2\n br i1 %flag4, label %r3, label %r4\n\nr0: ; preds = %t0\n %res0 = select i1 %cond1, i8 %vecext00, i8 0\n %res1 = select i1 %cond2, i8 %vecext11, i8 0\n %res01 = add i8 %res0, %res1\n ret i8 %res01\n\nr1: ; preds = %t1\n %res2 = select i1 %cond1, i8 %vecext02, i8 0\n %res3 = select i1 %cond2, i8 %vecext13, i8 0\n %res23 = add i8 %res2, %res3\n ret i8 %res23\n\nr2: ; preds = %t2\n %res4 = select i1 %cond1, i8 %vecext04, i8 0\n %res5 = select i1 %cond2, i8 %vecext15, i8 0\n %res45 = add i8 %res4, %res5\n ret i8 %res45\n\nr3: ; preds = %t3\n %res6 = select i1 %cond1, i8 %vecext06, i8 0\n %res7 = select i1 %cond2, i8 %vecext17, i8 0\n %res67 = add i8 %res6, %res7\n ret i8 %res67\n\nr4: ; preds = %t3\n %res8 = select i1 %cond1, i8 %vecext08, i8 0\n %res9 = select i1 %cond2, i8 %vecext19, i8 0\n %res89 = add i8 %res8, %res9\n ret i8 %res89\n}\n"
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"test_name": "fold_selects_from_bitcast_dominance_multiblock1",
|
| 48 |
+
"test_body": "define i8 @fold_selects_from_bitcast_dominance_multiblock1(<4 x i32> %src, i8 %a, i1 %flag1, i1 %flag2) {\n %bc = bitcast <4 x i32> %src to <16 x i8>\n %cond = icmp eq i8 %a, 0\n br i1 %flag1, label %first, label %trampoline\n\ntrampoline: ; preds = %0\n br i1 %flag2, label %second, label %third\n\nfirst: ; preds = %0\n %e00 = extractelement <16 x i8> %bc, i32 0\n %s00 = select i1 %cond, i8 %e00, i8 0\n %e01 = extractelement <16 x i8> %bc, i32 2\n %s01 = select i1 %cond, i8 %e01, i8 0\n %s0 = add i8 %s00, %s01\n br label %end\n\nsecond: ; preds = %trampoline\n %e10 = extractelement <16 x i8> %bc, i32 3\n %s10 = select i1 %cond, i8 %e10, i8 0\n %e11 = extractelement <16 x i8> %bc, i32 4\n %s11 = select i1 %cond, i8 %e11, i8 0\n %s1 = add i8 %s10, %s11\n br label %end\n\nthird: ; preds = %trampoline\n %e20 = extractelement <16 x i8> %bc, i32 5\n %s20 = select i1 %cond, i8 %e20, i8 0\n %e21 = extractelement <16 x i8> %bc, i32 6\n %s21 = select i1 %cond, i8 %e21, i8 0\n %s2 = add i8 %s20, %s21\n br label %end\n\nend: ; preds = %third, %second, %first\n %res = phi i8 [ %s0, %first ], [ %s1, %second ], [ %s2, %third ]\n ret i8 %res\n}\n"
|
| 49 |
+
}
|
| 50 |
+
]
|
| 51 |
+
}
|
| 52 |
+
],
|
| 53 |
+
"issue": {
|
| 54 |
+
"title": "[VectorCombine] LLVM ERROR: Broken module found, compilation aborted!",
|
| 55 |
+
"body": "Reproducer: https://godbolt.org/z/nWG51fEc1\nTestcase:\n```llvm\ndefine i8 @backsmith_pure_0() {\nentry:\n %0 = bitcast <4 x i64> splat (i64 1) to <32 x i8>\n %vecext56 = extractelement <32 x i8> %0, i64 0\n %tobool.not = icmp eq i8 0, 0\n %vecext36 = extractelement <32 x i8> %0, i64 0\n %narrow = select i1 %tobool.not, i8 %vecext36, i8 0\n %narrow8 = select i1 %tobool.not, i8 %vecext56, i8 0\n ret i8 %narrow8\n}\n```\n\nDump:\n```\nInstruction does not dominate all uses!\n %tobool.not = icmp eq i8 0, 0\n %0 = select i1 %tobool.not, <4 x i64> splat (i64 1), <4 x i64> zeroinitializer\nLLVM ERROR: Broken module found, compilation aborted!\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S --passes=vector-combine <source>\n1.\tRunning pass \"verify\" on module \"<source>\"\n #0 0x0000000005a91978 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5a91978)\n #1 0x0000000005a8e854 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x000074e865242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x000074e8652969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x000074e865242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x000074e8652287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x000000000082b993 llvm::json::operator==(llvm::json::Value const&, llvm::json::Value const&) (.cold) JSON.cpp:0:0\n #7 0x00000000059c3d61 (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x59c3d61)\n #8 0x0000000005847298 (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5847298)\n #9 0x0000000000962fde llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x962fde)\n#10 0x00000000058035e1 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x58035e1)\n#11 0x000000000096d1ca llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96d1ca)\n#12 0x0000000000961278 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x961278)\n#13 0x000074e865229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#14 0x000074e865229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#15 0x0000000000957ef5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x957ef5)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```",
|
| 56 |
+
"author": "XChy",
|
| 57 |
+
"labels": [
|
| 58 |
+
"crash-on-valid",
|
| 59 |
+
"generated by fuzzer",
|
| 60 |
+
"llvm::vectorcombine"
|
| 61 |
+
],
|
| 62 |
+
"comments": [
|
| 63 |
+
{
|
| 64 |
+
"author": "RKSimon",
|
| 65 |
+
"body": "```\nVECTORCOMBINE on backsmith_pure_0\nVC: Visiting: %0 = bitcast <4 x i64> splat (i64 1) to <32 x i8>\nVC: Replacing: %narrow = select i1 %tobool.not, i8 %vecext36, i8 0\n With: %3 = extractelement <32 x i8> %2, i64 0\nADD: %narrow = extractelement <32 x i8> %2, i64 0\nVC: Erasing: %3 = select i1 %tobool.not, i8 %vecext36, i8 0\nADD: %1 = select i1 %tobool.not, <4 x i64> splat (i64 1), <4 x i64> zeroinitializer\nADD: %narrow8 = select i1 %tobool.not, i8 %vecext56, i8 0\nADD: %tobool.not = icmp eq i8 0, 0\nVC: Erased: %vecext36 = extractelement <32 x i8> %0, i64 0\nVC: Replacing: %narrow8 = select i1 %tobool.not, i8 %vecext56, i8 0\n With: %3 = extractelement <32 x i8> %2, i64 0\nADD: ret i8 %narrow8\nADD: %narrow8 = extractelement <32 x i8> %2, i64 0\nVC: Erasing: %3 = select i1 %tobool.not, i8 %vecext56, i8 0\nVC: Erased: %vecext56 = extractelement <32 x i8> %0, i64 0\nVC: Erased: %0 = bitcast <4 x i64> splat (i64 1) to <32 x i8>\nVectorCombine: folded 2 selects into vector select\nVC: Visiting: %tobool.not = icmp eq i8 0, 0\nVC: Visiting: %narrow = extractelement <32 x i8> %1, i64 0\nVC: Visiting: %narrow8 = extractelement <32 x i8> %1, i64 0\nVC: Visiting: ret i8 %narrow8\nVC: Visiting: %narrow8 = extractelement <32 x i8> %1, i64 0\nVC: Visiting: ret i8 %narrow8\nVC: Visiting: %tobool.not = icmp eq i8 0, 0\nVC: Visiting: %0 = select i1 %tobool.not, <4 x i64> splat (i64 1), <4 x i64> zeroinitializer\nVC: Erasing: %narrow = extractelement <32 x i8> %1, i64 0\nADD: %narrow8 = extractelement <32 x i8> %1, i64 0\nADD: %1 = bitcast <4 x i64> %0 to <32 x i8>\nVC: Visiting: %1 = bitcast <4 x i64> %0 to <32 x i8>\nVC: Visiting: %narrow8 = extractelement <32 x i8> %1, i64 0\nInstruction does not dominate all uses!\n %tobool.not = icmp eq i8 0, 0\n %0 = select i1 %tobool.not, <4 x i64> splat (i64 1), <4 x i64> zeroinitializer\n```"
|
| 66 |
+
}
|
| 67 |
+
]
|
| 68 |
+
},
|
| 69 |
+
"properties": {
|
| 70 |
+
"is_single_file_fix": true,
|
| 71 |
+
"is_single_func_fix": true
|
| 72 |
+
},
|
| 73 |
+
"verified": true
|
| 74 |
+
}
|
dataset/178245.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "178245",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/178245",
|
| 4 |
+
"bug_type": "miscompilation",
|
| 5 |
+
"base_commit": "ff79d7d1bf0415e52ad542b059c55f0e92b3bad6",
|
| 6 |
+
"knowledge_cutoff": "2026-01-27T16:11:49Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/InstCombine"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "909041e4802c4b9a2223ca04099f35bf1dbbd460",
|
| 12 |
+
"components": [
|
| 13 |
+
"InstCombine"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp": [
|
| 17 |
+
[
|
| 18 |
+
3049,
|
| 19 |
+
3055
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp": [
|
| 25 |
+
"InstCombinerImpl::visitCallInst"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 909041e4802c4b9a2223ca04099f35bf1dbbd460\nAuthor: Matt Arsenault <Matthew.Arsenault@amd.com>\nDate: Tue Jan 27 18:21:44 2026 +0100\n\n InstCombine: Check one use before trying to simplify copysign sign (#178251)\n \n Fixes #178245\n\ndiff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp\nindex c34231a74c78..fbf69d871dfc 100644\n--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp\n+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp\n@@ -3049,7 +3049,8 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {\n Type *SignEltTy = Sign->getType()->getScalarType();\n \n Value *CastSrc;\n- if (match(Sign, m_ElementWiseBitCast(m_OneUse(m_Value(CastSrc)))) &&\n+ if (match(Sign,\n+ m_OneUse(m_ElementWiseBitCast(m_OneUse(m_Value(CastSrc))))) &&\n CastSrc->getType()->isIntOrIntVectorTy() &&\n APFloat::hasSignBitInMSB(SignEltTy->getFltSemantics())) {\n KnownBits Known(SignEltTy->getPrimitiveSizeInBits());\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/InstCombine/copysign.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -S -passes=instcombine<no-verify-fixpoint> < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "issue178245",
|
| 39 |
+
"test_body": "; bin/opt -passes=\"instcombine<no-verify-fixpoint>\" test.ll -S\ndefine i32 @src(i32 %i.0.i.i) {\nentry:\n %conv102.i.i = sext i32 %i.0.i.i to i64\n %add.i128.i.i = add i64 %conv102.i.i, 1177359834\n %tobool104.i.i = icmp ne i64 %add.i128.i.i, 0\n %conv108.i.i = zext i1 %tobool104.i.i to i16\n %mul.i.i.i = mul i16 -5, %conv108.i.i\n %conv111.i.i = sext i16 %mul.i.i.i to i32\n %0 = bitcast i32 %conv111.i.i to float\n %1 = fcmp uno float %0, 0.000000e+00\n %2 = call float @llvm.copysign.f32(float 0.000000e+00, float %0)\n %3 = select i1 %1, float 0.000000e+00, float %2\n %4 = bitcast float %3 to i32\n ret i32 %4\n}"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[InstCombine] Miscompilation at O1",
|
| 46 |
+
"body": "Reproducer: https://alive2.llvm.org/ce/z/BPpLg_\n```llvm\n; bin/opt -passes=\"instcombine<no-verify-fixpoint>\" test.ll -S\ndefine i32 @src(i32 %i.0.i.i) {\nentry:\n %conv102.i.i = sext i32 %i.0.i.i to i64\n %add.i128.i.i = add i64 %conv102.i.i, 1177359834\n %tobool104.i.i = icmp ne i64 %add.i128.i.i, 0\n %conv108.i.i = zext i1 %tobool104.i.i to i16\n %mul.i.i.i = mul i16 -5, %conv108.i.i\n %conv111.i.i = sext i16 %mul.i.i.i to i32\n %0 = bitcast i32 %conv111.i.i to float\n %1 = fcmp uno float %0, 0.000000e+00\n %2 = call float @llvm.copysign.f32(float 0.000000e+00, float %0)\n %3 = select i1 %1, float 0.000000e+00, float %2\n %4 = bitcast float %3 to i32\n ret i32 %4\n}\n```\nOutput:\n```llvm\ndefine i32 @src(i32 %i.0.i.i) {\nentry:\n %tobool104.i.i.not = icmp eq i32 %i.0.i.i, -1177359834\n %conv111.i.i = select i1 %tobool104.i.i.not, i32 0, i32 -1177359834\n %0 = bitcast i32 %conv111.i.i to float\n %1 = fcmp uno float %0, 0.000000e+00\n %2 = call float @llvm.copysign.f32(float 0.000000e+00, float %0)\n %3 = select i1 %1, float 0.000000e+00, float %2\n %4 = bitcast float %3 to i32\n ret i32 %4\n}\n```\n```\nTransformation doesn't verify!\n\nERROR: Value mismatch\n\nExample:\ni32 %i.0.i.i = #x00000000 (0)\n\nSource:\ni64 %conv102.i.i = #x0000000000000000 (0)\ni64 %add.i128.i.i = #x00000000462d15da (1177359834)\ni1 %tobool104.i.i = #x1 (1)\ni16 %conv108.i.i = #x0001 (1)\ni16 %mul.i.i.i = #xfffb (65531, -5)\ni32 %conv111.i.i = #xfffffffb (4294967291, -5)\nfloat %#0 = #xfffffffb (QNaN)\ni1 %#1 = #x1 (1)\nfloat %#2 = #x80000000 (-0.0)\nfloat %#3 = #x00000000 (+0.0)\ni32 %#4 = #x00000000 (0)\n\nTarget:\ni1 %tobool104.i.i.not = #x0 (0)\ni32 %conv111.i.i = #xb9d2ea26 (3117607462, -1177359834)\nfloat %#0 = #xb9d2ea26 (-0.000402287754?)\ni1 %#1 = #x0 (0)\nfloat %#2 = #x80000000 (-0.0)\nfloat %#3 = #x80000000 (-0.0)\ni32 %#4 = #x80000000 (2147483648, -2147483648)\nSource value: #x00000000 (0)\nTarget value: #x80000000 (2147483648, -2147483648)\n```\nllvm version: 94e21bcec061c1691cd0d5382e3c6f420e0386c4\nLooks like it is triggered by https://github.com/llvm/llvm-project/pull/177942. cc @arsenm",
|
| 47 |
+
"author": "dtcxzyw",
|
| 48 |
+
"labels": [
|
| 49 |
+
"miscompilation",
|
| 50 |
+
"llvm:instcombine",
|
| 51 |
+
"floating-point",
|
| 52 |
+
"generated by fuzzer"
|
| 53 |
+
],
|
| 54 |
+
"comments": [
|
| 55 |
+
{
|
| 56 |
+
"author": "arsenm",
|
| 57 |
+
"body": "[Reduced](https://alive2.llvm.org/ce/z/Xsp_n_)\n\nThe only thing that seems to have changed is the negative constant on the select?"
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"author": "dtcxzyw",
|
| 61 |
+
"body": "> The only thing that seems to have changed is the negative constant on the select?\n\nYeah. We cannot do it as `%i` has multiple users."
|
| 62 |
+
}
|
| 63 |
+
]
|
| 64 |
+
},
|
| 65 |
+
"properties": {
|
| 66 |
+
"is_single_file_fix": true,
|
| 67 |
+
"is_single_func_fix": true
|
| 68 |
+
},
|
| 69 |
+
"verified": true
|
| 70 |
+
}
|
dataset/178884.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "178884",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/178884",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "5d01a0ad3d599df56d902b418e1a7eaf3f84db42",
|
| 6 |
+
"knowledge_cutoff": "2026-01-30T12:59:59Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/SLPVectorizer"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "b73122d5b7f6f2ae7bce1a4d5e3f4c9fda88c787",
|
| 12 |
+
"components": [
|
| 13 |
+
"SLPVectorizer"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 17 |
+
[
|
| 18 |
+
20583,
|
| 19 |
+
20588
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
| 25 |
+
"BoUpSLP::vectorizeTree"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit b73122d5b7f6f2ae7bce1a4d5e3f4c9fda88c787\nAuthor: Alexey Bataev <a.bataev@outlook.com>\nDate: Fri Jan 30 08:45:39 2026 -0800\n\n [SLP]Cast incoming value to a propr type for int nodes, bitcasted to fp\n \n Before casting the value to FP type, need to check, if the type for\n reduced during minbitwidth analysis and need to restore the original\n source type to generate correct bitcast operation.\n \n Fixes #178884\n\ndiff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\nindex 5dd7909c7ee9..dd70e35b0eee 100644\n--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n@@ -20583,6 +20583,13 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {\n } else if (VecOpcode == Instruction::SIToFP && SrcIt != MinBWs.end() &&\n !SrcIt->second.second) {\n VecOpcode = Instruction::UIToFP;\n+ } else if (VecOpcode == Instruction::BitCast && SrcIt != MinBWs.end() &&\n+ ScalarTy->isFPOrFPVectorTy()) {\n+ Type *OrigSrcScalarTy = CI->getSrcTy();\n+ auto *OrigSrcVectorTy =\n+ getWidenedType(OrigSrcScalarTy, E->Scalars.size());\n+ InVec =\n+ Builder.CreateIntCast(InVec, OrigSrcVectorTy, SrcIt->second.second);\n }\n Value *V = (VecOpcode != ShuffleOrOp && VecOpcode == Instruction::BitCast)\n ? InVec\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/SLPVectorizer/X86/minbw-bitcast-to-fp.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux-gnu < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "\ndefine i16 @test(i16 %conv11) {\n;\nentry:\n %0 = add i64 0, 0\n %1 = bitcast i64 %0 to double\n %mul.i.i.17 = fmul double 0.000000e+00, %1\n %2 = or i64 0, 0\n %3 = bitcast i64 %2 to double\n %mul.i.i.18 = fmul double 0.000000e+00, %3\n %4 = fcmp uno double %mul.i.i.18, 0.000000e+00\n %5 = select i1 %4, i16 0, i16 0\n %6 = trunc i64 %2 to i16\n %7 = or i16 %5, %6\n %8 = fcmp uno double %mul.i.i.17, 0.000000e+00\n %9 = select i1 %8, i16 0, i16 0\n %10 = trunc i64 %0 to i16\n %11 = or i16 %9, %10\n %12 = or i64 0, 0\n %13 = bitcast i64 %12 to double\n %14 = fcmp uno double %13, 0.000000e+00\n %15 = select i1 %14, i16 0, i16 0\n %16 = trunc i64 %12 to i16\n %17 = zext i16 %conv11 to i64\n %18 = or i64 %17, 0\n %19 = bitcast i64 %18 to double\n %mul.i.i.21 = fmul double 0.000000e+00, %19\n %20 = fcmp uno double %mul.i.i.21, 0.000000e+00\n %21 = select i1 %20, i16 0, i16 0\n %22 = trunc i64 %18 to i16\n %23 = or i16 %21, %22\n %24 = or i16 %15, %16\n %conv140.i.18 = xor i16 %7, %11\n %conv140.i.20 = xor i16 %24, %conv140.i.18\n %conv140.i.21 = xor i16 %23, %conv140.i.20\n ret i16 %conv140.i.21\n}"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[SLPVectorizer] Assertion `castIsValid(op, S, Ty) && \"Invalid cast!\"' failed.",
|
| 46 |
+
"body": "Reproducer: https://godbolt.org/z/Kajqfzjfx\n```llvm\n; bin/opt -passes=slp-vectorizer test.ll -S\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128\"\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\ndefine fastcc i16 @func_257(i16 %conv11) {\nentry:\n %0 = add i64 0, 0\n %1 = bitcast i64 %0 to double\n %mul.i.i.17 = fmul double 0.000000e+00, %1\n %2 = or i64 0, 0\n %3 = bitcast i64 %2 to double\n %mul.i.i.18 = fmul double 0.000000e+00, %3\n %4 = fcmp uno double %mul.i.i.18, 0.000000e+00\n %5 = select i1 %4, i16 0, i16 0\n %6 = trunc i64 %2 to i16\n %7 = or i16 %5, %6\n %8 = fcmp uno double %mul.i.i.17, 0.000000e+00\n %9 = select i1 %8, i16 0, i16 0\n %10 = trunc i64 %0 to i16\n %11 = or i16 %9, %10\n %12 = or i64 0, 0\n %13 = bitcast i64 %12 to double\n %14 = fcmp uno double %13, 0.000000e+00\n %15 = select i1 %14, i16 0, i16 0\n %16 = trunc i64 %12 to i16\n %17 = zext i16 %conv11 to i64\n %18 = or i64 %17, 0\n %19 = bitcast i64 %18 to double\n %mul.i.i.21 = fmul double 0.000000e+00, %19\n %20 = fcmp uno double %mul.i.i.21, 0.000000e+00\n %21 = select i1 %20, i16 0, i16 0\n %22 = trunc i64 %18 to i16\n %23 = or i16 %21, %22\n %24 = or i16 %15, %16\n %conv140.i.18 = xor i16 %7, %11\n %conv140.i.20 = xor i16 %24, %conv140.i.18\n %conv140.i.21 = xor i16 %23, %conv140.i.20\n ret i16 %conv140.i.21\n}\n```\n```\nopt: /root/llvm-project/llvm/lib/IR/Instructions.cpp:3043: static llvm::CastInst* llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, const llvm::Twine&, llvm::InsertPosition): Assertion `castIsValid(op, S, Ty) && \"Invalid cast!\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=slp-vectorizer <source>\n1.\tRunning pass \"function(slp-vectorizer)\" on module \"<source>\"\n2.\tRunning pass \"slp-vectorizer\" on function \"func_257\"\n #0 0x0000000005ab1ef8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5ab1ef8)\n #1 0x0000000005aaedd4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x000072088da42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #3 0x000072088da969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #4 0x000072088da42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #5 0x000072088da287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #6 0x000072088da2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #7 0x000072088da39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #8 0x0000000005799836 (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5799836)\n #9 0x0000000000ba36b3 llvm::IRBuilderBase::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::MDNode*, llvm::FMFSource) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xba36b3)\n#10 0x0000000003838400 llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::slpvectorizer::BoUpSLP::TreeEntry*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3838400)\n#11 0x00000000038357ee llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::slpvectorizer::BoUpSLP::TreeEntry*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x38357ee)\n#12 0x0000000003835b5d llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::slpvectorizer::BoUpSLP::TreeEntry*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3835b5d)\n#13 0x0000000003836944 llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::slpvectorizer::BoUpSLP::TreeEntry*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3836944)\n#14 0x00000000038357ee llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::slpvectorizer::BoUpSLP::TreeEntry*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x38357ee)\n#15 0x0000000003856fa4 llvm::slpvectorizer::BoUpSLP::vectorizeTree(llvm::SmallDenseSet<llvm::Value*, 4u, llvm::DenseMapInfo<llvm::Value*, void>> const&, llvm::Instruction*, llvm::ArrayRef<std::tuple<llvm::Value*, unsigned int, bool>>) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3856fa4)\n#16 0x0000000003877229 (anonymous namespace)::HorizontalReduction::tryToReduce(llvm::slpvectorizer::BoUpSLP&, llvm::DataLayout const&, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo const&, llvm::AssumptionCache*, llvm::DominatorTree&) SLPVectorizer.cpp:0:0\n#17 0x000000000387a478 llvm::SLPVectorizerPass::vectorizeHorReduction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&, llvm::SmallVectorImpl<llvm::WeakTrackingVH>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x387a478)\n#18 0x000000000387f3ab llvm::SLPVectorizerPass::vectorizeRootInstruction(llvm::PHINode*, llvm::Instruction*, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (.constprop.0) SLPVectorizer.cpp:0:0\n#19 0x0000000003883940 llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3883940)\n#20 0x0000000003889ed6 llvm::SLPVectorizerPass::runImpl(llvm::Function&, llvm::ScalarEvolution*, llvm::TargetTransformInfo*, llvm::TargetLibraryInfo*, llvm::AAResults*, llvm::LoopInfo*, llvm::DominatorTree*, llvm::AssumptionCache*, llvm::DemandedBits*, llvm::OptimizationRemarkEmitter*) (.part.0) SLPVectorizer.cpp:0:0\n#21 0x000000000388ad5b llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x388ad5b)\n#22 0x0000000003028ffe llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x3028ffe)\n#23 0x00000000058232e1 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x58232e1)\n#24 0x0000000000f0866e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xf0866e)\n#25 0x000000000582189a llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x582189a)\n#26 0x000000000096594e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96594e)\n#27 0x0000000005821251 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5821251)\n#28 0x000000000096fb0a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x96fb0a)\n#29 0x0000000000963bb8 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x963bb8)\n#30 0x000072088da29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#31 0x000072088da29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#32 0x000000000095a835 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x95a835)\nProgram terminated with signal: SIGSEGV\nCompiler returned: 139\n```\nUnlike https://github.com/llvm/llvm-project/issues/170828, this crash can be triggered without revec.\n\n",
|
| 47 |
+
"author": "dtcxzyw",
|
| 48 |
+
"labels": [
|
| 49 |
+
"llvm:SLPVectorizer",
|
| 50 |
+
"crash-on-valid",
|
| 51 |
+
"generated by fuzzer"
|
| 52 |
+
],
|
| 53 |
+
"comments": [
|
| 54 |
+
{
|
| 55 |
+
"author": "dtcxzyw",
|
| 56 |
+
"body": "Bisected to e644f06c2ffc23b3415f3478b05c627303aef614"
|
| 57 |
+
}
|
| 58 |
+
]
|
| 59 |
+
},
|
| 60 |
+
"properties": {
|
| 61 |
+
"is_single_file_fix": true,
|
| 62 |
+
"is_single_func_fix": true
|
| 63 |
+
},
|
| 64 |
+
"verified": true
|
| 65 |
+
}
|
dataset/178917.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "178917",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/178917",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "c2082a65b7fc8e7587ed07170e250820d6bbda1d",
|
| 6 |
+
"knowledge_cutoff": "2026-01-30T16:51:03Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/VectorCombine"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "07a6a23f6c5387fc1e7df174b5921f6004db64e0",
|
| 12 |
+
"components": [
|
| 13 |
+
"VectorCombine"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/VectorCombine.cpp": [
|
| 17 |
+
[
|
| 18 |
+
5453,
|
| 19 |
+
5458
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/VectorCombine.cpp": [
|
| 25 |
+
"VectorCombine::shrinkLoadForShuffles"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 07a6a23f6c5387fc1e7df174b5921f6004db64e0\nAuthor: puneeth_aditya_5656 <myakampuneeth@gmail.com>\nDate: Sat Jan 31 00:52:39 2026 +0530\n\n [VectorCombine] Fix crash with poison mask elements in shrinkLoadForShuffles (#178920)\n \n ## Summary\n Fixes assertion failure when `shrinkLoadForShuffles` processes shuffle\n masks containing poison elements.\n \n The bug was introduced in #149093 , when adjusting mask indices for load\n trimming, poison indices (-1) were modified to invalid values (e.g.,\n -2), causing `isSingleSourceMaskImpl` to assert.\n \n The fix preserves poison indices without modification.\n \n Fixes #178917\n \n ## Test plan\n - Added regression test `@shuffle_with_poison_mask`\n\ndiff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\nindex d173afd24e54..c1cca6e28a8e 100644\n--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\n+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\n@@ -5453,6 +5453,11 @@ bool VectorCombine::shrinkLoadForShuffles(Instruction &I) {\n NewUses.push_back({Shuffle, {}});\n std::vector<int> &NewMask = NewUses.back().second;\n for (int Index : OldMask) {\n+ // Preserve poison indices without modification.\n+ if (Index == PoisonMaskElem) {\n+ NewMask.push_back(Index);\n+ continue;\n+ }\n int NewIndex = Index >= static_cast<int>(OldNumElements)\n ? Index - LowOffset - HighOffset\n : Index - LowOffset;\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/VectorCombine/load-shufflevector.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -passes=vector-combine -S < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "shuffle_with_poison_mask",
|
| 39 |
+
"test_body": "define <8 x i16> @shuffle_with_poison_mask(ptr %p) {\n %pre = load <8 x i16>, ptr %p, align 1\n %shuf = shufflevector <8 x i16> %pre, <8 x i16> poison, <8 x i32> <i32 1, i32 3, i32 poison, i32 poison, i32 poison, i32 5, i32 poison, i32 7>\n ret <8 x i16> %shuf\n}\n"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"test_name": "shuffle_v16_v16i8_r0_31",
|
| 43 |
+
"test_body": "define <16 x i8> @shuffle_v16_v16i8_r0_31(ptr %arg) {\n %load = load <16 x i8>, ptr %arg, align 1\n %shuf = shufflevector <16 x i8> %load, <16 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n ret <16 x i8> %shuf\n}\n"
|
| 44 |
+
}
|
| 45 |
+
]
|
| 46 |
+
}
|
| 47 |
+
],
|
| 48 |
+
"issue": {
|
| 49 |
+
"title": "[VectorCombine] Assertion `I >= 0 && I < (NumOpElts * 2) && \"Out-of-bounds shuffle mask element\"' failed.",
|
| 50 |
+
"body": "Reproducer (reduced from ncnn):\n```llvm\n; bin/opt -passes=vector-combine test.ll -S\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128\"\ntarget triple = \"x86_64-pc-linux-gnu\"\n\ndefine <8 x i16> @_ZN4ncnnL21cast_fp32_to_bf16_sseERKNS_3MatERS0_RKNS_6OptionE.omp_outlined(ptr %p) {\n.noexc.lr.ph:\n %.pre = load <8 x i16>, ptr %p, align 1\n %0 = shufflevector <8 x i16> %.pre, <8 x i16> poison, <8 x i32> <i32 1, i32 3, i32 poison, i32 poison, i32 poison, i32 5, i32 poison, i32 7>\n ret <8 x i16> %0\n}\n```\n```\nopt: /data/zyw/dev/llvm-project/llvm/lib/IR/Instructions.cpp:1919: bool isSingleSourceMaskImpl(llvm::ArrayRef<int>, int): Assertion `I >= 0 && I < (NumOpElts * 2) && \"Out-of-bounds shuffle mask element\"' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0. Program arguments: bin/opt -passes=vector-combine reduced.ll -S\n1. Running pass \"function(vector-combine)\" on module \"reduced.ll\"\n2. Running pass \"vector-combine\" on function \"_ZN4ncnnL21cast_fp32_to_bf16_sseERKNS_3MatERS0_RKNS_6OptionE.omp_outlined\"\n #0 0x00007ffff7dfd4c2 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /data/zyw/dev/llvm-project/llvm/lib/Support/Unix/Signals.inc:846:3\n #1 0x00007ffff7dfa3fc llvm::sys::RunSignalHandlers() /data/zyw/dev/llvm-project/llvm/lib/Support/Signals.cpp:108:20\n #2 0x00007ffff7dfac21 SignalHandler(int, siginfo_t*, void*) /data/zyw/dev/llvm-project/llvm/lib/Support/Unix/Signals.inc:429:14\n #3 0x00007ffff7845330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)\n #4 0x00007ffff789eb2c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\n #5 0x00007ffff789eb2c __pthread_kill_internal ./nptl/pthread_kill.c:78:10\n #6 0x00007ffff789eb2c pthread_kill ./nptl/pthread_kill.c:89:10\n #7 0x00007ffff784527e raise ./signal/../sysdeps/posix/raise.c:27:6\n #8 0x00007ffff78288ff abort ./stdlib/abort.c:81:7\n #9 0x00007ffff782881b _nl_load_domain ./intl/loadmsgcat.c:1177:9\n#10 0x00007ffff783b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)\n#11 0x00007fffee83fb66 isSingleSourceMaskImpl(llvm::ArrayRef<int>, int) /data/zyw/dev/llvm-project/llvm/lib/IR/Instructions.cpp:1913:3\n#12 0x00007fffee84a6de llvm::ShuffleVectorInst::isExtractSubvectorMask(llvm::ArrayRef<int>, int, int&) /data/zyw/dev/llvm-project/llvm/lib/IR/Instructions.cpp:2078:30\n#13 0x00007ffff6c170f3 llvm::BasicTTIImplBase<llvm::X86TTIImpl>::improveShuffleKindFromMask(llvm::TargetTransformInfo::ShuffleKind, llvm::ArrayRef<int>, llvm::VectorType*, int&, llvm::VectorType*&) const (.isra.0) /data/zyw/dev/llvm-project/llvm/include/llvm/CodeGen/BasicTTIImpl.h:1134:0\n#14 0x00007ffff6c193eb llvm::X86TTIImpl::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::VectorType*, llvm::ArrayRef<int>, llvm::TargetTransformInfo::TargetCostKind, int, llvm::VectorType*, llvm::ArrayRef<llvm::Value const*>, llvm::Instruction const*) const /data/zyw/dev/llvm-project/llvm/lib/Target/X86/X86TargetTransformInfo.cpp:1554:0\n#15 0x00007fffef27af8f llvm::TargetTransformInfo::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::VectorType*, llvm::ArrayRef<int>, llvm::TargetTransformInfo::TargetCostKind, int, llvm::VectorType*, llvm::ArrayRef<llvm::Value const*>, llvm::Instruction const*) const /data/zyw/dev/llvm-project/llvm/lib/Analysis/TargetTransformInfo.cpp:1039:49\n#16 0x00007ffff107f407 llvm::InstructionCost::propagateState(llvm::InstructionCost const&) /data/zyw/dev/llvm-project/llvm/include/llvm/Support/InstructionCost.h:58:5\n#17 0x00007ffff107f407 llvm::InstructionCost::operator+=(llvm::InstructionCost const&) /data/zyw/dev/llvm-project/llvm/include/llvm/Support/InstructionCost.h:100:19\n#18 0x00007ffff107f407 (anonymous namespace)::VectorCombine::shrinkLoadForShuffles(llvm::Instruction&) /data/zyw/dev/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:5470:60\n#19 0x00007ffff108a844 run /data/zyw/dev/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:5789:9\n#20 0x00007ffff108a844 llvm::VectorCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /data/zyw/dev/llvm-project/llvm/lib/Transforms/Vectorize/VectorCombine.cpp:5820:20\n#21 0x00007ffff1aef5b5 llvm::detail::PassModel<llvm::Function, llvm::VectorCombinePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /data/zyw/dev/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:92:3\n#22 0x00007fffee8d2c0d llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /data/zyw/dev/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:80:18\n#23 0x00007ffff68ca775 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /data/zyw/dev/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:92:3\n#24 0x00007fffee8d3047 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /data/zyw/dev/llvm-project/llvm/lib/IR/PassManager.cpp:132:41\n#25 0x00007ffff7f8bf75 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /data/zyw/dev/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:92:3\n#26 0x00007fffee8d42c6 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /data/zyw/dev/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:80:18\n#27 0x00007ffff7f97cdc llvm::SmallPtrSetImplBase::~SmallPtrSetImplBase() /data/zyw/dev/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:89:5\n#28 0x00007ffff7f97cdc llvm::SmallPtrSetImpl<llvm::AnalysisKey*>::~SmallPtrSetImpl() /data/zyw/dev/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:368:35\n#29 0x00007ffff7f97cdc llvm::SmallPtrSet<llvm::AnalysisKey*, 2u>::~SmallPtrSet() /data/zyw/dev/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:527:7\n#30 0x00007ffff7f97cdc llvm::PreservedAnalyses::~PreservedAnalyses() /data/zyw/dev/llvm-project/llvm/include/llvm/IR/Analysis.h:112:7\n#31 0x00007ffff7f97cdc llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) /data/zyw/dev/llvm-project/llvm/tools/opt/NewPMDriver.cpp:574:10\n#32 0x00007ffff7fa37c4 optMain /data/zyw/dev/llvm-project/llvm/tools/opt/optdriver.cpp:758:5\n#33 0x00007ffff782a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3\n#34 0x00007ffff782a28b call_init ./csu/../csu/libc-start.c:128:20\n#35 0x00007ffff782a28b __libc_start_main ./csu/../csu/libc-start.c:347:5\n#36 0x0000555555555095 _start (bin/opt+0x1095)\nAborted (core dumped)\n```\nThis is originally reported by https://github.com/dtcxzyw/llvm-opt-benchmark/issues/3405.\nIt should be caused by https://github.com/llvm/llvm-project/pull/149093. Reverting this patch addresses the issue.\ncc @PeddleSpam @arsenm @RKSimon \n",
|
| 51 |
+
"author": "dtcxzyw",
|
| 52 |
+
"labels": [
|
| 53 |
+
"crash-on-valid",
|
| 54 |
+
"llvm::vectorcombine"
|
| 55 |
+
],
|
| 56 |
+
"comments": []
|
| 57 |
+
},
|
| 58 |
+
"properties": {
|
| 59 |
+
"is_single_file_fix": true,
|
| 60 |
+
"is_single_func_fix": true
|
| 61 |
+
},
|
| 62 |
+
"verified": true
|
| 63 |
+
}
|
dataset/178954.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "178954",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/178954",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "7639d21e9db0803ffec5f9e188f3a3b6fb865cce",
|
| 6 |
+
"knowledge_cutoff": "2026-01-30T20:02:04Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/Attributor"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "485eb62afd7edb1ecb13c975bf62da03ff166b60",
|
| 12 |
+
"components": [
|
| 13 |
+
"Attributor"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/IPO/AttributorAttributes.cpp": [
|
| 17 |
+
[
|
| 18 |
+
10495,
|
| 19 |
+
10501
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/IPO/AttributorAttributes.cpp": [
|
| 25 |
+
"initialize"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 485eb62afd7edb1ecb13c975bf62da03ff166b60\nAuthor: Matt Arsenault <Matthew.Arsenault@amd.com>\nDate: Fri Jan 30 22:38:07 2026 +0100\n\n Attributor: Use anchor scope for SimplifyQuery context (#178958)\n \n This was asserting in computeKnownFPClass when a dominator tree\n check happened across functions.\n \n Fixes #178954\n\ndiff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp\nindex 9796b4f4cc40..86bdb7c49c0e 100644\n--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp\n+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp\n@@ -10495,7 +10495,7 @@ struct AANoFPClassImpl : AANoFPClass {\n const DominatorTree *DT = nullptr;\n AssumptionCache *AC = nullptr;\n const TargetLibraryInfo *TLI = nullptr;\n- Function *F = getAssociatedFunction();\n+ Function *F = getAnchorScope();\n if (F) {\n TLI = InfoCache.getTargetLibraryInfoForFunction(*F);\n if (!F->isDeclaration()) {\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/Attributor/nofpclass.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -passes=attributor -S < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "<module>",
|
| 39 |
+
"test_body": "; RUN: opt -passes=attributor %s\ntarget datalayout = \"e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9\"\ntarget triple = \"amdgcn-amd-amdhsa\"\n\ndefine double @__ocml_acosh_f64() {\nentry:\n %0 = tail call double @llvm.fma.f64(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)\n %cond.i = select i1 false, double 0.000000e+00, double %0\n %add.i46.i = fadd double %cond.i, 0.000000e+00\n %add.i.i33 = fadd double 0.000000e+00, %add.i46.i\n %add.i.i.i39 = fadd double %add.i.i33, 0.000000e+00\n %vecinit1.i.i.i.i43 = insertelement <2 x double> zeroinitializer, double %add.i.i.i39, i64 0\n %call7 = call double @__ocmlpriv_lnep_f64(<2 x double> %vecinit1.i.i.i.i43)\n ret double %call7\n}\n\ndefine double @__ocmlpriv_lnep_f64(<2 x double> %a) {\nentry:\n ret double 0.000000e+00\n}\n\ndeclare double @llvm.fma.f64(double, double, double) #0\n\nattributes #0 = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }\n"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "Attributor asserts when compiling rocm device libs",
|
| 46 |
+
"body": "https://godbolt.org/z/7ddYcExh5\n\n```llvm\n; RUN: opt -passes=attributor %s\ntarget datalayout = \"e-m:e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9\"\ntarget triple = \"amdgcn-amd-amdhsa\"\n\ndefine double @__ocml_acosh_f64() {\nentry:\n %0 = tail call double @llvm.fma.f64(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)\n %cond.i = select i1 false, double 0.000000e+00, double %0\n %add.i46.i = fadd double %cond.i, 0.000000e+00\n %add.i.i33 = fadd double 0.000000e+00, %add.i46.i\n %add.i.i.i39 = fadd double %add.i.i33, 0.000000e+00\n %vecinit1.i.i.i.i43 = insertelement <2 x double> zeroinitializer, double %add.i.i.i39, i64 0\n %call7 = call double @__ocmlpriv_lnep_f64(<2 x double> %vecinit1.i.i.i.i43)\n ret double %call7\n}\n\ndefine double @__ocmlpriv_lnep_f64(<2 x double> %a) {\nentry:\n ret double 0.000000e+00\n}\n\ndeclare double @llvm.fma.f64(double, double, double) #0\n\nattributes #0 = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }\n\n```\n\n```\nAssertion failed: ((!BB || Parent == NodeTrait::getParent(const_cast<NodeT *>(BB))) && \"cannot get DomTreeNode of block with different parent\"), function getNode, file GenericDomTree.h, line 425.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0.\tProgram arguments: opt -S -p=attributor -o - reduced-attrib.ll\n1.\tRunning pass \"attributor\" on module \"reduced-attrib.ll\"\n #0 0x00000001071c4f9c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/bin/opt+0x102774f9c)\n #1 0x00000001071c2f00 llvm::sys::RunSignalHandlers() (/usr/local/bin/opt+0x102772f00)\n #2 0x00000001071c5a44 SignalHandler(int, __siginfo*, void*) (/usr/local/bin/opt+0x102775a44)\n #3 0x000000018f84d6a4 (/usr/lib/system/libsystem_platform.dylib+0x1804ad6a4)\n #4 0x000000018f813848 (/usr/lib/system/libsystem_pthread.dylib+0x180473848)\n #5 0x000000018f71c9e4 (/usr/lib/system/libsystem_c.dylib+0x18037c9e4)\n #6 0x000000018f71bc18 (/usr/lib/system/libsystem_c.dylib+0x18037bc18)\n #7 0x0000000107da615c loadMBUFScalarOperandsFromVGPR(llvm::SIInstrInfo const&, llvm::MachineInstr&, llvm::ArrayRef<llvm::MachineOperand*>, llvm::MachineDominatorTree*, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>) (.cold.20) (/usr/local/bin/opt+0x10335615c)\n #8 0x000000010695be6c llvm::DominatorTreeBase<llvm::BasicBlock, false>::getNodeIndex(llvm::BasicBlock const*) const (/usr/local/bin/opt+0x101f0be6c)\n #9 0x0000000106374ccc isGuaranteedNotToBeUndefOrPoison(llvm::Value const*, llvm::AssumptionCache*, llvm::Instruction const*, llvm::DominatorTree const*, unsigned int, UndefPoisonKind) (/usr/local/bin/opt+0x101924ccc)\n```",
|
| 47 |
+
"author": "arsenm",
|
| 48 |
+
"labels": [
|
| 49 |
+
"crash-on-valid",
|
| 50 |
+
"llvm::Attributor"
|
| 51 |
+
],
|
| 52 |
+
"comments": []
|
| 53 |
+
},
|
| 54 |
+
"properties": {
|
| 55 |
+
"is_single_file_fix": true,
|
| 56 |
+
"is_single_func_fix": true
|
| 57 |
+
},
|
| 58 |
+
"verified": true
|
| 59 |
+
}
|
dataset/179074.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "179074",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/179074",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "584156d15d24c9b9f67aa7850e86ee2474a250c0",
|
| 6 |
+
"knowledge_cutoff": "2026-01-31T22:58:49Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "3bbf748a63a3cb38271a478b520789be57d5e2c8",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopVectorize"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp": [
|
| 17 |
+
[
|
| 18 |
+
225,
|
| 19 |
+
230
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp": [
|
| 25 |
+
"VPPredicator::createSwitchEdgeMasks"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 3bbf748a63a3cb38271a478b520789be57d5e2c8\nAuthor: nora <48135649+Noratrieb@users.noreply.github.com>\nDate: Thu Feb 5 08:50:57 2026 +0100\n\n [VPlan] Create edge mask for single-destination switch (#179107)\n \n When converting phis to blends, the `VPPredicator` expects to have edge\n masks to the phi node if the phi node has different incoming blocks.\n This was not the case if the predecessor of the phi was a switch where a\n conditional destination was the same as the default destination.\n \n This was because when creating edge masks in `createSwitchEdgeMasks`,\n edge masks are set in a loop through the *non-default* destinations. But\n when there are no non-default destinations (but at least one condition,\n otherwise an earlier condition would trigger and just forward the source\n mask), this loop is never executed, so the masks are never set.\n \n To resolve this, we explicitly forward the source mask for these cases\n as well, which is correct because it is an unconditional branch, just a\n very convoluted one.\n \n fixes #179074\n\ndiff --git a/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp b/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp\nindex f7e7fc29bc20..7f787dcbbf3c 100644\n--- a/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp\n+++ b/llvm/lib/Transforms/Vectorize/VPlanPredicator.cpp\n@@ -225,6 +225,10 @@ void VPPredicator::createSwitchEdgeMasks(VPInstruction *SI) {\n DefaultMask = Builder.createNot(DefaultMask);\n if (SrcMask)\n DefaultMask = Builder.createLogicalAnd(SrcMask, DefaultMask);\n+ } else {\n+ // There are no destinations other than the default destination, so this is\n+ // an unconditional branch.\n+ DefaultMask = SrcMask;\n }\n setEdgeMask(Src, DefaultDst, DefaultMask);\n }\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/LoopVectorize/predicate-switch.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -p loop-vectorize -force-vector-width=2 -force-vector-interleave=1 -S %s",
|
| 35 |
+
"opt -p loop-vectorize -force-vector-width=2 -force-vector-interleave=2 -S %s"
|
| 36 |
+
],
|
| 37 |
+
"tests": [
|
| 38 |
+
{
|
| 39 |
+
"test_name": "switch_unconditional",
|
| 40 |
+
"test_body": "define void @switch_unconditional(ptr %start) {\nentry:\n br label %loop.header\n\nloop.header: ; preds = %loop.latch, %entry\n %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop.latch ]\n %gep = getelementptr i32, ptr %start, i64 %iv\n %x = load i32, ptr %gep, align 4\n switch i32 %x, label %foo [\n ]\n\nfoo: ; preds = %loop.header\n br label %loop.latch\n\nloop.latch: ; preds = %foo\n store i32 0, ptr %gep, align 4\n %iv.next = add i64 %iv, 1\n %cmp = icmp eq i64 %iv.next, 100\n br i1 %cmp, label %exit, label %loop.header\n\nexit: ; preds = %loop.latch\n ret void\n}\n"
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"test_name": "switch_unconditional_duplicate_target",
|
| 44 |
+
"test_body": "define void @switch_unconditional_duplicate_target(ptr %start, ptr %dest) {\nentry:\n br label %loop\n\nloop: ; preds = %latch, %entry\n %iv = phi i64 [ 0, %entry ], [ %iv.next, %latch ]\n %gep = getelementptr i32, ptr %start, i64 %iv\n %x = load i32, ptr %gep, align 4\n %cond = icmp ult i32 %x, 10\n br i1 %cond, label %forward, label %latch\n\nforward: ; preds = %loop\n switch i32 %x, label %latch [\n i32 0, label %latch\n ]\n\nlatch: ; preds = %forward, %forward, %loop\n %gep.1 = phi ptr [ %gep, %loop ], [ %dest, %forward ], [ %dest, %forward ]\n store i32 0, ptr %gep.1, align 4\n %iv.next = add i64 %iv, 1\n %cmp = icmp eq i64 %iv.next, 100\n br i1 %cmp, label %exit, label %loop\n\nexit: ; preds = %latch\n ret void\n}\n"
|
| 45 |
+
}
|
| 46 |
+
]
|
| 47 |
+
}
|
| 48 |
+
],
|
| 49 |
+
"issue": {
|
| 50 |
+
"title": "Loop vectorizer crash in LLVM 22",
|
| 51 |
+
"body": "This code crashes in the loop vectorizer (`opt -passes=loop-vectorize`).\n\n```llvm\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128\"\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\ndefine void @reproducer() {\nentry:\n br label %head\n\nhead: ; preds = %tail, %entry\n %phi = phi ptr [ null, %entry ], [ %getelementptr, %tail ]\n %getelementptr = getelementptr i8, ptr %phi, i64 12\n br i1 false, label %tail, label %forward\n\nforward: ; preds = %head\n switch i32 0, label %tail [\n i32 0, label %tail\n ]\n\ntail: ; preds = %forward, %forward, %head\n %phi5 = phi i32 [ 1, %forward ], [ 1, %forward ], [ 0, %head ]\n %icmp = icmp eq ptr %getelementptr, null\n br i1 %icmp, label %exit, label %head\n\nexit: ; preds = %tail\n ret void\n}\n```\n\n```\nStack dump:\n0. Program arguments: /home/nora/projects/rust/build/host/ci-llvm/bin/opt meta.ll -passes=loop-vectorize -disable-output\n1. Running pass \"function(loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>)\" on module \"meta.ll\"\n2. Running pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"reproducer\"\n #0 0x00007f91e56c2008 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x58c2008)\n #1 0x00007f91e56bebe5 llvm::sys::RunSignalHandlers() (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x58bebe5)\n #2 0x00007f91e56c2746 SignalHandler(int, siginfo_t*, void*) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x58c2746)\n #3 0x00007f91dfa42790 __restore_rt (/nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/libc.so.6+0x42790)\n #4 0x00007f91e7879f77 llvm::VPlanTransforms::introduceMasksAndLinearize(llvm::VPlan&, bool) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x7a79f77)\n #5 0x00007f91e7662efb llvm::LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(std::unique_ptr<llvm::VPlan, std::default_delete<llvm::VPlan>>, llvm::VFRange&, llvm::LoopVersioning*) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x7862efb)\n #6 0x00007f91e7654643 llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x7854643)\n #7 0x00007f91e7653ab6 llvm::LoopVectorizationPlanner::plan(llvm::ElementCount, unsigned int) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x7853ab6)\n #8 0x00007f91e766beac llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x786beac)\n #9 0x00007f91e7678f8b llvm::LoopVectorizePass::runImpl(llvm::Function&) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x7878f8b)\n#10 0x00007f91e76798c2 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x78798c2)\n#11 0x00007f91e592f22f llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x5b2f22f)\n#12 0x00007f91e5934490 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x5b34490)\n#13 0x00007f91e592de99 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/nora/projects/rust/build/x86_64-unknown-linux-gnu/ci-llvm/bin/../lib/libLLVM.so.22.1-rust-1.95.0-nightly+0x5b2de99)\n#14 0x000055bb94c79523 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/home/nora/projects/rust/build/host/ci-llvm/bin/opt+0x2a523)\n#15 0x000055bb94c6b6ca optMain (/home/nora/projects/rust/build/host/ci-llvm/bin/opt+0x1c6ca)\n#16 0x00007f91dfa2b285 __libc_start_call_main (/nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/libc.so.6+0x2b285)\n#17 0x00007f91dfa2b338 __libc_start_main@GLIBC_2.2.5 (/nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/libc.so.6+0x2b338)\n#18 0x000055bb94c67e49 _start (/home/nora/projects/rust/build/host/ci-llvm/bin/opt+0x18e49)\n```\n",
|
| 52 |
+
"author": "Noratrieb",
|
| 53 |
+
"labels": [
|
| 54 |
+
"vectorizers",
|
| 55 |
+
"crash"
|
| 56 |
+
],
|
| 57 |
+
"comments": [
|
| 58 |
+
{
|
| 59 |
+
"author": "Noratrieb",
|
| 60 |
+
"body": "I've been trying to bisect it and it looks like this is not actually an LLVM 22 regression for the minimal reproducer, I've been able to reproduce it in LLVM 21 and LLVM 20. It looks like change in LLVM 22 that triggered the Rust reproducer (https://github.com/rust-lang/rust/issues/151926) was just perturbing something to reveal this existing bug."
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"author": "Noratrieb",
|
| 64 |
+
"body": "296781524902c4eb06efc5bb054cac58b973d839 looks relevant but it didn't cause this issue, it merely turned an assertion failure into the segfault (when I revert it it triggers the `Distinct incoming values with one having a full mask` assertion)"
|
| 65 |
+
}
|
| 66 |
+
]
|
| 67 |
+
},
|
| 68 |
+
"properties": {
|
| 69 |
+
"is_single_file_fix": true,
|
| 70 |
+
"is_single_func_fix": true
|
| 71 |
+
},
|
| 72 |
+
"verified": true
|
| 73 |
+
}
|
dataset/180361.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "180361",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/180361",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "39622a7739b85aa8cd1d5169028b6c8fd1e0bcaa",
|
| 6 |
+
"knowledge_cutoff": "2026-02-07T18:16:54Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/DeadStoreElimination"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "ec059d81aafedb253a02d6f490ad9b9747611038",
|
| 12 |
+
"components": [
|
| 13 |
+
"DeadStoreElimination"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1227,
|
| 19 |
+
1233
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp": [
|
| 25 |
+
"isInvisibleToCallerAfterRet"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit ec059d81aafedb253a02d6f490ad9b9747611038\nAuthor: Aiden Grossman <aidengrossman@google.com>\nDate: Sat Feb 7 11:43:56 2026 -0800\n\n [DSE] Handle variable offsets with sized dead_on_return (#180364)\n \n With a sized dead_on_return, we need to not eliminate stores if there\n are to a pointer with a variable offset from the underlying object\n marked dead_on_return. This manifested as an assertion failure as\n BaseValue/V ended up not being equal. It's possible we could do a range\n analysis to try and prove the variable offset stays within bounds, but\n this case seems to come up relatively rarely (only reproducible with a\n UBSan build of LLVM) and is probably not worth the compile time.\n \n Fixes #180361.\n\ndiff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp\nindex 582ec1dbcec9..e056f0c1f639 100644\n--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp\n+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp\n@@ -1227,7 +1227,11 @@ struct DSEState {\n int64_t ValueOffset;\n [[maybe_unused]] const Value *BaseValue =\n GetPointerBaseWithConstantOffset(Ptr, ValueOffset, DL);\n- assert(BaseValue == V);\n+ // If we are not able to find a constant offset from the UO, we have to\n+ // pessimistically assume that the store writes to memory out of the\n+ // dead_on_return bounds.\n+ if (BaseValue != V)\n+ return false;\n // This store is only invisible after return if we are in bounds of the\n // range marked dead.\n if (StoreSize.hasValue() &&\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/DeadStoreElimination/simple.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -passes=dse -S < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "test_dead_on_return_variable_offset",
|
| 39 |
+
"test_body": "\ndefine void @test_dead_on_return_variable_offset(ptr dead_on_return(4) %p, i64 %offset) {\n %p1 = getelementptr i8, ptr %p, i64 %offset\n store i32 0, ptr %p1\n ret void\n}\n"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[DSE] Assertion failure with clang using sized dead_on_return",
|
| 46 |
+
"body": "We hit an assertion failure in DSE from the following minimized test case:\n```llvm\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128\"\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\n; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)\ndeclare void @llvm.memset.p0.i64(ptr writeonly captures(none), i8, i64, i1 immarg) #0\n\ndefine void @_ZN4llvm19LegacyLegalizerInfoD2Ev(ptr dead_on_return(90056) %this, i64 %arraydestroy.elementPast.add) {\nentry:\n %arraydestroy.element.ptr = getelementptr i8, ptr %this, i64 %arraydestroy.elementPast.add\n tail call void @llvm.memset.p0.i64(ptr %arraydestroy.element.ptr, i8 0, i64 0, i1 false)\n ret void\n}\n\nattributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }\n```\nwith the following command line:\n```\nopt -passes=\"dse\" -disable-output <input path>\n```\n\nStack trace looks like the following:\n```\nopt: /home/gha/llvm-project/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1230: bool (anonymous namespace)::DSEState::isInvisibleToCallerAfterRet(const Value *, const Value *, const LocationSize): Assertion `BaseValue == V' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.\nStack dump:\n0. Program arguments: ./bin/opt -passes=dse ./reduced.ll\n1. Running pass \"function(dse)\" on module \"./reduced.ll\"\n2. Running pass \"dse\" on function \"_ZN4llvm19LegacyLegalizerInfoD2Ev\"\n #0 0x000055cf10cb8868 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./bin/opt+0x4af8868)\n #1 0x000055cf10cb5fa5 llvm::sys::RunSignalHandlers() (./bin/opt+0x4af5fa5)\n #2 0x000055cf10cb9631 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x00007f4e67768330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)\n #4 0x00007f4e677c1b2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)\n #5 0x00007f4e6776827e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)\n #6 0x00007f4e6774b8ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)\n #7 0x00007f4e6774b81b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)\n #8 0x00007f4e6775e517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)\n #9 0x000055cf0fb4221a (anonymous namespace)::DSEState::isInvisibleToCallerAfterRet(llvm::Value const*, llvm::Value const*, llvm::LocationSize) DeadStoreElimination.cpp:0:0\n#10 0x000055cf0fb3768c eliminateDeadStores(llvm::Function&, llvm::AAResults&, llvm::MemorySSA&, llvm::DominatorTree&, llvm::PostDominatorTree&, llvm::TargetLibraryInfo const&, llvm::LoopInfo const&) DeadStoreElimination.cpp:0:0\n#11 0x000055cf0fb34215 llvm::DSEPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (./bin/opt+0x3974215)\n#12 0x000055cf0e754bed llvm::detail::PassModel<llvm::Function, llvm::DSEPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (./bin/opt+0x2594bed)\n#13 0x000055cf10a79c37 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (./bin/opt+0x48b9c37)\n#14 0x000055cf0ce6ce2d llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (./bin/opt+0xcace2d)\n#15 0x000055cf10a7dc71 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (./bin/opt+0x48bdc71)\n#16 0x000055cf0c97cc0d llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (./bin/opt+0x7bcc0d)\n#17 0x000055cf10a78d07 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (./bin/opt+0x48b8d07)\n#18 0x000055cf0c974872 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (./bin/opt+0x7b4872)\n#19 0x000055cf0c96770d optMain (./bin/opt+0x7a770d)\n#20 0x00007f4e6774d1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)\n#21 0x00007f4e6774d28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)\n#22 0x000055cf0c960a05 _start (./bin/opt+0x7a0a05)\nAborted (core dumped)\n```",
|
| 47 |
+
"author": "boomanaiden154",
|
| 48 |
+
"labels": [
|
| 49 |
+
"crash",
|
| 50 |
+
"llvm:transforms"
|
| 51 |
+
],
|
| 52 |
+
"comments": []
|
| 53 |
+
},
|
| 54 |
+
"properties": {
|
| 55 |
+
"is_single_file_fix": true,
|
| 56 |
+
"is_single_func_fix": true
|
| 57 |
+
},
|
| 58 |
+
"verified": true
|
| 59 |
+
}
|
dataset/180363.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "180363",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/180363",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "7509cad693b6cfbf28944419703ef17c7e5b3e47",
|
| 6 |
+
"knowledge_cutoff": "2026-02-07T18:37:46Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "6324ee32c1b320bbac6638bdbc49a7844ac20d1f",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopVectorize"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp": [
|
| 17 |
+
[
|
| 18 |
+
1678,
|
| 19 |
+
1684
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp": [
|
| 25 |
+
"VPIRPhi::execute"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 6324ee32c1b320bbac6638bdbc49a7844ac20d1f\nAuthor: Florian Hahn <flo@fhahn.com>\nDate: Sun Feb 8 20:36:22 2026 +0000\n\n [VPlan] Use PredBB's terminator as insert point for VPIRPhi extracts.\n \n Use PredBB's terminator as insert point in VPIRPhi::execute to make sure\n the extracts are placed after any possibly sunk instructions.\n \n Fixes https://github.com/llvm/llvm-project/issues/180363.\n\ndiff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp\nindex b7eb5e74ed28..4a5145b092d6 100644\n--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp\n+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp\n@@ -1678,7 +1678,7 @@ void VPIRPhi::execute(VPTransformState &State) {\n BasicBlock *PredBB = State.CFG.VPBB2IRBB[PredVPBB];\n // Set insertion point in PredBB in case an extract needs to be generated.\n // TODO: Model extracts explicitly.\n- State.Builder.SetInsertPoint(PredBB, PredBB->getFirstNonPHIIt());\n+ State.Builder.SetInsertPoint(PredBB->getTerminator());\n Value *V = State.get(ExitValue, VPLane(Lane));\n // If there is no existing block for PredBB in the phi, add a new incoming\n // value. Otherwise update the existing incoming value for PredBB.\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/LoopVectorize/lcssa-crashes.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -passes=loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -S %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "exit_phi_sunk_def",
|
| 39 |
+
"test_body": "target datalayout = \"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128\"\n\ndefine i32 @exit_phi_sunk_def(ptr noalias %src, ptr noalias %dst) {\nentry:\n br label %loop\n\nloop: ; preds = %loop, %entry\n %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]\n %ld = load i32, ptr %src, align 4\n %cmp = icmp eq i32 %ld, 0\n %sel = select i1 %cmp, i32 0, i32 2\n %iv.next = add nuw nsw i32 %iv, 1\n store i32 %iv.next, ptr %dst, align 4\n %exit.cond = icmp ult i32 %iv, 2\n br i1 %exit.cond, label %loop, label %exit\n\nexit: ; preds = %loop\n ret i32 %sel\n}\n"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "clang crashes on valid code at -O3 on x86_64-linux-gnu: Assertion `!verifyFunction(*F, &dbgs())' failed",
|
| 46 |
+
"body": "Compiler Explorer: https://godbolt.org/z/cYs5resov\n\nNote:\n- fail: trunk\n- work: 21.1.0 and earlier\n\n```\n[526] % clangtk -v\nclang version 23.0.0git (https://github.com/llvm/llvm-project.git eff21afae01f4a8269a4beb6a7907d2abe6ad82a)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nInstalledDir: /local/home/suz/suz-local/software/local/clang-trunk/bin\nBuild config: +assertions\nFound candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11\nFound candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12\nSelected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12\nCandidate multilib: .;@m64\nCandidate multilib: 32;@m32\nCandidate multilib: x32;@mx32\nSelected multilib: .;@m64\nFound CUDA installation: /usr/local/cuda, version 12.1\n[527] % \n[527] % clangtk -O3 small.c\nInstruction does not dominate all uses!\n %4 = select i1 %2, <4 x i32> zeroinitializer, <4 x i32> splat (i32 2)\n %3 = extractelement <4 x i32> %4, i32 0\nclang-23: /local/suz-local/software/clangbuild/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9884: bool llvm::LoopVectorizePass::processLoop(llvm::Loop*): Assertion `!verifyFunction(*F, &dbgs())' failed.\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.\nStack dump:\n0.\tProgram arguments: /local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23 -cc1 -triple x86_64-unknown-linux-gnu -O3 -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name small.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/local/suz-local/software/emitesting/bugs/20260207-clangtk-m64-O3-build-072223/delta -fcoverage-compilation-dir=/local/suz-local/software/emitesting/bugs/20260207-clangtk-m64-O3-build-072223/delta -resource-dir /local/home/suz/suz-local/software/local/clang-trunk/lib/clang/23 -I /usr/local/include -I /local/suz-local/software/local/include -internal-isystem /local/home/suz/suz-local/software/local/clang-trunk/lib/clang/23/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fmessage-length=130 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -fdwarf2-cfi-asm -o /tmp/small-f0cadb.o -x c small.c\n1.\t<eof> parser at end of file\n2.\tOptimizer\n3.\tRunning pass \"function<eager-inv>(drop-unnecessary-assumes,float2int,lower-constant-intrinsics,chr,loop(loop-rotate<header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,drop-unnecessary-assumes,infer-alignment,loop-load-elim,instcombine<max-iterations=1;no-verify-fixpoint>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,slp-vectorizer,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop-unroll<O3>,transform-warning,sroa<preserve-cfg>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;switch-to-arithmetic;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)\" on module \"small.c\"\n4.\tRunning pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"k\"\n #0 0x000055f9b7427340 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x4527340)\n #1 0x000055f9b742401f llvm::sys::RunSignalHandlers() (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x452401f)\n #2 0x000055f9b7424172 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #3 0x00007f5c913be520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #4 0x00007f5c914129fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\n #5 0x00007f5c914129fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10\n #6 0x00007f5c914129fc pthread_kill ./nptl/pthread_kill.c:89:10\n #7 0x00007f5c913be476 gsignal ./signal/../sysdeps/posix/raise.c:27:6\n #8 0x00007f5c913a47f3 abort ./stdlib/abort.c:81:7\n #9 0x00007f5c913a471b _nl_load_domain ./intl/loadmsgcat.c:1177:9\n#10 0x00007f5c913b5e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n#11 0x000055f9b8f1951b llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x601951b)\n#12 0x000055f9b8f1a8d1 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x601a8d1)\n#13 0x000055f9b8f1aff5 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x601aff5)\n#14 0x000055f9b84fed26 llvm::detail::PassModel<llvm::Function, llvm::LoopVectorizePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x55fed26)\n#15 0x000055f9b6d25892 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x3e25892)\n#16 0x000055f9b42e5506 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x13e5506)\n#17 0x000055f9b6d238a9 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x3e238a9)\n#18 0x000055f9b42e5ba6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x13e5ba6)\n#19 0x000055f9b6d245f5 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x3e245f5)\n#20 0x000055f9b76eb5ce (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0\n#21 0x000055f9b76eeea1 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x47eeea1)\n#22 0x000055f9b7d91aa2 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x4e91aa2)\n#23 0x000055f9b98f3d0c clang::ParseAST(clang::Sema&, bool, bool) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x69f3d0c)\n#24 0x000055f9b80c03c9 clang::FrontendAction::Execute() (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x51c03c9)\n#25 0x000055f9b803dee5 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x513dee5)\n#26 0x000055f9b81b9073 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0x52b9073)\n#27 0x000055f9b3e20de0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0xf20de0)\n#28 0x000055f9b3e1719a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0\n#29 0x000055f9b3e1b538 clang_main(int, char**, llvm::ToolContext const&) (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0xf1b538)\n#30 0x000055f9b3ce200b main (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0xde200b)\n#31 0x00007f5c913a5d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16\n#32 0x00007f5c913a5e40 call_init ./csu/../csu/libc-start.c:128:20\n#33 0x00007f5c913a5e40 __libc_start_main ./csu/../csu/libc-start.c:379:5\n#34 0x000055f9b3e168b5 _start (/local/home/suz/suz-local/software/local/clang-trunk/bin/clang-23+0xf168b5)\nclangtk: error: unable to execute command: Aborted\nclangtk: error: clang frontend command failed due to signal (use -v to see invocation)\nclang version 23.0.0git (https://github.com/llvm/llvm-project.git eff21afae01f4a8269a4beb6a7907d2abe6ad82a)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nInstalledDir: /local/home/suz/suz-local/software/local/clang-trunk/bin\nBuild config: +assertions\nclangtk: note: diagnostic msg: \n********************\n\nPLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:\nPreprocessed source(s) and associated run script(s) are located at:\nclangtk: note: diagnostic msg: /tmp/small-e580ca.c\nclangtk: note: diagnostic msg: /tmp/small-e580ca.sh\nclangtk: note: diagnostic msg: \n\n********************\n[528] % \n[528] % cat small.c\n```\n```c\nstruct a {\n int b;\n int c;\n int d;\n int e;\n int f;\n};\nint *g, i;\nstatic int h;\nextern void s(struct a p);\nextern void t(int *q);\nvoid k() {\n int l = 1;\n unsigned n;\n goto m;\n while (1) {\n i = n;\n l = 0;\n m:\n h = 0;\n for (; h < 3; h++) {\n for (n = 2; n; n++)\n if (*g)\n break;\n if (l)\n t(0);\n }\n }\n}\nint main() {\n struct a o = {0,0,0,0,0};\n if (i)\n s(o);\n if (o.b)\n t(&h);\n return 0;\n}\n```",
|
| 47 |
+
"author": "zhendongsu",
|
| 48 |
+
"labels": [
|
| 49 |
+
"vectorizers",
|
| 50 |
+
"crash"
|
| 51 |
+
],
|
| 52 |
+
"comments": [
|
| 53 |
+
{
|
| 54 |
+
"author": "fhahn",
|
| 55 |
+
"body": "thanks, will check"
|
| 56 |
+
}
|
| 57 |
+
]
|
| 58 |
+
},
|
| 59 |
+
"properties": {
|
| 60 |
+
"is_single_file_fix": true,
|
| 61 |
+
"is_single_func_fix": true
|
| 62 |
+
},
|
| 63 |
+
"verified": true
|
| 64 |
+
}
|
dataset/180780.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "180780",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/180780",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "0215f6b6cf810d9ab6d02fc7bbec5c26ad4701ff",
|
| 6 |
+
"knowledge_cutoff": "2026-02-10T17:09:08Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/LoopVectorize"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "d3afa171ee236dfef4b7cd4b4dd0b0fb165a48cc",
|
| 12 |
+
"components": [
|
| 13 |
+
"LoopVectorize"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/Vectorize/LoopVectorize.cpp": [
|
| 17 |
+
[
|
| 18 |
+
5883,
|
| 19 |
+
5891
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/Vectorize/LoopVectorize.cpp": [
|
| 25 |
+
"LoopVectorizationCostModel::setCostBasedWideningDecision"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit d3afa171ee236dfef4b7cd4b4dd0b0fb165a48cc\nAuthor: Florian Hahn <flo@fhahn.com>\nDate: Wed Feb 11 20:52:07 2026 +0000\n\n [LV] Don't scalarize loads that need predication in legacy CM.\n \n The legacy cost model tries to scalarize loads that are used as\n pointers. Skip if the load would need predicating when scalarized,\n because that would incur very high costs, see useEmulatedMaskMemRefHack.\n \n Fixes https://github.com/llvm/llvm-project/issues/180780.\n\ndiff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\nindex 164d74f1a440..9b2641c2b9bb 100644\n--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\n+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\n@@ -5883,9 +5883,9 @@ void LoopVectorizationCostModel::setCostBasedWideningDecision(ElementCount VF) {\n // if the loaded register is involved in an address computation, it is\n // instead changed here when we know this is the case.\n InstWidening Decision = getWideningDecision(I, VF);\n- if (Decision == CM_Widen || Decision == CM_Widen_Reverse ||\n- (!isPredicatedInst(I) && !Legal->isUniformMemOp(*I, VF) &&\n- Decision == CM_Scalarize)) {\n+ if (!isPredicatedInst(I) &&\n+ (Decision == CM_Widen || Decision == CM_Widen_Reverse ||\n+ (!Legal->isUniformMemOp(*I, VF) && Decision == CM_Scalarize))) {\n // Scalarize a widened load of address or update the cost of a scalar\n // load of an address.\n setWideningDecision(\n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/LoopVectorize/X86/cost-model.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt < %s -passes=loop-vectorize -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx -S"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "known_deref_load_tail_folding",
|
| 39 |
+
"test_body": "target datalayout = \"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128\"\ntarget triple = \"x86_64-apple-macosx10.8.0\"\n\n@src.arr = external global [15 x double]\n@dst.arr.a = external global [10 x double]\n@dst.arr.b = external global [15 x double]\n\ndefine void @known_deref_load_tail_folding() #0 {\nentry:\n br label %loop\n\nloop: ; preds = %loop, %entry\n %iv = phi i64 [ 1, %entry ], [ %iv.next, %loop ]\n %gep.src = getelementptr double, ptr @src.arr, i64 %iv\n %val = load double, ptr %gep.src, align 8\n %cmp = fcmp oeq double %val, 0.000000e+00\n %dst.select = select i1 %cmp, ptr @dst.arr.a, ptr @dst.arr.b\n store double 0.000000e+00, ptr %dst.select, align 8\n %iv.next = add i64 %iv, 1\n %ec = icmp eq i64 %iv.next, 12\n br i1 %ec, label %exit, label %loop\n\nexit: ; preds = %loop\n ret void\n}\n\nattributes #0 = { \"target-cpu\"=\"haswell\" }\n"
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"issue": {
|
| 45 |
+
"title": "[LV]VPlan cost model and legacy cost model disagreed",
|
| 46 |
+
"body": "https://godbolt.org/z/o9sPfa35r\n@fhahn \nMaybe related to https://github.com/llvm/llvm-project/commit/7defb0a4a35817ee7accb310d99912152a542ec2",
|
| 47 |
+
"author": "alexey-bataev",
|
| 48 |
+
"labels": [
|
| 49 |
+
"vectorizers",
|
| 50 |
+
"crash-on-valid"
|
| 51 |
+
],
|
| 52 |
+
"comments": [
|
| 53 |
+
{
|
| 54 |
+
"author": "alexey-bataev",
|
| 55 |
+
"body": "Ping!"
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"author": "fhahn",
|
| 59 |
+
"body": "It's not related to https://github.com/llvm/llvm-project/commit/7defb0a4a35817ee7accb310d99912152a542ec2, but will fix soon"
|
| 60 |
+
}
|
| 61 |
+
]
|
| 62 |
+
},
|
| 63 |
+
"properties": {
|
| 64 |
+
"is_single_file_fix": true,
|
| 65 |
+
"is_single_func_fix": true
|
| 66 |
+
},
|
| 67 |
+
"verified": true
|
| 68 |
+
}
|
dataset/181117.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bug_id": "181117",
|
| 3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/181117",
|
| 4 |
+
"bug_type": "crash",
|
| 5 |
+
"base_commit": "dcb38a4ef788be1276ac1aee5b48a400dd18013f",
|
| 6 |
+
"knowledge_cutoff": "2026-02-12T11:02:10Z",
|
| 7 |
+
"lit_test_dir": [
|
| 8 |
+
"llvm/test/Transforms/AggressiveInstCombine"
|
| 9 |
+
],
|
| 10 |
+
"hints": {
|
| 11 |
+
"fix_commit": "4167b285e228ee1cfff77f30eee66cbc7b4dd3db",
|
| 12 |
+
"components": [
|
| 13 |
+
"AggressiveInstCombine"
|
| 14 |
+
],
|
| 15 |
+
"bug_location_lineno": {
|
| 16 |
+
"llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp": [
|
| 17 |
+
[
|
| 18 |
+
915,
|
| 19 |
+
921
|
| 20 |
+
]
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
"bug_location_funcname": {
|
| 24 |
+
"llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp": [
|
| 25 |
+
"mergeConsecutivePartStores"
|
| 26 |
+
]
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"patch": "commit 4167b285e228ee1cfff77f30eee66cbc7b4dd3db\nAuthor: Nikita Popov <npopov@redhat.com>\nDate: Thu Feb 12 14:41:00 2026 +0100\n\n [AggressiveInstCombine] Create zext during store merge (#181125)\n \n The top extracted value can include shifted-in zero bits. In that case\n we should emit a zext before the new store.\n \n Fixes https://github.com/llvm/llvm-project/issues/181117.\n\ndiff --git a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp\nindex 3341368208c2..797fabde3f25 100644\n--- a/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp\n+++ b/llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp\n@@ -915,7 +915,7 @@ static bool mergeConsecutivePartStores(ArrayRef<PartStore> Parts,\n Value *Val = First.Val;\n if (First.ValOffset != 0)\n Val = Builder.CreateLShr(Val, First.ValOffset);\n- Val = Builder.CreateTrunc(Val, NewTy);\n+ Val = Builder.CreateZExtOrTrunc(Val, NewTy);\n StoreInst *Store = Builder.CreateAlignedStore(\n Val, First.Store->getPointerOperand(), First.Store->getAlign());\n \n",
|
| 30 |
+
"tests": [
|
| 31 |
+
{
|
| 32 |
+
"file": "llvm/test/Transforms/AggressiveInstCombine/X86/store-merge.ll",
|
| 33 |
+
"commands": [
|
| 34 |
+
"opt -S -passes=aggressive-instcombine -mtriple=x86_64-unknown-linux-gnu < %s"
|
| 35 |
+
],
|
| 36 |
+
"tests": [
|
| 37 |
+
{
|
| 38 |
+
"test_name": "test_store_same_parts_twice",
|
| 39 |
+
"test_body": "define void @test_store_same_parts_twice(i32 %x, ptr %p) {\n %x.0 = trunc i32 %x to i8\n store i8 %x.0, ptr %p, align 1\n %shr.1 = lshr i32 %x, 8\n %x.1 = trunc i32 %shr.1 to i8\n %gep.1 = getelementptr i8, ptr %p, i64 1\n store i8 %x.1, ptr %gep.1, align 1\n %gep.2 = getelementptr i8, ptr %p, i64 2\n store i8 %x.0, ptr %gep.2, align 1\n %gep.3 = getelementptr i8, ptr %p, i64 3\n store i8 %x.1, ptr %gep.3, align 1\n ret void\n}\n"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"test_name": "test_zext_store",
|
| 43 |
+
"test_body": "define void @test_zext_store(i56 %arg, ptr %p) {\n %lo = trunc i56 %arg to i32\n store i32 %lo, ptr %p, align 4\n %shr = lshr i56 %arg, 32\n %hi = trunc i56 %shr to i32\n %p.4 = getelementptr i8, ptr %p, i64 4\n store i32 %hi, ptr %p.4, align 4\n ret void\n}\n"
|
| 44 |
+
}
|
| 45 |
+
]
|
| 46 |
+
}
|
| 47 |
+
],
|
| 48 |
+
"issue": {
|
| 49 |
+
"title": "[AggressiveInstCombine] Invalid trunc creation in store merge optimization",
|
| 50 |
+
"body": "```llvm\ntarget triple = \"x86_64-unknown-linux-gnu\"\n\ndefine void @test(i56 %arg, ptr %p) {\n %lo = trunc i56 %arg to i32\n store i32 %lo, ptr %p, align 4\n %shr = lshr i56 %arg, 32\n %hi = trunc i56 %shr to i32\n %p.4 = getelementptr i8, ptr %p, i64 4\n store i32 %hi, ptr %p.4, align 4\n ret void\n}\n```\n\n> opt: /home/npopov/repos/llvm-project/llvm/lib/IR/Instructions.cpp:3043: static CastInst *llvm::CastInst::Create(Instruction::CastOps, Value *, Type *, const Twine &, InsertPosition): Assertion `castIsValid(op, S, Ty) && \"Invalid cast!\"' failed.\n",
|
| 51 |
+
"author": "nikic",
|
| 52 |
+
"labels": [
|
| 53 |
+
"crash",
|
| 54 |
+
"llvm:instcombine"
|
| 55 |
+
],
|
| 56 |
+
"comments": []
|
| 57 |
+
},
|
| 58 |
+
"properties": {
|
| 59 |
+
"is_single_file_fix": true,
|
| 60 |
+
"is_single_func_fix": true
|
| 61 |
+
},
|
| 62 |
+
"verified": true
|
| 63 |
+
}
|
scripts/extract_from_issues.py
CHANGED
|
@@ -34,7 +34,7 @@ session.headers.update(
|
|
| 34 |
)
|
| 35 |
|
| 36 |
issue_id_begin = 76663 # Since 2024-01-01
|
| 37 |
-
issue_id_end =
|
| 38 |
|
| 39 |
|
| 40 |
def wait(progress):
|
|
|
|
| 34 |
)
|
| 35 |
|
| 36 |
issue_id_begin = 76663 # Since 2024-01-01
|
| 37 |
+
issue_id_end = 181129
|
| 38 |
|
| 39 |
|
| 40 |
def wait(progress):
|
scripts/llvm_helper.py
CHANGED
|
@@ -129,7 +129,7 @@ def build(max_build_jobs: int, additional_cmake_args=[]):
|
|
| 129 |
"-DLLVM_ABI_BREAKING_CHECKS=WITH_ASSERTS",
|
| 130 |
"-DLLVM_ENABLE_WARNINGS=OFF",
|
| 131 |
"-DLLVM_APPEND_VC_REV=OFF",
|
| 132 |
-
"-DLLVM_TARGETS_TO_BUILD='X86;RISCV;AArch64;SystemZ;Hexagon;PowerPC;'",
|
| 133 |
"-DLLVM_PARALLEL_LINK_JOBS=4",
|
| 134 |
"-DLLVM_INCLUDE_EXAMPLES=OFF",
|
| 135 |
"-DLLVM_ENABLE_ZSTD=OFF",
|
|
|
|
| 129 |
"-DLLVM_ABI_BREAKING_CHECKS=WITH_ASSERTS",
|
| 130 |
"-DLLVM_ENABLE_WARNINGS=OFF",
|
| 131 |
"-DLLVM_APPEND_VC_REV=OFF",
|
| 132 |
+
"-DLLVM_TARGETS_TO_BUILD='X86;RISCV;AArch64;SystemZ;Hexagon;PowerPC;NVPTX;'",
|
| 133 |
"-DLLVM_PARALLEL_LINK_JOBS=4",
|
| 134 |
"-DLLVM_INCLUDE_EXAMPLES=OFF",
|
| 135 |
"-DLLVM_ENABLE_ZSTD=OFF",
|
scripts/postfix_extract.py
CHANGED
|
@@ -172,6 +172,7 @@ fix_commit_map = {
|
|
| 172 |
"155162": None, # Missing reproducer
|
| 173 |
"155184": None, # Duplicate of #117157
|
| 174 |
"156190": None, # Cannot verify the fix
|
|
|
|
| 175 |
"157332": None, # Duplicate of #131488
|
| 176 |
"158197": None, # Cannot reproduce with Alive2
|
| 177 |
"161974": None, # Duplicate of #157314
|
|
@@ -179,13 +180,21 @@ fix_commit_map = {
|
|
| 179 |
"160912": None, # Unsupported intrinsic llvm.stepvector.nxv2i64
|
| 180 |
"162498": None, # Cannot reproduce with Alive2
|
| 181 |
"162512": None, # Unterminated loop in the reproducer
|
|
|
|
|
|
|
| 182 |
"168576": None, # Duplicate of #168512
|
| 183 |
"168263": None, # Missing reproducer
|
| 184 |
"168902": None, # Cannot reproduce with Alive2
|
| 185 |
"170211": None, # Reverted
|
| 186 |
"172609": None, # Depends on additional code changes
|
| 187 |
"172647": None, # Crash on invalid input
|
| 188 |
-
"172817": None, # Crash on invalid input
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
}
|
| 190 |
|
| 191 |
if issue_id in fix_commit_map:
|
|
|
|
| 172 |
"155162": None, # Missing reproducer
|
| 173 |
"155184": None, # Duplicate of #117157
|
| 174 |
"156190": None, # Cannot verify the fix
|
| 175 |
+
"157217": None, # Invalid reproducer
|
| 176 |
"157332": None, # Duplicate of #131488
|
| 177 |
"158197": None, # Cannot reproduce with Alive2
|
| 178 |
"161974": None, # Duplicate of #157314
|
|
|
|
| 180 |
"160912": None, # Unsupported intrinsic llvm.stepvector.nxv2i64
|
| 181 |
"162498": None, # Cannot reproduce with Alive2
|
| 182 |
"162512": None, # Unterminated loop in the reproducer
|
| 183 |
+
"166535": None, # Duplicate of #165031
|
| 184 |
+
"167813": None, # Still crashes on the regression testsuite
|
| 185 |
"168576": None, # Duplicate of #168512
|
| 186 |
"168263": None, # Missing reproducer
|
| 187 |
"168902": None, # Cannot reproduce with Alive2
|
| 188 |
"170211": None, # Reverted
|
| 189 |
"172609": None, # Depends on additional code changes
|
| 190 |
"172647": None, # Crash on invalid input
|
| 191 |
+
"172817": None, # Crash on invalid input
|
| 192 |
+
"175295": None, # Cannot verify the fix
|
| 193 |
+
"176674": None, # Crash on invalid input
|
| 194 |
+
"177772": None, # Cannot reproduce the crash
|
| 195 |
+
"177780": None, # Duplicate of #177772
|
| 196 |
+
"178275": None, # Crash on invalid input
|
| 197 |
+
"180846": None, # Cannot reproduce the hang (missing timeout)
|
| 198 |
}
|
| 199 |
|
| 200 |
if issue_id in fix_commit_map:
|