<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/91975>91975</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Assertion `Elt->getBitWidth() == EltVT.getSizeInBits() && "APInt size does not match type size!"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DigOrDog
</td>
</tr>
</table>
<pre>
# Description
The following code crashes aarch64 backend with "Assertion `Elt->getBitWidth() == EltVT.getSizeInBits() && "APInt size does not match type size!"' failed."
# Minimal Reproduction
https://godbolt.org/z/6Kvh5oeT8
## Code
```
; ModuleID = 'Fuzzer input'
source_filename = "M"
@G = global ppc_fp128 0xM7FF00000000000000000000000000000
define i1 @f(i1 %0, i8 %1, i64 %2) {
BB:
%CastFPTrunc1 = fpext float 4.200000e+01 to x86_fp80
%CastExt = sext i16 0 to i32
%CastFPTrunc = fpext float 0x47EFFFFFE0000000 to ppc_fp128
%RP = alloca i1, i32 %CastExt, align 1
%3 = load i1, ptr %RP, align 1
store ppc_fp128 %CastFPTrunc, ptr @G, align 16
store x86_fp80 %CastFPTrunc1, ptr %RP, align 16
ret i1 %3
}
```
## Stack Trace
```
llc: /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1703: llvm::SDValue llvm::SelectionDAG::getConstant(const llvm::ConstantInt&, const llvm::SDLoc&, llvm::EVT, bool, bool): Assertion `Elt->getBitWidth() == EltVT.getSizeInBits() && "APInt size does not match type size!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple aarch64 -global-isel -O0 <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'AArch64 Instruction Selection' on function '@f'
#0 0x000000000399e058 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x399e058)
#1 0x000000000399b7ac SignalHandler(int) Signals.cpp:0:0
#2 0x00007a02eb242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x00007a02eb2969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x00007a02eb242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x00007a02eb2287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x00007a02eb22871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x00007a02eb239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x000000000372fa81 llvm::SelectionDAG::getConstant(llvm::ConstantInt const&, llvm::SDLoc const&, llvm::EVT, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x372fa81)
#9 0x000000000384f5aa llvm::DAGTypeLegalizer::SoftenFloatRes_ConstantFP(llvm::SDNode*) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x384f5aa)
#10 0x0000000003862fa2 llvm::DAGTypeLegalizer::SoftenFloatResult(llvm::SDNode*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3862fa2)
#11 0x00000000037f2ed3 llvm::DAGTypeLegalizer::run() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37f2ed3)
#12 0x00000000037f3d59 llvm::SelectionDAG::LegalizeTypes() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37f3d59)
#13 0x00000000037664b4 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37664b4)
#14 0x0000000003769f45 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3769f45)
#15 0x000000000376b9b7 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#16 0x00000000029af0d1 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#17 0x0000000002f70f83 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f70f83)
#18 0x0000000002f711c1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f711c1)
#19 0x0000000002f71a25 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f71a25)
#20 0x000000000082dfcc compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#21 0x000000000072b486 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x72b486)
#22 0x00007a02eb229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x00007a02eb229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x0000000000824aee _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x824aee)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWN1y4joSfhpxo4KSZeOfCy4gQDa1k53UkJq9pGRbNtoIySXJZ0iefkuyIZbDzJzscqoONRNsSf311-pWdyOiNasFpQswX4H5ekJac5BqsWb1V7WW9SSX5esC4BCuqS4UawyTAqA1QMvnA4WV5Fz-YKKGhSwpLBTRB6ohIao4xBHMSfFCRQl_MHOAAOOl1lRZBAhitOFmCsJNTc2KmX-z0hwATgHOIAjXIFzDDTffn2c1NTv2Rh_Eihl9XoBjgGMH-PQgDNTsjcJSUg2FNPBITHGA5rWhbgLgAGAMcAIrwjgtZ_bNGdD_xSF8ZIIdCYffaKNk2RbvRh6MaTQIlwBvAd7WsswlNzOpaoC3bwBv43_-cZhL-pyOIC3q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