Datasets:

Modalities:
Text
Formats:
json
Size:
< 1K
Tags:
code
DOI:
Libraries:
Datasets
pandas
License:
dtcxzyw commited on
Commit
adb8cb5
·
1 Parent(s): 9d4f4b0
dataset.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
dataset/107569.json ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bug_id": "107569",
3
+ "issue_url": "https://github.com/llvm/llvm-project/issues/107569",
4
+ "bug_type": "crash",
5
+ "base_commit": "b0428870dae980af84e50dfa3ee6ed2165998678",
6
+ "knowledge_cutoff": "2024-09-06T11:56:19Z",
7
+ "lit_test_dir": [
8
+ "llvm/test/Transforms/DeadArgElim"
9
+ ],
10
+ "hints": {
11
+ "fix_commit": "5978bb2936d9a71d8e6891c640a36be760b569d3",
12
+ "components": [
13
+ "DeadArgumentElimination"
14
+ ],
15
+ "bug_location_lineno": {
16
+ "llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h": [
17
+ [
18
+ 106,
19
+ 118
20
+ ],
21
+ [
22
+ 131,
23
+ 142
24
+ ]
25
+ ],
26
+ "llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp": [
27
+ [
28
+ 87,
29
+ 97
30
+ ],
31
+ [
32
+ 280,
33
+ 286
34
+ ],
35
+ [
36
+ 496,
37
+ 502
38
+ ],
39
+ [
40
+ 504,
41
+ 510
42
+ ],
43
+ [
44
+ 522,
45
+ 550
46
+ ],
47
+ [
48
+ 555,
49
+ 562
50
+ ],
51
+ [
52
+ 564,
53
+ 577
54
+ ],
55
+ [
56
+ 610,
57
+ 620
58
+ ],
59
+ [
60
+ 628,
61
+ 646
62
+ ],
63
+ [
64
+ 680,
65
+ 693
66
+ ],
67
+ [
68
+ 696,
69
+ 701
70
+ ],
71
+ [
72
+ 710,
73
+ 716
74
+ ],
75
+ [
76
+ 734,
77
+ 741
78
+ ],
79
+ [
80
+ 807,
81
+ 813
82
+ ],
83
+ [
84
+ 1109,
85
+ 1134
86
+ ],
87
+ [
88
+ 1149,
89
+ 1156
90
+ ]
91
+ ]
92
+ },
93
+ "bug_location_funcname": {
94
+ "llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp": [
95
+ "DeadArgumentEliminationPass::isLive",
96
+ "DeadArgumentEliminationPass::markLive",
97
+ "DeadArgumentEliminationPass::markValue",
98
+ "DeadArgumentEliminationPass::propagateVirtMustcallLiveness",
99
+ "DeadArgumentEliminationPass::removeDeadArgumentsFromCallers",
100
+ "DeadArgumentEliminationPass::removeDeadStuffFromFunction",
101
+ "DeadArgumentEliminationPass::run",
102
+ "DeadArgumentEliminationPass::surveyFunction",
103
+ "isMustTailCalleeAnalyzable"
104
+ ]
105
+ }
106
+ },
107
+ "patch": "commit 5978bb2936d9a71d8e6891c640a36be760b569d3\nAuthor: u4f3 <[email protected]>\nDate: Thu Apr 10 22:08:09 2025 +0800\n\n [DeadArgElim] fix verifier failure when changing musttail's function signature (#127366)\n \n This commit is for #107569 and #126817.\n \n Stop changing musttail's caller and callee's function signature when\n calling convention is not swifttailcc nor tailcc. Verifier makes sure\n musttail's caller and callee shares exactly the same signature, see\n commit 9ff2eb1 and #54964.\n \n Otherwise just make sure the return type is the same and then process\n musttail like usual calls.\n \n close #107569, #126817\n\ndiff --git a/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h b/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h\nindex 63e1ad043d49..efa9c4bdc496 100644\n--- a/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h\n+++ b/llvm/include/llvm/Transforms/IPO/DeadArgumentElimination.h\n@@ -106,13 +106,16 @@ public:\n UseMap Uses;\n \n using LiveSet = std::set<RetOrArg>;\n- using LiveFuncSet = std::set<const Function *>;\n+ using FuncSet = std::set<const Function *>;\n \n /// This set contains all values that have been determined to be live.\n LiveSet LiveValues;\n \n- /// This set contains all values that are cannot be changed in any way.\n- LiveFuncSet LiveFunctions;\n+ /// This set contains all functions that cannot be changed in any way.\n+ FuncSet FrozenFunctions;\n+\n+ /// This set contains all functions that cannot change return type;\n+ FuncSet FrozenRetTyFunctions;\n \n using UseVector = SmallVector<RetOrArg, 5>;\n \n@@ -131,12 +134,13 @@ private:\n void markValue(const RetOrArg &RA, Liveness L,\n const UseVector &MaybeLiveUses);\n void markLive(const RetOrArg &RA);\n- void markLive(const Function &F);\n+ void markFrozen(const Function &F);\n+ void markRetTyFrozen(const Function &F);\n+ bool markFnOrRetTyFrozenOnMusttail(const Function &F);\n void propagateLiveness(const RetOrArg &RA);\n bool removeDeadStuffFromFunction(Function *F);\n bool deleteDeadVarargs(Function &F);\n bool removeDeadArgumentsFromCallers(Function &F);\n- void propagateVirtMustcallLiveness(const Module &M);\n };\n \n } // end namespace llvm\ndiff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp\nindex ed93b4491c50..2e2687a5ff6e 100644\n--- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp\n+++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp\n@@ -87,11 +87,6 @@ public:\n virtual bool shouldHackArguments() const { return false; }\n };\n \n-bool isMustTailCalleeAnalyzable(const CallBase &CB) {\n- assert(CB.isMustTailCall());\n- return CB.getCalledFunction() && !CB.getCalledFunction()->isDeclaration();\n-}\n-\n } // end anonymous namespace\n \n char DAE::ID = 0;\n@@ -280,7 +275,7 @@ bool DeadArgumentEliminationPass::removeDeadArgumentsFromCallers(Function &F) {\n // they are fully alive (e.g., called indirectly) and except for the fragile\n // (variadic) ones. In these cases, we may still be able to improve their\n // statically known call sites.\n- if ((F.hasLocalLinkage() && !LiveFunctions.count(&F)) &&\n+ if ((F.hasLocalLinkage() && !FrozenFunctions.count(&F)) &&\n !F.getFunctionType()->isVarArg())\n return false;\n \n@@ -496,7 +491,7 @@ void DeadArgumentEliminationPass::surveyFunction(const Function &F) {\n // particular register and memory layout.\n if (F.getAttributes().hasAttrSomewhere(Attribute::InAlloca) ||\n F.getAttributes().hasAttrSomewhere(Attribute::Preallocated)) {\n- markLive(F);\n+ markFrozen(F);\n return;\n }\n \n@@ -504,7 +499,7 @@ void DeadArgumentEliminationPass::surveyFunction(const Function &F) {\n // otherwise rely on the frame layout in a way that this analysis will not\n // see.\n if (F.hasFnAttribute(Attribute::Naked)) {\n- markLive(F);\n+ markFrozen(F);\n return;\n }\n \n@@ -522,29 +517,17 @@ void DeadArgumentEliminationPass::surveyFunction(const Function &F) {\n // MaybeLive. Initialized to a list of RetCount empty lists.\n RetUses MaybeLiveRetUses(RetCount);\n \n- bool HasMustTailCalls = false;\n for (const BasicBlock &BB : F) {\n- // If we have any returns of `musttail` results - the signature can't\n- // change\n- if (const auto *TC = BB.getTerminatingMustTailCall()) {\n- HasMustTailCalls = true;\n- // In addition, if the called function is not locally defined (or unknown,\n- // if this is an indirect call), we can't change the callsite and thus\n- // can't change this function's signature either.\n- if (!isMustTailCalleeAnalyzable(*TC)) {\n- markLive(F);\n+ if (BB.getTerminatingMustTailCall()) {\n+ LLVM_DEBUG(dbgs() << \"DeadArgumentEliminationPass - \" << F.getName()\n+ << \" has musttail calls\\n\");\n+ if (markFnOrRetTyFrozenOnMusttail(F))\n return;\n- }\n }\n }\n \n- if (HasMustTailCalls) {\n- LLVM_DEBUG(dbgs() << \"DeadArgumentEliminationPass - \" << F.getName()\n- << \" has musttail calls\\n\");\n- }\n-\n if (!F.hasLocalLinkage() && (!ShouldHackArguments || F.isIntrinsic())) {\n- markLive(F);\n+ markFrozen(F);\n return;\n }\n \n@@ -555,8 +538,6 @@ void DeadArgumentEliminationPass::surveyFunction(const Function &F) {\n // of them turn out to be live.\n unsigned NumLiveRetVals = 0;\n \n- bool HasMustTailCallers = false;\n-\n // Loop all uses of the function.\n for (const Use &U : F.uses()) {\n // If the function is PASSED IN as an argument, its address has been\n@@ -564,14 +545,16 @@ void DeadArgumentEliminationPass::surveyFunction(const Function &F) {\n const auto *CB = dyn_cast<CallBase>(U.getUser());\n if (!CB || !CB->isCallee(&U) ||\n CB->getFunctionType() != F.getFunctionType()) {\n- markLive(F);\n+ markFrozen(F);\n return;\n }\n \n- // The number of arguments for `musttail` call must match the number of\n- // arguments of the caller\n- if (CB->isMustTailCall())\n- HasMustTailCallers = true;\n+ if (CB->isMustTailCall()) {\n+ LLVM_DEBUG(dbgs() << \"DeadArgumentEliminationPass - \" << F.getName()\n+ << \" has musttail callers\\n\");\n+ if (markFnOrRetTyFrozenOnMusttail(F))\n+ return;\n+ }\n \n // If we end up here, we are looking at a direct call to our function.\n \n@@ -610,11 +593,6 @@ void DeadArgumentEliminationPass::surveyFunction(const Function &F) {\n }\n }\n \n- if (HasMustTailCallers) {\n- LLVM_DEBUG(dbgs() << \"DeadArgumentEliminationPass - \" << F.getName()\n- << \" has musttail callers\\n\");\n- }\n-\n // Now we've inspected all callers, record the liveness of our return values.\n for (unsigned Ri = 0; Ri != RetCount; ++Ri)\n markValue(createRet(&F, Ri), RetValLiveness[Ri], MaybeLiveRetUses[Ri]);\n@@ -628,19 +606,12 @@ void DeadArgumentEliminationPass::surveyFunction(const Function &F) {\n for (Function::const_arg_iterator AI = F.arg_begin(), E = F.arg_end();\n AI != E; ++AI, ++ArgI) {\n Liveness Result;\n- if (F.getFunctionType()->isVarArg() || HasMustTailCallers ||\n- HasMustTailCalls) {\n+ if (F.getFunctionType()->isVarArg()) {\n // Variadic functions will already have a va_arg function expanded inside\n // them, making them potentially very sensitive to ABI changes resulting\n // from removing arguments entirely, so don't. For example AArch64 handles\n // register and stack HFAs very differently, and this is reflected in the\n // IR which has already been generated.\n- //\n- // `musttail` calls to this function restrict argument removal attempts.\n- // The signature of the caller must match the signature of the function.\n- //\n- // `musttail` calls in this function prevents us from changing its\n- // signature\n Result = Live;\n } else {\n // See what the effect of this use is (recording any uses that cause\n@@ -680,14 +651,30 @@ void DeadArgumentEliminationPass::markValue(const RetOrArg &RA, Liveness L,\n }\n }\n \n+/// Return true if we freeze the whole function.\n+/// If the calling convention is not swifttailcc or tailcc, the caller and\n+/// callee of musttail must have exactly the same signature. Otherwise we\n+/// only needs to guarantee they have the same return type.\n+bool DeadArgumentEliminationPass::markFnOrRetTyFrozenOnMusttail(\n+ const Function &F) {\n+ if (F.getCallingConv() != CallingConv::SwiftTail ||\n+ F.getCallingConv() != CallingConv::Tail) {\n+ markFrozen(F);\n+ return true;\n+ } else {\n+ markRetTyFrozen(F);\n+ return false;\n+ }\n+}\n+\n /// Mark the given Function as alive, meaning that it cannot be changed in any\n /// way. Additionally, mark any values that are used as this function's\n /// parameters or by its return values (according to Uses) live as well.\n-void DeadArgumentEliminationPass::markLive(const Function &F) {\n- LLVM_DEBUG(dbgs() << \"DeadArgumentEliminationPass - Intrinsically live fn: \"\n+void DeadArgumentEliminationPass::markFrozen(const Function &F) {\n+ LLVM_DEBUG(dbgs() << \"DeadArgumentEliminationPass - frozen fn: \"\n << F.getName() << \"\\n\");\n- // Mark the function as live.\n- LiveFunctions.insert(&F);\n+ // Mark the function as frozen.\n+ FrozenFunctions.insert(&F);\n // Mark all arguments as live.\n for (unsigned ArgI = 0, E = F.arg_size(); ArgI != E; ++ArgI)\n propagateLiveness(createArg(&F, ArgI));\n@@ -696,6 +683,12 @@ void DeadArgumentEliminationPass::markLive(const Function &F) {\n propagateLiveness(createRet(&F, Ri));\n }\n \n+void DeadArgumentEliminationPass::markRetTyFrozen(const Function &F) {\n+ LLVM_DEBUG(dbgs() << \"DeadArgumentEliminationPass - frozen return type fn: \"\n+ << F.getName() << \"\\n\");\n+ FrozenRetTyFunctions.insert(&F);\n+}\n+\n /// Mark the given return value or argument as live. Additionally, mark any\n /// values that are used by this value (according to Uses) live as well.\n void DeadArgumentEliminationPass::markLive(const RetOrArg &RA) {\n@@ -710,7 +703,7 @@ void DeadArgumentEliminationPass::markLive(const RetOrArg &RA) {\n }\n \n bool DeadArgumentEliminationPass::isLive(const RetOrArg &RA) {\n- return LiveFunctions.count(RA.F) || LiveValues.count(RA);\n+ return FrozenFunctions.count(RA.F) || LiveValues.count(RA);\n }\n \n /// Given that RA is a live value, propagate it's liveness to any other values\n@@ -734,8 +727,8 @@ void DeadArgumentEliminationPass::propagateLiveness(const RetOrArg &RA) {\n /// Transform the function and all the callees of the function to not have these\n /// arguments and return values.\n bool DeadArgumentEliminationPass::removeDeadStuffFromFunction(Function *F) {\n- // Don't modify fully live functions\n- if (LiveFunctions.count(F))\n+ // Don't modify frozen functions\n+ if (FrozenFunctions.count(F))\n return false;\n \n // Start by computing a new prototype for the function, which is the same as\n@@ -807,7 +800,8 @@ bool DeadArgumentEliminationPass::removeDeadStuffFromFunction(Function *F) {\n // performance win, so the second option can just be used always for now.\n //\n // This should be revisited if 'returned' is ever applied more liberally.\n- if (RetTy->isVoidTy() || HasLiveReturnedArg) {\n+ if (RetTy->isVoidTy() || HasLiveReturnedArg ||\n+ FrozenRetTyFunctions.count(F)) {\n NRetTy = RetTy;\n } else {\n // Look at each of the original return values individually.\n@@ -1109,26 +1103,6 @@ bool DeadArgumentEliminationPass::removeDeadStuffFromFunction(Function *F) {\n return true;\n }\n \n-void DeadArgumentEliminationPass::propagateVirtMustcallLiveness(\n- const Module &M) {\n- // If a function was marked \"live\", and it has musttail callers, they in turn\n- // can't change either.\n- LiveFuncSet NewLiveFuncs(LiveFunctions);\n- while (!NewLiveFuncs.empty()) {\n- LiveFuncSet Temp;\n- for (const auto *F : NewLiveFuncs)\n- for (const auto *U : F->users())\n- if (const auto *CB = dyn_cast<CallBase>(U))\n- if (CB->isMustTailCall())\n- if (!LiveFunctions.count(CB->getParent()->getParent()))\n- Temp.insert(CB->getParent()->getParent());\n- NewLiveFuncs.clear();\n- NewLiveFuncs.insert(Temp.begin(), Temp.end());\n- for (const auto *F : Temp)\n- markLive(*F);\n- }\n-}\n-\n PreservedAnalyses DeadArgumentEliminationPass::run(Module &M,\n ModuleAnalysisManager &) {\n bool Changed = false;\n@@ -1149,8 +1123,6 @@ PreservedAnalyses DeadArgumentEliminationPass::run(Module &M,\n for (auto &F : M)\n surveyFunction(F);\n \n- propagateVirtMustcallLiveness(M);\n-\n // Now, remove all dead arguments and return values from each function in\n // turn. We use make_early_inc_range here because functions will probably get\n // removed (i.e. replaced by new ones).\n",
108
+ "tests": [
109
+ {
110
+ "file": "llvm/test/Transforms/DeadArgElim/musttail-caller.ll",
111
+ "commands": [
112
+ "opt -passes=deadargelim -S < %s"
113
+ ],
114
+ "tests": [
115
+ {
116
+ "test_name": "test",
117
+ "test_body": "define hidden void @test(i32 %a, i32 %b) {\n musttail call void @foo(i32 %a, i32 0)\n ret void\n}\n\ndeclare hidden void @foo(i32, i32)\n"
118
+ },
119
+ {
120
+ "test_name": "foo",
121
+ "test_body": "define hidden void @foo(i32 %a, i32 %b) {\n ret void\n}\n"
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ "file": "llvm/test/Transforms/DeadArgElim/musttail-verifier.ll",
127
+ "commands": [
128
+ "opt -passes=deadargelim -S < %s"
129
+ ],
130
+ "tests": [
131
+ {
132
+ "test_name": "<module>",
133
+ "test_body": "; Testcases comes from PR126817 and PR107569\n; See PR54964 and langref for more information about how llvm deal with musttail currently\n\ndefine i64 @A() {\n;\nentry:\n %v2660 = musttail call i64 @B()\n ret i64 %v2660\n}\n\ndefine internal i64 @B() {\n;\nentry:\n ret i64 0\n}\n\ndefine internal i64 @C() {\n;\nentry:\n %v30543 = musttail call i64 @B()\n ret i64 %v30543\n}\n\n%struct.S = type { double }\n\ndefine internal %struct.S @F38() {\n;\n ret %struct.S { double 0.0 }\n}\n\ndefine internal %struct.S @F36() {\n;\n %1 = alloca %struct.S, align 8\n %3 = musttail call %struct.S @F38()\n ret %struct.S %3\n}\n\ndefine double @foo() {\n;\n %3 = call %struct.S @F36()\n %5 = extractvalue %struct.S %3, 0\n ret double %5\n}"
134
+ }
135
+ ]
136
+ }
137
+ ],
138
+ "issue": {
139
+ "title": "DeadArgumentElimination creates invalid code with musttail calls returning structs",
140
+ "body": "The DeadArgumentElimination pass creates code which fails the IR verifier when run on this input:\r\n\r\n```test.ll\r\n%struct.S = type { i32 }\r\n\r\ndefine internal %struct.S @F38() {\r\n ret %struct.S { i32 0 }\r\n}\r\n\r\ndefine %struct.S @F36() {\r\n %3 = musttail call %struct.S @F38()\r\n ret %struct.S %3\r\n}\r\n```\r\n\r\n```\r\n$ /work/llvm/build/bin/opt test.ll -passes=deadargelim -S\r\ncannot guarantee tail call due to mismatched return types\r\n %1 = musttail call i32 @F38()\r\nLLVM ERROR: Broken module found, compilation aborted!\r\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.\r\nStack dump:\r\n0. Program arguments: /work/llvm/build/bin/opt test.ll -passes=deadargelim -S\r\n1. Running pass \"verify\" on module \"test.ll\"\r\n #0 0x000055c16a99ca37 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/work/llvm/build/bin/opt+0x4133a37)\r\n #1 0x000055c16a99a57e llvm::sys::RunSignalHandlers() (/work/llvm/build/bin/opt+0x413157e)\r\n #2 0x000055c16a99d27a SignalHandler(int) Signals.cpp:0:0\r\n #3 0x00007f38e3a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\r\n #4 0x00007f38e3a969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\r\n #5 0x00007f38e3a969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10\r\n #6 0x00007f38e3a969fc pthread_kill ./nptl/pthread_kill.c:89:10\r\n #7 0x00007f38e3a42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6\r\n #8 0x00007f38e3a287f3 abort ./stdlib/abort.c:81:7\r\n #9 0x000055c16a9857a3 llvm::report_fatal_error(llvm::Twine const&, bool) (/work/llvm/build/bin/opt+0x411c7a3)\r\n#10 0x000055c16a9855f6 (/work/llvm/build/bin/opt+0x411c5f6)\r\n#11 0x000055c16afe2d4a (/work/llvm/build/bin/opt+0x4779d4a)\r\n#12 0x000055c16bd1b53d llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) NewPMDriver.cpp:0:0\r\n#13 0x000055c16abad88a llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/work/llvm/build/bin/opt+0x434488a)\r\n#14 0x000055c16bd146eb 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) (/work/llvm/build/bin/opt+0x54ab6eb)\r\n#15 0x000055c16a964609 optMain (/work/llvm/build/bin/opt+0x40fb609)\r\n#16 0x00007f38e3a29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16\r\n#17 0x00007f38e3a29e40 call_init ./csu/../csu/libc-start.c:128:20\r\n#18 0x00007f38e3a29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5\r\n#19 0x000055c16a95e0a5 _start (/work/llvm/build/bin/opt+0x40f50a5)\r\nfish: Job 1, '/work/llvm/build/bin/opt test.l\u2026' terminated by signal SIGABRT (Abort)\r\n```\r\n\r\nFound using a fuzzer while testing #102896.",
141
+ "author": "ostannard",
142
+ "labels": [
143
+ "ipo",
144
+ "crash-on-valid"
145
+ ],
146
+ "comments": [
147
+ {
148
+ "author": "ostannard",
149
+ "body": "Related case with a different assertion message:\r\n```test2.ll\r\n%struct.S = type { double }\r\n\r\ndefine internal %struct.S @F38() {\r\n ret %struct.S { double 0.0 }\r\n}\r\n\r\ndefine internal %struct.S @F36() {\r\n %1 = alloca %struct.S, align 8\r\n %3 = musttail call %struct.S @F38()\r\n ret %struct.S %3\r\n}\r\n\r\ndefine double @foo() {\r\n %3 = call %struct.S @F36()\r\n %5 = extractvalue %struct.S %3, 0\r\n ret double %5\r\n}\r\n```\r\n\r\n```\r\n$ /work/llvm/build/bin/opt test2.ll -passes=deadargelim -S -print-after-all\r\n; *** IR Dump After DeadArgumentEliminationPass on [module] ***\r\n; ModuleID = 'test2.ll'\r\nsource_filename = \"test2.ll\"\r\n\r\n%struct.S = type { double }\r\n\r\ndefine internal double @F38() {\r\n %oldret = extractvalue %struct.S zeroinitializer, 0\r\n ret double %oldret\r\n}\r\n\r\ndefine internal double @F36() {\r\n %1 = alloca %struct.S, align 8\r\n %2 = musttail call double @F38()\r\n %oldret = insertvalue %struct.S poison, double %2, 0\r\n %oldret1 = extractvalue %struct.S %oldret, 0\r\n ret double %oldret1\r\n}\r\n\r\ndefine double @foo() {\r\n %1 = call double @F36()\r\n %oldret = insertvalue %struct.S poison, double %1, 0\r\n %2 = extractvalue %struct.S %oldret, 0\r\n ret double %2\r\n}\r\nmusttail call must precede a ret with an optional bitcast\r\n %2 = musttail call double @F38()\r\nLLVM ERROR: Broken module found, compilation aborted!\r\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.\r\nStack dump:\r\n0. Program arguments: /work/llvm/build/bin/opt test2.ll -passes=deadargelim -S -print-after-all\r\n1. Running pass \"verify\" on module \"test2.ll\"\r\n #0 0x000055c5f980ca37 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/work/llvm/build/bin/opt+0x4133a37)\r\n #1 0x000055c5f980a57e llvm::sys::RunSignalHandlers() (/work/llvm/build/bin/opt+0x413157e)\r\n #2 0x000055c5f980d27a SignalHandler(int) Signals.cpp:0:0\r\n #3 0x00007faf4da42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\r\n #4 0x00007faf4da969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76\r\n #5 0x00007faf4da969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10\r\n #6 0x00007faf4da969fc pthread_kill ./nptl/pthread_kill.c:89:10\r\n #7 0x00007faf4da42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6\r\n #8 0x00007faf4da287f3 abort ./stdlib/abort.c:81:7\r\n #9 0x000055c5f97f57a3 llvm::report_fatal_error(llvm::Twine const&, bool) (/work/llvm/build/bin/opt+0x411c7a3)\r\n#10 0x000055c5f97f55f6 (/work/llvm/build/bin/opt+0x411c5f6)\r\n#11 0x000055c5f9e52d4a (/work/llvm/build/bin/opt+0x4779d4a)\r\n#12 0x000055c5fab8b53d llvm::detail::PassModel<llvm::Module, llvm::VerifierPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) NewPMDriver.cpp:0:0\r\n#13 0x000055c5f9a1d88a llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/work/llvm/build/bin/opt+0x434488a)\r\n#14 0x000055c5fab846eb 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) (/work/llvm/build/bin/opt+0x54ab6eb)\r\n#15 0x000055c5f97d4609 optMain (/work/llvm/build/bin/opt+0x40fb609)\r\n#16 0x00007faf4da29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16\r\n#17 0x00007faf4da29e40 call_init ./csu/../csu/libc-start.c:128:20\r\n#18 0x00007faf4da29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5\r\n#19 0x000055c5f97ce0a5 _start (/work/llvm/build/bin/opt+0x40f50a5)\r\nfish: Job 1, '/work/llvm/build/bin/opt test2.\u2026' terminated by signal SIGABRT (Abort)\r\n```"
150
+ },
151
+ {
152
+ "author": "ParkHanbum",
153
+ "body": "we have the test for second case at musttail-invalid.ll\r\n```declare i32 @not_tail_pos_callee()\r\ndefine i32 @not_tail_pos() {\r\n; CHECK: musttail call must precede a ret with an optional bitcast\r\n %v = musttail call i32 @not_tail_pos_callee()\r\n %w = add i32 %v, 1\r\n ret i32 %w\r\n}\r\n```\r\n\r\nbut first case is not. maybe we need to add this into testcase.\r\n\r\nfirst case \r\n```void Verifier::verifyMustTailCall(CallInst &CI) {\r\n Check(!CI.isInlineAsm(), \"cannot use musttail call with inline asm\", &CI);\r\n\r\n Function *F = CI.getParent()->getParent();\r\n FunctionType *CallerTy = F->getFunctionType();\r\n FunctionType *CalleeTy = CI.getFunctionType();\r\n Check(CallerTy->isVarArg() == CalleeTy->isVarArg(),\r\n \"cannot guarantee tail call due to mismatched varargs\", &CI);\r\n Check(isTypeCongruent(CallerTy->getReturnType(), CalleeTy->getReturnType()),\r\n \"cannot guarantee tail call due to mismatched return types\", F, CallerTy->getReturnType(), &CI, CalleeTy->getReturnType());\r\n```\r\n\r\nCallInst: %1 = musttail call i32 @F38()\r\nReturn type of Caller : %struct.S = type { i32 }\r\nReturn type of Callee: i32\r\n\r\nThis is weird. \r\nI couldn't understand why `%struct.S = type { i32 }` is changed to `i32` at `%3 = musttail call %struct.S @F38()`\r\n\r\nbut after change it to `i32` then it works.\r\n```\r\n%struct.S = type { i32 }\r\n\r\ndefine internal %struct.S @F38() {\r\n ret %struct.S { i32 0 }\r\n}\r\n\r\ndefine i32 @F36() {\r\n %3 = musttail call i32 @F38()\r\n ret i32 %3\r\n}\r\n```\r\n```\r\n% bin/opt --passes=deadargelim test.ll -S \r\n; ModuleID = 'test.ll'\r\nsource_filename = \"test.ll\"\r\n\r\n%struct.S = type { i32 }\r\n\r\ndefine internal %struct.S @F38() {\r\n ret %struct.S zeroinitializer\r\n}\r\n\r\ndefine i32 @F36() {\r\n %1 = musttail call i32 @F38()\r\n ret i32 %1\r\n}\r\n\r\n```\r\n\r\nis this normal?"
154
+ },
155
+ {
156
+ "author": "ParkHanbum",
157
+ "body": "I found why it causes, maybe.\r\n```\r\nsource_filename = \"test.ll\"\r\n\r\n%struct.S = type { i32 }\r\n\r\ndefine internal i32 @F38() {\r\n %oldret = extractvalue %struct.S zeroinitializer, 0\r\n ret i32 %oldret\r\n}\r\n\r\ndefine %struct.S @F36() {\r\n %1 = musttail call i32 @F38()\r\n %oldret = insertvalue %struct.S poison, i32 %1, 0\r\n ret %struct.S %oldret\r\n}\r\n\r\n```\r\n\r\n"
158
+ },
159
+ {
160
+ "author": "ParkHanbum",
161
+ "body": "we create new return type in here\r\n```\r\n// Look at each of the original return values individually.\r\n for (unsigned Ri = 0; Ri != RetCount; ++Ri) {\r\n RetOrArg Ret = createRet(F, Ri);\r\n if (LiveValues.erase(Ret)) {\r\n RetTypes.push_back(getRetComponentType(F, Ri));\r\n NewRetIdxs[Ri] = RetTypes.size() - 1;\r\n } else {\r\n ++NumRetValsEliminated;\r\n LLVM_DEBUG(\r\n dbgs() << \"DeadArgumentEliminationPass - Removing return value \"\r\n << Ri << \" from \" << F->getName() << \"\\n\");\r\n }\r\n \r\n```\r\n\r\nI tested disabling the code that creates the new return type to see if it would make a quick improvement\r\n```\r\nNRetTy = RetTy;\r\n```\r\n\r\nit seems to work\r\n```\r\n; ModuleID = 'test.ll'\r\nsource_filename = \"test.ll\"\r\n\r\n%struct.S = type { i32 }\r\n\r\ndefine internal %struct.S @F38() {\r\n ret %struct.S zeroinitializer\r\n}\r\n\r\ndefine %struct.S @F36() {\r\n %1 = musttail call %struct.S @F38()\r\n ret %struct.S %1\r\n}\r\n\r\n```\r\n\r\nIf this is a defect,\r\n1. do not change return type if it conflict with caller's return type when CB was musttail call.\r\n2. if caller's return type is conflict with new return type then change all of uses type.\r\n\r\nwe can fix it by choosing one of above. IMO\r\nhow do you think?\r\n\r\nplease let me know this issue need to fix or not~\r\n\r\n@dtcxzyw Can you please review this issue?\r\n"
162
+ },
163
+ {
164
+ "author": "dtcxzyw",
165
+ "body": "cc @nikic @efriedma-quic "
166
+ },
167
+ {
168
+ "author": "efriedma-quic",
169
+ "body": "I'm not sure why we're trying to run DAE on functions where we can't change the signature; why doesn't the current check for musttail callers handle this?"
170
+ },
171
+ {
172
+ "author": "ParkHanbum",
173
+ "body": "@efriedma-quic Don't think it needs to be fix?\r\n"
174
+ },
175
+ {
176
+ "author": "efriedma-quic",
177
+ "body": "Not sure what you're saying. I'm asking about the structure of the existing code. There are already checks for musttail calls in DeadArgumentElimination, which at first glance should exclude transforming cases like this. Can those checks be extended to also exclude this case?"
178
+ }
179
+ ]
180
+ },
181
+ "verified": true
182
+ }
dataset/114901.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bug_id": "114901",
3
+ "issue_url": "https://github.com/llvm/llvm-project/issues/114901",
4
+ "bug_type": "miscompilation",
5
+ "base_commit": "a88be11eef59b1722030e1219109ea0b76eebbe5",
6
+ "knowledge_cutoff": "2024-11-05T00:44:52Z",
7
+ "lit_test_dir": [
8
+ "llvm/test/Transforms/VectorCombine"
9
+ ],
10
+ "hints": {
11
+ "fix_commit": "05e838f428555bcc4507bd37912da60ea9110ef6",
12
+ "components": [
13
+ "VectorCombine"
14
+ ],
15
+ "bug_location_lineno": {
16
+ "llvm/lib/Transforms/Vectorize/VectorCombine.cpp": [
17
+ [
18
+ 1032,
19
+ 1040
20
+ ],
21
+ [
22
+ 1113,
23
+ 1120
24
+ ]
25
+ ]
26
+ },
27
+ "bug_location_funcname": {
28
+ "llvm/lib/Transforms/Vectorize/VectorCombine.cpp": [
29
+ "VectorCombine::foldExtractedCmps"
30
+ ]
31
+ }
32
+ },
33
+ "patch": "commit 05e838f428555bcc4507bd37912da60ea9110ef6\nAuthor: Simon Pilgrim <[email protected]>\nDate: Tue Nov 5 11:42:20 2024 +0000\n\n [VectorCombine] foldExtractedCmps - disable fold on non-commutative binops\n \n The fold needs to be adjusted to correctly track the LHS/RHS operands, which will take some refactoring, for now just disable the fold in this case.\n \n Fixes #114901\n\ndiff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\nindex 025234c54956..332c52040e21 100644\n--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\n+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp\n@@ -1032,9 +1032,15 @@ bool VectorCombine::scalarizeBinopOrCmp(Instruction &I) {\n /// a vector into vector operations followed by extract. Note: The SLP pass\n /// may miss this pattern because of implementation problems.\n bool VectorCombine::foldExtractedCmps(Instruction &I) {\n+ auto *BI = dyn_cast<BinaryOperator>(&I);\n+\n // We are looking for a scalar binop of booleans.\n // binop i1 (cmp Pred I0, C0), (cmp Pred I1, C1)\n- if (!I.isBinaryOp() || !I.getType()->isIntegerTy(1))\n+ if (!BI || !I.getType()->isIntegerTy(1))\n+ return false;\n+\n+ // TODO: Support non-commutative binary ops.\n+ if (!BI->isCommutative())\n return false;\n \n // The compare predicates should match, and each compare should have a\n@@ -1113,8 +1119,7 @@ bool VectorCombine::foldExtractedCmps(Instruction &I) {\n Value *VCmp = Builder.CreateCmp(Pred, X, ConstantVector::get(CmpC));\n \n Value *Shuf = createShiftShuffle(VCmp, ExpensiveIndex, CheapIndex, Builder);\n- Value *VecLogic = Builder.CreateBinOp(cast<BinaryOperator>(I).getOpcode(),\n- VCmp, Shuf);\n+ Value *VecLogic = Builder.CreateBinOp(BI->getOpcode(), VCmp, Shuf);\n Value *NewExt = Builder.CreateExtractElement(VecLogic, CheapIndex);\n replaceValue(I, *NewExt);\n ++NumVecCmpBO;\n",
34
+ "tests": [
35
+ {
36
+ "file": "llvm/test/Transforms/VectorCombine/X86/pr114901.ll",
37
+ "commands": [
38
+ "opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=sse2",
39
+ "opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=avx2"
40
+ ],
41
+ "tests": [
42
+ {
43
+ "test_name": "PR114901",
44
+ "test_body": "define i1 @PR114901(<4 x i32> %a) {\n %e1 = extractelement <4 x i32> %a, i32 1\n %e3 = extractelement <4 x i32> %a, i32 3\n %cmp1 = icmp sgt i32 %e1, -8\n %cmp3 = icmp sgt i32 %e3, 42\n %r = ashr i1 %cmp3, %cmp1\n ret i1 %r\n}\n"
45
+ }
46
+ ]
47
+ }
48
+ ],
49
+ "issue": {
50
+ "title": "[VectorCombine] miscompilation",
51
+ "body": "Alive2 report: https://alive2.llvm.org/ce/z/YwSTI4\r\n\r\n```llvm\r\n----------------------------------------\r\ndefine i1 @icmp_xor_v4i32.2(<4 x i32> %a) {\r\n#0:\r\n %e1 = extractelement <4 x i32> %a, i32 3\r\n %e2 = extractelement <4 x i32> %a, i32 1\r\n %cmp1 = icmp sgt i32 %e1, 42\r\n %cmp2 = icmp sgt i32 %e2, 4294967288\r\n %#1 = ashr i1 %cmp1, %cmp2\r\n ret i1 %#1\r\n}\r\n=>\r\ndefine i1 @icmp_xor_v4i32.2(<4 x i32> %a) {\r\n#0:\r\n %#1 = icmp sgt <4 x i32> %a, { poison, 4294967288, poison, 42 }\r\n %shift = shufflevector <4 x i1> %#1, <4 x i1> poison, 4294967295, 3, 4294967295, 4294967295\r\n %#2 = ashr <4 x i1> %#1, %shift\r\n %#3 = extractelement <4 x i1> %#2, i64 1\r\n ret i1 %#3\r\n}\r\nTransformation doesn't verify!\r\n\r\nERROR: Target is more poisonous than source\r\n\r\nExample:\r\n<4 x i32> %a = < #x00000000 (0), #xfffffff8 (4294967288, -8), #x00000000 (0), #x0000002b (43) >\r\n\r\nSource:\r\ni32 %e1 = #x0000002b (43)\r\ni32 %e2 = #xfffffff8 (4294967288, -8)\r\ni1 %cmp1 = #x1 (1)\r\ni1 %cmp2 = #x0 (0)\r\ni1 %#1 = #x1 (1)\r\n\r\nTarget:\r\n<4 x i1> %#1 = < poison, #x0 (0), poison, #x1 (1) >\r\n<4 x i1> %shift = < poison, #x1 (1), poison, poison >\r\n<4 x i1> %#2 = < poison, poison, poison, poison >\r\ni1 %#3 = poison\r\nSource value: #x1 (1)\r\nTarget value: poison\r\n\r\nSummary:\r\n 0 correct transformations\r\n 1 incorrect transformations\r\n 0 failed-to-prove transformations\r\n 0 Alive2 errors\r\n```",
52
+ "author": "bongjunj",
53
+ "labels": [
54
+ "miscompilation"
55
+ ],
56
+ "comments": [
57
+ {
58
+ "author": "RKSimon",
59
+ "body": "It looks like the ashr operands have been commuted in the fold - will take a look later today"
60
+ }
61
+ ]
62
+ },
63
+ "verified": true
64
+ }
dataset/118725.json ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bug_id": "118725",
3
+ "issue_url": "https://github.com/llvm/llvm-project/issues/118725",
4
+ "bug_type": "crash",
5
+ "base_commit": "e3352904309a539eddcf3ddd9fb11ca2aef29d65",
6
+ "knowledge_cutoff": "2024-12-05T01:14:53Z",
7
+ "lit_test_dir": [
8
+ "llvm/test/Transforms/GlobalOpt"
9
+ ],
10
+ "hints": {
11
+ "fix_commit": "5013c81b781eb95af8e429956d63c8f9c16a4647",
12
+ "components": [
13
+ "Evaluator"
14
+ ],
15
+ "bug_location_lineno": {
16
+ "llvm/include/llvm/Transforms/Utils/Evaluator.h": [
17
+ [
18
+ 125,
19
+ 133
20
+ ]
21
+ ],
22
+ "llvm/lib/Transforms/Utils/Evaluator.cpp": [
23
+ [
24
+ 253,
25
+ 292
26
+ ],
27
+ [
28
+ 520,
29
+ 528
30
+ ],
31
+ [
32
+ 544,
33
+ 553
34
+ ]
35
+ ]
36
+ },
37
+ "bug_location_funcname": {
38
+ "llvm/include/llvm/Transforms/Utils/Evaluator.h": [
39
+ "setVal"
40
+ ],
41
+ "llvm/lib/Transforms/Utils/Evaluator.cpp": [
42
+ "Evaluator::EvaluateBlock",
43
+ "Evaluator::castCallResultIfNeeded",
44
+ "Evaluator::getFormalParams"
45
+ ]
46
+ }
47
+ },
48
+ "patch": "commit 5013c81b781eb95af8e429956d63c8f9c16a4647\nAuthor: Nikita Popov <[email protected]>\nDate: Thu Dec 12 10:44:52 2024 +0100\n\n [GlobalOpt][Evaluator] Don't evaluate calls with signature mismatch (#119548)\n \n The global ctor evaluator tries to evalute function calls where the call\n function type and function type do not match, by performing bitcasts.\n This currently causes a crash when calling a void function with non-void\n return type.\n \n I've opted to remove this functionality entirely rather than fixing this\n specific case. With opaque pointers, there shouldn't be a legitimate use\n case for this anymore, as we don't need to look through pointer type\n casts. Doing other bitcasts is very iffy because it ignores ABI\n considerations. We should at least leave adjusting the signatures to\n make them line up to InstCombine (which also does some iffy things, but\n is at least somewhat more constrained).\n \n Fixes https://github.com/llvm/llvm-project/issues/118725.\n\ndiff --git a/llvm/include/llvm/Transforms/Utils/Evaluator.h b/llvm/include/llvm/Transforms/Utils/Evaluator.h\nindex 5d53773b5d6b..118037625421 100644\n--- a/llvm/include/llvm/Transforms/Utils/Evaluator.h\n+++ b/llvm/include/llvm/Transforms/Utils/Evaluator.h\n@@ -125,9 +125,6 @@ private:\n ValueStack.back()[V] = C;\n }\n \n- /// Casts call result to a type of bitcast call expression\n- Constant *castCallResultIfNeeded(Type *ReturnType, Constant *RV);\n-\n /// Given call site return callee and list of its formal arguments\n Function *getCalleeWithFormalArgs(CallBase &CB,\n SmallVectorImpl<Constant *> &Formals);\ndiff --git a/llvm/lib/Transforms/Utils/Evaluator.cpp b/llvm/lib/Transforms/Utils/Evaluator.cpp\nindex cf1a8b4af112..2af447aadce2 100644\n--- a/llvm/lib/Transforms/Utils/Evaluator.cpp\n+++ b/llvm/lib/Transforms/Utils/Evaluator.cpp\n@@ -253,40 +253,17 @@ Evaluator::getCalleeWithFormalArgs(CallBase &CB,\n \n bool Evaluator::getFormalParams(CallBase &CB, Function *F,\n SmallVectorImpl<Constant *> &Formals) {\n- if (!F)\n- return false;\n-\n auto *FTy = F->getFunctionType();\n- if (FTy->getNumParams() > CB.arg_size()) {\n- LLVM_DEBUG(dbgs() << \"Too few arguments for function.\\n\");\n+ if (FTy != CB.getFunctionType()) {\n+ LLVM_DEBUG(dbgs() << \"Signature mismatch.\\n\");\n return false;\n }\n \n- auto ArgI = CB.arg_begin();\n- for (Type *PTy : FTy->params()) {\n- auto *ArgC = ConstantFoldLoadThroughBitcast(getVal(*ArgI), PTy, DL);\n- if (!ArgC) {\n- LLVM_DEBUG(dbgs() << \"Can not convert function argument.\\n\");\n- return false;\n- }\n- Formals.push_back(ArgC);\n- ++ArgI;\n- }\n+ for (Value *Arg : CB.args())\n+ Formals.push_back(getVal(Arg));\n return true;\n }\n \n-/// If call expression contains bitcast then we may need to cast\n-/// evaluated return value to a type of the call expression.\n-Constant *Evaluator::castCallResultIfNeeded(Type *ReturnType, Constant *RV) {\n- if (!RV || RV->getType() == ReturnType)\n- return RV;\n-\n- RV = ConstantFoldLoadThroughBitcast(RV, ReturnType, DL);\n- if (!RV)\n- LLVM_DEBUG(dbgs() << \"Failed to fold bitcast call expr\\n\");\n- return RV;\n-}\n-\n /// Evaluate all instructions in block BB, returning true if successful, false\n /// if we can't evaluate it. NewBB returns the next BB that control flows into,\n /// or null upon return. StrippedPointerCastsForAliasAnalysis is set to true if\n@@ -520,9 +497,7 @@ bool Evaluator::EvaluateBlock(BasicBlock::iterator CurInst, BasicBlock *&NextBB,\n if (Callee->isDeclaration()) {\n // If this is a function we can constant fold, do it.\n if (Constant *C = ConstantFoldCall(&CB, Callee, Formals, TLI)) {\n- InstResult = castCallResultIfNeeded(CB.getType(), C);\n- if (!InstResult)\n- return false;\n+ InstResult = C;\n LLVM_DEBUG(dbgs() << \"Constant folded function call. Result: \"\n << *InstResult << \"\\n\");\n } else {\n@@ -544,10 +519,7 @@ bool Evaluator::EvaluateBlock(BasicBlock::iterator CurInst, BasicBlock *&NextBB,\n return false;\n }\n ValueStack.pop_back();\n- InstResult = castCallResultIfNeeded(CB.getType(), RetVal);\n- if (RetVal && !InstResult)\n- return false;\n-\n+ InstResult = RetVal;\n if (InstResult) {\n LLVM_DEBUG(dbgs() << \"Successfully evaluated function. Result: \"\n << *InstResult << \"\\n\\n\");\n",
49
+ "tests": [
50
+ {
51
+ "file": "llvm/test/Transforms/GlobalOpt/evaluate-ret-void-mismatch.ll",
52
+ "commands": [
53
+ "opt -S -passes=globalopt < %s"
54
+ ],
55
+ "tests": [
56
+ {
57
+ "test_name": "<module>",
58
+ "test_body": "\n; Don't evaluate call with return value type mismatch.\n\[email protected]_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @__cxx_global_var_init, ptr null }]\n\ndefine void @__cxa_guard_acquire() {\n;\nentry:\n ret void\n}\n\ndefine void @__cxx_global_var_init() {\n;\n %res = call i32 @__cxa_guard_acquire()\n %tobool.not = icmp eq i32 %res, 0\n ret void\n}"
59
+ }
60
+ ]
61
+ }
62
+ ],
63
+ "issue": {
64
+ "title": "SIGSEGV with -flto",
65
+ "body": "Static linking with -flto on Arch linux with clang 18.1.8\n\nNot able to get a minimal repro at the moment. Other possibly less common options\n\n \"-std=c++20\",\n \"-nostdlib\",\n \"-nostartfiles\",\n \"-fno-exceptions\",\n \"-fno-rtti\",\n\nProgram terminated with signal SIGSEGV, Segmentation fault.\n#0 0x00007ee06170e69c in llvm::ConstantFoldConstant(llvm::Constant const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*) () from /usr/lib/libLLVM.so.18.1\n#0 0x00007ee06170e69c in llvm::ConstantFoldConstant(llvm::Constant const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*) () from /usr/lib/libLLVM.so.18.1\n#1 0x00007ee060abea1a in llvm::Evaluator::EvaluateBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true>, false, false>, llvm::BasicBlock*&, bool&) () from /usr/lib/libLLVM.so.18.1\n#2 0x00007ee060ac14e4 in llvm::Evaluator::EvaluateFunction(llvm::Function*, llvm::Constant*&, llvm::SmallVectorImpl<llvm::Constant*> const&) () from /usr/lib/libLLVM.so.18.1\n#3 0x00007ee061307930 in ?? () from /usr/lib/libLLVM.so.18.1\n#4 0x00007ee061308634 in ?? () from /usr/lib/libLLVM.so.18.1\n#5 0x00007ee060aa7649 in llvm::optimizeGlobalCtorsList(llvm::Module&, llvm::function_ref<bool (unsigned int, llvm::Function*)>) () from /usr/lib/libLLVM.so.18.1\n#6 0x00007ee0613135f9 in llvm::GlobalOptPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () from /usr/lib/libLLVM.so.18.1\n#7 0x00007ee06411d177 in ?? () from /usr/lib/libLLVM.so.18.1\n#8 0x00007ee05fbd767e in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) () from /usr/lib/libLLVM.so.18.1\n#9 0x00007ee061a57995 in ?? () from /usr/lib/libLLVM.so.18.1\n#10 0x00007ee061a591ff in llvm::lto::opt(llvm::lto::Config const&, llvm::TargetMachine*, unsigned int, llvm::Module&, bool, llvm::ModuleSummaryIndex*, llvm::ModuleSummaryIndex const*, std::vector<unsigned char, std::allocator<unsigned char> > const&) () from /usr/lib/libLLVM.so.18.1\n#11 0x00007ee061a5a582 in llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream> > > (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) () from /usr/lib/libLLVM.so.18.1\n#12 0x00007ee061a4ed49 in llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream> > > (unsigned int, llvm::Twine const&)>) () from /usr/lib/libLLVM.so.18.1\n#13 0x00007ee061a4f241 in llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream> > > (unsigned int, llvm::Twine const&)>, std::function<llvm::Expected<std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream> > > (unsigned int, llvm::Twine const&)> > (unsigned int, llvm::StringRef, llvm::Twine const&)>) () from /usr/lib/libLLVM.so.18.1\n#14 0x00007ee0678ce067 in ?? () from /usr/bin/../lib/LLVMgold.so\n#15 0x00007ee0678cfd12 in ?? () from /usr/bin/../lib/LLVMgold.so\n#16 0x000056f827567837 in ?? ()\n#17 0x000056f82756f75f in ?? ()\n#18 0x00007ee067a00e08 in ?? () from /usr/lib/libc.so.6\n#19 0x00007ee067a00ecc in __libc_start_main () from /usr/lib/libc.so.6\n#20 0x000056f82756ea65 in ?? ()\n",
66
+ "author": "illiminable",
67
+ "labels": [
68
+ "incomplete",
69
+ "crash",
70
+ "LTO"
71
+ ],
72
+ "comments": [
73
+ {
74
+ "author": "EugeneZelenko",
75
+ "body": "Could you please try 19 or `main` branch?"
76
+ },
77
+ {
78
+ "author": "illiminable",
79
+ "body": "I don't think 19 is packaged for arch yet. I'll see if I can build trunk later in the week.\n\nIs it possible to just to disable this optimizeGlobalCtorsList or all of globalopt. I looked through --hidden-help and could not see an option like this."
80
+ },
81
+ {
82
+ "author": "ms178",
83
+ "body": "@illiminable While it is not packaged by Arch yet, you could try the linked toolchain instead and use it via an environment variable which points llvm to the new path: https://mirrors.edge.kernel.org/pub/tools/llvm/"
84
+ },
85
+ {
86
+ "author": "illiminable",
87
+ "body": "OK thanks I'll try. FWIW this is the approximate code pattern. And presumably its trying to optimize the fact that there are N unique symbols that \"register\" assigns true to but then never get used.\n\n```\n// Header File\nclass Functor {\n virtual void execImpl() = 0;\n void exec() { execImpl(); }\n };\n \n class Info {\n Functor* fn = nullptr;\n };\n \n class Registry {\n array<Info, 1024> fns;\n int count = 0;\n \n void register(Info&& f) {\n fns[count++] = f;\n }\n \n void exec() {\n for i in 0..count { fns[i].fn->exec(); }\n }\n };\n \n inline Registry reg;\n \n inline bool register(Functor* fn) {\n reg.register({.fn = fn});\n return true;\n }\n \n \n // REPEAT approx 10 each copies of the below in 10 different .cpp TU's\n class _uniquesymbol_ : public Functor {\n void execImpl() override;\n };\n \n // Instance of the derived functor class\n _uniquesymbol_ _uniquesymbol__instance;\n \n // _uniquesymbol__flag is always true and never used. Theres probably a better\n // way to do this?\n const bool _uniquesymbol__flag = register(&_uniquesymbol__instance);\n \n void _uniquesymbol_::execImpl() {\n // do stuff\n }\n \n // END REPEAT\n \n \n // Usage...\n reg.exec();\n``` \n"
88
+ },
89
+ {
90
+ "author": "illiminable",
91
+ "body": "@ms178 The toolchain didn't work because it doesn't contain LLVMgold.so\n\nI was able to build from the 19.1.5 branch in debug and can repro. It's only on one target. This is the assert output\n\nld.gold: /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/Support/Casting.h:109: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::ConstantVector; From = llvm::Constant]: Assertion `Val && \"isa<> used on a null pointer\"' failed.\n\nAnd a better symbolized stack\n\n#0 0x00007c11cae473f4 in ?? () from /usr/lib/libc.so.6\n#0 0x00007c11cae473f4 in ?? () from /usr/lib/libc.so.6\n#1 0x00007c11cadee120 in raise () from /usr/lib/libc.so.6\n#2 0x00007c11cadd54c3 in abort () from /usr/lib/libc.so.6\n#3 0x00007c11cadd53df in ?? () from /usr/lib/libc.so.6\n#4 0x00007c11cade6177 in __assert_fail () from /usr/lib/libc.so.6\n#5 0x00007c11c329c245 in llvm::isa_impl_cl<llvm::ConstantVector, llvm::Constant const*>::doit (Val=0x0) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/Support/Casting.h:109\n#6 0x00007c11c329bd99 in llvm::isa_impl_wrap<llvm::ConstantVector, llvm::Constant const*, llvm::Constant const*>::doit (Val=@0x7ffd009f71a0: 0x0) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/Support/Casting.h:137\n#7 0x00007c11c329b45b in llvm::isa_impl_wrap<llvm::ConstantVector, llvm::Constant const* const, llvm::Constant const*>::doit (Val=@0x7ffd009f71f0: 0x0) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/Support/Casting.h:129\n#8 0x00007c11c329a6b6 in llvm::CastIsPossible<llvm::ConstantVector, llvm::Constant const*, void>::isPossible (f=@0x7ffd009f71f0: 0x0) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/Support/Casting.h:257\n#9 0x00007c11c5ccd903 in llvm::CastInfo<llvm::ConstantVector, llvm::Constant const* const, void>::isPossible (f=@0x7ffd009f7248: 0x0) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/Support/Casting.h:509\n#10 0x00007c11c5ccd3d8 in llvm::isa<llvm::ConstantVector, llvm::Constant const*> (Val=@0x7ffd009f7248: 0x0) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/Support/Casting.h:549\n#11 0x00007c11c5f8be6e in (anonymous namespace)::ConstantFoldConstantImpl (C=0x0, DL=..., TLI=0x5d4a86076c38, FoldedOps=...) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp:1078\n#12 0x00007c11c5f8c5d3 in llvm::ConstantFoldConstant (C=0x0, DL=..., TLI=0x5d4a86076c38) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/Analysis/ConstantFolding.cpp:1163\n#13 0x00007c11c5cb7bdc in llvm::Evaluator::EvaluateBlock (this=0x7ffd009f7930, CurInst=..., NextBB=@0x7ffd009f76e0: 0x0, StrippedPointerCastsForAliasAnalysis=@0x7ffd009f76d0: false) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:610\n#14 0x00007c11c5cb7fd8 in llvm::Evaluator::EvaluateFunction (this=0x7ffd009f7930, F=0x5d4a85ccc618, RetVal=@0x7ffd009f78a8: 0x7ffd009f7ae0, ActualArgs=...) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/Transforms/Utils/Evaluator.cpp:660\n#15 0x00007c11c4f410a8 in EvaluateStaticConstructor (F=0x5d4a85ccc618, DL=..., TLI=0x5d4a86076c38) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:2080\n#16 0x00007c11c4f42bf7 in operator() (__closure=0x7ffd009f7e90, Priority=65535, F=0x5d4a85ccc618) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:2524\n#17 0x00007c11c4f43f3b in llvm::function_ref<bool(unsigned int, llvm::Function*)>::callback_fn<optimizeGlobalsInModule(llvm::Module&, const llvm::DataLayout&, llvm::function_ref<llvm::TargetLibraryInfo&(llvm::Function&)>, llvm::function_ref<llvm::TargetTransformInfo&(llvm::Function&)>, llvm::function_ref<llvm::BlockFrequencyInfo&(llvm::Function&)>, llvm::function_ref<llvm::DominatorTree&(llvm::Function&)>, llvm::function_ref<void(llvm::Function&)>, llvm::function_ref<void(llvm::Function&)>)::<lambda(uint32_t, llvm::Function*)> >(intptr_t, unsigned int, llvm::Function *) (callable=140724613906064, params#0=65535, params#1=0x5d4a85ccc618) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45\n#18 0x00007c11c5c95103 in llvm::function_ref<bool(unsigned int, llvm::Function*)>::operator() (this=0x7ffd009f7cc0, params#0=65535, params#1=0x5d4a85ccc618) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68\n#19 0x00007c11c5c92754 in llvm::optimizeGlobalCtorsList (M=..., ShouldRemove=...) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/Transforms/Utils/CtorUtils.cpp:138\n#20 0x00007c11c4f4309c in optimizeGlobalsInModule(llvm::Module &, const llvm::DataLayout &, llvm::function_ref<llvm::TargetLibraryInfo&(llvm::Function&)>, llvm::function_ref<llvm::TargetTransformInfo&(llvm::Function&)>, llvm::function_ref<llvm::BlockFrequencyInfo&(llvm::Function&)>, llvm::function_ref<llvm::DominatorTree&(llvm::Function&)>, llvm::function_ref<void(llvm::Function&)>, llvm::function_ref<void(llvm::Function&)>) (M=..., DL=..., GetTLI=..., GetTTI=..., GetBFI=..., LookupDomTree=..., ChangedCFGCallback=..., DeleteFnCallback=...) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:2520\n#21 0x00007c11c4f435e0 in llvm::GlobalOptPass::run (this=0x5d4a85c13138, M=..., AM=...) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp:2583\n#22 0x00007c11c4366477 in llvm::detail::PassModel<llvm::Module, llvm::GlobalOptPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (this=0x5d4a85c13130, IR=..., AM=...) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90\n#23 0x00007c11c6e2f349 in llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (this=0x7ffd009f8300, IR=..., AM=...) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:81\n#24 0x00007c11c3934968 in runNewPMPasses (Conf=..., Mod=..., TM=0x5d4a85edf0b0, OptLevel=3, IsThinLTO=false, ExportSummary=0x5d4a85bc6d18, ImportSummary=0x0) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/LTO/LTOBackend.cpp:338\n#25 0x00007c11c3934b94 in llvm::lto::opt (Conf=..., TM=0x5d4a85edf0b0, Task=0, Mod=..., IsThinLTO=false, ExportSummary=0x5d4a85bc6d18, ImportSummary=0x0, CmdArgs=std::vector of length 0, capacity 0) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/LTO/LTOBackend.cpp:363\n#26 0x00007c11c3936054 in llvm::lto::backend (C=..., AddStream=..., ParallelCodeGenParallelismLevel=1, Mod=..., CombinedIndex=...) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/LTO/LTOBackend.cpp:517\n#27 0x00007c11c38e855d in llvm::lto::LTO::runRegularLTO (this=0x5d4a85bc6710, AddStream=...) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/LTO/LTO.cpp:1354\n#28 0x00007c11c38e746b in llvm::lto::LTO::run (this=0x5d4a85bc6710, AddStream=..., Cache=...) at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/lib/LTO/LTO.cpp:1186\n#29 0x00007c11c3255536 in runLTO () at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/tools/gold/gold-plugin.cpp:1111\n#30 0x00007c11c3255a0d in allSymbolsReadHook () at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/tools/gold/gold-plugin.cpp:1148\n#31 0x00007c11c3255c19 in all_symbols_read_hook () at /mnt/local/src/third_party/github/llvm/llvm-project/llvm/tools/gold/gold-plugin.cpp:1173\n#32 0x00005d4a6c4d9154 in ?? ()\n#33 0x00005d4a6c5138d0 in ?? ()\n#34 0x00005d4a6c3fc49a in ?? ()\n#35 0x00007c11cadd6e08 in ?? () from /usr/lib/libc.so.6\n#36 0x00007c11cadd6ecc in __libc_start_main () from /usr/lib/libc.so.6\n#37 0x00005d4a6c3ff985 in ?? ()"
92
+ },
93
+ {
94
+ "author": "ms178",
95
+ "body": "@illiminable Thanks for letting me know. Unfortunately I am not a developer and cannot help you to debug this problem further."
96
+ },
97
+ {
98
+ "author": "illiminable",
99
+ "body": "I debugged a little bit, but I don't fully understand this code.\n\nIn EvaluateBlock the issue is that after the various branches the code falls out to this block at 609 with InstResult still null. All the other branches usually check InstResult and return false. ConstantFoldConstant will assert or crash if the first parameter is null in the call from 610. I also tried just guarding this conditino with !InstResult but that doesn't seem right since it triggers another assert later \"Assertion `R && \"Reference to an uncomputed value!\"'.\n\nhttps://github.com/llvm/llvm-project/blob/llvmorg-19.1.5/llvm/lib/Transforms/Utils/Evaluator.cpp#L610\n\nThe bug only only occurs when the code hits the branch on 556. Strangely the debug log here says both branches of the if are success. I don't know if it's a copy paste error or if maybe the code should just return true after 558, but given the rest of the code this doesn't seem right.\n\nBut returning false in the line 556 branch seems to fix the crash and the resulting program seems to work fine.\n\nhttps://github.com/llvm/llvm-project/blob/llvmorg-19.1.5/llvm/lib/Transforms/Utils/Evaluator.cpp#L556\n\nSomeone who understands the code better should evaluate though.\n"
100
+ },
101
+ {
102
+ "author": "illiminable",
103
+ "body": "I used llvm-reduce to reduce the bitcode and when i looked at what was left it was basically __cxa_guard_acquire and I realized that while bootstrapping i defined it with the wrong return type. So since I violated the ABI I guess my fault.\n\nNot sure if there is still an underlying issue here someone wants to fix. ie. would be better to error or ignore than crash. But it seems pretty unlikely someone else will hit at least this specific cause of the problem.\n\nCan probably close if this corner case is not important."
104
+ },
105
+ {
106
+ "author": "nikic",
107
+ "body": "Could you please share the reduced bitcode? (Or IR after running it through llvm-dis.)"
108
+ },
109
+ {
110
+ "author": "illiminable",
111
+ "body": "[reduced.zip](https://github.com/user-attachments/files/18043521/reduced.zip)\n\nThis is the reduced.bc\n\n"
112
+ }
113
+ ]
114
+ },
115
+ "verified": true
116
+ }
dataset/134115.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bug_id": "134115",
3
+ "issue_url": "https://github.com/llvm/llvm-project/issues/134115",
4
+ "bug_type": "crash",
5
+ "base_commit": "6388a7acf7e31fdc7b9c168bd6ce0f4d25c98cd0",
6
+ "knowledge_cutoff": "2025-04-02T17:01:09Z",
7
+ "lit_test_dir": [
8
+ "llvm/test/Transforms/FunctionAttrs"
9
+ ],
10
+ "hints": {
11
+ "fix_commit": "0547e84181ff10b24d6363bbfc97f168fe245397",
12
+ "components": [
13
+ "FunctionAttrs"
14
+ ],
15
+ "bug_location_lineno": {
16
+ "llvm/lib/Transforms/IPO/FunctionAttrs.cpp": [
17
+ [
18
+ 661,
19
+ 668
20
+ ]
21
+ ]
22
+ },
23
+ "bug_location_funcname": {
24
+ "llvm/lib/Transforms/IPO/FunctionAttrs.cpp": [
25
+ "getArgumentAccessInfo"
26
+ ]
27
+ }
28
+ },
29
+ "patch": "commit 0547e84181ff10b24d6363bbfc97f168fe245397\nAuthor: Arthur Eubanks <[email protected]>\nDate: Wed Apr 23 15:56:24 2025 -0700\n\n [FunctionAttrs] Bail if initializes range overflows 64-bit signed int (#137053)\n \n Otherwise the range doesn't make sense since we interpret it as signed.\n \n Fixes #134115\n\ndiff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp\nindex bbfed2ac2c09..74e8a849803d 100644\n--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp\n+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp\n@@ -661,8 +661,13 @@ ArgumentAccessInfo getArgumentAccessInfo(const Instruction *I,\n auto TypeSize = DL.getTypeStoreSize(Ty);\n if (!TypeSize.isScalable() && Offset) {\n int64_t Size = TypeSize.getFixedValue();\n- return ConstantRange(APInt(64, *Offset, true),\n- APInt(64, *Offset + Size, true));\n+ APInt Low(64, *Offset, true);\n+ bool Overflow;\n+ APInt High = Low.sadd_ov(APInt(64, Size, true), Overflow);\n+ // Bail if the range overflows signed 64-bit int.\n+ if (Overflow)\n+ return std::nullopt;\n+ return ConstantRange(Low, High);\n }\n return std::nullopt;\n };\n",
30
+ "tests": [
31
+ {
32
+ "file": "llvm/test/Transforms/FunctionAttrs/initializes.ll",
33
+ "commands": [
34
+ "opt -passes=function-attrs -S < %s"
35
+ ],
36
+ "tests": [
37
+ {
38
+ "test_name": "memset_offset_1_size_0",
39
+ "test_body": "define void @memset_offset_1_size_0(ptr %dst, ptr %src) {\n %dst.1 = getelementptr inbounds i8, ptr %dst, i64 1\n call void @llvm.memmove.p0.p0.i64(ptr %dst.1, ptr %src, i64 0, i1 false)\n ret void\n}\n\n; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)\ndeclare void @llvm.memmove.p0.p0.i64(ptr writeonly captures(none), ptr readonly captures(none), i64, i1 immarg) #0\n\nattributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }\n"
40
+ },
41
+ {
42
+ "test_name": "range_overflows_signed_64_bit_int",
43
+ "test_body": "define void @range_overflows_signed_64_bit_int(ptr %arg) {\n %getelementptr = getelementptr i8, ptr %arg, i64 9223372036854775804\n store i32 0, ptr %getelementptr, align 4\n ret void\n}\n"
44
+ }
45
+ ]
46
+ }
47
+ ],
48
+ "issue": {
49
+ "title": "FunctionAttrs: Assertion `isOrder edRanges(RangesRef)' failed.",
50
+ "body": "```\n$ cat /tmp/f.ll\ndefine i32 @f(ptr %arg, ptr %arg2) {\n store ptr %arg, ptr %arg2\n %getelementptr = getelementptr float, ptr %arg, i64 2305843009213693951\n %load = load i32, ptr %getelementptr, align 4\n ret i32 %load\n}\n$ opt -p function-attrs /tmp/f.ll -disable-output\nopt: ../../llvm/include/llvm/IR/ConstantRangeList.h:36: llvm::ConstantRangeList::ConstantRangeList(ArrayRef<ConstantRange>): Assertion `isOrder\nedRanges(RangesRef)' failed.\n```",
51
+ "author": "aeubanks",
52
+ "labels": [
53
+ "ipo",
54
+ "crash"
55
+ ],
56
+ "comments": []
57
+ },
58
+ "verified": true
59
+ }
dataset/137152.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bug_id": "137152",
3
+ "issue_url": "https://github.com/llvm/llvm-project/issues/137152",
4
+ "bug_type": "crash",
5
+ "base_commit": "224cd50e005a9215e8c528d5ce68d4fcdfcdb98f",
6
+ "knowledge_cutoff": "2025-04-24T10:47:46Z",
7
+ "lit_test_dir": [
8
+ "llvm/test/Transforms/GlobalOpt"
9
+ ],
10
+ "hints": {
11
+ "fix_commit": "57530c23a53b5e003d389437637f61c5b9814e22",
12
+ "components": [
13
+ "GlobalOpt"
14
+ ],
15
+ "bug_location_lineno": {
16
+ "llvm/lib/Transforms/IPO/GlobalOpt.cpp": [
17
+ [
18
+ 719,
19
+ 728
20
+ ]
21
+ ]
22
+ },
23
+ "bug_location_funcname": {
24
+ "llvm/lib/Transforms/IPO/GlobalOpt.cpp": [
25
+ "allUsesOfLoadedValueWillTrapIfNull"
26
+ ]
27
+ }
28
+ },
29
+ "patch": "commit 57530c23a53b5e003d389437637f61c5b9814e22\nAuthor: Nikita Popov <[email protected]>\nDate: Thu Apr 24 15:15:47 2025 +0200\n\n [GlobalOpt] Do not promote malloc if there are atomic loads/stores (#137158)\n \n When converting a malloc stored to a global into a global, we will\n introduce an i1 flag to track whether the global has been initialized.\n \n In case of atomic loads/stores, this will result in verifier failures,\n because atomic ops on i1 are illegal. Even if we changed this to i8, I\n don't think it is a good idea to change atomic types in that way.\n \n Instead, bail out of the transform is we encounter any atomic\n loads/stores of the global.\n \n Fixes https://github.com/llvm/llvm-project/issues/137152.\n\ndiff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp\nindex cfba8dcc05b2..3771cccbde17 100644\n--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp\n+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp\n@@ -719,10 +719,14 @@ static bool allUsesOfLoadedValueWillTrapIfNull(const GlobalVariable *GV) {\n const Value *P = Worklist.pop_back_val();\n for (const auto *U : P->users()) {\n if (auto *LI = dyn_cast<LoadInst>(U)) {\n+ if (!LI->isSimple())\n+ return false;\n SmallPtrSet<const PHINode *, 8> PHIs;\n if (!AllUsesOfValueWillTrapIfNull(LI, PHIs))\n return false;\n } else if (auto *SI = dyn_cast<StoreInst>(U)) {\n+ if (!SI->isSimple())\n+ return false;\n // Ignore stores to the global.\n if (SI->getPointerOperand() != P)\n return false;\n",
30
+ "tests": [
31
+ {
32
+ "file": "llvm/test/Transforms/GlobalOpt/malloc-promote-atomic.ll",
33
+ "commands": [
34
+ "opt -passes=globalopt -S < %s"
35
+ ],
36
+ "tests": [
37
+ {
38
+ "test_name": "<module>",
39
+ "test_body": "\n@g = internal global ptr null, align 8\n\ndefine void @init() {\n;\n %alloc = call ptr @malloc(i64 48)\n store atomic ptr %alloc, ptr @g seq_cst, align 8\n ret void\n}\n\ndefine i1 @check() {\n;\n %val = load atomic ptr, ptr @g seq_cst, align 8\n %cmp = icmp eq ptr %val, null\n ret i1 %cmp\n}\n\ndeclare ptr @malloc(i64) allockind(\"alloc,uninitialized\") allocsize(0)"
40
+ }
41
+ ]
42
+ }
43
+ ],
44
+ "issue": {
45
+ "title": "[GlobalOpt] Incorrect change of atomic type",
46
+ "body": "```llvm\n; RUN: opt -S -passes=globalopt\n@g = internal global ptr null, align 8\n\ndefine void @init() {\n %alloc = call ptr @malloc(i64 48)\n store atomic ptr %alloc, ptr @g seq_cst, align 8\n ret void\n} \n\ndefine i1 @check() {\n %val = load atomic ptr, ptr @g seq_cst, align 8\n %cmp = icmp eq ptr %val, null\n ret i1 %cmp\n}\n\ndeclare ptr @malloc(i64) allockind(\"alloc,uninitialized\") allocsize(0)\n```\nResults in:\n```\natomic memory access' size must be byte-sized\n i1 store atomic i1 true, ptr @g.init seq_cst, align 1\natomic memory access' size must be byte-sized\n i1 %g.init.val = load atomic i1, ptr @g.init seq_cst, align 1\nLLVM ERROR: Broken module found, compilation aborted!\n```\n",
47
+ "author": "nikic",
48
+ "labels": [
49
+ "ipo",
50
+ "release:backport",
51
+ "crash"
52
+ ],
53
+ "comments": []
54
+ },
55
+ "verified": true
56
+ }
dataset/91177.json ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bug_id": "91177",
3
+ "issue_url": "https://github.com/llvm/llvm-project/issues/91177",
4
+ "bug_type": "miscompilation",
5
+ "base_commit": "de8cf69abf4f8b16d5c5ecb77a6dfb1f5c09e45a",
6
+ "knowledge_cutoff": "2024-05-06T09:27:25Z",
7
+ "lit_test_dir": [
8
+ "llvm/test/Transforms/FunctionAttrs"
9
+ ],
10
+ "hints": {
11
+ "fix_commit": "f34d30cdae0f59698f660d5cc8fb993fb3441064",
12
+ "components": [
13
+ "FunctionAttrs"
14
+ ],
15
+ "bug_location_lineno": {
16
+ "llvm/lib/Transforms/IPO/FunctionAttrs.cpp": [
17
+ [
18
+ 1186,
19
+ 1195
20
+ ]
21
+ ]
22
+ },
23
+ "bug_location_funcname": {
24
+ "llvm/lib/Transforms/IPO/FunctionAttrs.cpp": [
25
+ "isReturnNonNull"
26
+ ]
27
+ }
28
+ },
29
+ "patch": "commit f34d30cdae0f59698f660d5cc8fb993fb3441064\nAuthor: Nikita Popov <[email protected]>\nDate: Tue May 7 09:47:28 2024 +0900\n\n [FunctionAttrs] Fix incorrect nonnull inference for non-inbounds GEP (#91180)\n \n For inbounds GEPs, if the source pointer is non-null, the result must\n also be non-null. However, this does not hold for non-inbounds GEPs.\n \n Fixes https://github.com/llvm/llvm-project/issues/91177.\n\ndiff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp\nindex 8e11cbf1cee4..26a4508aa151 100644\n--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp\n+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp\n@@ -1186,10 +1186,15 @@ static bool isReturnNonNull(Function *F, const SCCNodeSet &SCCNodes,\n switch (RVI->getOpcode()) {\n // Extend the analysis by looking upwards.\n case Instruction::BitCast:\n- case Instruction::GetElementPtr:\n case Instruction::AddrSpaceCast:\n FlowsToReturn.insert(RVI->getOperand(0));\n continue;\n+ case Instruction::GetElementPtr:\n+ if (cast<GEPOperator>(RVI)->isInBounds()) {\n+ FlowsToReturn.insert(RVI->getOperand(0));\n+ continue;\n+ }\n+ return false;\n case Instruction::Select: {\n SelectInst *SI = cast<SelectInst>(RVI);\n FlowsToReturn.insert(SI->getTrueValue());\n",
30
+ "tests": [
31
+ {
32
+ "file": "llvm/test/Transforms/FunctionAttrs/nocapture.ll",
33
+ "commands": [
34
+ "opt -passes=function-attrs -S < %s",
35
+ "opt -passes=attributor-light -S < %s"
36
+ ],
37
+ "tests": [
38
+ {
39
+ "test_name": "lookup_bit",
40
+ "test_body": "@lookup_table = external global [2 x i1]\n\n; Function Attrs: nounwind memory(none)\ndefine ptr @lookup_bit(ptr %q, i32 %bitno) #0 {\n %tmp = ptrtoint ptr %q to i32\n %tmp2 = lshr i32 %tmp, %bitno\n %bit = and i32 %tmp2, 1\n %lookup = getelementptr [2 x i1], ptr @lookup_table, i32 0, i32 %bit\n ret ptr %lookup\n}\n\nattributes #0 = { nounwind memory(none) }\n"
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ "file": "llvm/test/Transforms/FunctionAttrs/nonnull.ll",
46
+ "commands": [
47
+ "opt -S -passes=function-attrs -enable-nonnull-arg-prop %s",
48
+ "opt -S -passes=attributor-light %s"
49
+ ],
50
+ "tests": [
51
+ {
52
+ "test_name": "pr91177_non_inbounds_gep",
53
+ "test_body": "target datalayout = \"e-m:e-i64:64-f80:128-n8:16:32:64-S128\"\n\ndefine ptr @pr91177_non_inbounds_gep(ptr nonnull %arg) {\n %res = getelementptr i8, ptr %arg, i64 -8\n ret ptr %res\n}\n"
54
+ },
55
+ {
56
+ "test_name": "PR43833_simple",
57
+ "test_body": "target datalayout = \"e-m:e-i64:64-f80:128-n8:16:32:64-S128\"\n\ndeclare void @sink(ptr)\n\ndefine void @PR43833_simple(ptr %0, i32 %1) {\n %3 = icmp ne i32 %1, 0\n br i1 %3, label %4, label %7\n\n4: ; preds = %2\n %5 = zext i32 %1 to i64\n %6 = getelementptr inbounds i32, ptr %0, i64 %5\n br label %8\n\n7: ; preds = %8, %2\n ret void\n\n8: ; preds = %8, %4\n %9 = phi i32 [ 1, %4 ], [ %10, %8 ]\n tail call void @sink(ptr %6)\n %10 = add nuw nsw i32 %9, 1\n %11 = icmp eq i32 %10, %1\n br i1 %11, label %7, label %8\n}\n"
58
+ }
59
+ ]
60
+ }
61
+ ],
62
+ "issue": {
63
+ "title": "[FunctionAttrs] Incorrect nonnull inference for non-inbounds GEP",
64
+ "body": "FunctionAttrs incorrectly infers that the following function returns nonnull (https://llvm.godbolt.org/z/49Kbq15xn):\r\n```llvm\r\ndefine ptr @test(ptr nonnull %arg) {\r\n %res = getelementptr i8, ptr %arg, i64 -8\r\n ret ptr %res\r\n}\r\n```\r\nThis is because the code assumes that the result of a GEP is non-null if the source is non-null here: https://github.com/llvm/llvm-project/blob/d98a78590f4f9e43fdfb69fde7d154a985e4560f/llvm/lib/Transforms/IPO/FunctionAttrs.cpp#L1189 This is not correct for non-inbounds GEPs.",
65
+ "author": "nikic",
66
+ "labels": [
67
+ "miscompilation",
68
+ "ipo"
69
+ ],
70
+ "comments": []
71
+ },
72
+ "verified": true
73
+ }
dataset/98143.json ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bug_id": "98143",
3
+ "issue_url": "https://github.com/llvm/llvm-project/issues/98143",
4
+ "bug_type": "crash",
5
+ "base_commit": "f4be6812e203690073280b9ac8d60092d75bbdce",
6
+ "knowledge_cutoff": "2024-07-09T10:43:20Z",
7
+ "lit_test_dir": [
8
+ "llvm/test/Instrumentation/NumericalStabilitySanitizer"
9
+ ],
10
+ "hints": {
11
+ "fix_commit": "70a9535f714e2fdb84af243a1a316012c8019049",
12
+ "components": [
13
+ "Instrumentation"
14
+ ],
15
+ "bug_location_lineno": {
16
+ "llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp": [
17
+ [
18
+ 1725,
19
+ 1730
20
+ ]
21
+ ]
22
+ },
23
+ "bug_location_funcname": {
24
+ "llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp": [
25
+ "NumericalStabilitySanitizer::createShadowValueWithOperandsAvailable"
26
+ ]
27
+ }
28
+ },
29
+ "patch": "commit 70a9535f714e2fdb84af243a1a316012c8019049\nAuthor: Alexander Shaposhnikov <[email protected]>\nDate: Thu Jul 25 21:34:08 2024 -0700\n\n [Instrumentation][nsan] Add support for Freeze instruction (#100490)\n \n Add support for Freeze.\n \n This fixes https://github.com/llvm/llvm-project/issues/98143 .\n\ndiff --git a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp\nindex b382fedde027..832506f639a7 100644\n--- a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp\n+++ b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp\n@@ -1725,6 +1725,9 @@ Value *NumericalStabilitySanitizer::createShadowValueWithOperandsAvailable(\n Map.getShadow(S->getTrueValue()),\n Map.getShadow(S->getFalseValue()));\n \n+ if (auto *Freeze = dyn_cast<FreezeInst>(&Inst))\n+ return Builder.CreateFreeze(Map.getShadow(Freeze->getOperand(0)));\n+\n if (auto *Extract = dyn_cast<ExtractElementInst>(&Inst))\n return Builder.CreateExtractElement(\n Map.getShadow(Extract->getVectorOperand()), Extract->getIndexOperand());\n",
30
+ "tests": [
31
+ {
32
+ "file": "llvm/test/Instrumentation/NumericalStabilitySanitizer/basic.ll",
33
+ "commands": [
34
+ "opt -passes=nsan -nsan-shadow-type-mapping=dqq -nsan-truncate-fcmp-eq=false -S %s",
35
+ "opt -passes=nsan -nsan-shadow-type-mapping=dlq -nsan-truncate-fcmp-eq=false -S %s"
36
+ ],
37
+ "tests": [
38
+ {
39
+ "test_name": "freeze_vector_insert",
40
+ "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\n; Function Attrs: sanitize_numerical_stability\ndefine void @freeze_vector_insert(<2 x float> %vec, i32 %idx, float %scalar) #0 {\nentry:\n %0 = insertelement <2 x float> %vec, float %scalar, i32 %idx\n %frozen = freeze <2 x float> %0\n ret void\n}\n\nattributes #0 = { sanitize_numerical_stability }\n"
41
+ },
42
+ {
43
+ "test_name": "vector_shuffle",
44
+ "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\n; Function Attrs: sanitize_numerical_stability\ndefine void @vector_shuffle(<2 x float> %0) #0 {\nentry:\n %1 = shufflevector <2 x float> %0, <2 x float> splat (float 1.000000e+00), <2 x i32> <i32 1, i32 3>\n ret void\n}\n\nattributes #0 = { sanitize_numerical_stability }\n"
45
+ }
46
+ ]
47
+ }
48
+ ],
49
+ "issue": {
50
+ "title": "ICE: Unimplemented support for freeze compiling with numerical sanitizer",
51
+ "body": "```\r\nfatal error: error in backend: Unimplemented support for freeze\r\nPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.\r\nStack dump:\r\n0. Program arguments: /afs/cern.ch/user/i/innocent/w5/bin/clang++ -c -DGNU_GCC -D_GNU_SOURCE -DTBB_USE_GLIBCXX_VERSION=120301 -DTBB_SUPPRESS_DEPRECATED_MESSAGES -DTBB_PREVIEW_RESUMABLE_TASKS=1 -DTBB_PREVIEW_TASK_GROUP_EXTENSIONS=1 -DBOOST_SPIRIT_THREADSAFE -DPHOENIX_THREADSAFE -DBOOST_MATH_DISABLE_STD_FPCLASSIFY -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX -DCMSSW_GIT_HASH=\\\"CMSSW_14_1_CLANG_X_2024-07-07-2300\\\" -DPROJECT_NAME=\\\"CMSSW\\\" -DPROJECT_VERSION=\\\"CMSSW_14_1_CLANG_X_2024-07-07-2300\\\" -Isrc -I/cvmfs/cms-ib.cern.ch/sw/x86_64/week1/el8_amd64_gcc12/cms/cmssw/CMSSW_14_1_CLANG_X_2024-07-07-2300/src -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/alpaka/1.1.0-0a6641b4bfdf883c8da5b9e8620be504/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/pcre/8.43-e34796d17981e9b6d174328c69446455/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/boost/1.80.0-a1544032d9d65904ac2112b6d35bba55/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/bz2lib/1.0.6-d065ccd79984efc6d4660f410e4c81de/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/clhep/2.4.7.1-8e40efd27b7394c1fa4e9c7e432d85cd/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/gsl/2.6-5e2ce72ea2977ff21a2344bbb52daf5c/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/hls/2019.08-0e37f055a3ed22611ce5edecb14d0695/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/libuuid/2.34-27ce4c3579b5b1de2808ea9c4cd8ed29/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/lcg/root/6.30.07-5b5d83179d6ed7bc60aa7a5006899eba/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/tbb/v2021.9.0-1dc6d66b4b014f4ae4733b04914ce7d4/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/cms/vdt/0.4.3-f094bee80112624813c07f9336e08d7d/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/xz/5.2.5-6f3f49b07db84e10c9be594a1176c114/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/zlib/1.2.11-1a082fc322b0051b504cc023f21df178/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/eigen/3bb6a48d8c171cf20b5f8e48bfb4e424fbd4f79e-3ca740c03e68b1a067f3ed0679234a78/include/eigen3 -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/fmt/8.0.1-258b4791803c34b7e98cf43693e54d87/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/md5/1.0.0-5b594b264e04ae51e893b1d69a797ec6/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/OpenBLAS/0.3.15-c877ab57fa7b04ce290093588c6c5717/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02845/el8_amd64_gcc12/external/tinyxml2/6.2.0-88fe0ec301baf763fa3c485e5b67ed91/include -O3 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++17 -ftree-vectorize -Werror=array\r\n-bounds -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -Wno-error=array-bounds -Warray-bounds -fuse-ld=bfd -march=x86-\r\n64-v2 -felide-constructors -fmessage-length=0 -Wall -Wno-long-long -Wreturn-type -Wextra -Wpessimizing-move -Wclass-memaccess -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-unused-pa\r\nrameter -Wunused -Wparentheses -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=unused-label -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-d\r\ntor -Werror=strict-aliasing -Werror=narrowing -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Wnon-virtual-dtor -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-\r\npsabi -Wno-c99-extensions -Wno-c++11-narrowing -D__STRICT_ANSI__ -Wno-unused-private-field -Wno-unknown-pragmas -Wno-unused-command-line-argument -Wno-unknown-warning-option -ftemplate-depth=1024 -Wno-error=potentially\r\n-evaluated-expression -Wno-tautological-type-limit-compare -Wno-vla-cxx-extension -fsized-deallocation --gcc-toolchain=/afs/cern.ch/work/i/innocent/public/w5 -Ofast -fno-reciprocal-math -mrecip=none -DEIGEN_DONT_PARALL\r\nELIZE -DEIGEN_MAX_ALIGN_BYTES=64 -Wno-error=unused-variable -DALPAKA_DEFAULT_HOST_MEMORY_ALIGNMENT=128 -DALPAKA_DISABLE_VENDOR_RNG -DBOOST_DISABLE_ASSERTS -g -fsanitize=numerical -fPIC -MMD -MF tmp/el8_amd64_gcc12/src/\r\nTrackingTools/TrajectoryState/src/TrackingToolsTrajectoryState/BasicTrajectoryState.cc.d src/TrackingTools/TrajectoryState/src/BasicTrajectoryState.cc -o tmp/el8_amd64_gcc12/src/TrackingTools/TrajectoryState/src/Tracki\r\nngToolsTrajectoryState/BasicTrajectoryState.cc.o\r\n1. <eof> parser at end of file\r\n2. Optimizer\r\n3. Running pass \"nsan\" on module \"src/TrackingTools/TrajectoryState/src/BasicTrajectoryState.cc\"\r\n #0 0x000000000389df7b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x389df7b)\r\n #1 0x000000000389bd04 llvm::sys::CleanupOnSignal(unsigned long) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x389bd04)\r\n #2 0x00000000037dc354 llvm::CrashRecoveryContext::HandleExit(int) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x37dc354)\r\n #3 0x0000000003892523 llvm::sys::Process::Exit(int, bool) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x3892523)\r\n #4 0x0000000000be52a7 (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0xbe52a7)\r\n #5 0x00000000037e7dea llvm::report_fatal_error(llvm::Twine const&, bool) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x37e7dea)\r\n #6 0x0000000004fbbf2c (anonymous namespace)::NumericalStabilitySanitizer::createShadowValueWithOperandsAvailable(llvm::Instruction&, llvm::TargetLibraryInfo const&, (anonymous namespace)::ValueToShadowMap const&) Nume\r\nricalStabilitySanitizer.cpp:0:0\r\n #7 0x0000000004fbcd55 llvm::NumericalStabilitySanitizerPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x4fbcd55)\r\n #8 0x0000000003b38ac2 llvm::detail::PassModel<llvm::Module, llvm::NumericalStabilitySanitizerPass, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/afs/cern.ch/user/i/in\r\nnocent/w5/bin/clang+++0x3b38ac2)\r\n #9 0x0000000003229bad llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x3229bad)\r\n#10 0x0000000003b46c3e (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<l\r\nlvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&, clang::BackendConsumer*) BackendUtil.cpp:0:0\r\n#11 0x0000000003b4a1ef (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) Back\r\nendUtil.cpp:0:0\r\n#12 0x0000000003b4acc1 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm:\r\n:Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/afs/cern.ch/user/i/inn\r\nocent/w5/bin/clang+++0x3b4acc1)\r\n#13 0x0000000004168f3b clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x4168f3b)\r\n#14 0x0000000005bd82cc clang::ParseAST(clang::Sema&, bool, bool) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x5bd82cc)\r\n#15 0x0000000004430459 clang::FrontendAction::Execute() (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x4430459)\r\n#16 0x00000000043b1c9b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x43b1c9b)\r\n#17 0x0000000004500ae7 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x4500ae7)\r\n#18 0x0000000000be70c4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0xbe70c4)\r\n#19 0x0000000000be0aac ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0\r\n#20 0x00000000041b6519 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::allo\r\ncator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0\r\n#21 0x00000000037dc253 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x37dc253)\r\n#22 0x00000000041b6d16 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:\r\n0:0\r\n#23 0x000000000417b1db clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x417b1db)\r\n#24 0x000000000417bbee clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/afs/cern.ch/user/i/innocent/w5/bin/clan\r\ng+++0x417bbee)\r\n#25 0x000000000418e11c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0x418e11\r\nc)\r\n#26 0x0000000000be40ae clang_main(int, char**, llvm::ToolContext const&) (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0xbe40ae)\r\n#27 0x0000000000aad1af main (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0xaad1af)\r\n#28 0x00007f2127913d85 __libc_start_main (/usr/lib64/libc.so.6+0x3ad85)\r\n#29 0x0000000000be04fe _start (/afs/cern.ch/user/i/innocent/w5/bin/clang+++0xbe04fe)\r\nclang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)\r\nclang version 19.0.0git ([email protected]:llvm/llvm-project.git 857700ff6fb9f9f653c3788445df06db07e7bb59)\r\nTarget: x86_64-unknown-linux-gnu\r\nThread model: posix\r\nInstalledDir: /afs/cern.ch/work/i/innocent/public/w5/bin\r\nclang++: note: diagnostic msg:\r\n********************\r\n\r\nPLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:\r\nPreprocessed source(s) and associated run script(s) are located at:\r\nclang++: note: diagnostic msg: tmp/el8_amd64_gcc12/src/TrackingTools/TrajectoryState/src/TrackingToolsTrajectoryState/BasicTrajectoryState-33393f.cpp\r\nclang++: note: diagnostic msg: tmp/el8_amd64_gcc12/src/TrackingTools/TrajectoryState/src/TrackingToolsTrajectoryState/BasicTrajectoryState-33393f.sh\r\nclang++: note: diagnostic msg:\r\n```\r\n[nsanCrash.tgz](https://github.com/user-attachments/files/16142152/nsanCrash.tgz)\r\n",
52
+ "author": "VinInn",
53
+ "labels": [
54
+ "crash-on-valid",
55
+ "compiler-rt:nsan"
56
+ ],
57
+ "comments": [
58
+ {
59
+ "author": "dtcxzyw",
60
+ "body": "cc @alexander-shaposhnikov "
61
+ },
62
+ {
63
+ "author": "VinInn",
64
+ "body": "compilation is stiill failing with\r\n```clang version 20.0.0git ([email protected]:llvm/llvm-project.git ba8126b6fef79bd344a247f6291aaec7b67bdff0)```\r\nwith the same error message \"fatal error: error in backend: Unimplemented support for freeze\"\r\n"
65
+ }
66
+ ]
67
+ },
68
+ "verified": true
69
+ }
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 = 140445
38
 
