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HR3Jvh5BLD9t13kyP0pCbw0GoOguUEZeqQlXYKja2FHbjWJn81pv75Lvmf5qe3XLzDcBtNB-TGENG73mGDcHhOk8zie56RkQjUWDILWiQHFLhOay2LYYQ4lQMNLix0NibGs7VNbF_xhDhO8nHH9q_tM4vv_8gHzB1cZ54uyabGgRUpTNmU1nOz0IueGab6b1louhofuPRz96gx60PICxh3zjrr6HZIWbwGMcV3Kw5z6UTg9LKLdLvXS3KOMJUlR-FnId7soSmlIwbpePJUs49IsJvPVZL6e_udLikXggZN8P_AT6tN05lMv3nlpkMx34Ig0A2tw8Kc8Xx9M9cKJxDsFGMRifrlbmEKcYYPJO4RWWMkX71pYPGz3r68MXplWg8vanNUGjseDu9ipA7xwaP8NHNFliA>53164</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
writing zeroinitialiser to large array causes llc assertion
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
cesaref
</td>
</tr>
</table>
<pre>
If we alloca a large array and zero initialise it, we trigger an llc assertion. This fails on arm64 and x64, not sure about other targets. In addition, if we repeat with smaller arrays (say, 10,000 elements) the code generator produces a large number of stores which is slow to optimise.
`jenkins@server MacOS % cat a.ll
; ModuleID = 'test'
source_filename = "test"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-darwin20.3.0"
; Function Attrs: argmemonly nounwind
define void @tests__bigStack1() #0 {
%1 = alloca [800000 x i32], align 4
store [800000 x i32] zeroinitializer, [800000 x i32]* %1, align 4
ret void
}
attributes #0 = { argmemonly nounwind }
jenkins@server MacOS % llc a.ll
Assertion failed: (NumValues == VTs.NumVTs && "NumValues wasn't wide enough for its operands!"), function SDNode, file /Users/jenkins/source/styx/3rdParty/llvm/src/llvm/include/llvm/CodeGen/SelectionDAGNodes.h, line 1062.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: /Users/jenkins/source/styx/3rdParty/llvm/build/osx/arm64/bin/llc a.ll
1. Running pass 'Function Pass Manager' on module 'a.ll'.
2. Running pass 'AArch64 Instruction Selection' on function '@tests__bigStack1'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 llc 0x0000000103e81814 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 llc 0x0000000103e80678 llvm::sys::RunSignalHandlers() + 128
2 llc 0x0000000103e81e8c SignalHandler(int) + 304
3 libsystem_platform.dylib 0x00000001a3569c44 _sigtramp + 56
4 libsystem_pthread.dylib 0x00000001a3521c24 pthread_kill + 292
5 libsystem_c.dylib 0x00000001a3469864 abort + 104
6 libsystem_c.dylib 0x00000001a3468b68 err + 0
7 llc 0x00000001048cd080 llvm::SDNode::SDNode(unsigned int, unsigned int, llvm::DebugLoc, llvm::SDVTList) (.cold.2) + 0
8 llc 0x0000000103d47444 llvm::SDNode::SDNode(unsigned int, unsigned int, llvm::DebugLoc, llvm::SDVTList) + 188
9 llc 0x0000000103d1f3b8 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::SDVTList, llvm::ArrayRef<llvm::SDValue>, llvm::SDNodeFlags) + 1696
10 llc 0x0000000103d19d30 llvm::SelectionDAG::getMergeValues(llvm::ArrayRef<llvm::SDValue>, llvm::SDLoc const&) + 336
11 llc 0x0000000103cbe298 llvm::SelectionDAGBuilder::getValueImpl(llvm::Value const*) + 3196
12 llc 0x0000000103cbd51c llvm::SelectionDAGBuilder::getValue(llvm::Value const*) + 248
13 llc 0x0000000103cb3720 llvm::SelectionDAGBuilder::visitStore(llvm::StoreInst const&) + 352
14 llc 0x0000000103cacbb4 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) + 132
15 llc 0x0000000103d3a260 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, bool&) + 84
16 llc 0x0000000103d39d98 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 6740
17 llc 0x0000000103d371d0 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 2104
18 llc 0x0000000103467b24 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 360
19 llc 0x000000010381af50 llvm::FPPassManager::runOnFunction(llvm::Function&) + 744
20 llc 0x0000000103820960 llvm::FPPassManager::runOnModule(llvm::Module&) + 68
21 llc 0x000000010381b53c llvm::legacy::PassManagerImpl::run(llvm::Module&) + 976
22 llc 0x000000010295775c main + 7220
23 libdyld.dylib 0x00000001a353df34 start + 4
zsh: abort ~/source/styx/3rdParty/llvm/build/osx/arm64/bin/llc a.ll
jenkins@server MacOS %
`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNWEtv4zgS_jXOhYghiXoefLDbyUyAZDroZBvYvRiURNucpiiDpJL2_PqpoiRb8jg96sFisUZiS2Sx-NW7yLwuj4uHLXnnhElZF4wwIpnewavW7EiYKskfXNdEKGEFk8JwIuws-IQrrBa7HddARKQsCDOGaytqNSeve2HIlglpSK2AVRWHjtX3OMS1qrbENBo2yevGktrugYvFba2ZkwdYUZYCOSGxcOg0P3Bmybuwe2IqwIr7IkRDZkFq2BFJfQ--Pc8jXPKKK2tmQUaAOSnqkpMdV1wzW2ty0HXZFNychFVNlQPDeksMzMPE-14UewJCGFm_E1uT-mBFBdLPZ9565i1H37H3O1ffhDKz0AMVvAGnJ1Z8fgFkESkANZtL2dHSFXmCzSV_WJMZhf8gsdyARpOWwNSNLvhmKyRXrOIdTdDSBC1NqylSMsskO6IGOyp-W83osr4VoGa6jMNb4QcpPMH3raJBO_aCYxeswJIHedrM2euWHWDotmT6XajAm9O5d1p1luW-UQUaiiyt1QY2AKPsKl7VSh7BzI2CxWVLXvKtUJy81aIkoCiUyGw2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