1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple aarch64-- -start-after codegenprepare -o - %s | FileCheck %s
6 ; This used to hit an assertion like this:
8 ; llc: ../lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1087: bool llvm::SelectionDAG::RemoveNodeFromCSEMaps(llvm::SDNode*): Assertion `N->getOpcode() != ISD::DELETED_NODE && "DELETED_NODE in CSEMap!"' failed.
10 ; 0. Program arguments: llc -mtriple aarch64 -o - reduced.ll -start-after codegenprepare
11 ; 1. Running pass 'Function Pass Manager' on module 'reduced.ll'.
12 ; 2. Running pass 'AArch64 Instruction Selection' on function '@g'
13 ; #0 0x00000000031615b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
14 ; #1 0x000000000315effe SignalHandler(int) Signals.cpp:0:0
15 ; #2 0x00007f2c746b2630 __restore_rt sigaction.c:0:0
16 ; #3 0x00007f2c7200f387 raise (/lib64/libc.so.6+0x36387)
17 ; #4 0x00007f2c72010a78 abort (/lib64/libc.so.6+0x37a78)
18 ; #5 0x00007f2c720081a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
19 ; #6 0x00007f2c72008252 (/lib64/libc.so.6+0x2f252)
20 ; #7 0x0000000002f06de9 llvm::SelectionDAG::RemoveNodeFromCSEMaps(llvm::SDNode*)
21 ; #8 0x0000000002f0f0b4 llvm::SelectionDAG::ReplaceAllUsesOfValuesWith(llvm::SDValue const*, llvm::SDValue const*, unsigned int)
22 ; #9 0x0000000002dc8a4f (anonymous namespace)::DAGCombiner::scalarizeExtractedVectorLoad(llvm::SDNode*, llvm::EVT, llvm::SDValue, llvm::LoadSDNode*) DAGCombiner.cpp:0:0
23 ; #10 0x0000000002de1a8e (anonymous namespace)::DAGCombiner::visitEXTRACT_VECTOR_ELT(llvm::SDNode*) DAGCombiner.cpp:0:0
24 ; #11 0x0000000002e12f41 (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*) DAGCombiner.cpp:0:0
25 ; #12 0x0000000002e14fe5 (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
27 define i64 @g(ptr %p) {
30 ; CHECK-NEXT: ldr x8, [x0, #8]
31 ; CHECK-NEXT: add x9, x8, x8
32 ; CHECK-NEXT: add x8, x9, x8
33 ; CHECK-NEXT: sub x0, x8, x8
35 %vec = load <2 x i64>, ptr %p, align 1
36 %elt = extractelement <2 x i64> %vec, i32 1
37 %scalarp = getelementptr inbounds { i64, i64 }, ptr %p, i32 0, i32 1
38 %scalar = load i64, ptr %scalarp, align 1
39 %add.i62 = add i64 %elt, %scalar
40 %add.i66 = add i64 %add.i62, %elt
41 %add.i72 = add i64 %scalar, %scalar
42 %add.i76 = add i64 %add.i72, %elt
43 %add.i80 = add i64 %add.i76, 0
44 %sub.i82 = sub i64 %add.i66, %add.i80