39
 
40
  def wait(progress):
@@ -87,9 +87,15 @@ def fetch(issue_id):
87
  "clang:",
88
  "clangd",
89
  "clang-tidy",
90
- "mlir:",
 
91
  "tools:",
92
  "flang:",
 
 
 
 
 
93
  ]:
94
  if key in label_name:
95
  return False
@@ -106,12 +112,15 @@ def fetch(issue_id):
106
  "llvm:bitcode",
107
  "llvm:openmpirbuilder",
108
  "BOLT",
 
 
 
109
  ]:
110
  return False
111
  if not has_valid_label:
112
  return False
113
- if not is_llvm_middleend:
114
- return False
115
 
116
  try:
117
  out = subprocess.check_output(
 
34
  )
35
 
36
  issue_id_begin = 76663 # Since 2024-01-01
37
+ issue_id_end = 140749
38
 
39
 
40
  def wait(progress):
 
87
  "clang:",
88
  "clangd",
89
  "clang-tidy",
90
+ "clang-format",
91
+ "mlir",
92
  "tools:",
93
  "flang:",
94
+ "lld:",
95
+ "lldb",
96
+ "tablegen",
97
+ "polly",
98
+ "PGO",
99
  ]:
100
  if key in label_name:
101
  return False
 
112
  "llvm:bitcode",
