<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/88966>88966</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Assertion failed: (N1.getValueType().bitsLT(VT) && "Invalid zext node, dst < src!"), function getNode, file SelectionDAG.cpp, line 5848.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AArch64,
            crash-on-valid
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          regehr
      </td>
    </tr>
</table>

<pre>
    this seemingly vanilla code is triggering a crash in SDAG:
```
Johns-MacBook-Pro:reduce2 regehr$ cat reduced.ll 

define i32 @f(ptr %0, i41 %1, ptr %2) {
  %new0 = and i41 %1, 1
  %last = trunc i41 %new0 to i1
  %4 = add i64 0, 1
  %5 = zext i1 %last to i64
  %6 = add i64 %4, %5
  %7 = icmp ult i64 %4, 0
  %8 = icmp ult i64 %6, %4
  %9 = and i1 %7, %8
  %10 = zext i1 %9 to i64
 store i64 %6, ptr %2, align 8
  store i64 %10, ptr %0, align 8
  ret i32 0
}
Johns-MacBook-Pro:reduce2 regehr$ ~/llvm-project/for-alive/bin/llc reduced.ll 
Assertion failed: (N1.getValueType().bitsLT(VT) && "Invalid zext node, dst < src!"), function getNode, file SelectionDAG.cpp, line 5848.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /Users/regehr/llvm-project/for-alive/bin/llc reduced.ll
1.      Running pass 'Function Pass Manager' on module 'reduced.ll'.
2.      Running pass 'AArch64 Instruction Selection' on function '@f'
 #0 0x000000010816c804 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/regehr/llvm-project/for-alive/lib/libLLVMSupport.dylib+0x148804)
 #1 0x000000010816a4d0 llvm::sys::RunSignalHandlers() (/Users/regehr/llvm-project/for-alive/lib/libLLVMSupport.dylib+0x1464d0)
 #2 0x000000010816cec0 SignalHandler(int) (/Users/regehr/llvm-project/for-alive/lib/libLLVMSupport.dylib+0x148ec0)
 #3 0x0000000184867584 (/usr/lib/system/libsystem_platform.dylib+0x180477584)
 #4 0x0000000184836c20 (/usr/lib/system/libsystem_pthread.dylib+0x180446c20)
 #5 0x0000000184743a20 (/usr/lib/system/libsystem_c.dylib+0x180353a20)
 #6 0x0000000184742d10 (/usr/lib/system/libsystem_c.dylib+0x180352d10)
 #7 0x0000000108f40770 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags) (.cold.17) (/Users/regehr/llvm-project/for-alive/lib/libLLVMSelectionDAG.dylib+0x314770)
 #8 0x0000000108e55170 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags) (/Users/regehr/llvm-project/for-alive/lib/libLLVMSelectionDAG.dylib+0x229170)
 #9 0x0000000108cdc128 llvm::TargetLoweringBase::promoteTargetBoolean(llvm::SelectionDAG&, llvm::SDValue, llvm::EVT) const (/Users/regehr/llvm-project/for-alive/lib/libLLVMSelectionDAG.dylib+0xb0128)
#10 0x0000000108d49e6c llvm::DAGTypeLegalizer::PromoteIntOp_ADDSUBO_CARRY(llvm::SDNode*, unsigned int) (/Users/regehr/llvm-project/for-alive/lib/libLLVMSelectionDAG.dylib+0x11de6c)
#11 0x0000000108d45ab8 llvm::DAGTypeLegalizer::PromoteIntegerOperand(llvm::SDNode*, unsigned int) (/Users/regehr/llvm-project/for-alive/lib/libLLVMSelectionDAG.dylib+0x119ab8)
#12 0x0000000108d62144 llvm::DAGTypeLegalizer::run() (/Users/regehr/llvm-project/for-alive/lib/libLLVMSelectionDAG.dylib+0x136144)
#13 0x0000000108d67358 llvm::SelectionDAG::LegalizeTypes() (/Users/regehr/llvm-project/for-alive/lib/libLLVMSelectionDAG.dylib+0x13b358)
#14 0x0000000108e97f94 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/Users/regehr/llvm-project/for-alive/lib/libLLVMSelectionDAG.dylib+0x26bf94)
#15 0x0000000108e96814 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/Users/regehr/llvm-project/for-alive/lib/libLLVMSelectionDAG.dylib+0x26a814)
#16 0x0000000108e93324 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/Users/regehr/llvm-project/for-alive/lib/libLLVMSelectionDAG.dylib+0x267324)
#17 0x000000010a0393c4 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/Users/regehr/llvm-project/for-alive/lib/libLLVMCodeGen.dylib+0x2693c4)
#18 0x000000010bb5ea3c llvm::FPPassManager::runOnFunction(llvm::Function&) (/Users/regehr/llvm-project/for-alive/lib/libLLVMCore.dylib+0x1caa3c)
#19 0x000000010bb6663c llvm::FPPassManager::runOnModule(llvm::Module&) (/Users/regehr/llvm-project/for-alive/lib/libLLVMCore.dylib+0x1d263c)
#20 0x000000010bb5f3d4 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/Users/regehr/llvm-project/for-alive/lib/libLLVMCore.dylib+0x1cb3d4)
#21 0x000000010085ad24 compileModule(char**, llvm::LLVMContext&) (/Users/regehr/llvm-project/for-alive/bin/llc+0x10001ed24)
#22 0x00000001008587f8 main (/Users/regehr/llvm-project/for-alive/bin/llc+0x10001c7f8)
#23 0x00000001844ae0e0 
Abort trap: 6
Johns-MacBook-Pro:reduce2 regehr$ 
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUWF1v2zoS_TX0CxGDpGh9PPhBieNuFslt0OQW2KeCIimZG5oSSKpt7sP-9oUoxRHddNsUcXe3KAJ5NJw553D4oWHOqcZIuQarc7DaLFjvd61dW9nInV1UrXhc-51y0Em5V6bRj_AzM0prBnkrJFQOequaRlplGsggt8ztoDLwblO-A0kJ0AagEqRo-h9-_r3dGXd2w_h52z6c3doWJKWVoueSwDExIBRy5uFoFU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