Sync
Browse files- dataset.jsonl +0 -0
- dataset/129236.json +56 -0
- dataset/129242.json +55 -0
- dataset/130250.json +197 -0
- scripts/extract_from_issues.py +1 -1
- scripts/postfix_extract.py +2 -0
dataset.jsonl
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
dataset/129236.json
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bug_id": "129236",
|
3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/129236",
|
4 |
+
"bug_type": "crash",
|
5 |
+
"base_commit": "fa5db05ca36a732bffb8128ff017c575ec6e1201",
|
6 |
+
"knowledge_cutoff": "2025-02-28T12:37:14Z",
|
7 |
+
"lit_test_dir": [
|
8 |
+
"llvm/test/Transforms/LoopVectorize"
|
9 |
+
],
|
10 |
+
"hints": {
|
11 |
+
"fix_commit": "f937b17e8570082d4710b6dca7a91b5c235c1c70",
|
12 |
+
"components": [
|
13 |
+
"LoopVectorize"
|
14 |
+
],
|
15 |
+
"bug_location_lineno": {
|
16 |
+
"llvm/lib/Transforms/Vectorize/LoopVectorize.cpp": [
|
17 |
+
[
|
18 |
+
6673,
|
19 |
+
6679
|
20 |
+
]
|
21 |
+
]
|
22 |
+
},
|
23 |
+
"bug_location_funcname": {
|
24 |
+
"llvm/lib/Transforms/Vectorize/LoopVectorize.cpp": [
|
25 |
+
"LoopVectorizationCostModel::getInstructionCost"
|
26 |
+
]
|
27 |
+
}
|
28 |
+
},
|
29 |
+
"patch": "commit f937b17e8570082d4710b6dca7a91b5c235c1c70\nAuthor: Florian Hahn <[email protected]>\nDate: Sun Mar 2 10:55:42 2025 +0000\n\n [LV] Don't query SCEV for non-invariant values in cost model.\n \n This fixes a divergence between VPlan and legacy cost model, matching\n behavior further up in getInstructionCost as well.\n \n Fixes https://github.com/llvm/llvm-project/issues/129236.\n\ndiff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\nindex c447fa484359..f3bdc95713af 100644\n--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\n+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp\n@@ -6673,7 +6673,8 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,\n // Certain instructions can be cheaper to vectorize if they have a constant\n // second vector operand. One example of this are shifts on x86.\n Value *Op2 = I->getOperand(1);\n- if (!isa<Constant>(Op2) && PSE.getSE()->isSCEVable(Op2->getType()) &&\n+ if (!isa<Constant>(Op2) && TheLoop->isLoopInvariant(Op2) &&\n+ PSE.getSE()->isSCEVable(Op2->getType()) &&\n isa<SCEVConstant>(PSE.getSCEV(Op2))) {\n Op2 = cast<SCEVConstant>(PSE.getSCEV(Op2))->getValue();\n }\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": "cost_ashr_with_op_known_invariant_via_scev",
|
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 i32 @cost_ashr_with_op_known_invariant_via_scev(i8 %a) {\nentry:\n %cmp.i = icmp eq i16 0, 0\n %conv.i = sext i16 0 to i32\n %conv5.i = sext i8 %a to i32\n br label %loop.header\n\nloop.header: ; preds = %loop.latch, %entry\n %iv = phi i8 [ 100, %entry ], [ %iv.next, %loop.latch ]\n br i1 %cmp.i, label %then, label %else\n\nthen: ; preds = %else, %loop.header\n %p.1 = phi i32 [ %rem.i, %else ], [ 0, %loop.header ]\n %shr.i = ashr i32 %conv5.i, %p.1\n %tobool6.not.i = icmp eq i32 %shr.i, 0\n %sext.i = shl i32 %p.1, 24\n %0 = ashr exact i32 %sext.i, 24\n %1 = select i1 %tobool6.not.i, i32 %0, i32 0\n br label %loop.latch\n\nelse: ; preds = %loop.header\n %rem.i = urem i32 -1, %conv.i\n %cmp3.i = icmp sgt i32 %rem.i, 1\n br i1 %cmp3.i, label %loop.latch, label %then\n\nloop.latch: ; preds = %else, %then\n %p.2 = phi i32 [ 0, %else ], [ %1, %then ]\n %iv.next = add i8 %iv, -1\n %ec = icmp eq i8 %iv.next, 0\n br i1 %ec, label %exit, label %loop.header\n\nexit: ; preds = %loop.latch\n ret i32 %p.2\n}\n"
|
40 |
+
}
|
41 |
+
]
|
42 |
+
}
|
43 |
+
],
|
44 |
+
"issue": {
|
45 |
+
"title": "[clang] Crash at -O2: Assertion Assertion `(BestFactor.Width == LegacyVF.Width || PlanForEarlyExitLoop...' failed.",
|
46 |
+
"body": "This code crashes at `-O2`:\n\n```c\nchar a;\nstruct b {\n short c;\n char d;\n long e;\n int f;\n} static g;\nint h;\nvoid i(struct b j) {\n char k;\n int l;\n for (; j.d; --j.d) {\n l = g.c == 0 ? 0 : 4294967295U % g.c;\n k = l >= 2 || a >> l ? 0 : l;\n h = k;\n }\n}\nvoid m() { i(g); }\n```\n\nCompiler Explorer: https://godbolt.org/z/WG85qYnc6\n\nBisected to https://github.com/llvm/llvm-project/commit/30f3752e54fa7cd595a434a985efbe9a7abe9b65, which was committed by @fhahn \n\nCrash:\n\n```console\nclang: /root/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7589: llvm::VectorizationFactor llvm::LoopVectorizationPlanner::computeBestVF(): Assertion `(BestFactor.Width == LegacyVF.Width || PlanForEarlyExitLoop || planContainsAdditionalSimplifications(getPlanFor(BestFactor.Width), CostCtx, OrigLoop) || planContainsAdditionalSimplifications(getPlanFor(LegacyVF.Width), CostCtx, OrigLoop)) && \" VPlan cost model and legacy cost model disagreed\"' failed.\n```\n\nBacktrace:\n\n```console\nStack dump:\n0.\tProgram arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O2 -Wall -Wextra <source>\n1.\t<eof> parser at end of file\n2.\tOptimizer\n3.\tRunning pass \"function<eager-inv>(float2int,lower-constant-intrinsics,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;>,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-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<O2>,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;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 \"<source>\"\n4.\tRunning pass \"loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>\" on function \"i\"\n #0 0x0000000003e76828 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3e76828)\n #1 0x0000000003e744e4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3e744e4)\n #2 0x0000000003dc0e18 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0\n #3 0x00007e3b78e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #4 0x00007e3b78e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)\n #5 0x00007e3b78e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)\n #6 0x00007e3b78e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)\n #7 0x00007e3b78e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)\n #8 0x00007e3b78e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)\n #9 0x00000000059b6042 llvm::LoopVectorizationPlanner::computeBestVF() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x59b6042)\n#10 0x00000000059cd46c llvm::LoopVectorizePass::processLoop(llvm::Loop*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x59cd46c)\n#11 0x00000000059cfb19 llvm::LoopVectorizePass::runImpl(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x59cfb19)\n#12 0x00000000059d0193 llvm::LoopVectorizePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x59d0193)\n#13 0x0000000005546d4e 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/clang+0x5546d4e)\n#14 0x000000000381d3f0 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x381d3f0)\n#15 0x000000000119ab8e 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/clang+0x119ab8e)\n#16 0x000000000381bd0b llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x381bd0b)\n#17 0x0000000001199e3e 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/clang+0x1199e3e)\n#18 0x000000000381b710 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x381b710)\n#19 0x00000000041305e8 (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#20 0x000000000413485e 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*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x413485e)\n#21 0x0000000004835d60 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4835d60)\n#22 0x000000000642100c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x642100c)\n#23 0x0000000004836168 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4836168)\n#24 0x0000000004afe6e5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4afe6e5)\n#25 0x0000000004a81dce clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4a81dce)\n#26 0x0000000004bec53e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4bec53e)\n#27 0x0000000000d4401f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd4401f)\n#28 0x0000000000d3b93a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0\n#29 0x000000000487e099 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0\n#30 0x0000000003dc12c4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3dc12c4)\n#31 0x000000000487e68f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0\n#32 0x00000000048412ad clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x48412ad)\n#33 0x000000000484232e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x484232e)\n#34 0x000000000484a2c5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x484a2c5)\n#35 0x0000000000d40e13 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd40e13)\n#36 0x0000000000c11aa4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xc11aa4)\n#37 0x00007e3b78e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)\n#38 0x00007e3b78e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)\n#39 0x0000000000d3b3e5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xd3b3e5)\n```",
|
47 |
+
"author": "cardigan1008",
|
48 |
+
"labels": [
|
49 |
+
"regression",
|
50 |
+
"vectorizers",
|
51 |
+
"crash"
|
52 |
+
],
|
53 |
+
"comments": []
|
54 |
+
},
|
55 |
+
"verified": true
|
56 |
+
}
|
dataset/129242.json
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bug_id": "129242",
|
3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/129242",
|
4 |
+
"bug_type": "crash",
|
5 |
+
"base_commit": "5faa5f848a35de13196f2f516f51aa970da942b4",
|
6 |
+
"knowledge_cutoff": "2025-02-28T13:35:26Z",
|
7 |
+
"lit_test_dir": [
|
8 |
+
"llvm/test/Transforms/SLPVectorizer"
|
9 |
+
],
|
10 |
+
"hints": {
|
11 |
+
"fix_commit": "a36a67c79afaa1fdd0dbe0440ec852fd4eb3a532",
|
12 |
+
"components": [
|
13 |
+
"SLPVectorizer"
|
14 |
+
],
|
15 |
+
"bug_location_lineno": {
|
16 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
17 |
+
[
|
18 |
+
11425,
|
19 |
+
11435
|
20 |
+
]
|
21 |
+
]
|
22 |
+
},
|
23 |
+
"bug_location_funcname": {
|
24 |
+
"llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp": [
|
25 |
+
"BoUpSLP::getEntryCost"
|
26 |
+
]
|
27 |
+
}
|
28 |
+
},
|
29 |
+
"patch": "commit a36a67c79afaa1fdd0dbe0440ec852fd4eb3a532\nAuthor: Alexey Bataev <[email protected]>\nDate: Fri Feb 28 13:15:46 2025 -0800\n\n [SLP]Fix the analysis of the user buildvector nodes for minbitwidth\n \n If the user node is a buildvector/gather node and it has no internal\n instructions state, need to check properly for this state and check the\n type of the node itself, not its operands.\n \n Fixes #129242\n\ndiff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\nindex 4a68e0ee5989..4f3fd6d53909 100644\n--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp\n@@ -11425,11 +11425,14 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,\n E->Idx != 0 &&\n (E->getOpcode() != Instruction::Load || E->UserTreeIndex)) {\n const EdgeInfo &EI = E->UserTreeIndex;\n- if (EI.UserTE->getOpcode() != Instruction::Select ||\n+ if (!EI.UserTE->hasState() ||\n+ EI.UserTE->getOpcode() != Instruction::Select ||\n EI.EdgeIdx != 0) {\n auto UserBWIt = MinBWs.find(EI.UserTE);\n Type *UserScalarTy =\n- EI.UserTE->getOperand(EI.EdgeIdx).front()->getType();\n+ EI.UserTE->isGather()\n+ ? EI.UserTE->Scalars.front()->getType()\n+ : EI.UserTE->getOperand(EI.EdgeIdx).front()->getType();\n if (UserBWIt != MinBWs.end())\n UserScalarTy = IntegerType::get(ScalarTy->getContext(),\n UserBWIt->second.first);\n",
|
30 |
+
"tests": [
|
31 |
+
{
|
32 |
+
"file": "llvm/test/Transforms/SLPVectorizer/X86/user-buildvector-with-minbiwidth.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 i32 @test(i8 %0, i32 %conv2, i1 %cmp.i, i64 %shl.i) {\n;\nentry:\n %conv21 = sext i8 %0 to i32\n %conv7 = zext i32 %conv2 to i64\n %cond.i = shl i64 %conv7, %shl.i\n %1 = and i64 %cond.i, 4294967295\n %.not = icmp eq i64 %1, 1\n %conv7.1 = zext i32 %conv2 to i64\n %cond.i.1 = shl i64 %conv7.1, %shl.i\n %2 = and i64 %cond.i.1, 4294967295\n %.not.1 = icmp eq i64 %2, 1\n %sub.2 = or i32 %conv21, 1\n %cond.2 = select i1 %cmp.i, i32 %sub.2, i32 0\n %conv7.2 = zext i32 %cond.2 to i64\n %cmp.i.2 = icmp slt i32 %cond.2, 1\n %shl.i.2 = zext i1 %cmp.i.2 to i64\n %cond.i.2 = shl i64 %conv7.2, %shl.i.2\n %3 = and i64 %cond.i.2, 4294967295\n %.not.2 = icmp eq i64 %3, 1\n %sub.3 = or i32 %conv21, 1\n %cond.3 = select i1 %cmp.i, i32 %sub.3, i32 0\n %conv7.3 = zext i32 %cond.3 to i64\n %cmp.i.3 = icmp slt i32 %cond.3, 1\n %shl.i.3 = zext i1 %cmp.i.3 to i64\n %cond.i.3 = shl i64 %conv7.3, %shl.i.3\n %4 = and i64 %cond.i.3, 4294967295\n %.not.3 = icmp eq i64 %4, 1\n %sub.4 = or i32 %conv21, 1\n %cond.4 = select i1 %cmp.i, i32 %sub.4, i32 0\n %conv7.4 = zext i32 %cond.4 to i64\n %cmp.i.4 = icmp slt i32 %cond.4, 1\n %shl.i.4 = zext i1 %cmp.i.4 to i64\n %cond.i.4 = shl i64 %conv7.4, %shl.i.4\n %5 = and i64 %cond.i.4, 4294967295\n %.not.4 = icmp eq i64 %5, 1\n %sub.5 = or i32 %conv21, 1\n %cond.5 = select i1 %cmp.i, i32 %sub.5, i32 0\n %conv7.5 = zext i32 %cond.5 to i64\n %cmp.i.5 = icmp slt i32 %cond.5, 1\n %shl.i.5 = zext i1 %cmp.i.5 to i64\n %cond.i.5 = shl i64 %conv7.5, %shl.i.5\n %6 = and i64 %cond.i.5, 4294967295\n %.not.5 = icmp eq i64 %6, 1\n %sub.6 = or i32 %conv21, 1\n %cond.6 = select i1 %cmp.i, i32 %sub.6, i32 0\n %conv7.6 = zext i32 %cond.6 to i64\n %cmp.i.6 = icmp slt i32 %cond.6, 1\n %shl.i.6 = zext i1 %cmp.i.6 to i64\n %cond.i.6 = shl i64 %conv7.6, %shl.i.6\n %7 = and i64 %cond.i.6, 4294967295\n %.not.6 = icmp eq i64 %7, 1\n %sub.7 = or i32 %conv21, 1\n %cond.7 = select i1 %cmp.i, i32 %sub.7, i32 0\n %conv7.7 = zext i32 %cond.7 to i64\n %cmp.i.7 = icmp slt i32 %cond.7, 1\n %shl.i.7 = zext i1 %cmp.i.7 to i64\n %cond.i.7 = shl i64 %conv7.7, %shl.i.7\n %8 = and i64 %cond.i.7, 4294967295\n %.not.7 = icmp eq i64 %8, 1\n %sub.8 = or i32 %conv21, 1\n %cond.8 = select i1 %cmp.i, i32 %sub.8, i32 0\n %conv7.8 = zext i32 %cond.8 to i64\n %cmp.i.8 = icmp slt i32 %cond.8, 1\n %shl.i.8 = zext i1 %cmp.i.8 to i64\n %cond.i.8 = shl i64 %conv7.8, %shl.i.8\n %9 = and i64 %cond.i.8, 4294967295\n %.not.8 = icmp eq i64 %9, 1\n %sub.9 = or i32 %conv21, 1\n %cond.9 = select i1 %cmp.i, i32 %sub.9, i32 0\n %conv7.9 = zext i32 %cond.9 to i64\n %cmp.i.9 = icmp slt i32 %cond.9, 1\n %shl.i.9 = zext i1 %cmp.i.9 to i64\n %cond.i.9 = shl i64 %conv7.9, %shl.i.9\n %10 = and i64 %cond.i.9, 4294967295\n %.not.9 = icmp eq i64 %10, 1\n br label %while.body\n\nwhile.body:\n br i1 %.not, label %for.inc, label %if.then10\n\nif.then10:\n br label %for.inc\n\nfor.inc:\n br i1 %.not.1, label %for.inc.1, label %if.then10.1\n\nif.then10.1:\n br label %for.inc.1\n\nfor.inc.1:\n br i1 %.not.2, label %for.inc.2, label %if.then10.2\n\nif.then10.2:\n br label %for.inc.2\n\nfor.inc.2:\n br i1 %.not.3, label %for.inc.3, label %if.then10.3\n\nif.then10.3:\n br label %for.inc.3\n\nfor.inc.3:\n br i1 %.not.4, label %for.inc.4, label %if.then10.4\n\nif.then10.4:\n br label %for.inc.4\n\nfor.inc.4:\n br i1 %.not.5, label %for.inc.5, label %if.then10.5\n\nif.then10.5:\n br label %for.inc.5\n\nfor.inc.5:\n br i1 %.not.6, label %for.inc.6, label %if.then10.6\n\nif.then10.6:\n br label %for.inc.6\n\nfor.inc.6:\n br i1 %.not.7, label %for.inc.7, label %if.then10.7\n\nif.then10.7:\n br label %for.inc.7\n\nfor.inc.7:\n br i1 %.not.8, label %for.inc.8, label %if.then10.8\n\nif.then10.8:\n br label %for.inc.8\n\nfor.inc.8:\n br i1 %.not.9, label %while.body, label %if.then10.9\n\nif.then10.9:\n br label %while.body\n}"
|
40 |
+
}
|
41 |
+
]
|
42 |
+
}
|
43 |
+
],
|
44 |
+
"issue": {
|
45 |
+
"title": "clang crashes on valid code at -O{2,3} on x86_64-linux-gnu: Assertion `valid() && \"InstructionsState is invalid.\"' failed",
|
46 |
+
"body": "It appears to be a recent regression as it doesn't reproduce with 19.1.0 and earlier.\n\nCompiler Explorer: https://godbolt.org/z/8KTq9hGv9\n\n```\n[516] % clangtk -v\nclang version 21.0.0git (https://github.com/llvm/llvm-project.git d0edd931bcc328b9502289d346f2b2219341f853)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nInstalledDir: /local/suz-local/software/local/clang-trunk/bin\nBuild config: +assertions\nFound candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10\nFound candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11\nFound candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9\nSelected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11\nCandidate multilib: .;@m64\nSelected multilib: .;@m64\n[517] % \n[517] % clangtk -O2 -w small.c\nclang-21: /local/suz-local/software/clangbuild/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:821: llvm::Instruction* {anonymous}::InstructionsState::getMainOp() const: Assertion `valid() && \"InstructionsState 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: /local/suz-local/software/local/clang-trunk/bin/clang-21 -cc1 -triple x86_64-unknown-linux-gnu -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/20250227-clangtk-m64-O3-build-235136/delta -fcoverage-compilation-dir=/local/suz-local/software/emitesting/bugs/20250227-clangtk-m64-O3-build-235136/delta -resource-dir /local/suz-local/software/local/clang-trunk/lib/clang/21 -I /usr/local/include -I /local/suz-local/software/local/include -internal-isystem /local/suz-local/software/local/clang-trunk/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -w -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/small-933a0f.o -x c small.c\n1.\t<eof> parser at end of file\n2.\tOptimizer\n3.\tRunning pass \"function<eager-inv>(float2int,lower-constant-intrinsics,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;>,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-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<O2>,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;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 \"slp-vectorizer\" on function \"main\"\n #0 0x00005597e9b142df llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x455e2df)\n #1 0x00005597e9b11ab4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0\n #2 0x00007fa06c8aa420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)\n #3 0x00007fa06c2e100b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1\n #4 0x00007fa06c2c0859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7\n #5 0x00007fa06c2c0729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8\n #6 0x00007fa06c2c0729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34\n #7 0x00007fa06c2d1fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)\n #8 0x00005597eb591745 (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x5fdb745)\n #9 0x00005597eb62a4e5 llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallPtrSetImpl<llvm::Value*>&)::'lambda0'(llvm::function_ref<llvm::InstructionCost (unsigned int)>, llvm::function_ref<llvm::InstructionCost (llvm::InstructionCost)>)::operator()(llvm::function_ref<llvm::InstructionCost (unsigned int)>, llvm::function_ref<llvm::InstructionCost (llvm::InstructionCost)>) const SLPVectorizer.cpp:0:0\n#10 0x00005597eb633034 llvm::slpvectorizer::BoUpSLP::getEntryCost(llvm::slpvectorizer::BoUpSLP::TreeEntry const*, llvm::ArrayRef<llvm::Value*>, llvm::SmallPtrSetImpl<llvm::Value*>&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x607d034)\n#11 0x00005597eb668741 llvm::slpvectorizer::BoUpSLP::getTreeCost(llvm::ArrayRef<llvm::Value*>) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x60b2741)\n#12 0x00005597eb672691 llvm::SLPVectorizerPass::tryToVectorizeList(llvm::ArrayRef<llvm::Value*>, llvm::slpvectorizer::BoUpSLP&, bool) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x60bc691)\n#13 0x00005597eb676e5e bool llvm::SLPVectorizerPass::vectorizeCmpInsts<std::reverse_iterator<llvm::CmpInst* const*>>(llvm::iterator_range<std::reverse_iterator<llvm::CmpInst* const*>>, llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x60c0e5e)\n#14 0x00005597eb6773db llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&)::'lambda3'(bool)::operator()(bool) const SLPVectorizer.cpp:0:0\n#15 0x00005597eb67ac20 llvm::SLPVectorizerPass::vectorizeChainsInBlock(llvm::BasicBlock*, llvm::slpvectorizer::BoUpSLP&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x60c4c20)\n#16 0x00005597eb681396 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#17 0x00005597eb681ef3 llvm::SLPVectorizerPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x60cbef3)\n#18 0x00005597eb104166 llvm::detail::PassModel<llvm::Function, llvm::SLPVectorizerPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x5b4e166)\n#19 0x00005597e948caf9 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x3ed6af9)\n#20 0x00005597e6d6c406 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/suz-local/software/local/clang-trunk/bin/clang-21+0x17b6406)\n#21 0x00005597e948b362 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x3ed5362)\n#22 0x00005597e6d6a4b6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x17b44b6)\n#23 0x00005597e948ad81 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x3ed4d81)\n#24 0x00005597e9ddb283 (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#25 0x00005597e9ddf573 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/suz-local/software/local/clang-trunk/bin/clang-21+0x4829573)\n#26 0x00005597ea51bba0 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x4f65ba0)\n#27 0x00005597ebe39acc clang::ParseAST(clang::Sema&, bool, bool) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x6883acc)\n#28 0x00005597ea51bfc8 clang::CodeGenAction::ExecuteAction() (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x4f65fc8)\n#29 0x00005597ea7f2779 clang::FrontendAction::Execute() (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x523c779)\n#30 0x00005597ea77325e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x51bd25e)\n#31 0x00005597ea8e7626 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x5331626)\n#32 0x00005597e68fefb7 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x1348fb7)\n#33 0x00005597e68f66ea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0\n#34 0x00005597e68fa97a clang_main(int, char**, llvm::ToolContext const&) (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x134497a)\n#35 0x00005597e67edccb main (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x1237ccb)\n#36 0x00007fa06c2c2083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3\n#37 0x00005597e68f617e _start (/local/suz-local/software/local/clang-trunk/bin/clang-21+0x134017e)\nclangtk: error: unable to execute command: Aborted\nclangtk: error: clang frontend command failed due to signal (use -v to see invocation)\nclang version 21.0.0git (https://github.com/llvm/llvm-project.git d0edd931bcc328b9502289d346f2b2219341f853)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nInstalledDir: /local/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-fd80bc.c\nclangtk: note: diagnostic msg: /tmp/small-fd80bc.sh\nclangtk: note: diagnostic msg: \n\n********************\n[518] % \n[518] % cat small.c\nint a[1], g;\nchar b, c;\nvolatile int d;\nlong e, f;\nlong h(long i) { return i > 1 ? i : i << 1; }\nint main() {\n if (g)\n while (1) {\n b = 0;\n for (; b < 10; b++) {\n e = c & b ? 0 : c - b;\n f = h(e);\n g = (a != 0) % (unsigned)f;\n if (g)\n d;\n }\n }\n return 0;\n}\n```\n\n",
|
47 |
+
"author": "zhendongsu",
|
48 |
+
"labels": [
|
49 |
+
"llvm:SLPVectorizer",
|
50 |
+
"crash"
|
51 |
+
],
|
52 |
+
"comments": []
|
53 |
+
},
|
54 |
+
"verified": true
|
55 |
+
}
|
dataset/130250.json
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bug_id": "130250",
|
3 |
+
"issue_url": "https://github.com/llvm/llvm-project/issues/130250",
|
4 |
+
"bug_type": "crash",
|
5 |
+
"base_commit": "3ed4daf9a749fe8590ad291f63fabce48fb4135f",
|
6 |
+
"knowledge_cutoff": "2025-03-07T05:51:40Z",
|
7 |
+
"lit_test_dir": [
|
8 |
+
"llvm/test/Transforms/PhaseOrdering",
|
9 |
+
"llvm/test/Transforms/VectorCombine"
|
10 |
+
],
|
11 |
+
"hints": {
|
12 |
+
"fix_commit": "0ee8f699780569d7a6b94d61cd833285bb67eca1",
|
13 |
+
"components": [
|
14 |
+
"VectorCombine"
|
15 |
+
],
|
16 |
+
"bug_location_lineno": {
|
17 |
+
"llvm/lib/Transforms/Vectorize/VectorCombine.cpp": [
|
18 |
+
[
|
19 |
+
2037,
|
20 |
+
2043
|
21 |
+
],
|
22 |
+
[
|
23 |
+
2051,
|
24 |
+
2074
|
25 |
+
]
|
26 |
+
]
|
27 |
+
},
|
28 |
+
"bug_location_funcname": {
|
29 |
+
"llvm/lib/Transforms/Vectorize/VectorCombine.cpp": [
|
30 |
+
"VectorCombine::foldShuffleOfSelects"
|
31 |
+
]
|
32 |
+
}
|
33 |
+
},
|
34 |
+
"patch": "commit 0ee8f699780569d7a6b94d61cd833285bb67eca1\nAuthor: hanbeom <[email protected]>\nDate: Sat Mar 8 01:40:26 2025 +0900\n\n [VectorCombine] Fix invalid shuffle cost argument of foldShuffleOfSelects (#130281)\n \n In the previous code (#128032), it specified the destination vector as the\n getShuffleCost argument. Because the shuffle mask specifies the indices\n of the two vectors specified as elements, the maximum value is twice the\n size of the source vector. This causes a problem if the destination\n vector is smaller than the source vector and specify an index in the\n mask that exceeds the size of the destination vector.\n \n Fix the problem by correcting the previous code, which was using wrong\n argument in the Cost calculation.\n \n Fixes #130250\n\ndiff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\nindex 4d4a1a6e04d3..019d79567b4a 100644\n--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\n+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\n@@ -2037,7 +2037,6 @@ bool VectorCombine::foldShuffleOfSelects(Instruction &I) {\n m_Mask(Mask))))\n return false;\n \n- auto *DstVecTy = dyn_cast<FixedVectorType>(I.getType());\n auto *C1VecTy = dyn_cast<FixedVectorType>(C1->getType());\n auto *C2VecTy = dyn_cast<FixedVectorType>(C2->getType());\n if (!C1VecTy || !C2VecTy || C1VecTy != C2VecTy)\n@@ -2051,24 +2050,26 @@ bool VectorCombine::foldShuffleOfSelects(Instruction &I) {\n (SI0FOp->getFastMathFlags() != SI1FOp->getFastMathFlags())))\n return false;\n \n+ auto *SrcVecTy = dyn_cast<FixedVectorType>(T1->getType());\n+ auto *DstVecTy = dyn_cast<FixedVectorType>(I.getType());\n auto SK = TargetTransformInfo::SK_PermuteTwoSrc;\n auto SelOp = Instruction::Select;\n InstructionCost OldCost = TTI.getCmpSelInstrCost(\n- SelOp, T1->getType(), C1VecTy, CmpInst::BAD_ICMP_PREDICATE, CostKind);\n- OldCost += TTI.getCmpSelInstrCost(SelOp, T2->getType(), C2VecTy,\n+ SelOp, SrcVecTy, C1VecTy, CmpInst::BAD_ICMP_PREDICATE, CostKind);\n+ OldCost += TTI.getCmpSelInstrCost(SelOp, SrcVecTy, C2VecTy,\n CmpInst::BAD_ICMP_PREDICATE, CostKind);\n- OldCost += TTI.getShuffleCost(SK, DstVecTy, Mask, CostKind, 0, nullptr,\n+ OldCost += TTI.getShuffleCost(SK, SrcVecTy, Mask, CostKind, 0, nullptr,\n {I.getOperand(0), I.getOperand(1)}, &I);\n \n- auto *C1C2VecTy = cast<FixedVectorType>(\n- toVectorTy(Type::getInt1Ty(I.getContext()), DstVecTy->getNumElements()));\n InstructionCost NewCost =\n- TTI.getShuffleCost(SK, C1C2VecTy, Mask, CostKind, 0, nullptr, {C1, C2});\n+ TTI.getShuffleCost(SK, C1VecTy, Mask, CostKind, 0, nullptr, {C1, C2});\n NewCost +=\n- TTI.getShuffleCost(SK, DstVecTy, Mask, CostKind, 0, nullptr, {T1, T2});\n+ TTI.getShuffleCost(SK, SrcVecTy, Mask, CostKind, 0, nullptr, {T1, T2});\n NewCost +=\n- TTI.getShuffleCost(SK, DstVecTy, Mask, CostKind, 0, nullptr, {F1, F2});\n- NewCost += TTI.getCmpSelInstrCost(SelOp, DstVecTy, DstVecTy,\n+ TTI.getShuffleCost(SK, SrcVecTy, Mask, CostKind, 0, nullptr, {F1, F2});\n+ auto *C1C2ShuffledVecTy = cast<FixedVectorType>(\n+ toVectorTy(Type::getInt1Ty(I.getContext()), DstVecTy->getNumElements()));\n+ NewCost += TTI.getCmpSelInstrCost(SelOp, DstVecTy, C1C2ShuffledVecTy,\n CmpInst::BAD_ICMP_PREDICATE, CostKind);\n \n LLVM_DEBUG(dbgs() << \"Found a shuffle feeding two selects: \" << I\n",
|
35 |
+
"tests": [
|
36 |
+
{
|
37 |
+
"file": "llvm/test/Transforms/PhaseOrdering/X86/blendv-select.ll",
|
38 |
+
"commands": [
|
39 |
+
"opt < %s -O3 -S -mtriple=x86_64-- -mcpu=x86-64-v2",
|
40 |
+
"opt < %s -O3 -S -mtriple=x86_64-- -mcpu=x86-64-v3",
|
41 |
+
"opt < %s -O3 -S -mtriple=x86_64-- -mcpu=x86-64-v4"
|
42 |
+
],
|
43 |
+
"tests": [
|
44 |
+
{
|
45 |
+
"test_name": "x86_pblendvb_v8f32_v4f32",
|
46 |
+
"test_body": "define <8 x float> @x86_pblendvb_v8f32_v4f32(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x float> %d) {\n %a.bc = bitcast <8 x float> %a to <32 x i8>\n %b.bc = bitcast <8 x float> %b to <32 x i8>\n %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %cmp = fcmp olt <8 x float> %c, %d\n %sext = sext <8 x i1> %cmp to <8 x i32>\n %sext.bc = bitcast <8 x i32> %sext to <32 x i8>\n %sext.lo = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %sext.hi = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)\n %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)\n %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %res = bitcast <32 x i8> %concat to <8 x float>\n ret <8 x float> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)\ndeclare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }\n"
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"test_name": "x86_pblendvb_v32i16_v16i16",
|
50 |
+
"test_body": "define <8 x i64> @x86_pblendvb_v32i16_v16i16(<8 x i64> %a, <8 x i64> %b, <8 x i64> %c, <8 x i64> %d) {\n %a.bc = bitcast <8 x i64> %a to <64 x i8>\n %b.bc = bitcast <8 x i64> %b to <64 x i8>\n %c.bc = bitcast <8 x i64> %c to <32 x i16>\n %d.bc = bitcast <8 x i64> %d to <32 x i16>\n %a.lo = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %b.lo = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %a.hi = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %b.hi = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %cmp = icmp slt <32 x i16> %c.bc, %d.bc\n %sext = sext <32 x i1> %cmp to <32 x i16>\n %sext.bc = bitcast <32 x i16> %sext to <64 x i8>\n %sext.lo = shufflevector <64 x i8> %sext.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %sext.hi = shufflevector <64 x i8> %sext.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %sel.lo = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.lo, <32 x i8> %b.lo, <32 x i8> %sext.lo)\n %sel.hi = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.hi, <32 x i8> %b.hi, <32 x i8> %sext.hi)\n %concat = shufflevector <32 x i8> %sel.lo, <32 x i8> %sel.hi, <64 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %res = bitcast <64 x i8> %concat to <8 x i64>\n ret <8 x i64> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)\ndeclare <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8>, <32 x i8>, <32 x i8>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }\n"
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"test_name": "x86_pblendvb_v64i8_v32i8",
|
54 |
+
"test_body": "define <8 x i64> @x86_pblendvb_v64i8_v32i8(<8 x i64> %a, <8 x i64> %b, <8 x i64> %c, <8 x i64> %d) {\n %a.bc = bitcast <8 x i64> %a to <64 x i8>\n %b.bc = bitcast <8 x i64> %b to <64 x i8>\n %c.bc = bitcast <8 x i64> %c to <64 x i8>\n %d.bc = bitcast <8 x i64> %d to <64 x i8>\n %a.lo = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %b.lo = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %a.hi = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %b.hi = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %cmp = icmp slt <64 x i8> %c.bc, %d.bc\n %sext = sext <64 x i1> %cmp to <64 x i8>\n %sext.lo = shufflevector <64 x i8> %sext, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %sext.hi = shufflevector <64 x i8> %sext, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %sel.lo = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.lo, <32 x i8> %b.lo, <32 x i8> %sext.lo)\n %sel.hi = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.hi, <32 x i8> %b.hi, <32 x i8> %sext.hi)\n %concat = shufflevector <32 x i8> %sel.lo, <32 x i8> %sel.hi, <64 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %res = bitcast <64 x i8> %concat to <8 x i64>\n ret <8 x i64> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)\ndeclare <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8>, <32 x i8>, <32 x i8>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }\n"
|
55 |
+
},
|
56 |
+
{
|
57 |
+
"test_name": "x86_pblendvb_v4f64_v2f64",
|
58 |
+
"test_body": "define <4 x double> @x86_pblendvb_v4f64_v2f64(<4 x double> %a, <4 x double> %b, <4 x double> %c, <4 x double> %d) {\n %a.bc = bitcast <4 x double> %a to <32 x i8>\n %b.bc = bitcast <4 x double> %b to <32 x i8>\n %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %cmp = fcmp olt <4 x double> %c, %d\n %sext = sext <4 x i1> %cmp to <4 x i64>\n %sext.bc = bitcast <4 x i64> %sext to <32 x i8>\n %sext.lo = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %sext.hi = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)\n %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)\n %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %res = bitcast <32 x i8> %concat to <4 x double>\n ret <4 x double> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)\ndeclare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }\n"
|
59 |
+
},
|
60 |
+
{
|
61 |
+
"test_name": "x86_pblendvb_v16i16_v8i16",
|
62 |
+
"test_body": "define <4 x i64> @x86_pblendvb_v16i16_v8i16(<4 x i64> %a, <4 x i64> %b, <4 x i64> %c, <4 x i64> %d) {\n %a.bc = bitcast <4 x i64> %a to <32 x i8>\n %b.bc = bitcast <4 x i64> %b to <32 x i8>\n %c.bc = bitcast <4 x i64> %c to <16 x i16>\n %d.bc = bitcast <4 x i64> %d to <16 x i16>\n %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %cmp = icmp slt <16 x i16> %c.bc, %d.bc\n %sext = sext <16 x i1> %cmp to <16 x i16>\n %sext.bc = bitcast <16 x i16> %sext to <32 x i8>\n %sext.lo = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %sext.hi = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)\n %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)\n %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %res = bitcast <32 x i8> %concat to <4 x i64>\n ret <4 x i64> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)\ndeclare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }\n"
|
63 |
+
},
|
64 |
+
{
|
65 |
+
"test_name": "x86_pblendvb_v8i32_v4i32",
|
66 |
+
"test_body": "define <4 x i64> @x86_pblendvb_v8i32_v4i32(<4 x i64> %a, <4 x i64> %b, <4 x i64> %c, <4 x i64> %d) {\n %a.bc = bitcast <4 x i64> %a to <32 x i8>\n %b.bc = bitcast <4 x i64> %b to <32 x i8>\n %c.bc = bitcast <4 x i64> %c to <8 x i32>\n %d.bc = bitcast <4 x i64> %d to <8 x i32>\n %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %cmp = icmp slt <8 x i32> %c.bc, %d.bc\n %sext = sext <8 x i1> %cmp to <8 x i32>\n %sext.bc = bitcast <8 x i32> %sext to <32 x i8>\n %sext.lo = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %sext.hi = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)\n %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)\n %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %res = bitcast <32 x i8> %concat to <4 x i64>\n ret <4 x i64> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)\ndeclare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }\n"
|
67 |
+
},
|
68 |
+
{
|
69 |
+
"test_name": "x86_pblendvb_v4i64_v2i64",
|
70 |
+
"test_body": "define <4 x i64> @x86_pblendvb_v4i64_v2i64(<4 x i64> %a, <4 x i64> %b, <4 x i64> %c, <4 x i64> %d) {\n %a.bc = bitcast <4 x i64> %a to <32 x i8>\n %b.bc = bitcast <4 x i64> %b to <32 x i8>\n %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %cmp = icmp slt <4 x i64> %c, %d\n %sext = sext <4 x i1> %cmp to <4 x i64>\n %sext.bc = bitcast <4 x i64> %sext to <32 x i8>\n %sext.lo = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %sext.hi = shufflevector <32 x i8> %sext.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)\n %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)\n %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %res = bitcast <32 x i8> %concat to <4 x i64>\n ret <4 x i64> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)\ndeclare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }\n"
|
71 |
+
},
|
72 |
+
{
|
73 |
+
"test_name": "x86_pblendvb_v32i8_v16i8",
|
74 |
+
"test_body": "define <4 x i64> @x86_pblendvb_v32i8_v16i8(<4 x i64> %a, <4 x i64> %b, <4 x i64> %c, <4 x i64> %d) {\n %a.bc = bitcast <4 x i64> %a to <32 x i8>\n %b.bc = bitcast <4 x i64> %b to <32 x i8>\n %c.bc = bitcast <4 x i64> %c to <32 x i8>\n %d.bc = bitcast <4 x i64> %d to <32 x i8>\n %a.lo = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %b.lo = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %a.hi = shufflevector <32 x i8> %a.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %b.hi = shufflevector <32 x i8> %b.bc, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %cmp = icmp slt <32 x i8> %c.bc, %d.bc\n %sext = sext <32 x i1> %cmp to <32 x i8>\n %sext.lo = shufflevector <32 x i8> %sext, <32 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n %sext.hi = shufflevector <32 x i8> %sext, <32 x i8> poison, <16 x i32> <i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %sel.lo = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.lo, <16 x i8> %b.lo, <16 x i8> %sext.lo)\n %sel.hi = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %a.hi, <16 x i8> %b.hi, <16 x i8> %sext.hi)\n %concat = shufflevector <16 x i8> %sel.lo, <16 x i8> %sel.hi, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %res = bitcast <32 x i8> %concat to <4 x i64>\n ret <4 x i64> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)\ndeclare <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8>, <16 x i8>, <16 x i8>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }\n"
|
75 |
+
},
|
76 |
+
{
|
77 |
+
"test_name": "x86_pblendvb_v16i32_v8i32",
|
78 |
+
"test_body": "define <8 x i64> @x86_pblendvb_v16i32_v8i32(<8 x i64> %a, <8 x i64> %b, <8 x i64> %c, <8 x i64> %d) {\n %a.bc = bitcast <8 x i64> %a to <64 x i8>\n %b.bc = bitcast <8 x i64> %b to <64 x i8>\n %c.bc = bitcast <8 x i64> %c to <16 x i32>\n %d.bc = bitcast <8 x i64> %d to <16 x i32>\n %a.lo = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %b.lo = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %a.hi = shufflevector <64 x i8> %a.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %b.hi = shufflevector <64 x i8> %b.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %cmp = icmp slt <16 x i32> %c.bc, %d.bc\n %sext = sext <16 x i1> %cmp to <16 x i32>\n %sext.bc = bitcast <16 x i32> %sext to <64 x i8>\n %sext.lo = shufflevector <64 x i8> %sext.bc, <64 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>\n %sext.hi = shufflevector <64 x i8> %sext.bc, <64 x i8> poison, <32 x i32> <i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %sel.lo = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.lo, <32 x i8> %b.lo, <32 x i8> %sext.lo)\n %sel.hi = tail call <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8> %a.hi, <32 x i8> %b.hi, <32 x i8> %sext.hi)\n %concat = shufflevector <32 x i8> %sel.lo, <32 x i8> %sel.hi, <64 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>\n %res = bitcast <64 x i8> %concat to <8 x i64>\n ret <8 x i64> %res\n}\n\n; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)\ndeclare <32 x i8> @llvm.x86.avx2.pblendvb(<32 x i8>, <32 x i8>, <32 x i8>) #0\n\nattributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }\n"
|
79 |
+
}
|
80 |
+
]
|
81 |
+
},
|
82 |
+
{
|
83 |
+
"file": "llvm/test/Transforms/VectorCombine/AArch64/shuffletoidentity.ll",
|
84 |
+
"commands": [
|
85 |
+
"opt -passes=vector-combine -S %s"
|
86 |
+
],
|
87 |
+
"tests": [
|
88 |
+
{
|
89 |
+
"test_name": "bitcast_smax_v8i32_v4i32",
|
90 |
+
"test_body": "target triple = \"aarch64\"\n\ndefine <4 x i64> @bitcast_smax_v8i32_v4i32(<4 x i64> %a, <4 x i64> %b) {\n %a.bc0 = bitcast <4 x i64> %a to <8 x i32>\n %b.bc0 = bitcast <4 x i64> %b to <8 x i32>\n %cmp = icmp slt <8 x i32> %a.bc0, %b.bc0\n %cmp.lo = shufflevector <8 x i1> %cmp, <8 x i1> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>\n %cmp.hi = shufflevector <8 x i1> %cmp, <8 x i1> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>\n %a.bc1 = bitcast <4 x i64> %a to <8 x i32>\n %b.bc1 = bitcast <4 x i64> %b to <8 x i32>\n %a.lo = shufflevector <8 x i32> %a.bc1, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>\n %b.lo = shufflevector <8 x i32> %b.bc1, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>\n %lo = select <4 x i1> %cmp.lo, <4 x i32> %b.lo, <4 x i32> %a.lo\n %a.bc2 = bitcast <4 x i64> %a to <8 x i32>\n %b.bc2 = bitcast <4 x i64> %b to <8 x i32>\n %a.hi = shufflevector <8 x i32> %a.bc2, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>\n %b.hi = shufflevector <8 x i32> %b.bc2, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>\n %hi = select <4 x i1> %cmp.hi, <4 x i32> %b.hi, <4 x i32> %a.hi\n %concat = shufflevector <4 x i32> %lo, <4 x i32> %hi, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>\n %res = bitcast <8 x i32> %concat to <4 x i64>\n ret <4 x i64> %res\n}\n"
|
91 |
+
}
|
92 |
+
]
|
93 |
+
},
|
94 |
+
{
|
95 |
+
"file": "llvm/test/Transforms/VectorCombine/X86/shuffle-of-selects.ll",
|
96 |
+
"commands": [
|
97 |
+
"opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mcpu=x86-64-v2",
|
98 |
+
"opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mcpu=x86-64-v3",
|
99 |
+
"opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mcpu=x86-64-v4"
|
100 |
+
],
|
101 |
+
"tests": [
|
102 |
+
{
|
103 |
+
"test_name": "src_v8tov16_i16",
|
104 |
+
"test_body": "define <16 x i16> @src_v8tov16_i16(<8 x i1> %a, <8 x i1> %b, <8 x i16> %x, <8 x i16> %y, <8 x i16> %z) {\n %select.xz = select <8 x i1> %a, <8 x i16> %x, <8 x i16> %z\n %select.yx = select <8 x i1> %b, <8 x i16> %y, <8 x i16> %x\n %res = shufflevector <8 x i16> %select.xz, <8 x i16> %select.yx, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>\n ret <16 x i16> %res\n}\n"
|
105 |
+
},
|
106 |
+
{
|
107 |
+
"test_name": "src_v4tov8_float",
|
108 |
+
"test_body": "define <8 x float> @src_v4tov8_float(<4 x i1> %a, <4 x i1> %b, <4 x float> %x, <4 x float> %y, <4 x float> %z) {\n %select.xz = select <4 x i1> %a, <4 x float> %x, <4 x float> %z\n %select.yx = select <4 x i1> %b, <4 x float> %y, <4 x float> %x\n %res = shufflevector <4 x float> %select.xz, <4 x float> %select.yx, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>\n ret <8 x float> %res\n}\n"
|
109 |
+
},
|
110 |
+
{
|
111 |
+
"test_name": "src_v4tov8_i16",
|
112 |
+
"test_body": "define <8 x i16> @src_v4tov8_i16(<4 x i1> %a, <4 x i1> %b, <4 x i16> %x, <4 x i16> %y, <4 x i16> %z) {\n %select.xz = select <4 x i1> %a, <4 x i16> %x, <4 x i16> %z\n %select.yx = select <4 x i1> %b, <4 x i16> %y, <4 x i16> %x\n %res = shufflevector <4 x i16> %select.xz, <4 x i16> %select.yx, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>\n ret <8 x i16> %res\n}\n"
|
113 |
+
},
|
114 |
+
{
|
115 |
+
"test_name": "src_v2tov4_i64",
|
116 |
+
"test_body": "define <4 x i64> @src_v2tov4_i64(<2 x i1> %a, <2 x i1> %b, <2 x i64> %x, <2 x i64> %y, <2 x i64> %z) {\n %select.xz = select <2 x i1> %a, <2 x i64> %x, <2 x i64> %z\n %select.yx = select <2 x i1> %b, <2 x i64> %y, <2 x i64> %x\n %res = shufflevector <2 x i64> %select.xz, <2 x i64> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>\n ret <4 x i64> %res\n}\n"
|
117 |
+
},
|
118 |
+
{
|
119 |
+
"test_name": "src_v2tov2_i64",
|
120 |
+
"test_body": "define <2 x i64> @src_v2tov2_i64(<2 x i1> %a, <2 x i1> %b, <2 x i64> %x, <2 x i64> %y, <2 x i64> %z) {\n %select.xz = select <2 x i1> %a, <2 x i64> %x, <2 x i64> %z\n %select.yx = select <2 x i1> %b, <2 x i64> %y, <2 x i64> %x\n %res = shufflevector <2 x i64> %select.xz, <2 x i64> %select.yx, <2 x i32> <i32 0, i32 3>\n ret <2 x i64> %res\n}\n"
|
121 |
+
},
|
122 |
+
{
|
123 |
+
"test_name": "src_v2tov4_i32",
|
124 |
+
"test_body": "define <4 x i32> @src_v2tov4_i32(<2 x i1> %a, <2 x i1> %b, <2 x i32> %x, <2 x i32> %y, <2 x i32> %z) {\n %select.xz = select <2 x i1> %a, <2 x i32> %x, <2 x i32> %z\n %select.yx = select <2 x i1> %b, <2 x i32> %y, <2 x i32> %x\n %res = shufflevector <2 x i32> %select.xz, <2 x i32> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>\n ret <4 x i32> %res\n}\n"
|
125 |
+
},
|
126 |
+
{
|
127 |
+
"test_name": "src_v2tov2_double",
|
128 |
+
"test_body": "define <2 x double> @src_v2tov2_double(<2 x i1> %a, <2 x i1> %b, <2 x double> %x, <2 x double> %y, <2 x double> %z) {\n %select.xz = select <2 x i1> %a, <2 x double> %x, <2 x double> %z\n %select.yx = select <2 x i1> %b, <2 x double> %y, <2 x double> %x\n %res = shufflevector <2 x double> %select.xz, <2 x double> %select.yx, <2 x i32> <i32 0, i32 3>\n ret <2 x double> %res\n}\n"
|
129 |
+
},
|
130 |
+
{
|
131 |
+
"test_name": "test_mask0",
|
132 |
+
"test_body": "define <2 x float> @test_mask0(<4 x i1> %c, <4 x float> %x, <4 x float> %y, <4 x float> %z) {\n %select.xy = select <4 x i1> %c, <4 x float> %x, <4 x float> %y\n %select.yz = select <4 x i1> %c, <4 x float> %y, <4 x float> %z\n %res = shufflevector <4 x float> %select.xy, <4 x float> %select.yz, <2 x i32> <i32 4, i32 7>\n ret <2 x float> %res\n}\n"
|
133 |
+
},
|
134 |
+
{
|
135 |
+
"test_name": "src_v2tov4_i16",
|
136 |
+
"test_body": "define <4 x i16> @src_v2tov4_i16(<2 x i1> %a, <2 x i1> %b, <2 x i16> %x, <2 x i16> %y, <2 x i16> %z) {\n %select.xz = select <2 x i1> %a, <2 x i16> %x, <2 x i16> %z\n %select.yx = select <2 x i1> %b, <2 x i16> %y, <2 x i16> %x\n %res = shufflevector <2 x i16> %select.xz, <2 x i16> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>\n ret <4 x i16> %res\n}\n"
|
137 |
+
},
|
138 |
+
{
|
139 |
+
"test_name": "src_v4tov8_i32",
|
140 |
+
"test_body": "define <8 x i32> @src_v4tov8_i32(<4 x i1> %a, <4 x i1> %b, <4 x i32> %x, <4 x i32> %y, <4 x i32> %z) {\n %select.xz = select <4 x i1> %a, <4 x i32> %x, <4 x i32> %z\n %select.yx = select <4 x i1> %b, <4 x i32> %y, <4 x i32> %x\n %res = shufflevector <4 x i32> %select.xz, <4 x i32> %select.yx, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>\n ret <8 x i32> %res\n}\n"
|
141 |
+
},
|
142 |
+
{
|
143 |
+
"test_name": "src_v8tov8_i16",
|
144 |
+
"test_body": "define <8 x i16> @src_v8tov8_i16(<8 x i1> %a, <8 x i1> %b, <8 x i16> %x, <8 x i16> %y, <8 x i16> %z) {\n %select.xz = select <8 x i1> %a, <8 x i16> %x, <8 x i16> %z\n %select.yx = select <8 x i1> %b, <8 x i16> %y, <8 x i16> %x\n %res = shufflevector <8 x i16> %select.xz, <8 x i16> %select.yx, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>\n ret <8 x i16> %res\n}\n"
|
145 |
+
},
|
146 |
+
{
|
147 |
+
"test_name": "src_v2tov4_float",
|
148 |
+
"test_body": "define <4 x float> @src_v2tov4_float(<2 x i1> %a, <2 x i1> %b, <2 x float> %x, <2 x float> %y, <2 x float> %z) {\n %select.xz = select <2 x i1> %a, <2 x float> %x, <2 x float> %z\n %select.yx = select <2 x i1> %b, <2 x float> %y, <2 x float> %x\n %res = shufflevector <2 x float> %select.xz, <2 x float> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>\n ret <4 x float> %res\n}\n"
|
149 |
+
},
|
150 |
+
{
|
151 |
+
"test_name": "test_mask1",
|
152 |
+
"test_body": "define <2 x float> @test_mask1(<4 x i1> %c, <4 x float> %x, <4 x float> %y, <4 x float> %z) {\n %select.xy = select <4 x i1> %c, <4 x float> %x, <4 x float> %y\n %select.yz = select <4 x i1> %c, <4 x float> %y, <4 x float> %z\n %res = shufflevector <4 x float> %select.xy, <4 x float> %select.yz, <2 x i32> <i32 7, i32 4>\n ret <2 x float> %res\n}\n"
|
153 |
+
},
|
154 |
+
{
|
155 |
+
"test_name": "src_v2tov4_double",
|
156 |
+
"test_body": "define <4 x double> @src_v2tov4_double(<2 x i1> %a, <2 x i1> %b, <2 x double> %x, <2 x double> %y, <2 x double> %z) {\n %select.xz = select <2 x i1> %a, <2 x double> %x, <2 x double> %z\n %select.yx = select <2 x i1> %b, <2 x double> %y, <2 x double> %x\n %res = shufflevector <2 x double> %select.xz, <2 x double> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>\n ret <4 x double> %res\n}\n"
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"test_name": "src_v2tov4_float_nnan",
|
160 |
+
"test_body": "define <4 x float> @src_v2tov4_float_nnan(<2 x i1> %a, <2 x i1> %b, <2 x float> %x, <2 x float> %y, <2 x float> %z) {\n %select.xz = select nnan <2 x i1> %a, <2 x float> %x, <2 x float> %z\n %select.yx = select nnan <2 x i1> %b, <2 x float> %y, <2 x float> %x\n %res = shufflevector <2 x float> %select.xz, <2 x float> %select.yx, <4 x i32> <i32 0, i32 1, i32 2, i32 3>\n ret <4 x float> %res\n}\n"
|
161 |
+
}
|
162 |
+
]
|
163 |
+
}
|
164 |
+
],
|
165 |
+
"issue": {
|
166 |
+
"title": "A/F: `I >= 0 && I < (NumOpElts * 2) && \"Out-of-bounds shuffle mask element\" after upstream commit 5d1029b",
|
167 |
+
"body": "One of our internal tests recently started hitting an assertion failure when building which I bisected back to 5d1029b4a87f36a394c169b89b26a74d17f7ff01. I was able to reduce the test case to the following code:\n```c++\ntypedef float e __attribute__((__vector_size__(16)));\ne g(e h, e j) { return __builtin_ia32_cmpltps(j, h); }\ne k(float, float l, float n, float) { return {n, l}; }\ne o, p;\ntypedef union q {\n e r;\n} t;\ntypedef union u {\n e r;\n} w;\nunion aa {\n t ab;\n w ac;\n float f[];\n aa(t v) : ab(v) {}\n e ad;\n aa(e v) : ad(v) {}\n};\n#define ae(v) aa(v).ab\n#define af(v) aa(v).ac\n#define ag(a, b, c, d) ae(k(d, c, b, a))\n#define ah(v, ai) aa(v).f[ai]\n#define aj(a, b) af(g(a.r, b.r))\n#define ak(a, b, m) ae(al(a.r, b.r, m.r))\nt am(t an, t abcd) {\n e ao = __builtin_shufflevector(an.r, abcd.r, 0, 4, 1, 5);\n t ap = ae(ao);\n return ap;\n}\ne al(e, e, e aq) {\n e ar = __builtin_ia32_blendvps(o, p, aq);\n return ar;\n}\nfloat as(t v, int s) { return ah(v, s); }\nw at(t a, t b) { return aj(a, b); }\nt au(w aq) {\n t b, a;\n return ak(a, b, aq);\n}\nt av(t an, t abcd) { return am(an, abcd); }\nt aw_x, bl, bq_ay;\nt bf();\nstruct bc {\n t bd;\n bc(t bg) { bd = bg; }\n t be() { return bd; }\n};\nstruct bh {\n t bi;\n int i;\n bh(t bg, int bj) : bi(bg), i(bj) {}\n operator float() {\n float bk = as(bi, i);\n return bk;\n }\n};\nfloat bm_x;\nstruct bm {\n bm(float y, float z) { bl = ag(bm_x, y, z, 0.0f); }\n bm(bc y, bc z) {\n q bn = z.be(), bo(bn), bp = y.be();\n bl = av(bo, bp);\n }\n bh operator[](int bj) { return bh(bl, bj); }\n};\nbc bq() {\n t __trans_tmp_3 = bf();\n u bb = at(bq_ay, aw_x);\n __trans_tmp_3 = au(bb);\n return __trans_tmp_3;\n}\nbm bs() { return bm(bq(), bq()); }\nvoid bx() {\n unsigned char by, bz;\n bm ca = bs();\n bz = ca[1];\n by = ca[2];\n bm(bz, by);\n}\n```\nIf compiled with a compiler that includes 5d1029b4a87f36a394c169b89b26a74d17f7ff01 and with optimizations and AVX enabled, the compiler hits an assertion failure:\n```\n$ ~/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang -c -O2 -mavx repro.cpp\nclang: /home/dyung/src/upstream/llvm_clean_git/llvm/lib/IR/Instructions.cpp:1906: 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, preprocessed source, and associated run script.\nStack dump:\n0. Program arguments: /home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang -c -O2 repro.cpp -mavx\n1. <eof> parser at end of file\n2. Optimizer\n3. Running pass \"function<eager-inv>(float2int,lower-constant-intrinsics,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;>,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-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<O2>,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;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 \"repro.cpp\"\n4. Running pass \"vector-combine\" on function \"_Z2bxv\"\n #0 0x0000561cf26380ef llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x224f0ef)\n #1 0x0000561cf2635c04 llvm::sys::CleanupOnSignal(unsigned long) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x224cc04)\n #2 0x0000561cf2586258 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0\n #3 0x00007f5f727e6420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)\n #4 0x00007f5f722b300b raise /build/glibc-FcRMwW/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1\n #5 0x00007f5f72292859 abort /build/glibc-FcRMwW/glibc-2.31/stdlib/abort.c:81:7\n #6 0x00007f5f72292729 get_sysdep_segment_value /build/glibc-FcRMwW/glibc-2.31/intl/loadmsgcat.c:509:8\n #7 0x00007f5f72292729 _nl_load_domain /build/glibc-FcRMwW/glibc-2.31/intl/loadmsgcat.c:970:34\n #8 0x00007f5f722a3fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)\n #9 0x0000561cf203aa46 isSingleSourceMaskImpl(llvm::ArrayRef<int>, int) Instructions.cpp:0:0\n#10 0x0000561cf20436e4 llvm::ShuffleVectorInst::isSelectMask(llvm::ArrayRef<int>, int) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x1c5a6e4)\n#11 0x0000561cf116c2b0 llvm::X86TTIImpl::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::ArrayRef<int>, llvm::TargetTransformInfo::TargetCostKind, int, llvm::VectorType*, llvm::ArrayRef<llvm::Value const*>, llvm::Instruction const*) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xd832b0)\n#12 0x0000561cf17404ed llvm::TargetTransformInfo::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::ArrayRef<int>, llvm::TargetTransformInfo::TargetCostKind, int, llvm::VectorType*, llvm::ArrayRef<llvm::Value const*>, llvm::Instruction const*) const (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x13574ed)\n#13 0x0000561cf42a667a (anonymous namespace)::VectorCombine::foldShuffleOfSelects(llvm::Instruction&) VectorCombine.cpp:0:0\n#14 0x0000561cf42c0e55 (anonymous namespace)::VectorCombine::run()::'lambda'(llvm::Instruction&)::operator()(llvm::Instruction&) const (.isra.0) VectorCombine.cpp:0:0\n#15 0x0000561cf42c1d85 llvm::VectorCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x3ed8d85)\n#16 0x0000561cf3b8f1a6 llvm::detail::PassModel<llvm::Function, llvm::VectorCombinePass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x37a61a6)\n#17 0x0000561cf20deb09 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x1cf5b09)\n#18 0x0000561cf11a9906 llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xdc0906)\n#19 0x0000561cf20dd372 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x1cf4372)\n#20 0x0000561cf11aa2c6 llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xdc12c6)\n#21 0x0000561cf20dcd91 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x1cf3d91)\n#22 0x0000561cf28d99aa (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#23 0x0000561cf28dd9db 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*) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x24f49db)\n#24 0x0000561cf3021121 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2c38121)\n#25 0x0000561cf4a4170c clang::ParseAST(clang::Sema&, bool, bool) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x465870c)\n#26 0x0000561cf3021548 clang::CodeGenAction::ExecuteAction() (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2c38548)\n#27 0x0000561cf32f80f9 clang::FrontendAction::Execute() (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2f0f0f9)\n#28 0x0000561cf3278f4e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2e8ff4e)\n#29 0x0000561cf33ed2b6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x30042b6)\n#30 0x0000561cf1125ccd cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xd3cccd)\n#31 0x0000561cf111d5ca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0\n#32 0x0000561cf306b3cd void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0\n#33 0x0000561cf2586760 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x219d760)\n#34 0x0000561cf306b9ef clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0\n#35 0x0000561cf302c9c4 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2c439c4)\n#36 0x0000561cf302da5e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2c44a5e)\n#37 0x0000561cf3035ef5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0x2c4cef5)\n#38 0x0000561cf1122aab clang_main(int, char**, llvm::ToolContext const&) (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xd39aab)\n#39 0x0000561cf10546bb main (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xc6b6bb)\n#40 0x00007f5f72294083 __libc_start_main /build/glibc-FcRMwW/glibc-2.31/csu/../csu/libc-start.c:342:3\n#41 0x0000561cf111d05e _start (/home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin/clang+0xd3405e)\nclang: error: clang frontend command failed with exit code 134 (use -v to see invocation)\nclang version 21.0.0 (https://github.com/llvm/llvm-project.git 5d1029b4a87f36a394c169b89b26a74d17f7ff01)\nTarget: x86_64-unknown-linux-gnu\nThread model: posix\nInstalledDir: /home/dyung/src/upstream/5d1029b4a87f36a394c169b89b26a74d17f7ff01-linux/bin\nBuild config: +assertions\n```",
|
168 |
+
"author": "dyung",
|
169 |
+
"labels": [
|
170 |
+
"crash",
|
171 |
+
"llvm:transforms"
|
172 |
+
],
|
173 |
+
"comments": [
|
174 |
+
{
|
175 |
+
"author": "ParkHanbum",
|
176 |
+
"body": "Can you help me compile the sample?\nnever mind. I get the crash."
|
177 |
+
},
|
178 |
+
{
|
179 |
+
"author": "ParkHanbum",
|
180 |
+
"body": "```\ndefine void @test(<4 x i1> %z, <4 x float> %1, <4 x float> %2) {\n%a = select <4 x i1> %z, <4 x float> %1, <4 x float> %2\n%b = select <4 x i1> %z, <4 x float> %1, <4 x float> %2\n%c = shufflevector <4 x float> %a, <4 x float> %b, <2 x i32> <i32 0, i32 5>\nret void\n}\n```\nThe problematic IR is shown above.\n\n```\n * frame #4: 0x00000001043d7fe8 clang++`isIdentityMaskImpl(llvm::ArrayRef<int>, int) (.cold.3) + 36\n frame #5: 0x0000000100fd5334 clang++`llvm::ShuffleVectorInst::isSelectMask(llvm::ArrayRef<int>, int) + 256\n frame #6: 0x0000000100095ff8 clang++`llvm::BasicTTIImplBase<llvm::X86TTIImpl>::improveShuffleKindFromMask(llvm::TargetTransformInfo::ShuffleKind, llvm::ArrayRef<int>, llvm::VectorType*, int&, llvm::VectorType*&) const + 184\n frame #7: 0x000000010033e104 clang++`llvm::X86TTIImpl::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::ArrayRef<int>, llvm::TargetTransformInfo::TargetCostKind, int, llvm::VectorType*, llvm::ArrayRef<llvm::Value const*>, llvm::Instruction const*) + 128\n```\n\nThis is where the crash happens.\n\n\n```\n OldCost += TTI.getShuffleCost(SK, DstVecTy, Mask, CostKind, 0, nullptr,\n {I.getOperand(0), I.getOperand(1)}, &I);\n```\n\nThe problematic IR is shown above.\n\nTo calculate the OldCost, call getShuffleCost.\nThe DstVecTy passed as an argument is `<2 x float>` and the Mask is <i32 0, i32 5>.\n\nThe second Mask specifier is 5, which is greater than NumOpElts * 2 of DstVecTy, so this assertion seems to be thrown.\n(If we increase the Mask to <3 x i32> <i32 0, i32 5, i32 5> or decrease the Mask size to <2 x i32> <i32 0, i32 3>, the error will not occur.)\n\nI will add a fix after further analysis.\n\n\n"
|
181 |
+
},
|
182 |
+
{
|
183 |
+
"author": "RKSimon",
|
184 |
+
"body": "@ParkHanbum You must use the source type not destination type for getShuffleCost"
|
185 |
+
},
|
186 |
+
{
|
187 |
+
"author": "ParkHanbum",
|
188 |
+
"body": "@RKSimon I'm sorry, I made a mistake. I'll push up the patch quickly.\n"
|
189 |
+
},
|
190 |
+
{
|
191 |
+
"author": "RKSimon",
|
192 |
+
"body": "You just need the fix + test coverage - no need to revert the existing patch if you are prompt"
|
193 |
+
}
|
194 |
+
]
|
195 |
+
},
|
196 |
+
"verified": true
|
197 |
+
}
|
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 = 130472
|
38 |
|
39 |
|
40 |
def wait(progress):
|
scripts/postfix_extract.py
CHANGED
@@ -124,6 +124,8 @@ fix_commit_map = {
|
|
124 |
"127173": None, # Reverted
|
125 |
"127177": None, # Reverted
|
126 |
"127220": None, # Reverted
|
|
|
|
|
127 |
}
|
128 |
|
129 |
if issue_id in fix_commit_map:
|
|
|
124 |
"127173": None, # Reverted
|
125 |
"127177": None, # Reverted
|
126 |
"127220": None, # Reverted
|
127 |
+
"129244": None, # Cannot reproduce the miscompilation
|
128 |
+
"130082": None, # Non-deterministic bug
|
129 |
}
|
130 |
|
131 |
if issue_id in fix_commit_map:
|