113
  "llvm:openmpirbuilder",
114
  "BOLT",
115
+ "mc",
116
+ "libc++",
117
+ "coroutines",
118
  ]:
119
  return False
120
  if not has_valid_label:
121
  return False
122
+ # if not is_llvm_middleend:
123
+ # return False
124
 
125
  try:
126
  out = subprocess.check_output(
scripts/llvm_helper.py CHANGED
@@ -162,7 +162,9 @@ def apply(patch: str):
162
 
163
 
164
  def filter_out_unsupported_feats(src: str):
165
- return src.replace(" noalias ", " ")
 
 
166
 
167
 
168
  def alive2_check(src: str, tgt: str, additional_args: str):
 
162
 
163
 
164
  def filter_out_unsupported_feats(src: str):
165
+ src = src.replace(" noalias ", " ")
166
+ src = src.replace(" nofree ", " ")
167
+ return src
168
 
169
 
170
  def alive2_check(src: str, tgt: str, additional_args: str):
scripts/postfix_extract.py CHANGED
@@ -64,6 +64,7 @@ fix_commit_map = {
64
  "81561": "97088b2ab2184ad4bd64f59fba0b92b70468b10d",
65
  "81793": None, # Cannot reproduce with alive2
66
  "81872": None, # Multi-commit fix
 
67
  "85185": None, # Duplicate of #79742
68
  "85568": None, # Object bug
69
  "86280": None, # Object bug
@@ -73,6 +74,7 @@ fix_commit_map = {
73
  "91417": "645fb04a3389e69801d401e669eae9ee42d70217", # Use the second fix
74
  "92217": None, # See also https://github.com/AliveToolkit/alive2/issues/1037
75
  "93017": None, # Constant expr
 
76
  "96857": None, # miscompilation:undef
77
  "97702": None, # uninit mem
78
  "97837": None, # Alive2 bug e4508ba85747eb3a5e002915e544d2e08e751425
@@ -88,6 +90,7 @@ fix_commit_map = {
88
  "107501": None, # Complicated fix
89
  "108618": None, # Multi-commit fix
90
  "108854": None, # Multi-commit fix
 
91
  "109581": None, # Too many unrelated changes
92
  "110440": None, # Duplicate of #109528
93
  "110819": None, # Outdated issue
@@ -110,6 +113,7 @@ fix_commit_map = {
110
  "122166": None, # Duplicate of #117308
111
  "122324": None, # Cannot confirm fix with alive2
112
  "122430": None, # Cannot confirm fix with alive2
 
113
  "122537": None, # Clang codegen issue
114
  "122602": None, # Duplicate of #122496
115
  "123920": None, # Cannot reproduce with alive2
@@ -136,6 +140,7 @@ fix_commit_map = {
136
  "135531": None, # Cannot reproduce with Alive2
137
  "137164": None, # Cannot reproduce the crash as it requires llvm to build with hardened libc++
138
  "138178": None, # Cannot reproduce the crash as it requires llvm to build with hardened libc++
 
139
  "138819": None, # Alive2 timeout
140
  "138923": None, # Invalid reproducer
141
  "139065": None, # Duplicate of #139060
 
64
  "81561": "97088b2ab2184ad4bd64f59fba0b92b70468b10d",
65
  "81793": None, # Cannot reproduce with alive2
66
  "81872": None, # Multi-commit fix
67
+ "84807": None, # IPO miscompilation
68
  "85185": None, # Duplicate of #79742
69
  "85568": None, # Object bug
70
  "86280": None, # Object bug
 
74
  "91417": "645fb04a3389e69801d401e669eae9ee42d70217", # Use the second fix
75
  "92217": None, # See also https://github.com/AliveToolkit/alive2/issues/1037
76
  "93017": None, # Constant expr
77
+ "96197": None, # Cannot reproduce the crash
78
  "96857": None, # miscompilation:undef
79
  "97702": None, # uninit mem
80
  "97837": None, # Alive2 bug e4508ba85747eb3a5e002915e544d2e08e751425
 
90
  "107501": None, # Complicated fix
91
  "108618": None, # Multi-commit fix
92
  "108854": None, # Multi-commit fix
93
+ "108936": None, # Codegen issue
94
  "109581": None, # Too many unrelated changes
95
  "110440": None, # Duplicate of #109528
96
  "110819": None, # Outdated issue
 
113
  "122166": None, # Duplicate of #117308
114
  "122324": None, # Cannot confirm fix with alive2
115
  "122430": None, # Cannot confirm fix with alive2
116
+ "122467": None, # Invalid reproducer
117
  "122537": None, # Clang codegen issue
118
  "122602": None, # Duplicate of #122496
119
  "123920": None, # Cannot reproduce with alive2
 
140
  "135531": None, # Cannot reproduce with Alive2
141
  "137164": None, # Cannot reproduce the crash as it requires llvm to build with hardened libc++
142
  "138178": None, # Cannot reproduce the crash as it requires llvm to build with hardened libc++
143
+ "138194": None, # LTO bug
144
  "138819": None, # Alive2 timeout
145
  "138923": None, # Invalid reproducer
146
  "139065": None, # Duplicate of #139060